samples: nrf: system_off: Fix force state usage

The sample cannot spin in an infinity loop because the idle thread will
not run and consequently the forced state will not be used.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2022-02-24 23:56:04 -08:00 committed by Carles Cufí
parent ba02864d41
commit 49520eea57

View file

@ -93,6 +93,12 @@ void main(void)
*/
pm_state_force(0u, &(struct pm_state_info){PM_STATE_SOFT_OFF, 0, 0});
/* Now we need to go sleep. This will let the idle thread runs and
* the pm subsystem will use the forced state. To confirm that the
* forced state is used, lets set the same timeout used previously.
*/
k_sleep(K_SECONDS(SLEEP_S));
printk("ERROR: System off failed\n");
while (true) {
/* spin to avoid fall-off behavior */