Browse Source

0.5.104

* improved wifi connection #652
pull/788/head
lumapu 2 years ago
parent
commit
25695fc30a
  1. 1
      src/CHANGES.md
  2. 12
      src/wifi/ahoywifi.cpp

1
src/CHANGES.md

@ -7,6 +7,7 @@
* removed `#` character from ePaper
* fixed saving pinout for `Nokia-Display`
* removed `Reset` Pin for monochrome displays
* improved wifi connection #652
## 0.5.103
* merged MI improvements, thx @rejoe2 #778

12
src/wifi/ahoywifi.cpp

@ -88,12 +88,11 @@ void ahoywifi::tickWifiLoop() {
}
mCnt++;
uint8_t timeout = 10; // seconds
uint8_t timeout = (mStaConn == DISCONNECTED) ? 10 : 20; // seconds
if (mStaConn == CONNECTED) // connected but no ip
timeout = 20;
if(!mScanActive && mBSSIDList.empty() && ((mCnt % timeout) == 0)) { // start scanning APs with the given SSID
if(!mScanActive && mBSSIDList.empty() && (mStaConn == DISCONNECTED)) { // start scanning APs with the given SSID
DBGPRINT(F("scanning APs with SSID "));
DBGPRINTLN(String(mConfig->sys.stationSsid));
mScanCnt = 0;
@ -115,8 +114,9 @@ void ahoywifi::tickWifiLoop() {
mCnt = timeout - 2;
}
if((mCnt % timeout) == 0) { // try to reconnect after x sec without connection
if(mStaConn != CONNECTED)
mStaConn = CONNECTING;
WiFi.disconnect();
if(mBSSIDList.size() > 0) { // get first BSSID in list
DBGPRINT(F("try to connect to AP with BSSID:"));
uint8_t bssid[6];
@ -126,9 +126,11 @@ void ahoywifi::tickWifiLoop() {
DBGPRINT(" " + String(bssid[j], HEX));
}
DBGPRINTLN("");
WiFi.disconnect();
WiFi.begin(mConfig->sys.stationSsid, mConfig->sys.stationPwd, 0, &bssid[0]);
}
else
mStaConn = DISCONNECTED;
mCnt = 0;
}
}

Loading…
Cancel
Save