6.1.1.13 - Fixes

6.1.1.13 20180828
 * Fix 6.1.1.12 regression of Mem and Var default handling (#3618)
 * Optimizations
This commit is contained in:
Theo Arends 2018-08-28 11:10:32 +02:00
parent f8666c0410
commit 55b43734d8
6 changed files with 17 additions and 17 deletions

View File

@ -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 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) * Add rule variables %sunrise%, %sunset%, %uptime% and %time% (#3608)
* Fix handling use of default names when using names starting with shortcut character (#3392, #3600) * Fix handling use of default names when using names starting with shortcut character (#3392, #3600)

View File

@ -135,7 +135,6 @@ int ota_result = 0; // OTA result
int restart_flag = 0; // Sonoff restart flag int restart_flag = 0; // Sonoff restart flag
int wifi_state_flag = WIFI_RESTART; // Wifi state flag int wifi_state_flag = WIFI_RESTART; // Wifi state flag
int tele_period = 0; // Tele period timer int tele_period = 0; // Tele period timer
int status_update_timer = 0; // Refresh initial status
int blinks = 201; // Number of LED blinks int blinks = 201; // Number of LED blinks
uint32_t uptime = 0; // Counting every second until 4294967295 = 130 year uint32_t uptime = 0; // Counting every second until 4294967295 = 130 year
uint32_t global_update = 0; // Timestamp of last global temperature and humidity update 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(); ResetGlobalValues();
if (Settings.tele_period) { if (Settings.tele_period) {
@ -2528,7 +2517,7 @@ void setup()
save_data_counter = Settings.save_data; save_data_counter = Settings.save_data;
sleep = Settings.sleep; 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++) { for (byte i = 0; i < MAX_RULE_SETS; i++) {
if (bitRead(Settings.rule_stop, i)) { bitWrite(Settings.rule_enabled, i, 0); } if (bitRead(Settings.rule_stop, i)) { bitWrite(Settings.rule_enabled, i, 0); }
} }

View File

@ -20,7 +20,7 @@
#ifndef _SONOFF_VERSION_H_ #ifndef _SONOFF_VERSION_H_
#define _SONOFF_VERSION_H_ #define _SONOFF_VERSION_H_
#define VERSION 0x0601010C #define VERSION 0x0601010D
#define D_PROGRAMNAME "Sonoff-Tasmota" #define D_PROGRAMNAME "Sonoff-Tasmota"
#define D_AUTHOR "Theo Arends" #define D_AUTHOR "Theo Arends"

View File

@ -82,6 +82,10 @@ String GetResetReason()
} }
} }
boolean OsWatchBlockedLoop()
{
return oswatch_blocked_loop;
}
/*********************************************************************************************\ /*********************************************************************************************\
* Miscellaneous * Miscellaneous
\*********************************************************************************************/ \*********************************************************************************************/

View File

@ -376,10 +376,13 @@ void MqttConnected()
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_RESTARTREASON "\":\"%s\"}"), snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_RESTARTREASON "\":\"%s\"}"),
(GetResetReason() == "Exception") ? ESP.getResetInfo().c_str() : GetResetReason().c_str()); (GetResetReason() == "Exception") ? ESP.getResetInfo().c_str() : GetResetReason().c_str());
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_INFO "3")); 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) { if (Settings.tele_period) {
tele_period = Settings.tele_period -9; tele_period = Settings.tele_period -9;
} }
status_update_timer = 2;
rules_flag.system_boot = 1; rules_flag.system_boot = 1;
XdrvCall(FUNC_MQTT_INIT); XdrvCall(FUNC_MQTT_INIT);
} }

View File

@ -548,13 +548,13 @@ boolean RulesCommand()
} }
else if ((CMND_VAR == command_code) && (index > 0) && (index <= MAX_RULE_VARS)) { else if ((CMND_VAR == command_code) && (index > 0) && (index <= MAX_RULE_VARS)) {
if (XdrvMailbox.data_len > 0) { 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]); 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)) { else if ((CMND_MEM == command_code) && (index > 0) && (index <= MAX_RULE_MEMS)) {
if (XdrvMailbox.data_len > 0) { 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]); snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, Settings.mems[index -1]);
} }