From c3f07f0bd25a55affcb84bf53f51ad6066945626 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Mon, 26 Nov 2018 17:00:18 +0100 Subject: [PATCH] Fix WifiManager functionality Fix WifiManager functionality on initial installation (#4433) --- sonoff/_changelog.ino | 3 ++- sonoff/xdrv_01_webserver.ino | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index f548a76da..2351beb8c 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -1,6 +1,7 @@ /* 6.3.0.13 20181126 * 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 * Remove delays introduced in 6.3.0.11 (#4233) * Add additional start-up delay during initial wifi connection diff --git a/sonoff/xdrv_01_webserver.ino b/sonoff/xdrv_01_webserver.ino index a6c2a2a1c..cd0204a48 100644 --- a/sonoff/xdrv_01_webserver.ino +++ b/sonoff/xdrv_01_webserver.ino @@ -25,12 +25,14 @@ * Based on source by AlexT (https://github.com/tzapu) \*********************************************************************************************/ -#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 // WifiManager, Webserver -#include // WifiManager +#include +#include #ifdef USE_RF_FLASH uint8_t *efm8bb1_update = NULL; @@ -95,12 +97,12 @@ const char HTTP_SCRIPT_WIFI[] PROGMEM = "}"; const char HTTP_SCRIPT_RELOAD[] PROGMEM = - "setTimeout(function(){location.href='.';},9000);" + "setTimeout(function(){location.href='.';}," STR(HTTP_RESTART_RECONNECT_TIME) ");" ""; // Local OTA upgrade requires more time to complete cp: before web ui should be reloaded const char HTTP_SCRIPT_RELOAD_OTA[] PROGMEM = - "setTimeout(function(){location.href='.';},20000);" + "setTimeout(function(){location.href='.';}," STR(HTTP_OTA_RESTART_RECONNECT_TIME) ");" ""; const char HTTP_SCRIPT_CONSOL[] PROGMEM = @@ -1417,7 +1419,7 @@ void HandleUpgradeFirmwareStart(void) page += F("
" D_UPGRADE_STARTED " ...
"); page += FPSTR(HTTP_MSG_RSTRT); page += FPSTR(HTTP_BTN_MAIN); -// page.replace(F(""), FPSTR(HTTP_SCRIPT_RELOAD)); + page.replace(F(""), FPSTR(HTTP_SCRIPT_RELOAD_OTA)); ShowPage(page); snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_UPGRADE " 1")); @@ -2063,12 +2065,10 @@ boolean Xdrv01(byte function) switch (function) { case FUNC_LOOP: - if (!global_state.wifi_down) { - PollDnsWebserver(); + PollDnsWebserver(); #ifdef USE_EMULATION - if (Settings.flag2.emulation) PollUdp(); + if (Settings.flag2.emulation) PollUdp(); #endif // USE_EMULATION - } break; case FUNC_COMMAND: result = WebCommand();