Skip to content

BLE App Interface#1

Merged
spectrachrome merged 4 commits intomainfrom
ble
Feb 18, 2026
Merged

BLE App Interface#1
spectrachrome merged 4 commits intomainfrom
ble

Conversation

@spectrachrome
Copy link
Owner

@spectrachrome spectrachrome commented Feb 18, 2026

BLE Nordic UART Service, AUX strobe, and armed mode improvements

Branch: ble → main

Summary

  • BLE Nordic UART Service (NUS) for Flutter app control via JSON protocol —
    advertises as "AirLED", supports all LED parameters (brightness, color mode,
    animation, color balance, etc.)
  • AUX7 3-position strobe (off / low / full) with AUX8 spring switch override
    for full-blast Lichthupe
  • Rainbow ripple armed mode replacing the 4-pattern rainbow cycle
  • Continuous FC pulse across arming states — red (forbidden) / green (allowed)
    with smooth phase continuity
  • Flutter BLE integration guide documenting the full protocol for companion
    app development

Changes

File: src/ble.rs
Description: New: BLE protocol layer — Command/Response enums, serde JSON,
command handler, unit tests
────────────────────────────────────────
File: src/lib.rs
Description: Add pub mod ble
────────────────────────────────────────
File: src/state.rs
Description: Add BLE_FLASH + STATE_CHANGED signals, aux_strobe: u8 field
────────────────────────────────────────
File: src/msp.rs
Description: Add MSP_RC constant, parse_rc_channels() for AUX channel reading
────────────────────────────────────────
File: src/bin/main.rs
Description: BLE task (GATT server, chunked notifications, state push), AUX
strobe, RC polling at ~10ms, armed ripple, full-buffer LED writes
────────────────────────────────────────
File: Cargo.toml
Description: Add serde, serde-json-core, futures; enable heapless/serde
────────────────────────────────────────
File: FLUTTER_BLE_GUIDE.md
Description: Complete protocol reference for Flutter app development
────────────────────────────────────────
File: CHANGELOG.md
Description: Document BLE NUS integration

Test plan

  • BLE connect/disconnect with blue LED flash indicator
  • JSON command round-trip (GetState, Set* commands, ack/error responses)
  • State auto-push on flight mode change
  • AUX7 3-position strobe (off/low/full) on battery
  • AUX8 spring switch full-blast override
  • 10s boot guard prevents false strobe trigger
  • Continuous pulse phase across arming state transitions
  • num_leds change over BLE immediately clears unused LEDs
  • WiFi web UI still functional alongside BLE

…olling

- Replace AUX8 on/off strobe with AUX7 3-position switch:
  ~1100 = off, ~1400 = low (80), ~1900 = full (255)
- Strobe bypasses current limiter for maximum output on battery
- Shorter attack/decay ramp (4-frame cycle, 25 Hz at 100 FPS)
- Replace rainbow show cycle with rainbow ripple for armed mode
- MSP loop sleep reduced from 100ms to 10ms for faster response
- STATUS timeout 30ms, RC timeout 20ms, RC polled every tick
- Clear aux_strobe on FC disconnect to prevent stuck strobe
- Always write strobe state on each RC poll (not just transitions)
- AUX8 momentary switch (>1800) overrides AUX7 to full strobe (255)
- Skip first 3 RC polls to avoid garbage values triggering strobe at boot
- Add Flutter BLE integration guide (FLUTTER_BLE_GUIDE.md)
- Merge arming forbidden/allowed into single continuous fc_pulse (50% floor)
  so the breathing curve is uninterrupted when arming state changes
- Suppress strobe for first 10s after boot to avoid garbage RC triggers
- Write full 200-LED buffer every frame, clearing tail beyond num_leds
  so BLE num_leds changes immediately turn off unused LEDs
@spectrachrome spectrachrome merged commit 4e93bcc into main Feb 18, 2026
2 of 6 checks passed
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.

1 participant