Skip to content

Commit

Permalink
In shutdown, on button press, wake back to application rather than in…
Browse files Browse the repository at this point in the history
…to the loader. (#4997)

Suggested by lyusupov and implemented by todd-herbert.
#4651
  • Loading branch information
jhps authored Oct 8, 2024
1 parent 411aeda commit 37f294d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/platform/nrf52/main-nrf52.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 37f294d

Please sign in to comment.