Rename -> Inst. Cluster (user); power manager: deep sleep on link silence, wake on IO1 or 60 s probe boot; Ota::isBusy; sleep bit in shared header
Firmware / build (push) Successful in 2m59s
Firmware / build (push) Successful in 2m59s
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
|
||||
/* Memory settings */
|
||||
#define LV_MEM_CUSTOM 0 // Use LVGL's built-in memory manager
|
||||
/* 128 KB pool in PSRAM (2026-09-27, as on Controller A): the old 64 KB pool sat
|
||||
/* 128 KB pool in PSRAM (2026-09-27, as on Main CTRL): the old 64 KB pool sat
|
||||
* in the scarce internal RAM. Draw buffers stay internal (SPI DMA). */
|
||||
#define LV_MEM_SIZE (128 * 1024U)
|
||||
#define LV_MEM_ADR 0
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* ota_config.h - where Controller B looks for firmware updates, and what it trusts.
|
||||
* ota_config.h - where Inst. Cluster looks for firmware updates, and what it trusts.
|
||||
*
|
||||
* Same scheme as Controller A (ESP32-S3-Touch-LCD-5B/include/config/ota_config.h):
|
||||
* Same scheme as Main CTRL (ESP32-S3-Touch-LCD-5B/include/config/ota_config.h):
|
||||
* releases of THIS repo on Gitea, manifest signed with the shared project key,
|
||||
* target string "patrol-b" so an A image is never accepted here.
|
||||
* See wiki/pages/controller-b-ota.md.
|
||||
@@ -95,7 +95,7 @@ static const char OTA_CA_PEM[] =
|
||||
"sI1ANRYvqSFC2X1VRZfDg+wD6E21BccmifG4yWc=\n"
|
||||
"-----END CERTIFICATE-----\n";
|
||||
|
||||
// Firmware signing public key (ECDSA P-256), same key as Controller A.
|
||||
// Firmware signing public key (ECDSA P-256), same key as Main CTRL.
|
||||
static const char OTA_SIGNING_PUBKEY_PEM[] =
|
||||
"-----BEGIN PUBLIC KEY-----\n"
|
||||
"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE496tys+NeIrdDLNaGHLzr6L4oGmF\n"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Serial console (Controller B) - line reader + command chain.
|
||||
* Serial console (Inst. Cluster) - line reader + command chain.
|
||||
*
|
||||
* Commands live in their modules (LinkPeer, Ota); this only splits lines and
|
||||
* asks each handler in turn. `help` lists them.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Debug Monitor Module for ESP32-S3-LCD-1.3 (Controller B)
|
||||
* Debug Monitor Module for ESP32-S3-LCD-1.3 (Inst. Cluster)
|
||||
*
|
||||
* Synchronizes LVGL performance and memory monitor visibility with Controller A.
|
||||
* Synchronizes LVGL performance and memory monitor visibility with Main CTRL.
|
||||
* Monitors are shown/hidden based on the debug_enabled flag received via UART.
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,7 @@ void init();
|
||||
* @brief Set debug monitor visibility
|
||||
*
|
||||
* Controls the visibility of LVGL's built-in performance and memory monitors.
|
||||
* This should be called when receiving packets from Controller A to sync
|
||||
* This should be called when receiving packets from Main CTRL to sync
|
||||
* with the debug_enabled flag.
|
||||
*
|
||||
* @param enabled True to show monitors, false to hide them
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* ESP-NOW Receiver Module (Controller B)
|
||||
* ESP-NOW Receiver Module (Inst. Cluster)
|
||||
*
|
||||
* Wireless leg of the A -> B link. Frames are byte-identical to the UART ones
|
||||
* and are handed to UARTReceiver::processFrame(), which dedupes on packet_id.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Gauge Outputs Module (Controller B)
|
||||
* Gauge Outputs Module (Inst. Cluster)
|
||||
*
|
||||
* Drives the Nissan Patrol cluster from the data Controller A sends:
|
||||
* Drives the Nissan Patrol cluster from the data Main CTRL sends:
|
||||
* - tachometer: variable-frequency square wave on IO7 (LEDC timer 1)
|
||||
* - coolant gauge: fixed-frequency PWM with variable duty on IO8 (LEDC timer 2)
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Link Peer Module (Controller B) - the maintenance side of the link to A.
|
||||
* Link Peer Module (Inst. Cluster) - the maintenance side of the link to A.
|
||||
*
|
||||
* The data path (DATA/CONFIG frames) is UARTReceiver's. This module owns
|
||||
* everything else on the link, see wiki/pages/controller-b-ota.md:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* ota_update.h - Controller B pulls its own firmware from this repo's Gitea
|
||||
* releases. Port of Controller A's module (ESP32-S3-Touch-LCD-5B/src/modules/
|
||||
* ota_update.h - Inst. Cluster pulls its own firmware from this repo's Gitea
|
||||
* releases. Port of Main CTRL's module (ESP32-S3-Touch-LCD-5B/src/modules/
|
||||
* ota_update.cpp), see wiki/pages/controller-b-ota.md.
|
||||
*
|
||||
* Triggered by A (OTA_CMD inside a SECURE frame, behind A's parking gate and
|
||||
@@ -45,6 +45,9 @@ bool handleCommand(const char* line);
|
||||
|
||||
const char* version();
|
||||
|
||||
/** A check or install is queued or running (the power manager must not sleep). */
|
||||
bool isBusy();
|
||||
|
||||
} // namespace Ota
|
||||
|
||||
#endif // OTA_UPDATE_H
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Power Manager (Inst. Cluster) - deep sleep when the Main CTRL goes quiet.
|
||||
*
|
||||
* Controlled from the Main CTRL's Settings switch "Sleep when the car is off":
|
||||
* it arrives as the CFG_SLEEP_WHEN_SILENT bit of the CONFIG frame and is
|
||||
* cached in NVS with the rest of the gauge config, so it is known even while
|
||||
* the Main CTRL is already asleep.
|
||||
*
|
||||
* Sleep when: the bit is set, no DATA frame on any transport for
|
||||
* SLEEP_AFTER_MS, no update job running, up for at least SLEEP_AFTER_MS.
|
||||
* Gauges are driven low and the backlight off first.
|
||||
*
|
||||
* Wake:
|
||||
* - UART RX (IO1, RTC IO) goes low: the Main CTRL's first frame on the wire
|
||||
* - a timer every PROBE_PERIOD_S: a short "probe boot" with the backlight
|
||||
* off that listens for ESP-NOW frames for a few seconds and goes straight
|
||||
* back to sleep if nothing arrives. This is what wakes the board when the
|
||||
* link is radio-only (no wire in the car).
|
||||
*
|
||||
* Console: sleep status | now
|
||||
*/
|
||||
|
||||
#ifndef POWER_MANAGER_H
|
||||
#define POWER_MANAGER_H
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
namespace PowerManager {
|
||||
|
||||
/** Right after DisplayInit::init(): detects a probe boot and keeps the panel dark. */
|
||||
void init();
|
||||
|
||||
/** True during a timer-wake probe boot (setup() skips its waits). */
|
||||
bool isProbeBoot();
|
||||
|
||||
void tick();
|
||||
bool handleCommand(const char* line);
|
||||
|
||||
} // namespace PowerManager
|
||||
|
||||
#endif // POWER_MANAGER_H
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Link Receiver Module (Controller B)
|
||||
* Link Receiver Module (Inst. Cluster)
|
||||
*
|
||||
* Receives v2 frames from Controller A on two transports:
|
||||
* Receives v2 frames from Main CTRL on two transports:
|
||||
* - UART1 (byte stream, framed here with a state machine)
|
||||
* - ESP-NOW (whole frames, delivered by EspNowReceiver)
|
||||
* Both feed processFrame(). DATA frames are deduplicated on packet_id so a frame
|
||||
|
||||
@@ -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
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user