Files
ESP32-S3-Touch-LCD-5B/src/modules/tuning_screen.h
T
julian f60bdac268 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>
2026-09-21 19:12:31 +02:00

37 lines
1.1 KiB
C++

/*
* Gauge Tuning Screen Module
*
* Hand-coded LVGL screen for the Patrol gauge tunables (link_config_t):
* tach pulses/rev + trim, coolant PWM law, alert thresholds, enables, and a
* bench override (force an rpm / a duty) so the needles can be calibrated
* from the touchscreen while watching the cluster.
*
* Lives in src/ (never touched by SquareLine exports), like DrivelineScreen.
* Reached by swiping RIGHT on the Driveline screen; the Driveline button (top
* right) goes back. No swipe gesture on this screen (it would fight the sliders).
* Every change goes through Tunables, so it is saved to NVS (overrides
* excepted) and pushed to Controller B in the next CONFIG frame.
*/
#pragma once
#include <Arduino.h>
#include <lvgl.h>
namespace TuningScreen {
/**
* @brief Build the screen (idempotent), refresh it from Tunables, and load it.
* @note Caller must hold the LVGL lock.
*/
void show();
/**
* @brief Refresh displayed values if the tunables changed elsewhere (console).
* Cheap no-op unless the screen exists and is on display. Call from
* loop(); takes its own lock.
*/
void tick();
} // namespace TuningScreen