further improvements regarding wifi #611, fix connection if only one AP with same SSID is there

fix endless loop in `zerovalues` #564
fix auto discover again #565
added total values to autodiscover #630
improved zero at midnight #625
This commit is contained in:
lumapu 2023-01-29 00:55:10 +01:00
parent f8d4b4f5ae
commit 8457f46b0c
4 changed files with 63 additions and 37 deletions

View file

@ -98,7 +98,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;
@ -110,20 +115,14 @@ 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"));
if(mScanActive) {
getBSSIDs();
if(!mScanActive) // scan completed
if ((mCnt % timeout) < 8)
mCnt = timeout - 2;
//if(!mScanActive) // scan completed
// if ((mCnt % timeout) < 8)
// mCnt = timeout - 2;
}
if((mCnt % timeout) == 0) { // try to reconnect after x sec without connection
if(mStaConn != CONNECTED)