Link protocol v2, ESP-NOW leg, gauge tunables + tuning screen; remove Home screen

Protocol v2 (shared header, byte-identical with the 1.3 repo):
- typed DATA/CONFIG frames: 0xAA | ver | type | len | payload | XOR | 0x55
- gear split into lever (P/R/N/D/S/M) + target/engaged nibbles, engine rpm,
  alert bitmap decided here from tunable thresholds, link_config_t tunables
- docs/UART_PROTOCOL.md rewritten for v2

Controller A modules:
- tunables: gauge calibration + alert thresholds in NVS, 'cfg' serial console,
  bench override (never persisted)
- espnow_link: every frame also broadcast on ESP-NOW ch 1; radio stays in STA
  (WiFiManager no longer powers it off)
- uart_manager: DATA at 5 Hz + CONFIG on change/5 s on both transports
- can_driver: publishes gear pieces and rpm, evaluates alerts
- tuning_screen: hand-coded Gauge Tuning page (swipe right from Driveline),
  -/+ rows, enable switches, override sliders, Driveline/Defaults buttons

UI: SquareLine Home screen (3 meters + battery) and meters_manager removed;
Driveline is the boot screen; Settings back-gesture calls app_show_driveline().

tools/fix_penv_deps.ps1: repairs the shared PlatformIO penv after a 1.3 build.
Bench-verified with Controller B: both transports alive, dedupe, override
rpm 2000 -> 133.3 Hz tach output.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-09-21 19:12:31 +02:00
parent a8f68ebc27
commit f60bdac268
33 changed files with 1743 additions and 2266 deletions
+37
View File
@@ -0,0 +1,37 @@
/*
* ESP-NOW Link Module (Controller A side, transmit only)
*
* Second transport for the A -> B link: every frame the UART manager builds
* is also broadcast over ESP-NOW, so B keeps receiving if the wire is lost.
* B dedupes on packet_id, so both paths may be live at once.
*
* Radio policy: the Wi-Fi radio stays in STA mode permanently (the WiFi
* manager's "off" only stops scanning). A transmits on ESPNOW_CHANNEL unless
* associated to an access point, in which case the AP's channel is used and
* B hops until it finds us.
*/
#pragma once
#include <Arduino.h>
namespace EspNowLink {
/**
* Bring the radio up in STA mode on ESPNOW_CHANNEL and register the
* broadcast peer. Safe to call after WiFiManager::init().
* @return true if ESP-NOW is ready
*/
bool init();
/**
* Broadcast one complete frame (start..end bytes).
* @return true if queued for transmission
*/
bool send(const uint8_t* frame, size_t len);
bool isReady();
uint32_t sentCount();
uint32_t failCount();
} // namespace EspNowLink