mirror of
https://github.com/lumapu/ahoy.git
synced 2025-08-06 09:58:23 +02:00
Merge branch 'main' into hms
Update to latest release
This commit is contained in:
commit
4fd93be575
32 changed files with 646 additions and 633 deletions
|
@ -1,6 +1,6 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 2023 Ahoy, https://www.mikrocontroller.net/topic/525778
|
||||
// Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
|
||||
// 2023 Ahoy, https://ahoydtu.de
|
||||
// Creative Commons - https://creativecommons.org/licenses/by-nc-sa/4.0/deed
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if defined(ESP32) && defined(F)
|
||||
|
@ -31,6 +31,7 @@ void ahoywifi::setup(settings_t *config, uint32_t *utcTimestamp, appWifiCb cb) {
|
|||
mStaConn = DISCONNECTED;
|
||||
mCnt = 0;
|
||||
mScanActive = false;
|
||||
mScanCnt = 0;
|
||||
|
||||
#if defined(ESP8266)
|
||||
wifiConnectHandler = WiFi.onStationModeConnected(std::bind(&ahoywifi::onConnect, this, std::placeholders::_1));
|
||||
|
@ -115,7 +116,7 @@ void ahoywifi::tickWifiLoop() {
|
|||
DBGPRINTLN(F(" seconds"));
|
||||
if(mScanActive) {
|
||||
getBSSIDs();
|
||||
if(!mScanActive) // scan completed
|
||||
if((!mScanActive) && (!mBSSIDList.empty())) // scan completed
|
||||
if ((mCnt % timeout) < timeout - 2)
|
||||
mCnt = timeout - 2;
|
||||
}
|
||||
|
@ -166,6 +167,9 @@ void ahoywifi::setupAp(void) {
|
|||
DBGPRINTLN(mApIp.toString());
|
||||
DBGPRINTLN(F("---------\n"));
|
||||
|
||||
if(String(mConfig->sys.deviceName) != "")
|
||||
WiFi.hostname(mConfig->sys.deviceName);
|
||||
|
||||
WiFi.mode(WIFI_AP_STA);
|
||||
WiFi.softAPConfig(mApIp, mApIp, IPAddress(255, 255, 255, 0));
|
||||
WiFi.softAP(WIFI_AP_SSID, WIFI_AP_PWD);
|
||||
|
@ -300,8 +304,7 @@ void ahoywifi::getAvailNetworks(JsonObject obj) {
|
|||
void ahoywifi::getBSSIDs() {
|
||||
int n = WiFi.scanComplete();
|
||||
if (n < 0) {
|
||||
mScanCnt++;
|
||||
if (mScanCnt < 20)
|
||||
if (++mScanCnt < 20)
|
||||
return;
|
||||
}
|
||||
if(n > 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue