From 55b43734d8794ffc8a9e31a61ec2770f6df0ac4d Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Tue, 28 Aug 2018 11:10:32 +0200 Subject: [PATCH] 6.1.1.13 - Fixes 6.1.1.13 20180828 * Fix 6.1.1.12 regression of Mem and Var default handling (#3618) * Optimizations --- sonoff/_changelog.ino | 6 +++++- sonoff/sonoff.ino | 13 +------------ sonoff/sonoff_version.h | 2 +- sonoff/support.ino | 4 ++++ sonoff/xdrv_01_mqtt.ino | 5 ++++- sonoff/xdrv_10_rules.ino | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index c021faba3..046e19a39 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -1,4 +1,8 @@ -/* 6.1.1.12 20180827 +/* 6.1.1.13 20180828 + * Fix 6.1.1.12 regression of Mem and Var default handling (#3618) + * Optimizations + * + * 6.1.1.12 20180827 * Add commands ButtonDebounce 40..1000 and SwitchDebounce 40..1000 to have user control over debounce timing. Default is 50mS (#3594) * Add rule variables %sunrise%, %sunset%, %uptime% and %time% (#3608) * Fix handling use of default names when using names starting with shortcut character (#3392, #3600) diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index ad091fd8d..8cd69e4cc 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -135,7 +135,6 @@ int ota_result = 0; // OTA result int restart_flag = 0; // Sonoff restart flag int wifi_state_flag = WIFI_RESTART; // Wifi state flag int tele_period = 0; // Tele period timer -int status_update_timer = 0; // Refresh initial status int blinks = 201; // Number of LED blinks uint32_t uptime = 0; // Counting every second until 4294967295 = 130 year uint32_t global_update = 0; // Timestamp of last global temperature and humidity update @@ -1593,16 +1592,6 @@ void PerformEverySecond() } } - if (status_update_timer) { - status_update_timer--; - if (!status_update_timer) { - for (byte i = 1; i <= devices_present; i++) { - MqttPublishPowerState(i); - if (SONOFF_IFAN02 == Settings.module) { break; } // Only report status of light relay - } - } - } - ResetGlobalValues(); if (Settings.tele_period) { @@ -2528,7 +2517,7 @@ void setup() save_data_counter = Settings.save_data; sleep = Settings.sleep; - if ((resetInfo.reason == REASON_WDT_RST) || (resetInfo.reason == REASON_EXCEPTION_RST) || (resetInfo.reason == REASON_SOFT_WDT_RST)) { + if ((resetInfo.reason == REASON_WDT_RST) || (resetInfo.reason == REASON_EXCEPTION_RST) || (resetInfo.reason == REASON_SOFT_WDT_RST) || OsWatchBlockedLoop()) { for (byte i = 0; i < MAX_RULE_SETS; i++) { if (bitRead(Settings.rule_stop, i)) { bitWrite(Settings.rule_enabled, i, 0); } } diff --git a/sonoff/sonoff_version.h b/sonoff/sonoff_version.h index c498dccec..f351b547d 100644 --- a/sonoff/sonoff_version.h +++ b/sonoff/sonoff_version.h @@ -20,7 +20,7 @@ #ifndef _SONOFF_VERSION_H_ #define _SONOFF_VERSION_H_ -#define VERSION 0x0601010C +#define VERSION 0x0601010D #define D_PROGRAMNAME "Sonoff-Tasmota" #define D_AUTHOR "Theo Arends" diff --git a/sonoff/support.ino b/sonoff/support.ino index 654c998b8..e7cfa6177 100644 --- a/sonoff/support.ino +++ b/sonoff/support.ino @@ -82,6 +82,10 @@ String GetResetReason() } } +boolean OsWatchBlockedLoop() +{ + return oswatch_blocked_loop; +} /*********************************************************************************************\ * Miscellaneous \*********************************************************************************************/ diff --git a/sonoff/xdrv_01_mqtt.ino b/sonoff/xdrv_01_mqtt.ino index de0df8f9f..c47728df0 100644 --- a/sonoff/xdrv_01_mqtt.ino +++ b/sonoff/xdrv_01_mqtt.ino @@ -376,10 +376,13 @@ void MqttConnected() snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_RESTARTREASON "\":\"%s\"}"), (GetResetReason() == "Exception") ? ESP.getResetInfo().c_str() : GetResetReason().c_str()); MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_INFO "3")); + for (byte i = 1; i <= devices_present; i++) { + MqttPublishPowerState(i); + if (SONOFF_IFAN02 == Settings.module) { break; } // Only report status of light relay + } if (Settings.tele_period) { tele_period = Settings.tele_period -9; } - status_update_timer = 2; rules_flag.system_boot = 1; XdrvCall(FUNC_MQTT_INIT); } diff --git a/sonoff/xdrv_10_rules.ino b/sonoff/xdrv_10_rules.ino index fb40fc95f..df27cb4cd 100644 --- a/sonoff/xdrv_10_rules.ino +++ b/sonoff/xdrv_10_rules.ino @@ -548,13 +548,13 @@ boolean RulesCommand() } else if ((CMND_VAR == command_code) && (index > 0) && (index <= MAX_RULE_VARS)) { if (XdrvMailbox.data_len > 0) { - strlcpy(vars[index -1], (SC_CLEAR == Shortcut(XdrvMailbox.data)) ? "" : XdrvMailbox.data, sizeof(vars[index -1])); + strlcpy(vars[index -1], ('"' == XdrvMailbox.data[0]) ? "" : XdrvMailbox.data, sizeof(vars[index -1])); } snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, vars[index -1]); } else if ((CMND_MEM == command_code) && (index > 0) && (index <= MAX_RULE_MEMS)) { if (XdrvMailbox.data_len > 0) { - strlcpy(Settings.mems[index -1], (SC_CLEAR == Shortcut(XdrvMailbox.data)) ? "" : XdrvMailbox.data, sizeof(Settings.mems[index -1])); + strlcpy(Settings.mems[index -1], ('"' == XdrvMailbox.data[0]) ? "" : XdrvMailbox.data, sizeof(Settings.mems[index -1])); } snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, Settings.mems[index -1]); }