mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-28 05:06:32 +00:00
Refactor RtcReboot counter
This commit is contained in:
parent
9d664059cd
commit
f6a7722a3c
@ -231,6 +231,12 @@ void RtcRebootSave(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RtcRebootReset(void)
|
||||||
|
{
|
||||||
|
RtcReboot.fast_reboot_count = 0;
|
||||||
|
RtcRebootSave();
|
||||||
|
}
|
||||||
|
|
||||||
void RtcRebootLoad(void)
|
void RtcRebootLoad(void)
|
||||||
{
|
{
|
||||||
ESP.rtcUserMemoryRead(100 - sizeof(RTCRBT), (uint32_t*)&RtcReboot, sizeof(RTCRBT)); // 0x280
|
ESP.rtcUserMemoryRead(100 - sizeof(RTCRBT), (uint32_t*)&RtcReboot, sizeof(RTCRBT)); // 0x280
|
||||||
@ -1148,6 +1154,7 @@ void SettingsDelta(void)
|
|||||||
if (Settings.version < 0x07000004) {
|
if (Settings.version < 0x07000004) {
|
||||||
Settings.wifi_output_power = 170;
|
Settings.wifi_output_power = 170;
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings.version = VERSION;
|
Settings.version = VERSION;
|
||||||
SettingsSave(1);
|
SettingsSave(1);
|
||||||
}
|
}
|
||||||
|
@ -615,6 +615,7 @@ void WifiShutdown(void)
|
|||||||
void EspRestart(void)
|
void EspRestart(void)
|
||||||
{
|
{
|
||||||
WifiShutdown();
|
WifiShutdown();
|
||||||
|
RtcRebootReset();
|
||||||
// ESP.restart(); // This results in exception 3 on restarts on core 2.3.0
|
// ESP.restart(); // This results in exception 3 on restarts on core 2.3.0
|
||||||
ESP.reset();
|
ESP.reset();
|
||||||
}
|
}
|
||||||
|
@ -816,8 +816,7 @@ void PerformEverySecond(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (BOOT_LOOP_TIME == uptime) {
|
if (BOOT_LOOP_TIME == uptime) {
|
||||||
RtcReboot.fast_reboot_count = 0;
|
RtcRebootReset();
|
||||||
RtcRebootSave();
|
|
||||||
|
|
||||||
#ifdef USE_DEEPSLEEP
|
#ifdef USE_DEEPSLEEP
|
||||||
if (!(DeepSleepEnabled() && !Settings.flag3.bootcount_update)) {
|
if (!(DeepSleepEnabled() && !Settings.flag3.bootcount_update)) {
|
||||||
|
@ -62,8 +62,7 @@ bool DeepSleepEnabled(void)
|
|||||||
void DeepSleepInit(void)
|
void DeepSleepInit(void)
|
||||||
{
|
{
|
||||||
if (DeepSleepEnabled()) {
|
if (DeepSleepEnabled()) {
|
||||||
RtcReboot.fast_reboot_count = 0;
|
RtcRebootReset();
|
||||||
RtcRebootSave();
|
|
||||||
if ((RtcSettings.ultradeepsleep > MAX_DEEPSLEEP_CYCLE) && (RtcSettings.ultradeepsleep < 1700000000)) {
|
if ((RtcSettings.ultradeepsleep > MAX_DEEPSLEEP_CYCLE) && (RtcSettings.ultradeepsleep < 1700000000)) {
|
||||||
// Go back to sleep after 60 minutes if requested deepsleep has not been reached
|
// Go back to sleep after 60 minutes if requested deepsleep has not been reached
|
||||||
RtcSettings.ultradeepsleep = RtcSettings.ultradeepsleep - MAX_DEEPSLEEP_CYCLE;
|
RtcSettings.ultradeepsleep = RtcSettings.ultradeepsleep - MAX_DEEPSLEEP_CYCLE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user