improve flow for restarting in wifimanager mode

This commit is contained in:
technyon
2022-04-09 11:58:28 +02:00
parent 17461a2a84
commit 9adfb6a717
4 changed files with 88 additions and 62 deletions

View File

@@ -22,17 +22,19 @@ void Network::initialize()
//WiFiManager, Local intialization. Once its business is done, there is no need to keep it around
WiFiManager wm;
// reset settings - wipe stored credentials for testing
// these are stored by the esp library
//wm.resetSettings();
std::vector<const char *> wm_menu;
wm_menu.push_back("wifi");
wm_menu.push_back("exit");
wm.setShowInfoUpdate(false);
wm.setMenu(wm_menu);
bool res = false;
if(_cookie.isSet())
{
Serial.println(F("Opening WiFi configuration portal."));
res = wm.startConfigPortal();
_cookie.clear();
res = wm.startConfigPortal();
}
else
{
@@ -166,8 +168,6 @@ void Network::update()
}
_mqttClient.loop();
vTaskDelay( 100 / portTICK_PERIOD_MS);
}
void Network::onMqttDataReceivedCallback(char *topic, byte *payload, unsigned int length)