OTA updates for Controller A: dual-slot partitions, signed Gitea releases
- partition table: two 7.9 MB OTA slots, SPIFFS dropped, nvs/otadata offsets unchanged (tunables survived the one-time USB flash) - ota_update.cpp: manual `ota status|check|install|rollback` console; HTTPS pull from the public repo's latest release, ECDSA P-256 signature over "patrol-a|version|sha256" checked before download, streamed image must match, parked gate before download and before the slot switch, 30 s confirm-or-rollback (verifyRollbackLater override) - ota_config.h: server/repo, ISRG Root X1 + Root YR, signing public key - .gitea/workflows/firmware.yml: main -> rolling unsigned pre-release main-latest; v* tag -> signed release (needs secret FIRMWARE_SIGNING_KEY) - wiki: pages/ota-updates.md (design, decisions, B-over-ESP-NOW plan); CLAUDE.md, index, log, open-questions #12 updated Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -80,6 +80,7 @@ src/
|
||||
espnow_link.cpp # ESP-NOW broadcast leg of the link
|
||||
tuning_screen.cpp # Hand-coded LVGL Gauge Tuning screen (swipe right from Driveline)
|
||||
diag_probe.cpp # On-demand OBD-II requests ('diag' console) - the ONLY CAN transmitter
|
||||
ota_update.cpp # Manual firmware updates from Gitea releases ('ota' console)
|
||||
settings_manager.cpp # NVS persistent storage
|
||||
ui_state_manager.cpp # UI synchronization logic
|
||||
display_init.cpp # Display initialization; boots into DrivelineScreen
|
||||
@@ -228,6 +229,10 @@ Settings persist across power cycles via ESP32 NVS (Non-Volatile Storage):
|
||||
|
||||
`src/modules/diag_probe.cpp` is the only code allowed to call `CANDriver::transmit()`. It sends single diagnostic requests and reassembles the ISO-TP replies, on two routes: generic OBD-II on `0x7DF` (replies `0x7E8..0x7EF`) and BMW-addressed KWP2000 on `0x6F1` with target byte (replies `0x600`+addr, extended addressing). Commands: `diag pids` (supported-PID bitmap scan), `diag pid <hex>`, `diag dtc` (mode 03), `diag vin`, `diag ecu`, `diag ident [addr]` (KWP `1A 80`), `diag bmw <addr> <hex...>` (raw, whitelisted), `diag raw on|off` (CANRAW mute for scans), `diag status`. One request in flight, single-shot frames, refused for 3 s after any foreign tester frame (`0x7DF`, `0x7E0-7`, `0x6F1`); read-only services only — generic 01/03/09, BMW `1A`/`18`/`21`/`22` (whitelist enforced in `sendBmwRequest()`), never session control or writes. Transmitted frames are echoed as `CANTX,` lines in the same format as `CANRAW,`. Console lines that `cfg` does not recognise are passed to it via `Tunables::setExtraCommandHandler()`. Background and test procedure: `wiki/pages/obd-diagnostic-polling.md`.
|
||||
|
||||
### OTA updates (`ota` console)
|
||||
|
||||
`src/modules/ota_update.cpp` pulls signed firmware from this repo's Gitea releases (`include/config/ota_config.h`: server, repo, Let's Encrypt roots, signing public key). Manual only: `ota status | check | install [force] | rollback` - the future password-gated Diagnostics screen will call the same code. Install is refused unless parked (engine off, shaft still, lever not in a drive gear; silent bus = parked), checked before download and again before the slot switch. The manifest's ECDSA P-256 signature over `patrol-a|version|sha256` is checked before download; the streamed image must match that sha256. `verifyRollbackLater()` is overridden so a new image stays pending until `Ota::tick()` confirms it after 30 s - a reset before that rolls back. CI: `.gitea/workflows/firmware.yml` (push `main` -> rolling unsigned pre-release `main-latest`; tag `v*` -> signed release, needs repo secret `FIRMWARE_SIGNING_KEY`). Never put secrets in firmware source - the repo and its release binaries are public. Details: `wiki/pages/ota-updates.md`.
|
||||
|
||||
### ESP-NOW link
|
||||
|
||||
`src/modules/espnow_link.cpp` broadcasts every frame on Wi-Fi channel `ESPNOW_CHANNEL` (1). The radio stays in STA mode permanently — `WiFiManager`'s "off" only stops scanning/association (it no longer calls `WiFi.mode(WIFI_OFF)`). If Wi-Fi joins an AP the channel follows the AP; B hops to find it.
|
||||
@@ -255,7 +260,7 @@ Settings persist across power cycles via ESP32 NVS (Non-Volatile Storage):
|
||||
- Custom Arduino core: `pioarduino/platform-espressif32` (Arduino 3.3.3 / ESP-IDF 5.5.1) for RGB LCD support
|
||||
- Board: Custom `esp32-s3-wroom-1-n16r8` (defined in `boards/esp32-s3-wroom-1-n16r8.json`)
|
||||
- PSRAM: OPI mode (`qio_opi` memory type) - REQUIRED for 8MB OPI PSRAM and 1024x600 display
|
||||
- Partition: `partition_table.csv` (12.5MB app / 3.375MB SPIFFS) - optimized for 16MB flash
|
||||
- Partition: `partition_table.csv` (dual OTA: 2 x 7.9MB app slots, no SPIFFS) - see OTA updates below
|
||||
- Debug level: `CORE_DEBUG_LEVEL=1` (1=Error, 5=Verbose)
|
||||
- Libraries: ESP32_Display_Panel v1.0.4, LVGL 8.4.0 (from GitHub)
|
||||
|
||||
@@ -267,11 +272,11 @@ Settings persist across power cycles via ESP32 NVS (Non-Volatile Storage):
|
||||
- Critical settings: `memory_type: qio_opi`, `psram_type: opi`
|
||||
|
||||
**partition_table.csv** (Partition Table)
|
||||
- NVS: 20KB @ 0x9000 (settings storage)
|
||||
- OTA Data: 8KB @ 0xe000 (for future OTA support)
|
||||
- App: 12.5MB @ 0x10000 (large partition for UI assets)
|
||||
- SPIFFS: 3.375MB @ 0xC90000 (file system)
|
||||
- NVS: 20KB @ 0x9000 (settings storage) - never move it, or saved settings/tunables are lost
|
||||
- OTA Data: 8KB @ 0xe000 (which slot boots)
|
||||
- app0 / app1: 7.9MB each @ 0x10000 / 0x800000 (OTA slots; firmware ~1.65MB)
|
||||
- Coredump: 64KB @ 0xFF0000 (crash debugging)
|
||||
- Changing this table needs one USB flash; OTA can't repartition
|
||||
|
||||
**include/lv_conf.h**
|
||||
- LVGL 8.4.0 configuration
|
||||
|
||||
Reference in New Issue
Block a user