diff options
author | Nick Winans <nick@winans.codes> | 2021-07-27 00:15:42 -0500 |
---|---|---|
committer | Pete Johanson <peter@peterjohanson.com> | 2021-08-02 21:48:42 -0400 |
commit | 1cafbd8069ae98682b4b4849a6dfd281c1370f58 (patch) | |
tree | e83f32cb37c7c21493bd2a70bec7ba50d185d63a /app | |
parent | 2b9deb824b9fa6bb22d73ccec4794ff51fabdfc7 (diff) |
fix(power): Manually trigger pm_low_power_devices() before sleep
Diffstat (limited to 'app')
-rw-r--r-- | app/src/activity.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/app/src/activity.c b/app/src/activity.c index 0661b27..f31e608 100644 --- a/app/src/activity.c +++ b/app/src/activity.c @@ -7,6 +7,7 @@ #include <device.h> #include <init.h> #include <kernel.h> +#include <power/power.h> #include <logging/log.h> @@ -55,6 +56,8 @@ void activity_work_handler(struct k_work *work) { int32_t inactive_time = current - activity_last_uptime; #if IS_ENABLED(CONFIG_ZMK_SLEEP) if (inactive_time > MAX_SLEEP_MS) { + // Put devices in low power mode before sleeping + pm_power_state_force((struct pm_state_info){PM_STATE_STANDBY, 0, 0}); set_state(ZMK_ACTIVITY_SLEEP); } else #endif /* IS_ENABLED(CONFIG_ZMK_SLEEP) */ |