feat(behavior) Add &sleep behavior
Add a new behavior that'll allow users to put their keyboard to sleep ahead of timeouts. This is meant to be used as a binding on a keymap.
@mcrosson did you see the review items on this?
@mcrosson did you see the review items on this?
Yes, I thought it was agreed this was 'on hold' until after locality landed? I was planning on working on any necessary changes once locality landed.
Had some spare brain cycles and time ; updated according to the above feedback
@mcrosson Any plans to wrap this up, fix current conflicts, etc?
I was trying to implement soft power off/lockout in the application code, happened to almost reimplement this.
However, regardless of whether I called set_state, I can not wake up my keyboard through typing. This works great for my "power off" purpose, but not for the "sleep" here. When the keyboard is put to sleep by activity_work_handler in activity.c, I can wake the keyboard up by typing. So I wonder which part of code make it possible to wake up the keyboard by typing.
Edit: Oh I think I just found it, first introduced by pr 211 at app/drivers/kscan/kscan_gpio_matrix.c, documented. I think I have the idea to implement both.
In my code, the behavior is triggered upon pressing the key. My code is based on current latest main branch (https://github.com/zmkfirmware/zmk/commit/94789a092c6d8ddf5ab5ad88eb011a4ece6b5cee).
Arguably obsoleted by #2085 and related PRs.
I recall someone requesting a &sleep behaviour in addition to &soft_off, to use &sleep for power conserving and &soft_off for transportation. For that reason I would say that it's not obsolete yet.