fix reboot to wifi manager

This commit is contained in:
technyon
2023-01-01 16:33:00 +01:00
parent a4d496f92b
commit e202db236e
2 changed files with 10 additions and 2 deletions

View File

@@ -9,9 +9,7 @@ RTC_NOINIT_ATTR char WiFiDevice_reconfdetect[17];
WifiDevice::WifiDevice(const String& hostname, Preferences* _preferences)
: NetworkDevice(hostname)
{
WiFiDevice_reconfdetect[16] = 0x00;
_startAp = strcmp(WiFiDevice_reconfdetect, "reconfigure_wifi") == 0;
memset(WiFiDevice_reconfdetect, 0, sizeof WiFiDevice_reconfdetect);
_restartOnDisconnect = _preferences->getBool(preference_restart_on_disconnect);
@@ -69,6 +67,8 @@ void WifiDevice::initialize()
_wm.setMenu(wm_menu);
_wm.setHostname(_hostname);
_wm.setAPCallback(clearRtcInitVar);
bool res = false;
if(_startAp)
@@ -105,6 +105,7 @@ void WifiDevice::initialize()
void WifiDevice::reconfigure()
{
strcpy(WiFiDevice_reconfdetect, "reconfigure_wifi");
delay(200);
ESP.restart();
}
@@ -148,3 +149,8 @@ int8_t WifiDevice::signalStrength()
{
return WiFi.RSSI();
}
void WifiDevice::clearRtcInitVar(WiFiManager *)
{
memset(WiFiDevice_reconfdetect, 0, sizeof WiFiDevice_reconfdetect);
}