feat: low-battery LED indicator (ENABLE_BATT_LED, default ON)

Blink the Pico onboard LED at 1 Hz when the connected DualSense
reports PowerPercent <= 1 (i.e. <= 10%) and PowerState == Discharging.
Source data is byte 52 of the BT 0x31 input report, already copied
into interrupt_in_data; no new BT parsing required.

The new module owns the LED only while it is actively blinking; it
detects controller disconnection via stale-report timeout and steps
out, so bt.cpp's existing connect/disconnect LED handling stays in
charge in all other states. Honors disable_pico_led.

Gated by -DENABLE_BATT_LED=ON (default). With the option off, the
source file is not compiled and behavior is identical to upstream.
CI gains a compile-only check for the OFF flavor.

(cherry picked from commit 2f8ea73c9fb695e24e7cc3329db7cb925e82e1c9)
This commit is contained in:
Thierry Perraut
2026-05-13 18:09:31 +08:00
committed by awalol
parent d3311a35d9
commit 63c62081eb
6 changed files with 136 additions and 0 deletions
+8
View File
@@ -94,6 +94,14 @@ jobs:
cmake --build build/debug --target ds5-bridge
cp build/debug/ds5-bridge.uf2 artifacts/ds5-bridge-debug.uf2
- name: Build no-batt-led firmware (compile check only)
run: |
cmake -S . -B build/no-batt-led -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DPICO_SDK_PATH="$PICO_SDK_PATH" \
-DENABLE_BATT_LED=OFF
cmake --build build/no-batt-led --target ds5-bridge
- name: Upload standard UF2 artifact
uses: actions/upload-artifact@v7
with: