Skip to content

Commit

Permalink
WiFi updates. (#135)
Browse files Browse the repository at this point in the history
* Fix hang if no SSID configured.
* Updates to Wifi initialization.
* Update to latest pico-sensor-lib version.
  • Loading branch information
tjko authored Dec 7, 2024
1 parent e2a7fa5 commit 62beef6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ Fanpico supports following commands:
* [CONFigure:SENSORx:TEMPNominal?](#configuresensorxtempnominal-1)
* [CONFigure:SENSORx:FILTER](#configuresensorxfilter)
* [CONFigure:SENSORx:FILTER?](#configuresensorxfilter-1)
* [CONFigure:VSENSORS?](#systemvsensors)
* [CONFigure:VSENSORS:SOUrces?](#systemvsensorssources)
* [CONFigure:VSENSORS?](#configurevsensors)
* [CONFigure:VSENSORS:SOUrces?](#configurevsensorssources)
* [CONFigure:VSENSORx:NAME](#configurevsensorxname)
* [CONFigure:VSENSORx:NAME?](#configurevsensorxname-1)
* [CONFigure:VSENSORx:SOUrce](#configurevsensorxsource)
Expand Down
2 changes: 1 addition & 1 deletion libs/pico-sensor-lib
2 changes: 1 addition & 1 deletion src/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void setup_i2c_bus(struct fanpico_config *config)
baudrate = i2c_init(i2c_bus, config->i2c_speed);
baudrate /= 1000;
i2c_sensor_baudrate(baudrate);
log_msg(LOG_INFO, "I2C Bus initalized at %u kHz", baudrate);
log_msg(LOG_INFO, "I2C Bus initialized at %u kHz", baudrate);
gpio_set_function(SDA_PIN, GPIO_FUNC_I2C);
gpio_set_function(SCL_PIN, GPIO_FUNC_I2C);
gpio_pull_up(SDA_PIN);
Expand Down
5 changes: 1 addition & 4 deletions src/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ void wifi_init()
/* Get adapter MAC address */
if ((res = cyw43_wifi_get_mac(&cyw43_state, CYW43_ITF_STA, cyw43_mac))) {
log_msg(LOG_ALERT, "Cannot get WiFi MAC address: %d", res);
cyw43_arch_deinit();
return;
}
log_msg(LOG_NOTICE, "WiFi MAC: %s", mac_address_str(cyw43_mac));
Expand All @@ -156,7 +155,7 @@ void wifi_init()
/* Default is to initiate asynchronous connection. */
res = cyw43_arch_wifi_connect_async(cfg->wifi_ssid,
cfg->wifi_passwd,
CYW43_AUTH_WPA2_AES_PSK);
CYW43_AUTH_WPA3_WPA2_AES_PSK);
} else {
/* If "SYS:WIFI:MODE 1" has been used, attempt synchronous connection
as connection to some buggy(?) APs don't seem to always work with
Expand All @@ -173,12 +172,10 @@ void wifi_init()
}
if (res != 0) {
log_msg(LOG_ERR, "WiFi connect failed: %d", res);
cyw43_arch_deinit();
return;
}
} else {
log_msg(LOG_ERR, "No WiFi SSID configured");
cyw43_arch_deinit();
return;
}

Expand Down

0 comments on commit 62beef6

Please sign in to comment.