Skip to content

Commit

Permalink
Merge pull request #26 from fwallacevt/master
Browse files Browse the repository at this point in the history
ESP32: Make sure wifi is started when trying to connect
  • Loading branch information
Deomid Ryabkov authored May 7, 2019
2 parents 2a814e9 + b73a8c2 commit 968f20c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/esp32/esp32_wifi.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,8 @@ bool mgos_wifi_dev_ap_setup(const struct mgos_config_wifi_ap *cfg) {
}

bool mgos_wifi_dev_sta_connect(void) {
if (esp32_wifi_ensure_init() != ESP_OK) return false;
if ((esp32_wifi_ensure_init() != ESP_OK) ||
(esp32_wifi_ensure_start() != ESP_OK)) return false;
wifi_mode_t cur_mode = esp32_wifi_get_mode();
if (cur_mode == WIFI_MODE_NULL || cur_mode == WIFI_MODE_AP) return false;
esp_err_t r = esp_wifi_connect();
Expand Down

0 comments on commit 968f20c

Please sign in to comment.