fix Interrupt

fix connect to WiFi with only one AP
This commit is contained in:
lumapu 2023-02-06 00:07:58 +01:00
parent a85ed6c089
commit edefcf1c83
5 changed files with 26 additions and 8 deletions

View file

@ -88,7 +88,12 @@ void ahoywifi::tickWifiLoop() {
}
mCnt++;
if(!mScanActive && mBSSIDList.empty()) { // start scanning APs with the given SSID
uint8_t timeout = 10; // seconds
if (mStaConn == CONNECTED) // connected but no ip
timeout = 20;
if(!mScanActive && mBSSIDList.empty() && ((mCnt % timeout) == 0)) { // start scanning APs with the given SSID
DBGPRINT(F("scanning APs with SSID "));
DBGPRINTLN(String(mConfig->sys.stationSsid));
mScanCnt = 0;
@ -100,12 +105,6 @@ void ahoywifi::tickWifiLoop() {
#endif
return;
}
uint8_t timeout = 10; // seconds
if (mStaConn == CONNECTED) // connected but no ip
timeout = 20;
DBGPRINT(F("reconnect in "));
DBGPRINT(String(timeout-mCnt));
DBGPRINTLN(F(" seconds"));