zmkfirmware / zmk

ZMK Firmware Repository
https://zmk.dev/
MIT License
2.82k stars 2.85k forks source link

Feature request: Balance split battery drain by cycling central and peripheral roles #1040

Open pawlowskialex opened 2 years ago

pawlowskialex commented 2 years ago

I'm not a split user, but I was playing with Power Profiler and the difference between Central and Peripheral battery lives is quite stark.

One solution would be to periodically switch the roles of each half. Obviously, the system shouldn't balance mid-keystroke, so there should be some debouncing. The sequence can look something like this:

<central>
- if time_since_last_cycle >= switch_interval and time_since_last_keystroke >= debounce_interval
- send cycle_role_request to peripheral
- receive ack
- disconnect bluetooth and switch to peripheral role

<peripheral>
- receive cycle_role_request
- send ack
- wait for central to disconnect
- switch to central role

Ideally the current central should present itself to the computer as the exact same device as the previous central. This way the balancing process is completely transparent to the computer, and computer would only see a temporary reconnection every now and then.

But even if this isn't possible then pairing every half once during setup is not a big deal.

NilsIrl commented 3 months ago

This feature is mentioned in the tracking issue https://github.com/zmkfirmware/zmk/issues/58