zmk icon indicating copy to clipboard operation
zmk copied to clipboard

feat(behavior) Add &sleep behavior

Open mcrosson opened this issue 5 years ago • 7 comments

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 avatar Jan 30 '21 05:01 mcrosson

@mcrosson did you see the review items on this?

petejohanson avatar Mar 12 '21 23:03 petejohanson

@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.

mcrosson avatar Mar 12 '21 23:03 mcrosson

Had some spare brain cycles and time ; updated according to the above feedback

mcrosson avatar Mar 13 '21 19:03 mcrosson

@mcrosson Any plans to wrap this up, fix current conflicts, etc?

petejohanson avatar Sep 28 '22 02:09 petejohanson

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).

hyx0329 avatar May 09 '23 09:05 hyx0329

Arguably obsoleted by #2085 and related PRs.

lesshonor avatar Jul 07 '24 14:07 lesshonor

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.

nmunnich avatar Jul 18 '24 08:07 nmunnich