In shutdown, on button press, wake back to application rather than into the loader. (#4997)

Suggested by lyusupov and implemented by todd-herbert.
https://github.com/meshtastic/firmware/issues/4651
This commit is contained in:
jhps 2024-10-07 18:39:59 -07:00 committed by GitHub
parent 411aedaf5d
commit 37f294d0a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -270,6 +270,11 @@ void cpuDeepSleep(uint32_t msecToWake)
delay(msecToWake);
NVIC_SystemReset();
} else {
// Resume on user button press
// https://github.com/lyusupov/SoftRF/blob/81c519ca75693b696752235d559e881f2e0511ee/software/firmware/source/SoftRF/src/platform/nRF52.cpp#L1738
constexpr uint32_t DFU_MAGIC_SKIP = 0x6d;
sd_power_gpregret_set(0, DFU_MAGIC_SKIP); // Equivalent NRF_POWER->GPREGRET = DFU_MAGIC_SKIP
// FIXME, use system off mode with ram retention for key state?
// FIXME, use non-init RAM per
// https://devzone.nordicsemi.com/f/nordic-q-a/48919/ram-retention-settings-with-softdevice-enabled