Preferences for BLE and status LEDs#1934
Preferences for BLE and status LEDs#1934andyshinn wants to merge 6 commits intomeshcore-dev:mainfrom
Conversation
…the BLE LED is actually enabled so we can control it
There was a problem hiding this comment.
Pull request overview
Adds user-configurable preferences to control BLE connection LED behavior and status LED blinking, including an upstream Bluefruit SDK patch to ensure autoConnLed(false) reliably prevents SDK-driven LED toggling.
Changes:
- Introduces
led.bleandled.statuspersisted preferences (plus CLI Rescue setters) in thecompanion_radioexample. - Extends NRF52
SerialBLEInterfaceto accept a BLE LED mode and to manage the BLE LED state in connect/secure/disconnect flows. - Adds UI task logic to disable status LED blinking and to implement “blink only when disconnected” for BLE LED in the companion UI.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/helpers/nrf52/SerialBLEInterface.h | Adds a stored BLE LED mode and extends begin() signature to accept it. |
| src/helpers/nrf52/SerialBLEInterface.cpp | Implements BLE LED mode behavior and disables SDK auto LED handling for non-default modes. |
| examples/companion_radio/ui-orig/UITask.h | Adds BLE LED pin resolution and declares a BLE LED handler. |
| examples/companion_radio/ui-orig/UITask.cpp | Disables status LED blinking via pref; adds disconnected-only BLE LED blink handler. |
| examples/companion_radio/ui-new/UITask.h | Adds BLE LED pin resolution and per-instance BLE blink state. |
| examples/companion_radio/ui-new/UITask.cpp | Disables status LED blinking via pref; adds disconnected-only BLE LED blink handler. |
| examples/companion_radio/main.cpp | Passes led_ble_mode into BLE interface initialization. |
| examples/companion_radio/NodePrefs.h | Adds LED mode constants and persisted fields led_ble_mode / led_status_mode. |
| examples/companion_radio/MyMesh.cpp | Adds CLI Rescue commands set led.ble and set led.status. |
| examples/companion_radio/DataStore.cpp | Persists the new LED preference fields. |
| arch/nrf52/extra_scripts/patch_bluefruit.py | Patches Bluefruit to guard blink callback LED toggling behind _led_conn and exposes the callback as a friend. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi, interesting commit But I find this is very specific to a device to make a new command in the protocol Why didn't you use a custom var instead (as for the gps toggle) ? It's a generic approach and it removes the burden of writing the client part (that does not have to worry about if the feature exists on the companion) |
|
Sure that makes sense. I reworked it to be a custom var instead. |
This adds some settings to control the BLE and status LEDs:
led.ble0: Enables the normal behavior of blinking when disconnected from BLE and solid when connected to BLE.1: Blinks BLE LED only when disconnected from BLE.2: Turns on the BLE LED solid when connected but doesn't blink when disconnected.3: Disables the BLE LED.led.status:0: Existing behavior to enable the status LED blinking.1: Disables the status LED.For the BLE LED to work it required a patch to the upstream Bluefruit SDK so I added that here as well.
Will need to be added in downstream clients.Now done as custom vars so we already get them in clients. Can also be tested in CLI Rescue withset led.status #andset led.ble #Possibly related to #1214.