Skip to content
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

Option to turn off the BLE profile indicator during inactivity #8

Conversation

cvcore
Copy link

@cvcore cvcore commented Aug 26, 2023

Reason for this PR is that currently the BLE profile indicator on the left half will stay on all the time and cause a significant imbalance in the battery usage between left and right part.

Since a normal indicator LED will need up to 20mA of current, I think it's a good idea to only turn it on when needed. The new behavior will trigger it to show the color for current profile when:

  • Bluetooth Connection is established for current profile
  • The Mod key is pressed on the keyboard

for around 5 seconds before turning it off again.

But when the keyboard is powered with the USBC cable, this behavior will be disabled automatically.

bortoz and others added 30 commits September 12, 2022 21:58
moved peripheral updating from behaviour bnased to dedicated bluetooth services, added custom lighting effects to the adv360
Dim brightness of LEDS for improved battery life, Decrease settings save timeout to 29.5 seconds so it occurs before idle timeout
Disable battery reporting, stops spurious wakeups on Macs
Changed the endpoints code to rename the existing endpoint types to
"endpoint transport" and add the concept of "endpoint instances". A
transport is the method by which data is sent, while instances allow
describing multiple endpoints that use the same transport (e.g.
bluetooth profiles).

Also added new APIs to get the total number of possible endpoint
instances and assign each instance a unique index, which can be used
for tracking separate state for each endpoint in other code files.
* fix(backlight/tests): Restore original behaviour to fix backlight tests

* fix(build): Remove feature-specific code when SPLIT_BLE, RGB_UNDERGLOW or BACKLIGHT isn't enabled

* refactor(bluetooth): Add battery reporting config.

* Add dedicated battery reporting Kconfig that is `imply`d by
  enabling ZMK_BLE.

* fix(rgb_underglow): Use correct condition in service.c

* Revert "refactor(bluetooth): Add battery reporting config."

This reverts commit 881da25.

---------

Co-authored-by: Peter Johanson <[email protected]>
- added switch `CONFIG_ZMK_HANDLE_BLE_DISCONNECTION`
- fix KinesisCorporation/Adv360-Pro-ZMK#172
trueNAHO and others added 18 commits August 5, 2023 20:03
Properly make the battery sensor Kconfig symbols depend
on `SENSOR` config, and minor battery reporting Kconfig
symbol dependency fix.
Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md)
- [Commits](npm/node-semver@v5.7.1...v5.7.2)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
* When the clear bonds Kconfig is set, also clear peripheral
  address slots addresses from settings as well.
* Properly compare to zero when comparing LE addresses.
* Proper usage of bt_uuid_cmp.
* Central's don't start scanning for peripherals if
  `ZMK_BLE_CLEAR_BONDS_ON_START` is enabled.
* Split peripherals don't advertize if
  `ZMK_BLE_CLEAR_BONDS_ON_START` is enabled.
* Don't reference `pro_micro` nexus node in settings_reset
  so it can be used with other controllers.
* Use mock kscan node instead.
* Add new shield for splitkb.com Aurora Sofle, supporting
  keys, encoder(s), displays, and RGB.

Co-authored-by: Cem Aksoylar <[email protected]>
Blocking operations on the high priority system workqueue may result in
deadlocks, particularly when Bluetooth is in use.
doing so will balance power usage for the left and right parts,
as previously the BLE indicator stays on for the left half all the time.
@ReFil
Copy link
Owner

ReFil commented Sep 4, 2023

These LEDs dont draw that much current at all, but i can see why this would be useful, once the beta changes are pulled in i'll merge this

@ReFil
Copy link
Owner

ReFil commented Sep 12, 2023

There's just been a major update to the beta branch with the goal of improving bluetooth reliability between splits, would you be able to rebase your changes onto the current branch?

@cvcore
Copy link
Author

cvcore commented Sep 22, 2023

There's just been a major update to the beta branch with the goal of improving bluetooth reliability between splits, would you be able to rebase your changes onto the current branch?

Sure, I will try that during this weekend. Have you noticed major improvements from your side after flashing the hardware with the latest build in the z3.2 beta branch @ReFil ?

@cvcore
Copy link
Author

cvcore commented Sep 23, 2023

So I did some testing during the merge and there exists serious regressions from the latest beta branch 2f7db1a that the right part again refuses to connect to the left after power cycle :(

Have you tested the latest version with your hardware and did you see the same issue? @ReFil

To reproduce:

(Please note the steps below is done first without applying any patch)

  1. Check out to the git version mentioned above
  2. Build firmware from that version
  3. Do a clean settings reset and then flash the firmware for both left and right split.
  4. Power on the left half, wait 1 sec, power on the right half.

Observation:

For the very first time after the fresh flashing, the right half is able to connect to the left half without any issue. But it will stop working from the second time on:

IMG_4996.MOV

Binaries used during testing:

You may want to check if these have the same hash as your generated artifacts. Because I'm not sure if the linked zephyr repo needs to be manually checked out to a specific version or not (mine is at zephyrproject-rtos/zephyr@0a586db)? I suppose west is managing the zephyr versions?

Firmware built from 2f7db1a that contains the regression.
2f7db1adef5f4b01602379758ea48d940c6ab305.zip

Last tested stable version with the LED indicator patch applied, that doesn't have the disconnectivity issue (commit: 8af876c)
8af876c094d65f81410c790767818cd901fc31cf.zip

@ReFil
Copy link
Owner

ReFil commented Sep 25, 2023

Ah i'm really sorry, I've chased out that bug but forgot to push. Please rebase and then remove the CONFIG_BT_PRIVACY=y line from your adv360_left_defconfig. also i think there's something up with the git commit history as it stillw ants to merge 80 commits

@cvcore
Copy link
Author

cvcore commented Oct 3, 2023

Closed for #9

The tests on my hardware has been positive. Thanks for the fix! Please review the newly created PR which also has a cleaner git log. @ReFil

@cvcore cvcore closed this Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.