|
|
@ -306,19 +306,25 @@ static void ICACHE_FLASH_ATTR resetTimerCb(void *arg) { |
|
|
|
DBG("Wifi check: mode=%s status=%d\n", wifiMode[m], x); |
|
|
|
DBG("Wifi check: mode=%s status=%d\n", wifiMode[m], x); |
|
|
|
|
|
|
|
|
|
|
|
if(m!=2){ |
|
|
|
if(m!=2){ |
|
|
|
if( x == STATION_GOT_IP ){ |
|
|
|
if ( x == STATION_GOT_IP ) { |
|
|
|
|
|
|
|
if (m != 1) { |
|
|
|
#ifdef CHANGE_TO_STA |
|
|
|
#ifdef CHANGE_TO_STA |
|
|
|
if(m != 1) |
|
|
|
// We're happily connected, go to STA mode
|
|
|
|
|
|
|
|
DBG("Wifi got IP. Going into STA mode..\n"); |
|
|
|
wifi_set_opmode(1); |
|
|
|
wifi_set_opmode(1); |
|
|
|
|
|
|
|
os_timer_arm(&resetTimer, RESET_TIMEOUT, 0); // check one more time after switching to STA-only
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
log_uart(false); |
|
|
|
log_uart(false); |
|
|
|
}else{ |
|
|
|
// no more resetTimer at this point, gotta use physical reset to recover if in trouble
|
|
|
|
log_uart(true); |
|
|
|
} else { |
|
|
|
DBG("Enabling/continuing uart log\n"); |
|
|
|
if (m != 3) { |
|
|
|
if (m==1){ |
|
|
|
DBG("Wifi connect failed. Going into STA+AP mode..\n"); |
|
|
|
wifi_set_opmode(3); |
|
|
|
wifi_set_opmode(3); |
|
|
|
wifi_softap_set_config(&apconf); |
|
|
|
wifi_softap_set_config(&apconf); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
log_uart(true); |
|
|
|
|
|
|
|
DBG("Enabling/continuing uart log\n"); |
|
|
|
os_timer_arm(&resetTimer, RESET_TIMEOUT, 0); |
|
|
|
os_timer_arm(&resetTimer, RESET_TIMEOUT, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|