mirror of
https://github.com/arendst/Tasmota.git
synced 2025-08-03 07:57:43 +00:00
6.4.1.13 Add boot loop offset
6.4.1.13 20190130 * Add command SetOption36 to control boot loop default restoration (#4645, #5063)
This commit is contained in:
parent
cb13e8b05e
commit
2c164a8b4b
@ -1,4 +1,7 @@
|
||||
/* 6.4.1.12 20190128
|
||||
/* 6.4.1.13 20190130
|
||||
* Add command SetOption36 to control boot loop default restoration (#4645, #5063)
|
||||
*
|
||||
* 6.4.1.12 20190128
|
||||
* Change code use of boolean to bool and byte to uint8_t
|
||||
* Change code uint8_t flags to bool flags
|
||||
*
|
||||
|
@ -54,6 +54,7 @@
|
||||
|
||||
#define SAVE_DATA 1 // [SaveData] Save changed parameters to Flash (0 = disable, 1 - 3600 seconds)
|
||||
#define SAVE_STATE 1 // [SetOption0] Save changed power state to Flash (0 = disable, 1 = enable)
|
||||
#define BOOT_LOOP_OFFSET 1 // [SetOption36] Number of boot loops before starting restoring defaults (0 = disable, 1..200 = boot loops offset)
|
||||
|
||||
// -- Wifi ----------------------------------------
|
||||
#define WIFI_IP_ADDRESS "0.0.0.0" // [IpAddress1] Set to 0.0.0.0 for using DHCP or enter a static IP address
|
||||
|
@ -1027,6 +1027,9 @@ void SettingsDelta(void)
|
||||
Settings.interlock[0] = 0xFF; // Legacy support using all relays in one interlock group
|
||||
for (uint8_t i = 1; i < MAX_INTERLOCKS; i++) { Settings.interlock[i] = 0; }
|
||||
}
|
||||
if (Settings.version < 0x0604010D) {
|
||||
Settings.param[P_BOOT_LOOP_OFFSET] = BOOT_LOOP_OFFSET;
|
||||
}
|
||||
|
||||
Settings.version = VERSION;
|
||||
SettingsSave(1);
|
||||
|
@ -227,7 +227,7 @@ enum ButtonStates { PRESSED, NOT_PRESSED };
|
||||
|
||||
enum Shortcuts { SC_CLEAR, SC_DEFAULT, SC_USER };
|
||||
|
||||
enum SettingsParmaIndex {P_HOLD_TIME, P_MAX_POWER_RETRY, P_TUYA_DIMMER_ID, P_MDNS_DELAYED_START, P_MAX_PARAM8}; // Max is PARAM8_SIZE (18) - SetOption32 until SetOption49
|
||||
enum SettingsParmaIndex {P_HOLD_TIME, P_MAX_POWER_RETRY, P_TUYA_DIMMER_ID, P_MDNS_DELAYED_START, P_BOOT_LOOP_OFFSET, P_MAX_PARAM8}; // Max is PARAM8_SIZE (18) - SetOption32 until SetOption49
|
||||
|
||||
enum DomoticzSensors {DZ_TEMP, DZ_TEMP_HUM, DZ_TEMP_HUM_BARO, DZ_POWER_ENERGY, DZ_ILLUMINANCE, DZ_COUNT, DZ_VOLTAGE, DZ_CURRENT, DZ_AIRQUALITY, DZ_MAX_SENSORS};
|
||||
|
||||
|
@ -2484,30 +2484,32 @@ void setup(void)
|
||||
Settings.flag2.emulation = 0;
|
||||
#endif // USE_EMULATION
|
||||
|
||||
// Disable functionality as possible cause of fast restart within BOOT_LOOP_TIME seconds (Exception, WDT or restarts)
|
||||
if (RtcReboot.fast_reboot_count > 1) { // Restart twice
|
||||
Settings.flag3.user_esp8285_enable = 0; // Disable ESP8285 Generic GPIOs interfering with flash SPI
|
||||
if (RtcReboot.fast_reboot_count > 2) { // Restart 3 times
|
||||
for (uint8_t i = 0; i < MAX_RULE_SETS; i++) {
|
||||
if (bitRead(Settings.rule_stop, i)) {
|
||||
bitWrite(Settings.rule_enabled, i, 0); // Disable rules causing boot loop
|
||||
if (Settings.param[P_BOOT_LOOP_OFFSET]) {
|
||||
// Disable functionality as possible cause of fast restart within BOOT_LOOP_TIME seconds (Exception, WDT or restarts)
|
||||
if (RtcReboot.fast_reboot_count > Settings.param[P_BOOT_LOOP_OFFSET]) { // Restart twice
|
||||
Settings.flag3.user_esp8285_enable = 0; // Disable ESP8285 Generic GPIOs interfering with flash SPI
|
||||
if (RtcReboot.fast_reboot_count > Settings.param[P_BOOT_LOOP_OFFSET] +1) { // Restart 3 times
|
||||
for (uint8_t i = 0; i < MAX_RULE_SETS; i++) {
|
||||
if (bitRead(Settings.rule_stop, i)) {
|
||||
bitWrite(Settings.rule_enabled, i, 0); // Disable rules causing boot loop
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (RtcReboot.fast_reboot_count > 3) { // Restarted 4 times
|
||||
Settings.rule_enabled = 0; // Disable all rules
|
||||
}
|
||||
if (RtcReboot.fast_reboot_count > 4) { // Restarted 5 times
|
||||
for (uint8_t i = 0; i < sizeof(Settings.my_gp); i++) {
|
||||
Settings.my_gp.io[i] = GPIO_NONE; // Reset user defined GPIO disabling sensors
|
||||
if (RtcReboot.fast_reboot_count > Settings.param[P_BOOT_LOOP_OFFSET] +2) { // Restarted 4 times
|
||||
Settings.rule_enabled = 0; // Disable all rules
|
||||
}
|
||||
if (RtcReboot.fast_reboot_count > Settings.param[P_BOOT_LOOP_OFFSET] +3) { // Restarted 5 times
|
||||
for (uint8_t i = 0; i < sizeof(Settings.my_gp); i++) {
|
||||
Settings.my_gp.io[i] = GPIO_NONE; // Reset user defined GPIO disabling sensors
|
||||
}
|
||||
}
|
||||
if (RtcReboot.fast_reboot_count > Settings.param[P_BOOT_LOOP_OFFSET] +4) { // Restarted 6 times
|
||||
Settings.module = SONOFF_BASIC; // Reset module to Sonoff Basic
|
||||
// Settings.last_module = SONOFF_BASIC;
|
||||
}
|
||||
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION D_LOG_SOME_SETTINGS_RESET " (%d)"), RtcReboot.fast_reboot_count);
|
||||
AddLog(LOG_LEVEL_DEBUG);
|
||||
}
|
||||
if (RtcReboot.fast_reboot_count > 5) { // Restarted 6 times
|
||||
Settings.module = SONOFF_BASIC; // Reset module to Sonoff Basic
|
||||
// Settings.last_module = SONOFF_BASIC;
|
||||
}
|
||||
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION D_LOG_SOME_SETTINGS_RESET " (%d)"), RtcReboot.fast_reboot_count);
|
||||
AddLog(LOG_LEVEL_DEBUG);
|
||||
}
|
||||
|
||||
Format(mqtt_client, Settings.mqtt_client, sizeof(mqtt_client));
|
||||
|
@ -20,7 +20,7 @@
|
||||
#ifndef _SONOFF_VERSION_H_
|
||||
#define _SONOFF_VERSION_H_
|
||||
|
||||
#define VERSION 0x0604010C
|
||||
#define VERSION 0x0604010D
|
||||
|
||||
#define D_PROGRAMNAME "Sonoff-Tasmota"
|
||||
#define D_AUTHOR "Theo Arends"
|
||||
|
Loading…
x
Reference in New Issue
Block a user