Rename Controller A/B -> Main CTRL / Inst. Cluster (user); Sleep when the car is off: Settings switch, deep sleep on quiet CAN + idle screen, CAN RX wake, switch mirrored to the cluster; docs
Firmware / build (push) Successful in 7m22s

This commit is contained in:
2026-09-28 16:38:13 +02:00
parent 7a74c02b20
commit 803af7568f
48 changed files with 400 additions and 156 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
/**
* ota_config.h - where Controller A looks for firmware updates, and what it trusts.
* ota_config.h - where Main CTRL looks for firmware updates, and what it trusts.
*
* Updates are pulled over HTTPS from this repo's Gitea releases (public repo,
* no token). CI (.gitea/workflows/firmware.yml) attaches firmware.bin +
@@ -19,7 +19,7 @@
#define FW_VERSION "dev"
#endif
// Identity inside the signed statement, so a Controller B image can never be
// Identity inside the signed statement, so a Inst. Cluster image can never be
// accepted by A (and vice versa) even though both are signed by the same key.
#define OTA_TARGET "patrol-a"
+1 -1
View File
@@ -69,7 +69,7 @@ typedef struct {
/**
* Decoded driveline speeds. Deliberately NOT part of automotive_data_t: that
* struct is the wire format for the UART link to Controller B, and widening it
* struct is the wire format for the UART link to Inst. Cluster, and widening it
* would break the receiver. These live here until there's a reason to spend a
* protocol version bump on them.
*
+13 -9
View File
@@ -1,8 +1,8 @@
/**
* automotive_data.h
*
* Shared wire contract between Controller A (ESP32-S3-Touch-LCD-5B) and
* Controller B (ESP32-S3-LCD-1.3).
* Shared wire contract between Main CTRL (ESP32-S3-Touch-LCD-5B) and
* Inst. Cluster (ESP32-S3-LCD-1.3).
*
* THIS FILE MUST BE BYTE-IDENTICAL IN BOTH REPOS. Copy it across whenever it
* changes and bump PACKET_VERSION; B rejects frames with any other version.
@@ -45,8 +45,8 @@
// (B hops until it hears A, then locks)
// NOTE: UART pin assignments are controller-specific:
// - Controller A (5B): uart_manager.cpp (TX GPIO 44 -> SP3485 -> 485_A/B)
// - Controller B (1.3): platformio.ini (RX IO1)
// - Main CTRL (5B): uart_manager.cpp (TX GPIO 44 -> SP3485 -> 485_A/B)
// - Inst. Cluster (1.3): platformio.ini (RX IO1)
// ============================================================================
// FRAME FORMAT (identical on UART and ESP-NOW)
@@ -90,7 +90,7 @@ typedef enum {
LEVER_UNKNOWN = 0xFF
} gear_lever_t;
// Controller A's internal gear enum (CAN decode helpers below use it). Not on
// Main CTRL's internal gear enum (CAN decode helpers below use it). Not on
// the wire any more - B never sees it.
typedef enum {
GEAR_PARK = 0,
@@ -187,6 +187,10 @@ typedef struct __attribute__((packed)) {
#define OUT_ENABLE_TACH (1 << 0)
#define OUT_ENABLE_TEMP (1 << 1)
// Not an output: the Main CTRL's "Sleep when the car is off" switch, carried in
// the same byte so the CONFIG layout (and PACKET_VERSION) stay unchanged. The
// Inst. Cluster caches CONFIG in NVS, so it knows the setting while A sleeps.
#define CFG_SLEEP_WHEN_SILENT (1 << 7)
#define OVERRIDE_TACH (1 << 0)
#define OVERRIDE_TEMP (1 << 1)
@@ -216,7 +220,7 @@ static inline void link_config_defaults(link_config_t* c) {
}
// ============================================================================
// LINK MAINTENANCE FRAMES (2026-09-27) - Controller B firmware updates
// LINK MAINTENANCE FRAMES (2026-09-27) - Inst. Cluster firmware updates
// ============================================================================
//
// B pulls its own signed release over Wi-Fi; A only hands it the credentials
@@ -241,7 +245,7 @@ typedef struct __attribute__((packed)) {
} link_pair_t; // 42 bytes
// --- STATUS (B -> A, ESP-NOW unicast, every LINK_STATUS_PERIOD_MS) ----------
// ota_phase mirrors Controller A's Ota::phase_t so one UI renders both.
// ota_phase mirrors Main CTRL's Ota::phase_t so one UI renders both.
#define LINK_OTA_IDLE 0
#define LINK_OTA_CHECKING 1
#define LINK_OTA_UP_TO_DATE 2
@@ -756,7 +760,7 @@ static inline const char* gear_to_string(gear_position_t gear) {
* @return Pointer to buffer
*/
static inline char* format_temperature(int16_t temp_x10, char* buffer) {
// Plain "C": Controller B's UI font has no degree-sign glyph.
// Plain "C": Inst. Cluster's UI font has no degree-sign glyph.
sprintf(buffer, "%d.%dC", temp_x10 / 10, abs(temp_x10 % 10));
return buffer;
}
@@ -774,6 +778,6 @@ static inline char* format_voltage(uint16_t voltage_x100, char* buffer) {
// No default / test values: a field is only ever filled from a CAN frame, and
// its VALID_FLAG_* bit says so. Removed 2026-09-28 - the bench defaults
// (89 / 85 degC, 12.45 V) looked like real readings on Controller B.
// (89 / 85 degC, 12.45 V) looked like real readings on Inst. Cluster.
#endif // _AUTOMOTIVE_DATA_H
+1 -1
View File
@@ -5,7 +5,7 @@
*
* payload = nonce[12] | tag[16] | AES-256-GCM(key, nonce, inner_type | inner)
*
* Both cores ship mbedtls (2.28 on Controller B's IDF 4.4, 3.x on Controller
* Both cores ship mbedtls (2.28 on Inst. Cluster's IDF 4.4, 3.x on Controller
* A's IDF 5.5); the GCM calls are the same, only SHA-256's name differs.
*/