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
+5 -4
View File
@@ -23,7 +23,7 @@
#if defined(SIMU)
#define WRITE_DELAY_10MS 100
#elif defined(RAMBACKUP)
#elif defined(RTC_BACKUP_RAM)
#define WRITE_DELAY_10MS 1500 /* 15s */
#elif defined(PCBTARANIS)
#define WRITE_DELAY_10MS 500
@@ -37,10 +37,11 @@ extern uint8_t storageDirtyMsk;
extern tmr10ms_t storageDirtyTime10ms;
#define TIME_TO_WRITE() (storageDirtyMsk && (tmr10ms_t)(get_tmr10ms() - storageDirtyTime10ms) >= (tmr10ms_t)WRITE_DELAY_10MS)
#if defined(RAMBACKUP)
#if defined(RTC_BACKUP_RAM)
#include "storage/rtc_backup.h"
extern uint8_t rambackupDirtyMsk;
extern tmr10ms_t rambackupDirtyTime10ms;
#define TIME_TO_RAMBACKUP() (rambackupDirtyMsk && (tmr10ms_t)(get_tmr10ms() - rambackupDirtyTime10ms) >= (tmr10ms_t)100)
#define TIME_TO_BACKUP_RAM() (rambackupDirtyMsk && (tmr10ms_t)(get_tmr10ms() - rambackupDirtyTime10ms) >= (tmr10ms_t)100)
#endif
void storageEraseAll(bool warn);
@@ -64,7 +65,7 @@ void checkExternalAntenna();
#include "sdcard_raw.h"
#endif
#if defined(RAMBACKUP)
#if defined(RTC_BACKUP_RAM)
void rambackupWrite();
bool rambackupRestore();
unsigned int compress(uint8_t * dst, unsigned int dstsize, const uint8_t * src, unsigned int len);