-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core): Allow idle and deep sleep timeouts to be set at runtime #2817
base: main
Are you sure you want to change the base?
Conversation
static struct k_work_delayable activity_save_work; | ||
#endif | ||
|
||
static int activity_save_timeouts(void) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compiler probably already puts this inline, but this feels like it should be inline to me. I don't know enough about the specifics of what it would do for certain though, feel free to ignore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ngl I don't know much about inlining functions, I modelled this after the endpoints code and I didn't recall it being inlined there
void zmk_activity_set_idle_timeout(uint32_t timeout); | ||
|
||
#if IS_ENABLED(CONFIG_ZMK_SLEEP) | ||
uint32_t zmk_activity_get_sleep_timeout(void); | ||
void zmk_activity_set_sleep_timeout(uint32_t timeout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void zmk_activity_set_idle_timeout(uint32_t timeout); | |
#if IS_ENABLED(CONFIG_ZMK_SLEEP) | |
uint32_t zmk_activity_get_sleep_timeout(void); | |
void zmk_activity_set_sleep_timeout(uint32_t timeout); | |
int zmk_activity_set_idle_timeout(uint32_t timeout); | |
#if IS_ENABLED(CONFIG_ZMK_SLEEP) | |
uint32_t zmk_activity_get_sleep_timeout(void); | |
int zmk_activity_set_sleep_timeout(uint32_t timeout); |
These feel like they should return the value from activity_save_timeouts
in case of error messages.
This adds functions to set the idle and deep sleep timeouts, the new timeouts are persisted in settings across reboots of the board
PR check-list