Fix WifiManager functionality

Fix WifiManager functionality on initial installation (#4433)
This commit is contained in:
Theo Arends 2018-11-26 17:00:18 +01:00
parent b4e2fe0439
commit c3f07f0bd2
2 changed files with 13 additions and 12 deletions

View File

@ -1,5 +1,6 @@
/* 6.3.0.13 20181126 /* 6.3.0.13 20181126
* Add command SetOption59 0/1 to change state topic from tele/STATE to stat/RESULT (#4450) * Add command SetOption59 0/1 to change state topic from tele/STATE to stat/RESULT (#4450)
* Fix WifiManager functionality on initial installation (#4433)
* *
* 6.3.0.12 20181122 * 6.3.0.12 20181122
* Remove delays introduced in 6.3.0.11 (#4233) * Remove delays introduced in 6.3.0.11 (#4233)

View File

@ -28,9 +28,11 @@
#define XDRV_01 1 #define XDRV_01 1
#define HTTP_REFRESH_TIME 2345 // milliseconds #define HTTP_REFRESH_TIME 2345 // milliseconds
#define HTTP_RESTART_RECONNECT_TIME 9000 // milliseconds
#define HTTP_OTA_RESTART_RECONNECT_TIME 20000 // milliseconds
#include <ESP8266WebServer.h> // WifiManager, Webserver #include <ESP8266WebServer.h>
#include <DNSServer.h> // WifiManager #include <DNSServer.h>
#ifdef USE_RF_FLASH #ifdef USE_RF_FLASH
uint8_t *efm8bb1_update = NULL; uint8_t *efm8bb1_update = NULL;
@ -95,12 +97,12 @@ const char HTTP_SCRIPT_WIFI[] PROGMEM =
"}"; "}";
const char HTTP_SCRIPT_RELOAD[] PROGMEM = const char HTTP_SCRIPT_RELOAD[] PROGMEM =
"setTimeout(function(){location.href='.';},9000);" "setTimeout(function(){location.href='.';}," STR(HTTP_RESTART_RECONNECT_TIME) ");"
"</script>"; "</script>";
// Local OTA upgrade requires more time to complete cp: before web ui should be reloaded // Local OTA upgrade requires more time to complete cp: before web ui should be reloaded
const char HTTP_SCRIPT_RELOAD_OTA[] PROGMEM = const char HTTP_SCRIPT_RELOAD_OTA[] PROGMEM =
"setTimeout(function(){location.href='.';},20000);" "setTimeout(function(){location.href='.';}," STR(HTTP_OTA_RESTART_RECONNECT_TIME) ");"
"</script>"; "</script>";
const char HTTP_SCRIPT_CONSOL[] PROGMEM = const char HTTP_SCRIPT_CONSOL[] PROGMEM =
@ -1417,7 +1419,7 @@ void HandleUpgradeFirmwareStart(void)
page += F("<div style='text-align:center;'><b>" D_UPGRADE_STARTED " ...</b></div>"); page += F("<div style='text-align:center;'><b>" D_UPGRADE_STARTED " ...</b></div>");
page += FPSTR(HTTP_MSG_RSTRT); page += FPSTR(HTTP_MSG_RSTRT);
page += FPSTR(HTTP_BTN_MAIN); page += FPSTR(HTTP_BTN_MAIN);
// page.replace(F("</script>"), FPSTR(HTTP_SCRIPT_RELOAD)); page.replace(F("</script>"), FPSTR(HTTP_SCRIPT_RELOAD_OTA));
ShowPage(page); ShowPage(page);
snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_UPGRADE " 1")); snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_UPGRADE " 1"));
@ -2063,12 +2065,10 @@ boolean Xdrv01(byte function)
switch (function) { switch (function) {
case FUNC_LOOP: case FUNC_LOOP:
if (!global_state.wifi_down) {
PollDnsWebserver(); PollDnsWebserver();
#ifdef USE_EMULATION #ifdef USE_EMULATION
if (Settings.flag2.emulation) PollUdp(); if (Settings.flag2.emulation) PollUdp();
#endif // USE_EMULATION #endif // USE_EMULATION
}
break; break;
case FUNC_COMMAND: case FUNC_COMMAND:
result = WebCommand(); result = WebCommand();