Skip to content

feat: temporal dithering, position-light strobe, and BLE TX buffering#2

Merged
spectrachrome merged 5 commits intomainfrom
temporal_dithering
Feb 22, 2026
Merged

feat: temporal dithering, position-light strobe, and BLE TX buffering#2
spectrachrome merged 5 commits intomainfrom
temporal_dithering

Conversation

@spectrachrome
Copy link
Owner

@spectrachrome spectrachrome commented Feb 22, 2026

  • Temporal dithering for WS2812B LEDs — error-diffusion, ordered (Bayer
    4×4), and hybrid modes add perceived bit depth by varying quantized output
    frame-to-frame faster than flicker fusion. Controlled at runtime via
    SetDitherMode / SetDitherFps BLE commands. Disabled by default.

    • Position-light strobe mode — AUX7 three-way switch: off → red/green
      (port/starboard) → white. AUX8 momentary triggers white strobe. Quadratic
      envelope for sharper flash, green scaled to 75% for perceptual brightness
      match.
    • BLE TX append buffering — responses are appended after unsent data
      with a compact step, preventing overwrites when multiple responses queue
      up.
    • Strobe gated on flight mode — strobe suppressed for 10s after boot
      and when FC reports ArmingForbidden (no valid RX link).

    Test plan

    • Flash firmware and verify AUX7 three-way cycles off → red/green →
      white
    • Verify AUX8 momentary triggers white strobe
    • Confirm red/green port/starboard orientation is correct
    • Verify strobe is suppressed before TX link is established
    • Enable temporal dithering via BLE (SetDitherMode) and confirm
      smooth gradients at low brightness
    • Send rapid BLE commands and verify no responses are dropped

Add RC-based TX link detection: when all 4 stick channels (AETR) read
exactly 1500 µs, no transmitter is bound and strobe is suppressed.
Prevents false strobe triggers from unassigned AUX channels defaulting
to 1500 µs center position.

Remove Wi-Fi AP, HTTP web UI, DHCP server, and related dependencies
(embassy-net, smoltcp, edge-dhcp, embedded-io). BLE is now the sole
control interface.

Expose tx_linked field in BLE StateResponse for app display.
Add temporal dithering module (src/dither.rs) with three algorithms:
error diffusion, ordered Bayer 4x4, and hybrid (default). 8.8
fixed-point gamma LUTs computed at compile time provide sub-u8
precision. The LED task now runs an inner dither loop at dither_fps
rate (100-960 Hz) between animation frames.

Gate AUX strobe on flight_mode != ArmingForbidden instead of
RSSI-based tx_linked heuristic — the FC's own state machine
already validates RX link, eliminating false strobe triggers
from noisy RSSI when no TX is connected.

BLE commands: SetDitherMode, SetDitherFps, DisplayTestPattern,
CancelTestPattern. Default dither mode is Hybrid at 300 Hz.
Remap AUX strobe switches: AUX8 momentary and AUX7 mid both trigger
white strobe at 80, AUX7 high triggers red/green position-light strobe.
Add strobe_split field to LedState for split colour rendering.

BLE TX responses are now appended after unsent data instead of
overwriting, with a compact step to reclaim consumed buffer space.
Reorder AUX7 three-way: off → red/green position-light → white.
Use quadratic envelope for sharper strobe flash. Scale green to 75%
to match perceived red brightness. Fix port/starboard color swap.
@spectrachrome spectrachrome merged commit 8f82364 into main Feb 22, 2026
2 of 6 checks passed
@spectrachrome spectrachrome deleted the temporal_dithering branch February 22, 2026 04:14
spectrachrome added a commit that referenced this pull request Feb 23, 2026
Binary protocol (22-byte state snapshots, 1–4 byte commands),
TestPattern command, GetVersion command, removed serde/heapless deps.
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