mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-24 14:26:11 +02:00
parent
a6b8794855
commit
25695fc30a
2 changed files with 9 additions and 6 deletions
|
@ -7,6 +7,7 @@
|
||||||
* removed `#` character from ePaper
|
* removed `#` character from ePaper
|
||||||
* fixed saving pinout for `Nokia-Display`
|
* fixed saving pinout for `Nokia-Display`
|
||||||
* removed `Reset` Pin for monochrome displays
|
* removed `Reset` Pin for monochrome displays
|
||||||
|
* improved wifi connection #652
|
||||||
|
|
||||||
## 0.5.103
|
## 0.5.103
|
||||||
* merged MI improvements, thx @rejoe2 #778
|
* merged MI improvements, thx @rejoe2 #778
|
||||||
|
|
|
@ -88,12 +88,11 @@ void ahoywifi::tickWifiLoop() {
|
||||||
}
|
}
|
||||||
mCnt++;
|
mCnt++;
|
||||||
|
|
||||||
uint8_t timeout = 10; // seconds
|
uint8_t timeout = (mStaConn == DISCONNECTED) ? 10 : 20; // seconds
|
||||||
if (mStaConn == CONNECTED) // connected but no ip
|
if (mStaConn == CONNECTED) // connected but no ip
|
||||||
timeout = 20;
|
timeout = 20;
|
||||||
|
|
||||||
|
if(!mScanActive && mBSSIDList.empty() && (mStaConn == DISCONNECTED)) { // start scanning APs with the given SSID
|
||||||
if(!mScanActive && mBSSIDList.empty() && ((mCnt % timeout) == 0)) { // start scanning APs with the given SSID
|
|
||||||
DBGPRINT(F("scanning APs with SSID "));
|
DBGPRINT(F("scanning APs with SSID "));
|
||||||
DBGPRINTLN(String(mConfig->sys.stationSsid));
|
DBGPRINTLN(String(mConfig->sys.stationSsid));
|
||||||
mScanCnt = 0;
|
mScanCnt = 0;
|
||||||
|
@ -115,8 +114,9 @@ void ahoywifi::tickWifiLoop() {
|
||||||
mCnt = timeout - 2;
|
mCnt = timeout - 2;
|
||||||
}
|
}
|
||||||
if((mCnt % timeout) == 0) { // try to reconnect after x sec without connection
|
if((mCnt % timeout) == 0) { // try to reconnect after x sec without connection
|
||||||
if(mStaConn != CONNECTED)
|
|
||||||
mStaConn = CONNECTING;
|
mStaConn = CONNECTING;
|
||||||
|
WiFi.disconnect();
|
||||||
|
|
||||||
if(mBSSIDList.size() > 0) { // get first BSSID in list
|
if(mBSSIDList.size() > 0) { // get first BSSID in list
|
||||||
DBGPRINT(F("try to connect to AP with BSSID:"));
|
DBGPRINT(F("try to connect to AP with BSSID:"));
|
||||||
uint8_t bssid[6];
|
uint8_t bssid[6];
|
||||||
|
@ -126,9 +126,11 @@ void ahoywifi::tickWifiLoop() {
|
||||||
DBGPRINT(" " + String(bssid[j], HEX));
|
DBGPRINT(" " + String(bssid[j], HEX));
|
||||||
}
|
}
|
||||||
DBGPRINTLN("");
|
DBGPRINTLN("");
|
||||||
WiFi.disconnect();
|
|
||||||
WiFi.begin(mConfig->sys.stationSsid, mConfig->sys.stationPwd, 0, &bssid[0]);
|
WiFi.begin(mConfig->sys.stationSsid, mConfig->sys.stationPwd, 0, &bssid[0]);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
mStaConn = DISCONNECTED;
|
||||||
|
|
||||||
mCnt = 0;
|
mCnt = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue