From b541718588b1baf93d94be36d10e0442a52b12c6 Mon Sep 17 00:00:00 2001 From: lorol Date: Thu, 12 Mar 2020 13:04:59 -0400 Subject: [PATCH] Bugfix --- examples/SmartSwitch/README.md | 7 ++++--- examples/SmartSwitch/SmartSwitch.ino | 16 +++++++++++----- .../SmartSwitch/data/{index2.htm => index.htm} | 10 ++++++---- examples/SmartSwitch/data/index.htm.gz | Bin 3834 -> 0 bytes examples/SmartSwitch/data_src/index.htm | 10 ++++++---- 5 files changed, 27 insertions(+), 16 deletions(-) rename examples/SmartSwitch/data/{index2.htm => index.htm} (98%) delete mode 100644 examples/SmartSwitch/data/index.htm.gz diff --git a/examples/SmartSwitch/README.md b/examples/SmartSwitch/README.md index 1a9c83e..ac61481 100644 --- a/examples/SmartSwitch/README.md +++ b/examples/SmartSwitch/README.md @@ -2,12 +2,13 @@ ## SmartSwitch * Remote Temperature Control application with schedule (example car block heater or battery charger) -* Based on the ESP_AsyncFSBrowser example +* Based on ESP_AsyncFSBrowser example * Wide browser compatibility, no extra server-side needed. * HTTP server and WebSocket, single port * Standalone, no JS dependencies for the browser from Internet (I hope), ace editor included * Added ESPAsyncWiFiManager * Real Time (NTP) w/ Time Zones * Memorized settings to EEPROM -* Multiple clients can be connected at same time, they see each other requests -* Use latest ESP8266 core lib (from github) +* Multiple clients can be connected at same time, they see each other' requests +* Default credentials smart:switch +* Use latest ESP8266 core lib (from Github) diff --git a/examples/SmartSwitch/SmartSwitch.ino b/examples/SmartSwitch/SmartSwitch.ino index a1d2c95..11d17e7 100644 --- a/examples/SmartSwitch/SmartSwitch.ino +++ b/examples/SmartSwitch/SmartSwitch.ino @@ -14,6 +14,9 @@ Use latest ESP core lib (from github) */ #define USE_WFM // to use ESPAsyncWiFiManager +//#define DEL_WFM // delete Wifi credentials stored + //(use once then comment and flash again), also HTTP /erase-wifi can do the same live + #define USE_AUTH // .setAuthentication for all static #include @@ -44,7 +47,7 @@ Use latest ESP core lib (from github) #define EECH 104 // fixed eeprom address to keep selected active channel, only for reference here #define EEBEGIN EECH + 1 #define EEMARK 0x5A -#define MEMMAX 1 // 0,1,2... last max index (only 2 channels) +#define MEMMAX 2 // 0,1,2... last max index (only 3 channels) #define EEALL 512 #define HYST 0.5 // C +/- hysteresis @@ -140,8 +143,9 @@ void showTime() Serial.printf("RTC: %02d:%02d\n", tm->tm_hour, tm->tm_min); if (sched == 0) { // automatic - if ((tm->tm_wday > 0)&&(tm->tm_wday < 6)) tmpch = 0; //weekdays - else tmpch = 0; //weekend + if ((tm->tm_wday > 0)&&(tm->tm_wday < 6)) tmpch = 0; //Mon - Fri + else if (tm->tm_wday == 6) tmpch = 1; //Sat + else if (tm->tm_wday == 0) tmpch = 2; //Sun } else { // manual tmpch = sched - 1; //and stays } @@ -372,8 +376,10 @@ void setup(){ //Wifi #ifdef USE_WFM AsyncWiFiManager wifiManager(&server,&dns); - //wifiManager.resetSettings(); - wifiManager.autoConnect("SmartSW"); + #ifdef DEL_WFM + wifiManager.resetSettings(); + #endif + wifiManager.autoConnect(hostName); #else //WiFi.mode(WIFI_AP_STA); // Core SVN 5179 use STA as default interface in mDNS (#7042) //WiFi.softAP(hostName); // Core SVN 5179 use STA as default interface in mDNS (#7042) diff --git a/examples/SmartSwitch/data/index2.htm b/examples/SmartSwitch/data/index.htm similarity index 98% rename from examples/SmartSwitch/data/index2.htm rename to examples/SmartSwitch/data/index.htm index 44c86bf..7c28036 100644 --- a/examples/SmartSwitch/data/index2.htm +++ b/examples/SmartSwitch/data/index.htm @@ -251,12 +251,14 @@
-