diff --git a/sonoff/sonoff.h b/sonoff/sonoff.h index c8c5a290d..c5e801564 100644 --- a/sonoff/sonoff.h +++ b/sonoff/sonoff.h @@ -110,6 +110,7 @@ const uint8_t MAX_POWER_RETRY = 5; // Retry count allowing agreed power const uint8_t STATES = 20; // Number of states per second using 50 mSec interval const uint8_t IMMINENT_RESET_FACTOR = 10; // Factor to extent button hold time for imminent Reset to default 40 seconds using KEY_HOLD_TIME of 40 const uint32_t BOOT_LOOP_TIME = 10; // Number of seconds to stop detecting boot loops +const uint32_t POWER_CYCLE_TIME = 8; // Number of seconds to reset power cycle boot loops const uint16_t SYSLOG_TIMER = 600; // Seconds to restore syslog_level const uint16_t SERIALLOG_TIMER = 600; // Seconds to disable SerialLog const uint8_t OTA_ATTEMPTS = 5; // Number of times to try fetching the new firmware diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 22fb2daf7..3e198737a 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -778,10 +778,13 @@ void PerformEverySecond(void) ntp_synced_message = false; } + if (POWER_CYCLE_TIME == uptime) { + UpdateQuickPowerCycle(false); + } + if (BOOT_LOOP_TIME == uptime) { RtcReboot.fast_reboot_count = 0; RtcRebootSave(); - UpdateQuickPowerCycle(false); Settings.bootcount++; // Moved to here to stop flash writes during start-up AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BOOT_COUNT " %d"), Settings.bootcount);