feat: report bluetooth battery percentage - #83
Conversation
|
Curious how much of this is Bluetooth related vs PMU. Your previous PR #78 implements battery status, but this seems to take it further with additional PMU logic. You mention "battery measurement multiplier" which seems like it would be part of the battery status PR. |
|
Heya, I think there might be a slight mix-up with the PR numbers in your comment ! You mention #78 implementing battery status, but I believe you meant #81. You were completely right though: the PMU logic mathematically belongs with the base battery implementation ! To clean this up and make reviewing easier, I have reorganized the open PRs:
Does this separation look good to you? Thanks again for the thorough review! |
b772207 to
449a53a
Compare
|
I rebased the PR against the latest changes. Using it on all my RAKs successfully. |
449a53a to
f8f9dd6
Compare
This PR resolves an issue where the battery percentage for the RAK4631 board was completely missing or permanently stuck at
0%over Bluetooth.Changes Made
1. BLE Battery Service Fixes (
Bluetooth.h,Power.h)Bluefruit.Advertising.addService(blebas)so the Battery Service UUID is properly advertised to scanning devicesblebas.write(battery_percent)immediately afterblebas.begin(). Without this, the characteristic length is 0 bytes when BlueZ initially queries it upon connection, causing Linux to silently drop theorg.bluez.Battery1interfaceblebas.notify(battery_percent)in theupdate_pmu()routine so connected BLE clients receive automatic updates without needing to actively poll the GATT characteristicTesting
rak4631bluetoothctl infoon Linux now successfully exposes theBattery Percentagecharacteristic (0x2A19) upon connection.