MAGIC value for powerReason should be stored in RTC backup on Horus (#7096)

- Allows the radio main application to start correctly when coming from an app in RAM
- Refactoring of the `UNEXPECTED_SHUTDOWN()` process
- Saves the RTC battery as BACKUP RAM is not needed on normal shutdown
- On PWR OFF on an ALERT, the radio won't show the next alert before shutting down
- Bootloader flashable through the SD Manager
This commit is contained in:
Bertrand Songis
2019-11-21 11:50:33 +01:00
committed by GitHub
parent 103534bdcf
commit 4cdd17f0d7
41 changed files with 235 additions and 190 deletions
+3 -3
View File
@@ -36,7 +36,7 @@ void watchdogInit(unsigned int duration)
IWDG->KR = 0x5555; // Unlock registers
IWDG->PR = 3; // Divide by 32 => 1kHz clock
IWDG->KR = 0x5555; // Unlock registers
IWDG->RLR = duration; // 1.5 seconds nominal
IWDG->RLR = duration;
IWDG->KR = 0xAAAA; // reload
IWDG->KR = 0xCCCC; // start
}
@@ -222,7 +222,7 @@ void boardOff()
#if defined(PWR_BUTTON_PRESS)
while (pwrPressed()) {
wdt_reset();
WDG_RESET();
}
#endif
@@ -234,7 +234,7 @@ void boardOff()
__disable_irq();
while (1) {
wdt_reset();
WDG_RESET();
#if defined(PWR_BUTTON_PRESS)
// X9E/X7 needs watchdog reset because CPU is still running while
// the power key is held pressed by the user.