Skip to content

feat(split): Increase split interval during idle#682

Closed
Nicell wants to merge 1 commit intozmkfirmware:mainfrom
Nicell:split/idle-interval
Closed

feat(split): Increase split interval during idle#682
Nicell wants to merge 1 commit intozmkfirmware:mainfrom
Nicell:split/idle-interval

Conversation

@Nicell
Copy link
Copy Markdown
Member

@Nicell Nicell commented Feb 18, 2021

This PR makes the split connection interval increase during idle. There's a brief period (about 0.6-1s) where the chances of having misordered keypresses are higher when coming out of idle, but this overall works well from my testing. This makes wireless battery consumption of the central half 1/3rd what it currently is when idle, and the peripheral's battery life is mostly unaffected.

For some reason, the bt_conn_foreach finds two connections rather than one that matches the role of master, and the first one always fails to update. Not sure what's up with that, but the second one updates the split connection properly.

Would appreciate people testing this branch to see how it performs for them. Specifically, I'd be interested in how this affects your typing experience (if at all).

@Nicell Nicell added bluetooth Bluetooth related items core Core functionality/behavior of ZMK split labels Feb 18, 2021
@scottg88
Copy link
Copy Markdown

I've tried this on my nice!nano + sofle split briefly. Haven't seen any issues when coming out of idle yet. I'll daily drive this for a day and see if any issues come up. I'm very interested in all improvements that help with battery life so I'll test wherever I can.

@scottg88
Copy link
Copy Markdown

scottg88 commented Feb 19, 2021

After trying this out for about 8 hours, I haven't practically run into any issues. I can reproduce the out of order key presses you mentioned but I have to try hard, I didn't run into it in practice.

@Nicell
Copy link
Copy Markdown
Member Author

Nicell commented Feb 19, 2021

Thanks for testing this @scottg88. I don't currently daily drive a split, so I'd like to hear a few others' experiences before moving this forward. Sounds like this is pretty promising.

@Nicell Nicell marked this pull request as ready for review March 1, 2021 19:14
@Nicell Nicell requested a review from petejohanson March 1, 2021 19:14
Copy link
Copy Markdown
Contributor

@petejohanson petejohanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one comment, otherwise, the code and approach looks good. Haven't had a chance to test myself yet.

bt_conn_get_info(conn, &info);

if (info.role == BT_CONN_ROLE_MASTER) {
int err = bt_conn_le_param_update(conn, BT_LE_CONN_PARAM(0x0012, 0x0012, 10, 400));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we create #defines for this and the wake versions to make this a bit clearer?

@caksoylar
Copy link
Copy Markdown
Contributor

I have been testing this for three days on my split and haven't run into any issues. However I also couldn't intentionally reproduce the out of order keys (after waiting 30 seconds for idle).

@Nicell
Copy link
Copy Markdown
Member Author

Nicell commented May 16, 2021

An issue found from testing this PR: https://discord.com/channels/719497620560543766/784523018050469939/827426904470192159

I've been using #682 for about a week, Iv not had any key order issues, but I have had the peripheral half drop connection with the host, a few times it may or may not be related,but it feels like it coincides with using #682

@Nicell Nicell force-pushed the split/idle-interval branch 3 times, most recently from ea8f4e6 to 7f62317 Compare May 6, 2022 03:49
@Nicell Nicell force-pushed the split/idle-interval branch 2 times, most recently from ef59d6c to 09b3331 Compare May 11, 2022 17:10
@Nicell Nicell marked this pull request as draft May 12, 2024 20:08
@Nicell
Copy link
Copy Markdown
Member Author

Nicell commented May 12, 2024

If anyone would like to pick this up, it would need some updates to use the Kconfig values that control connection parameters. Maybe new Kconfig options for idle multipliers could be defined. More testing around the two halves losing their connection when the connection settings update needs to be investigated.

@github-actions
Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had activity in 10 months. It will be closed in 14 days if no further activity occurs. Feel free to give a status update or re-open when it has been rebased and is ready for review (again). Thanks!

@github-actions github-actions bot added the Stale label Jul 23, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Aug 7, 2025

This PR was closed because it had no activity for over 10 months. Feel free to give a status update or re-open when it has been rebased and is ready for review (again).

@github-actions github-actions bot closed this Aug 7, 2025
carrefinho added a commit to carrefinho/zmk that referenced this pull request Dec 31, 2025
Slows down BLE connection interval between split halves when keyboard
goes idle, reducing central half battery consumption significantly
during idle periods.

When the keyboard becomes active again, connection parameters are
restored to their normal values. There may be brief latency (0.6-1s)
when waking from idle.

Based on: zmkfirmware#682

Co-authored-by: Nick Winans <nick@winans.codes>
carrefinho added a commit to carrefinho/zmk that referenced this pull request Dec 31, 2025
Slows down BLE connection interval between split halves when keyboard
goes idle, reducing central half battery consumption significantly
during idle periods.

When the keyboard becomes active again, connection parameters are
restored to their normal values. There may be brief latency (0.6-1s)
when waking from idle.

Based on: zmkfirmware#682

Co-authored-by: Nick Winans <nick@winans.codes>
carrefinho added a commit to carrefinho/zmk that referenced this pull request Dec 31, 2025
Slows down BLE connection interval between split halves when keyboard
goes idle, reducing central half battery consumption significantly
during idle periods.

When the keyboard becomes active again, connection parameters are
restored to their normal values. There may be brief latency (0.6-1s)
when waking from idle.

Based on: zmkfirmware#682

Co-authored-by: Nick Winans <nick@winans.codes>
carrefinho added a commit to carrefinho/zmk that referenced this pull request Dec 31, 2025
Slows down BLE connection interval between split halves when keyboard
goes idle, reducing central half battery consumption significantly
during idle periods.

When the keyboard becomes active again, connection parameters are
restored to their normal values. There may be brief latency (0.6-1s)
when waking from idle.

Based on: zmkfirmware#682

Co-authored-by: Nick Winans <nick@winans.codes>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bluetooth Bluetooth related items core Core functionality/behavior of ZMK split Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants