-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Feature request: Soft shutdown of keyboard #1292
Comments
How would that work in theory? Would it shut down until a certain keycombo is pressed? If yes, how often does the mcu scan for the combo? If no, is there another way to start it again? Pluging it into something maybe? Or a designated button to restart it? Maybe a reset button? {just brainstorming out loud here ^^} |
Good question. There was some discussion about this on Discord a few days ago. Here are some relevant snippets to aid the brainstorming:
…
|
Hmm I see. What do you think about a user defined combo where the mcu would only ever scan one of the columns of the combo so that there wouldnt be as much activity as usally but when theres any key pressed in that column it would start scanning for the whole combo again? |
Not every board uses a matrix, some use direct pin assignments (but I guess you could make that configurable at compile time). What about split keyboards? I guess since the slave side already operates very power efficient it could be ignored, but maybe some users would like to shut down both sides. |
Also see #405. |
Hi, i did a 2 hour stab at this (instead of figuring how to solder a power switch to my corne helix), and found a solution that seems to work for me on nice nano v2. I haven't measured the current draw, but i do not get any presses until reset i pressed. The following patches are needed (if someone wants to make this into a proper upstream feature it would be great. feel free, and use the MIT license. It would be great if you'd mention my name in the commit message):
And for zephyr (on revision 8adeab429a2480198d22df9847933cfe3f9ea410 ):
|
@freqmod To make your changes easier to test, here they are in separate branches, including a change to the zmk manifest to use the zephyr fork.
Support is also included in Miryoku ZMK. |
@freqmod Could this be implemented using |
Initially i tried to do global behaviour. As far as i could see from the implementation the global behaviour first sends a command to the peripheral (right side) and then executes the command itself. I was a bit concerned that the command to the peripheral side seems to be put in a queue. If the right side executes before the queue element is processed then it will power down the right side before the left side gets the command to power of. I guess there are ways to handle this e.g. by putting the command to power down the left side in the queue after the other command. Another option may be to sleep, but if you block the queue processing it does not help. I just wanted something that worked within a reasonable implementation time, so i haven't investigated this, and rather went with the local behaviour. Btw i have been testing this for a week without any issues (except sometimes reconnecting after wakeup, but i guess that is present if you use a hard power off switch too). It seems my battery stays charged too. Also it may be useful see https://github.com/freqmod/zmk where i have applied the zmk (but not zephyr) patch, in addition to other patches i use. I will rebase this now and then, whenever I want new zmk firmware on my keyboards. |
@freqmod Question (and please excuse my noobiness): I'm testing this on a Corne with OLED displays; I usually keep the OLEDs off unless diagnosing a fault, but kept them on to test this soft shutdown. I have a "travel layer" with a keymap full of &nones that I'd usually toggle on before packing the board; I've now added &suspend keys to each side in that layer. When I press the &suspend keys, the Bluetooth connection shuts down and the keys are non-responsive (as I'd expect for a shutdown) but the OLEDs continue to display whatever was showing when I pressed the suspend keys— is that expected? |
I am not sure what the nrf52 suspend does. Have you considered seeing if the external power off behaviour turns off the displays, maybe they can be combined with this in a macro or something? If so it may be sensible to add external power down etc. in the code pre shutdown. I am not sure what is required on startup though, if you need specific code to power it up at that time. |
Something like: ? I'll give this a go and see. |
Any update on this? |
At least for my side I am not intending to try to spend effort to try to upstream this(I. e. get this merged). Especially since it requires changes to zephyr too (to reset the device). If anybody else wants to do the work that would be great though. |
Would be resolved by #1942. |
Closed by #2085 |
Lots of users request the ability to power off their keyboard (in the absence of a physical power switch).
The reason behind most of the requests is so that the keyboard can be transported in a bag without accidentally sending keystrokes and/or draining battery. However, it's also just nice to be able to turn things off when they're not being used. 🙂
The text was updated successfully, but these errors were encountered: