Link protocol v2 receiver, ESP-NOW leg, Patrol gauge outputs, gear pulse
- protocol header v2 copied byte-identical from the 5B repo - uart_receiver: processFrame() shared by the UART framing task and ESP-NOW, version check, dedupe on packet_id+timestamp, per-transport liveness, CONFIG cache with sequence number - espnow_receiver: STA mode, channel hopping while silent, locks on frames - gauge_outputs: tach on IO7 (LEDC ch2, 14-bit), coolant PWM on IO8 (LEDC ch4, 8-bit), config cached in NVS, overrides applied but not saved - main: gear label from lever + engaged/target (pulses while shifting, red on mismatch), icons driven by A's alert bits, gauge update at 5 Hz, link stats - wiki: temp_stage.cfd (user's old CANNY program) decoded as prior art; controller-link, link-redundancy, patrol-gauge-outputs, open-questions updated with the bench-verified v2 results and calibration procedure Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,7 @@ updated: 2026-09-21
|
||||
|
||||
# Link Redundancy: wired + wireless
|
||||
|
||||
Stated goal (user, 2026-09-21): connect B to A "through some serial or BLE, or maybe a combination of both as redundant in case the wired connection is lost." This page is the design space. **Nothing here is decided or verified** — every item is `(unverified)` unless labelled otherwise.
|
||||
Stated goal (user, 2026-09-21): connect B to A "through some serial or BLE, or maybe a combination of both as redundant in case the wired connection is lost." This page is the design space. **Status 2026-09-21: ESP-NOW is implemented and bench-verified as the second transport** (see below); the RS485 question and BLE remain open. Items are `(unverified)` unless labelled otherwise.
|
||||
|
||||
## Why redundancy matters more once B drives gauges
|
||||
|
||||
@@ -21,6 +21,13 @@ Today a lost link only blanks a secondary display. Once B drives the cluster's t
|
||||
| **BLE 5 GATT** (A = peripheral notifying, B = central) | both boards have BLE 5 `(source: waveshare-wiki-esp32-s3-lcd-1-3)`; connection-oriented, so B gets an explicit disconnect event; notify payload of 23 bytes fits one packet | connection setup/reconnect takes hundreds of ms to seconds; BLE stack costs RAM on both ends (NimBLE is the lighter choice on Arduino-ESP32); A's Core 0 already runs Wi-Fi scanning + CAN + UART, and Wi-Fi/BLE coexistence on one radio can add jitter | The user's stated candidate |
|
||||
| **ESP-NOW** | connectionless, ~ms latency, no pairing state, trivially broadcast the same 23-byte frame; both are ESP32-S3 so it is a one-call API | Wi-Fi-based, so it shares the radio with A's Wi-Fi scanning; no link-layer "disconnected" event — liveness must come from the existing 1 s timeout | Worth benchmarking against BLE before committing; simpler failover semantics |
|
||||
|
||||
## What was built (2026-09-21, verified on the bench)
|
||||
|
||||
- A broadcasts every frame on **both** UART1 and ESP-NOW (channel 1, broadcast peer, radio held in STA mode; the WiFi manager's "off" no longer powers the radio down).
|
||||
- B receives on both, hands every frame to one `processFrame()`, dedupes DATA on `packet_id` + `timestamp_ms`, and tracks per-transport liveness (`uart alive, espnow alive`). While ESP-NOW is silent B hops channels 1–13 every 400 ms and locks when frames arrive.
|
||||
- Result on the desk: every frame seen on both paths, all duplicates dropped, zero errors. Pulling either path should leave the other carrying the link — **not yet tested by physically pulling the wire** `(unverified)`.
|
||||
- Not built: B talking back, BLE, an on-screen indicator of which path is live (the serial stats line shows it).
|
||||
|
||||
## Failover design sketch
|
||||
|
||||
1. B keeps **one** packet consumer. Every transport (UART, BLE/ESP-NOW) feeds validated `automotive_data_t` frames into the same queue, tagged with a source id.
|
||||
|
||||
Reference in New Issue
Block a user