From d9aa3102a71ecb54531d0b8c69cf6c185929f8f5 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Thu, 14 Mar 2019 17:21:45 +0100 Subject: [PATCH] Prep for release 6.5 Prep for release 6.5 --- RELEASENOTES.md | 94 ++++++++++++++----------------- sonoff/_changelog.ino | 3 +- sonoff/settings.h | 16 +++--- sonoff/sonoff.ino | 33 +++++------ sonoff/support.ino | 2 +- sonoff/xdrv_01_webserver.ino | 38 +++++-------- sonoff/xdrv_12_home_assistant.ino | 2 +- 7 files changed, 82 insertions(+), 106 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index d8cec96f2..7089a956c 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -195,35 +195,27 @@ The following binary downloads have been compiled with ESP8266/Arduino library c | USE_DISPLAY | - | - | - | - | - | - | ## Changelog -Version 6.5.0 20190315 - - * Remove command SetOption14 as it has been superseded by command Interlock - * Remove command SetOption63 as it has been superseded by command Interlock +Version 6.5.0 20190319 + * Remove commands SetOption14 and SetOption63 as it has been superseded by command Interlock * Remove command SetOption35 0-255 for mDNS start-up delay (#4793) * Change webserver content handling from single String to small Chunks increasing RAM - * Change logging message handling * Change code use of boolean to bool and byte to uint8_t * Change code uint8_t flags to bool flags * Change sonoff_template.h layout regarding optional module flags like ADC0 - * Change button driver making it modular * Change sonoff_template.h module lay-out by removing non-configurable GPIOs + * Change button driver making it modular * Change switch driver making it modular and introduce input filter (#4665, #4724) * Change switch input detection by optimizing switch debounce (#4724) * Change web authentication (#4865) - * Change image name BE_MINIMAL to FIRMWARE_MINIMAL (#5106) - * Change image names USE_xyz to FIRMWARE_xyz (#5106) - * Change GUI weblog solving possible empty screens (#5154) - * Change PN532 support from I2C to Serial for more stability (#5162) - * Change template update by removing possibility to add user module config keeping template as defined (#5222) + * Change image name BE_MINIMAL to FIRMWARE_MINIMAL and USE_xyz to FIRMWARE_xyz (#5106) + * Change GUI weblog from XML to plain text solving possible empty screens (#5154) * Fix most compiler warnings - * Fix IR local echo * Fix Display exception 28 when JSON value is NULL received - * Fix HLW8012, HJL01 and BL0937 based energy sensors low Power (below 10W) measurement regression from 6.4.1.6 * Fix epaper driver (#4785) - * Fix Home Assistant Sensor Discovery Software Watchdog restart (#4831, #4988) + * Fix HAss Sensor Discovery Software Watchdog restart (#4831, #4988) * Fix allowable MAX_RULE_VARS to 16 (#4933) * Fix mDNS addService (#4938, #4951) - * Fix Hass discovery of MHZ19(B) sensors (#4992) + * Fix HAss discovery of MHZ19(B) sensors (#4992) * Fix some exceptions and watchdogs due to lack of stack space (#5215) * Fix GUI wifi password acception starting with asteriks (*) (#5231, #5242) * Fix command WebSend intermittent results (#5273, #5304) @@ -233,52 +225,50 @@ Version 6.5.0 20190315 * Fix float calculations in range from 0 to -1 (#5386) * Fix exception on GUI Configure Logging and Configure Other (#5424) * Add commands PowerCal, VoltageCal and CurrentCal for HLW8012, HJL01 and BL0937 based energy sensors - * Add Power status functionality to LED2 when configured leaving LED1 for Link status indication - * Add support for Smanergy KA10 Smart Wall Socket with Energy monitoring - * Add SerialBridge command SSerialSend5 \ - * Add SetOption32 until SetOption49 diagnostic information to Status 3 report as replacement for second property value in SetOption property name - * Add Resolution property to Status 3 report providing previous SetOption second value property - * Add user configuration of HLW8012 and HJL-01/BL0937 Energy Monitoring as used in Sonoff S31, Pow Ra and many Tuya based devices - * Add user configuration of MCP39F501 Energy Monitoring as used in Shelly2 - * Add property LinkCount to state and status 11 message representing number of Wifi Link re-connections - * Add property MqttCount to status 6 message representing number of Mqtt re-connections - * Add property Downtime to state and status 11 message representing the duration of wifi connection loss - * Add support for commands in sensor drivers - * Add (S)SerialSend3 escape sequence \x to allow hexadecimal byte value (#3560, #4947) + * Add command SerialDelimiter 128 to filter reception of only characters between ASCII 32 and 127 (#5131) + * Add command SSerialSend5 \ to SerialBridge + * Add command Interlock 0 / 1 / 1,2 3,4 .. to control interlock ON/OFF and add up to 8 relays in 1 to 4 interlock groups (#4910, #5014) + * Add command Template 255 to copy module configuration over to current active template and store as user template named Merged (#5371) + * Add command WifiConfig 7 to allow reset of device in AP mode without admin password (#5297) * Add command SetOption36 to control boot loop default restoration (#4645, #5063) - * Add define DS18B20_INTERNAL_PULLUP to select internal input pullup when only one DS18B20 sensor is connected eliminating external resistor (#4738) - * Add variable %timestamp% to rules (#4749) + * Add command SetOption37 for RGBCW color mapping (#5326) + * Add command SetOption55 0/1 and define MDNS_ENABLE to disable/enable mDNS (#4793, #4923) + * Add command SetOption62 0/1 to disable retain on Button or Switch hold messages (#5299) + * Add support for Smanergy KA10 Smart Wall Socket with Energy monitoring + * Add support for commands in sensor drivers * Add support for MAX31855 K-Type thermocouple sensor using softSPI (#4764) - * Add button control when no relay configured (#4682) - * Add support for Near Field Communication (NFC) controller PN532 using I2C (#4791) - * Add command SetOption55 0/1 to disable/enable mDNS (#4793) - * Add 4 seconds startup delay to button control (#4829) + * Add support for Near Field Communication (NFC) controller PN532 using Serial (#4791, #5162) * Add support for OBI Power Socket 2 (#4829) * Add support for YTF IR Bridge (#4855) * Add support for Mi LED Desk Lamp with rotary switch (#4887) * Add support for Digoo DG-SP202 Smart Socket with Energy monitoring (#4891) * Add support for MAX44009 Ambient Light sensor (#4907) - * Add split interlock (#4910) * Add support for inverted buttons and inverted buttons without pullup (#4914) - * Add core version conditional compile options to provided PWM files (#4917) * Add support for Luminea ZX2820 Smart Socket with Energy monitoring (#4921) - * Add define MDNS_ENABLE to control initial mDNS state (#4923) - * Add command Interlock 0 / 1 / 1,2 3,4 .. to control interlock ON/OFF and add up to 8 relays in 1 to 4 interlock groups (#5014) - * Add resiliency to saved Settings (#5065) * Add support for multiple ADS1115 I2C devices (#5083) - * Add rule support for "==", "!=" ">=" and "<=" (#5122) - * Add MHZ19 Temperature as Domoticz Temperature selection (#5128) - * Add command SerialDelimiter 128 to filter reception of only characters between ASCII 32 and 127 (#5131) - * Add Hass status sensor (#5139) - * Add status message to former declined group commands (#5145) * Add support for online template change using command Template or GUI Configure Other (#5177) - * Add parameter CFG_HOLDER to status 1 message (#5206) - * Add rule expression enabled by define USE_EXPRESSION in my_user_config.h (#5210) - * Add Configure Template menu option to GUI (#5222) - * Add option WifiConfig 7 to allow reset of device in AP mode without admin password (#5297) - * Add command SetOption62 0/1 to disable retain on Button or Swith hold messages (#5299) - * Add command SetOption37 for RGBCW color mapping (#5326) - * Add Korean language translations (#5344) - * Add command Template 255 to copy module configuration over to current active template and store as user template named Merged (#5371) - * Add 0x to IRRemote (SetOption29) and RCSwitch (SetOption28) received hexadecimal data (#5431) + * Add support for Korean language translations (#5344) * Add support for sensor SCD30 (#5434) + * Add parameter CFG_HOLDER to status 1 message (#5206) + * Add SetOption32 until SetOption49 diagnostic information to Status 3 report as replacement for second property value in SetOption property name + * Add Resolution property to Status 3 report providing previous SetOption second value property + * Add property MqttCount to status 6 message representing number of Mqtt re-connections + * Add property LinkCount to state and status 11 message representing number of Wifi Link re-connections + * Add property Downtime to state and status 11 message representing the duration of wifi connection loss + * Add variable %timestamp% to rules (#4749) + * Add rule support for "==", "!=" ">=" and "<=" (#5122) + * Add rule expression enabled by define USE_EXPRESSION in my_user_config.h (#5210) + * Add Power status functionality to LED2 when configured leaving LED1 for Link status indication + * Add user configuration of HLW8012 and HJL-01/BL0937 Energy Monitoring as used in Sonoff Pow and many Tuya based devices + * Add user configuration of MCP39F501 Energy Monitoring as used in Shelly2 + * Add online template configuration using both commands and Configure Template menu option in GUI + * Add (S)SerialSend3 escape sequence \x to allow hexadecimal byte value (#3560, #4947) + * Add define DS18B20_INTERNAL_PULLUP to select internal input pullup when only one DS18B20 sensor is connected eliminating external resistor (#4738) + * Add button control when no relay configured (#4682) + * Add startup delay of 4 seconds to button control (#4829) + * Add core version conditional compile options to provided PWM files (#4917) + * Add resiliency to saved Settings (#5065) + * Add MHZ19 Temperature as Domoticz Temperature selection (#5128) + * Add HAss status sensor (#5139) + * Add status message to former declined group commands (#5145) + * Add 0x to IRRemote (SetOption29) and RCSwitch (SetOption28) received hexadecimal data (#5431) diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index 0ef542e5e..58ead17cd 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -1,4 +1,5 @@ -/* 6.5.0 20190315 +/* 6.5.0 20190319 + * New Release * * 6.4.1.21 20190309 * Fix exception on GUI Configure Logging and Configure Other (#5424) diff --git a/sonoff/settings.h b/sonoff/settings.h index 342ff1612..5a7827365 100644 --- a/sonoff/settings.h +++ b/sonoff/settings.h @@ -200,8 +200,8 @@ struct SYSCFG { uint8_t seriallog_level; // 09E uint8_t sta_config; // 09F uint8_t sta_active; // 0A0 - char sta_ssid[2][33]; // 0A1 - Keep together with sta_pwd as being copied as one chunck with reset 4/5 - char sta_pwd[2][65]; // 0E3 - Keep together with sta_ssid as being copied as one chunck with reset 4/5 + char sta_ssid[2][33]; // 0A1 - Keep together with sta_pwd as being copied as one chunck with reset 5 + char sta_pwd[2][65]; // 0E3 - Keep together with sta_ssid as being copied as one chunck with reset 5 char hostname[33]; // 165 char syslog_host[33]; // 186 uint8_t rule_stop; // 1A7 @@ -213,12 +213,12 @@ struct SYSCFG { uint8_t free_1D5[20]; // 1D5 Free since 5.12.0e - char mqtt_host[33]; // 1E9 - uint16_t mqtt_port; // 20A - char mqtt_client[33]; // 20C - char mqtt_user[33]; // 22D - char mqtt_pwd[33]; // 24E - char mqtt_topic[33]; // 26F + char mqtt_host[33]; // 1E9 - Keep together with below as being copied as one chunck with reset 6 + uint16_t mqtt_port; // 20A - Keep together + char mqtt_client[33]; // 20C - Keep together + char mqtt_user[33]; // 22D - Keep together + char mqtt_pwd[33]; // 24E - Keep together + char mqtt_topic[33]; // 26F - Keep together with above items as being copied as one chunck with reset 6 char button_topic[33]; // 290 char mqtt_grptopic[33]; // 2B1 uint8_t display_model; // 2D2 diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 82c306c90..39f180c0b 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -2082,31 +2082,26 @@ void Every250mSeconds(void) } if (restart_flag && (backlog_pointer == backlog_index)) { if ((214 == restart_flag) || (215 == restart_flag) || (216 == restart_flag)) { - char storage[sizeof(Settings.sta_ssid) + sizeof(Settings.sta_pwd)]; - char storage_mqtt_host[sizeof(Settings.mqtt_host)]; - uint16_t storage_mqtt_port; - char storage_mqtt_user[sizeof(Settings.mqtt_user)]; - char storage_mqtt_pwd[sizeof(Settings.mqtt_pwd)]; - char storage_mqtt_topic[sizeof(Settings.mqtt_topic)]; - memcpy(storage, Settings.sta_ssid, sizeof(storage)); // Backup current SSIDs and Passwords + char storage_wifi[sizeof(Settings.sta_ssid) + + sizeof(Settings.sta_pwd)]; + char storage_mqtt[sizeof(Settings.mqtt_host) + + sizeof(Settings.mqtt_port) + + sizeof(Settings.mqtt_client) + + sizeof(Settings.mqtt_user) + + sizeof(Settings.mqtt_pwd) + + sizeof(Settings.mqtt_topic)]; + memcpy(storage_wifi, Settings.sta_ssid, sizeof(storage_wifi)); // Backup current SSIDs and Passwords if (216 == restart_flag) { - memcpy(storage_mqtt_host, Settings.mqtt_host, sizeof(Settings.mqtt_host)); - storage_mqtt_port = Settings.mqtt_port; - memcpy(storage_mqtt_user, Settings.mqtt_user, sizeof(Settings.mqtt_user)); - memcpy(storage_mqtt_pwd, Settings.mqtt_pwd, sizeof(Settings.mqtt_pwd)); - memcpy(storage_mqtt_topic, Settings.mqtt_topic, sizeof(Settings.mqtt_topic)); + memcpy(storage_mqtt, Settings.mqtt_host, sizeof(storage_mqtt)); // Backup mqtt host, port, client, username and password } if ((215 == restart_flag) || (216 == restart_flag)) { SettingsErase(0); // Erase all flash from program end to end of physical flash } SettingsDefault(); - memcpy(Settings.sta_ssid, storage, sizeof(storage)); // Restore current SSIDs and Passwords - if (216 == restart_flag) { // Restore the mqtt host, port, username and password - memcpy(Settings.mqtt_host, storage_mqtt_host, sizeof(Settings.mqtt_host)); - Settings.mqtt_port = storage_mqtt_port; - memcpy(Settings.mqtt_user, storage_mqtt_user, sizeof(Settings.mqtt_user)); - memcpy(Settings.mqtt_pwd, storage_mqtt_pwd, sizeof(Settings.mqtt_pwd)); - memcpy(Settings.mqtt_topic, storage_mqtt_topic, sizeof(Settings.mqtt_topic)); + memcpy(Settings.sta_ssid, storage_wifi, sizeof(storage_wifi)); // Restore current SSIDs and Passwords + if (216 == restart_flag) { + memcpy(Settings.mqtt_host, storage_mqtt, sizeof(storage_mqtt)); // Restore the mqtt host, port, client, username and password + strlcpy(Settings.mqtt_client, MQTT_CLIENT_ID, sizeof(Settings.mqtt_client)); // Set client to default } restart_flag = 2; } diff --git a/sonoff/support.ino b/sonoff/support.ino index fc2a3d853..e6068fb77 100644 --- a/sonoff/support.ino +++ b/sonoff/support.ino @@ -1278,7 +1278,7 @@ void AddLog_P2(uint8_t loglevel, PGM_P formatP, ...) { va_list arg; va_start(arg, formatP); - int len = vsnprintf_P(log_data, sizeof(log_data), formatP, arg); + vsnprintf_P(log_data, sizeof(log_data), formatP, arg); va_end(arg); AddLog(loglevel); diff --git a/sonoff/xdrv_01_webserver.ino b/sonoff/xdrv_01_webserver.ino index 9d96c480c..f243b1b11 100644 --- a/sonoff/xdrv_01_webserver.ino +++ b/sonoff/xdrv_01_webserver.ino @@ -272,7 +272,7 @@ const char HTTP_HEAD_STYLE3[] PROGMEM = #else "

%s " D_MODULE "

" #endif - "

%s

%s"; + "

%s

"; const char HTTP_MSG_SLIDER1[] PROGMEM = "
" D_COLDLIGHT "" D_WARMLIGHT "
" @@ -566,27 +566,6 @@ bool HttpCheckPriviledgedAccess(bool autorequestauth = true) return true; } -String WSNetworkInfo(void) -{ - String info = ""; - if (Settings.flag3.gui_hostname_ip) { - uint8_t more_ips = 0; - info += F("

"); info += my_hostname; - if (mdns_begun) { info += F(".local"); } - info += F(" ("); - if (static_cast(WiFi.localIP()) != 0) { - info += WiFi.localIP().toString(); - more_ips++; - } - if (static_cast(WiFi.softAPIP()) != 0) { - if (more_ips) { info += F(", "); } - info += WiFi.softAPIP().toString(); - } - info += F(")

"); - } - return info; -} - void WSHeaderSend(void) { WebServer->sendHeader(F("Cache-Control"), F("no-cache, no-store, must-revalidate")); @@ -701,7 +680,18 @@ void WSContentSendStyle_P(const char* style) WSContentSend_P(HTTP_HEAD_STYLE1); WSContentSend_P(HTTP_HEAD_STYLE2); WSContentSend_P(style); - WSContentSend_P(HTTP_HEAD_STYLE3, ModuleName().c_str(), Settings.friendlyname[0], WSNetworkInfo().c_str()); + WSContentSend_P(HTTP_HEAD_STYLE3, ModuleName().c_str(), Settings.friendlyname[0]); + if (Settings.flag3.gui_hostname_ip) { + bool lip = (static_cast(WiFi.localIP()) != 0); + bool sip = (static_cast(WiFi.softAPIP()) != 0); + WSContentSend_P(PSTR("

%s%s (%s%s%s)

"), // sonoff.local (192.168.2.12,192.168.4.1) + my_hostname, + (mdns_begun) ? ".local" : "", + (lip) ? WiFi.localIP().toString().c_str() : "", + (lip && sip) ? "," : "", + (sip) ? WiFi.softAPIP().toString().c_str() : ""); + } + WSContentSend_P(PSTR("")); } void WSContentSendStyle(void) @@ -812,7 +802,7 @@ void HandleRoot(void) if ((Settings.web_password[0] != 0) && !(WebServer->hasArg("USER1")) && !(WebServer->hasArg("PASS1")) && HTTP_MANAGER_RESET_ONLY != webserver_state) { HandleWifiLogin(); } else { - if (!(Settings.web_password[0] != 0) || ((WebServer->arg("USER1") == WEB_USERNAME ) && (WebServer->arg("PASS1") == Settings.web_password ) || HTTP_MANAGER_RESET_ONLY == webserver_state)) { + if (!(Settings.web_password[0] != 0) || (((WebServer->arg("USER1") == WEB_USERNAME ) && (WebServer->arg("PASS1") == Settings.web_password )) || HTTP_MANAGER_RESET_ONLY == webserver_state)) { HandleWifiConfiguration(); } else { // wrong user and pass diff --git a/sonoff/xdrv_12_home_assistant.ino b/sonoff/xdrv_12_home_assistant.ino index 5998b3585..639c74499 100644 --- a/sonoff/xdrv_12_home_assistant.ino +++ b/sonoff/xdrv_12_home_assistant.ino @@ -166,7 +166,7 @@ static void Shorten(char** s, char *prefix) } } -int try_snprintf_P(char *s, size_t n, const char *format, ... ) +void try_snprintf_P(char *s, int n, const char *format, ... ) { va_list args; va_start(args, format);