Skip to content

Commit dacce7a

Browse files
committed
disable auto connect at boot
otherwise we have trouble connecting to ap when it tries to reconnect to non existing network esp8266/Arduino#1624
1 parent 1c0460f commit dacce7a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

modules/wifi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ void ICACHE_FLASH_ATTR wifi_connect(uint8_t* ssid, uint8_t* pass, WifiCallback c
359359

360360
INFO("WIFI_INIT\r\n");
361361
wifi_set_opmode(STATIONAP_MODE);
362-
wifi_station_set_auto_connect(false);
362+
wifi_station_set_auto_connect(false); // according to docs this can only be done from user_init() or we have to reboot after calling
363363
wifi_cb = cb;
364364
config_ssid = ssid;
365365
config_pass = pass;
@@ -375,7 +375,7 @@ void ICACHE_FLASH_ATTR wifi_connect(uint8_t* ssid, uint8_t* pass, WifiCallback c
375375
// start wifi scan timer
376376
wifi_start_scan();
377377

378-
wifi_station_set_auto_connect(true);
378+
wifi_station_set_auto_connect(true); // according to docs this can only be done from user_init() or we have to reboot after calling
379379
wifi_set_event_handler_cb(wifi_handle_event_cb);
380380
wifi_station_connect();
381381

user/user_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,7 @@ ICACHE_FLASH_ATTR void user_init(void) {
898898

899899
// make sure the device is in AP and STA combined mode; otherwise we cant scan
900900
wifi_set_opmode_current(STATIONAP_MODE);
901+
wifi_station_set_auto_connect(false);
901902
// do everything else in system_init_done
902903
system_init_done_cb(&system_init_done);
903904
}

0 commit comments

Comments
 (0)