diff --git a/README.md b/README.md index df1799a..c915647 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,10 @@ Current target vehicle: The firmware itself is intended to stay vehicle-agnostic. -## Current Version +## Current Build - 0.5.0 +The controller reports its build version through `GET /api/v1/health` and +`GET /api/v1/status`. Treat that runtime value as authoritative. ## What It Does @@ -18,7 +19,7 @@ The ESP32 controller currently provides: - Local WebUI - HTTP API -- UART JSON protocol +- Optional UART JSON diagnostics protocol - USB serial maintenance commands - Relay control - JBD/Xiaoxiang BLE BMS telemetry @@ -32,11 +33,14 @@ The ESP32 controller currently provides: Current controller: -- ESP32 2-relay board +- LILYGO T-Relay-S3 6-relay board +- Six low-current relay/control outputs driven through the onboard 74HC595 +- DS18B20 OneWire bus on GPIO 15 Primary dashboard target: -- Waveshare ESP32-S3-Touch-LCD-5 +- Waveshare ESP32-S3 Touch LCD 5B +- 1024x600 display - WiFi client to the Cargo ESP32 access point - HTTP API integration @@ -78,7 +82,6 @@ A future Pi Zero may be added for long-term logging or richer local integrations Important docs: -- `docs/project-state.md` - `docs/API.md` - `docs/ARCHITECTURE.md` - `docs/HARDWARE.md` @@ -88,7 +91,7 @@ Important docs: - `docs/SERIAL_COMMANDS.md` - `docs/PARITY_MATRIX.md` - `docs/TEMP_SETUP.md` -- `docs/ROADMAP.md` +- `docs/roadmap.md` - `docs/CHANGELOG.md` ## Safety diff --git a/docs/API.md b/docs/API.md index 48f888d..1754cf5 100644 --- a/docs/API.md +++ b/docs/API.md @@ -16,11 +16,9 @@ Current API base path: All documented endpoints are local-first and must continue to work without internet access. Consumers should ignore unknown response fields for forward compatibility. -Current firmware version: - -```text -0.5.0 -``` +The API returns the running build version in each system, health, and +capabilities response. Do not treat examples in this document as a version +source of truth. ## Current Endpoints @@ -41,6 +39,9 @@ POST /api/v1/config/temp POST /api/v1/config/bms POST /api/v1/config/save POST /api/v1/config/factory-reset +GET /api/v1/config/ap +POST /api/v1/config/ap +POST /api/v1/config/ap/reset GET /api/v1/config/wifi POST /api/v1/config/wifi @@ -55,18 +56,12 @@ POST /api/v1/bms/setup/enter POST /api/v1/bms/setup/exit POST /api/v1/bms/scan POST /api/v1/bms/select + +POST /api/v1/system/ota ``` -Pre-versioned root routes remain registered as compatibility aliases for existing local clients. New clients should use `/api/v1`. - -Legacy GET relay routes remain available only as root compatibility aliases: - -```text -GET /relay/relay_1/on -GET /relay/relay_1/off -GET /relay/relay_2/on -GET /relay/relay_2/off -``` +Only `/api/v1` routes are registered. New clients must use the versioned API +prefix; root-route compatibility aliases are not available. ## Dashboard Contract @@ -91,7 +86,7 @@ Returns a lightweight liveness response for dashboards and service tools. "ok": true, "api_version": "v1", "firmware_name": "overland-controller", - "firmware_version": "0.5.0", + "firmware_version": "", "uptime_seconds": 123, "network": { "ap_enabled": true, @@ -120,14 +115,14 @@ Returns API and feature discovery data for clients. "ok": true, "api_version": "v1", "firmware_name": "overland-controller", - "firmware_version": "0.5.0", + "firmware_version": "", "endpoints": [ "GET /api/v1/status", "POST /api/v1/relay/set" ], "limits": { - "relay_count": 2, - "temperature_sensor_count": 8, + "relay_count": 6, + "temperature_sensor_count": 4, "runtime_temperature_status_count": 4, "wifi_network_count": 3 }, @@ -137,8 +132,8 @@ Returns API and feature discovery data for clients. "wifi_config": true, "config_backup_restore": true, "bms_setup": true, - "uart_json": true, - "root_compatibility_aliases": true + "uart_json": false, + "root_compatibility_aliases": false } } ``` @@ -244,7 +239,8 @@ Fields: | `online` | Current sensor detection state | | `temperature_f` | Current Fahrenheit value, or `null` when offline | -Config supports `temp_1` through `temp_8`. Current `/api/v1/status` runtime output is limited to the configured count capped at four sensors. +Config supports `temp_1` through `temp_4`. `/api/v1/status` returns the +configured runtime sensors, capped at four. ### relays @@ -252,7 +248,7 @@ Config supports `temp_1` through `temp_8`. Current `/api/v1/status` runtime outp { "id": "relay_1", "name": "Aux Power", - "pin": 16, + "hardware_channel": 1, "enabled": true, "state": false } @@ -263,6 +259,10 @@ Valid relay IDs: ```text relay_1 relay_2 +relay_3 +relay_4 +relay_5 +relay_6 ``` Relay names are user configuration. Firmware and clients should use generic IDs for commands. @@ -319,7 +319,7 @@ The AP remains enabled even when STA WiFi is configured or connected. ```json { "firmware_name": "overland-controller", - "firmware_version": "0.5.0", + "firmware_version": "", "build_date": "Jun 7 2026", "build_time": "12:00:00", "uptime_seconds": 123 @@ -394,7 +394,7 @@ Fields: | Field | Required | Description | |---|---:|---| -| `id` | Yes | `relay_1` or `relay_2` | +| `id` | Yes | `relay_1` through `relay_6` | | `name` | No | User display name | | `enabled` | No | Configured enabled state. When set to `false`, the relay output is forced OFF and future relay control requests are rejected with `relay_disabled`. | @@ -418,7 +418,7 @@ Fields: | Field | Required | Description | |---|---:|---| -| `id` | Yes | `temp_1` through `temp_8` | +| `id` | Yes | `temp_1` through `temp_4` | | `name` | No | User display name | | `address` | No | DS18B20 address | | `enabled` | No | Configured enabled state | @@ -472,7 +472,7 @@ Important: export includes saved WiFi passwords so the backup can be restored. T "ok": true, "api_version": "v1", "firmware_name": "overland-controller", - "firmware_version": "0.5.0", + "firmware_version": "", "config": { "device_name": "Overland Controller", "temperature_sensor_count": 4, @@ -541,27 +541,6 @@ Response: } ``` -### Legacy GET relay routes - -These routes remain for compatibility but should not be used by new clients: - -```text -GET /relay/relay_1/on -GET /relay/relay_1/off -GET /relay/relay_2/on -GET /relay/relay_2/off -``` - -Response: - -```json -{ - "ok": true, - "id": "relay_1", - "state": true -} -``` - ## WiFi ### GET /api/v1/config/wifi @@ -836,7 +815,8 @@ Some serial/UART errors use `message` instead of `error`; HTTP clients should re Current stable API prefix is `/api/v1`, for example `GET /api/v1/status`. -Pre-versioned root routes remain registered as local compatibility aliases. Do not add new root-only HTTP API routes. +Pre-versioned root routes are not registered. Do not add new root-only HTTP +API routes. New fields may be added to existing JSON objects. Consumers should ignore unknown fields. diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 3b356af..5da6e62 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -32,8 +32,8 @@ The Cargo ESP32 should not depend on the dashboard, phone, home server, or inter Target hardware: -- Waveshare ESP32-S3-Touch-LCD-5 -- 5 inch 800x480 capacitive touchscreen +- Waveshare ESP32-S3 Touch LCD 5B +- 5 inch 1024x600 capacitive touchscreen - ESP32-S3 - 16MB flash - 8MB PSRAM @@ -101,7 +101,8 @@ Preferred direction: POST /api/v1/config/import POST /api/v1/relay/set -Pre-versioned root routes remain registered as compatibility aliases for existing local clients. +Only `/api/v1` routes are registered; root-route compatibility aliases are not +part of the current API. ## Generic IDs @@ -111,17 +112,14 @@ Relays: relay_1 relay_2 + relay_3 + relay_4 + relay_5 + relay_6 Temperature sensors: - temp_1 - temp_2 - temp_3 - temp_4 - temp_5 - temp_6 - temp_7 - temp_8 + temp_1 through temp_4 Install-specific names belong in saved configuration only. @@ -201,15 +199,9 @@ Active dashboard communication is WiFi/HTTP using `/api/v1`. The old Pico/dashboard UART path is retired from active hardware use. USB Serial remains available for development, debug, and manual configuration from a computer. -Current Cargo ESP32 GPIO plan: - -- GPIO 16: Relay 1 trigger output -- GPIO 17: Relay 2 trigger output -- GPIO 4: DS18B20 OneWire temperature bus -- GPIO 34: Ignition sense input -- GPIO 21: SSD1306 OLED I2C SDA -- GPIO 22: SSD1306 OLED I2C SCL -- GPIO 25: OLED setup/status button +The active LILYGO Cargo profile uses its onboard 74HC595 for relay control. +GPIO4 is the relay output-enable pin and the DS18B20 OneWire bus uses GPIO15. +See `docs/HARDWARE.md` for the complete current pin map. ## Role Boundary Summary @@ -266,7 +258,7 @@ This means future dashboard work should display existing Cargo ESP temperature t ## Cargo ESP API Contract -The Cargo ESP API contract is documented in `docs/cargo-api-contract.md`. +The Cargo ESP API contract is documented in `docs/API.md`. The Cargo ESP32 is the source of truth for: @@ -278,22 +270,12 @@ The Cargo ESP32 is the source of truth for: The ESP32-S3 dashboard should consume Cargo ESP API data over WiFi/HTTP REST instead of directly owning cargo sensors or relay state. -## Cargo ESP Hardware Transition Plan +## Cargo ESP Hardware Profile -Current active development and testing remains on the existing 2-channel relay board. - -A LILYGO T-Relay-S3 6-way board has been ordered as a future Cargo ESP candidate. - -Transition strategy: - -- Keep current 2-channel board working. -- Make the Cargo ESP API output-count agnostic. -- Represent outputs as a list of output objects. -- Let clients render whatever output list the Cargo ESP exposes. -- Add a hardware profile/config layer before migrating firmware to LilyGO. -- Bench test LilyGO relay boot behavior before connecting it to the WUPP block. - -The API should not require redesign when moving from 2 outputs to 6 outputs. +The active Cargo profile is `lilygo_trelay_s3_6ch`: six outputs driven through +the LILYGO T-Relay-S3 onboard 74HC595. Clients must render the output list +returned by the API rather than assuming a fixed relay count. Bench test relay +boot state and CH1–CH6 mapping before connecting vehicle loads. ## Planned WebSocket Push Layer diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.md index d6c42e4..a45a743 100644 --- a/docs/CONFIGURATION.md +++ b/docs/CONFIGURATION.md @@ -46,12 +46,16 @@ Relays use generic firmware IDs: relay_1 relay_2 + relay_3 + relay_4 + relay_5 + relay_6 Each relay has: - id - name -- pin +- hardware channel - enabled Example: @@ -75,14 +79,7 @@ Disabled relays are forced OFF immediately, hidden from normal dashboard control Temperature sensors use generic firmware IDs: - temp_1 - temp_2 - temp_3 - temp_4 - temp_5 - temp_6 - temp_7 - temp_8 + temp_1 through temp_4 Each sensor has: diff --git a/docs/HARDWARE.md b/docs/HARDWARE.md index cbd0997..9d83878 100644 --- a/docs/HARDWARE.md +++ b/docs/HARDWARE.md @@ -24,12 +24,12 @@ Do not directly route fridge, Starlink, inverter, lights, or other major loads t Target: - Waveshare ESP32-S3-Touch-LCD-5 + Waveshare ESP32-S3 Touch LCD 5B Reasons: - ESP32-S3 is mature enough for LVGL dashboard -- 5 inch 800x480 display gives enough UI space +- 5 inch 1024x600 display gives enough UI space - WiFi connects to Cargo ESP32 AP - CAN interface with onboard TJA1051 supports future OBD-II vehicle data - microSD allows future logging @@ -149,15 +149,8 @@ Active dashboard communication is WiFi/HTTP using `/api/v1`. The old Pico/dashboard UART path is retired from active hardware use. USB Serial remains available for development, debug, and manual configuration from a computer. -Current Cargo ESP32 GPIO plan: - -- GPIO 16: Relay 1 trigger output -- GPIO 17: Relay 2 trigger output -- GPIO 4: DS18B20 OneWire temperature bus -- GPIO 34: Ignition sense input -- GPIO 21: SSD1306 OLED I2C SDA -- GPIO 22: SSD1306 OLED I2C SCL -- GPIO 25: OLED setup/status button +Current Cargo ESP32 GPIO plan is defined by the active LILYGO T-Relay-S3 +profile below. Do not use the retired direct-GPIO relay map. ## Automotive Load-Switching Layer @@ -214,13 +207,12 @@ Current expectation: Do not move cargo/fridge temperature sensing to the dashboard controller unless the architecture is explicitly changed later. -## Ordered Cargo ESP Hardware: LILYGO T-Relay-S3 6-Way +## Cargo Controller: LILYGO T-Relay-S3 6-Way -The LILYGO T-Relay-S3 6-way board has been ordered as a future Cargo ESP candidate. +The active Cargo controller is the LILYGO T-Relay-S3 6-way board. Its relay +outputs are low-current control outputs; they do not carry major load current. -Current active testing should continue on the existing 2-channel relay board until the LilyGO board arrives and is bench tested. - -Planned LilyGO role: +Current role: LILYGO T-Relay-S3 6-way -> low-current control/relay outputs @@ -228,17 +220,18 @@ Planned LilyGO role: -> fused load switching Fridge / Starlink / lights / spare / spare / spare -Important guardrails: +Guardrails: -- Do not migrate active firmware assumptions until the board is physically available. - Bench test relay boot behavior before connecting to WUPP or vehicle loads. - Confirm relay polarity/state behavior. - Confirm available GPIO for DS18B20 and any optional OLED/status hardware. - Treat the LilyGO board as the controller, not the high-current load path. -## M9N GPS Module +## Sensor-node GPS and IMU -The dashboard enclosure will include an M9N GPS module connected to the ESP32-S3 dashboard over UART. It will provide GPS fix status, satellite count, position, speed, and UTC time. Future work will use GPS time/location for automatic timezone and DST handling. +The XIAO ESP32-C6 node provides MAX-M10S GPS and BNO086 IMU telemetry to the +dashboard over RS485. The dashboard does not need a second, direct GPS module +for the current architecture. ## XIAO sensor-node RS485 link @@ -252,11 +245,8 @@ The dashboard uses the Waveshare ESP32-S3-Touch-LCD-5B onboard RS485 receiver fo The onboard transceiver handles direction automatically. Configure 115200 baud, 8-N-1, connect A-to-A, B-to-B, and share ground. Keep **USB CDC On Boot** enabled so USB diagnostics do not claim the RS485 UART pins. -### LilyGO T-Relay-S3 6-relay cargo controller - -The cargo ESP now targets the LilyGO T-Relay-S3 6-relay board. - -Relay control is handled through the onboard 74HC595 shift register, not direct ESP32 GPIO relay outputs. +Relay control is handled through the onboard 74HC595 shift register, not direct +ESP32 GPIO relay outputs. | Function | GPIO | | --- | --- | @@ -274,6 +264,7 @@ Relay control is handled through the onboard 74HC595 shift register, not direct | relay_5 | CH5 | SR5 | | relay_6 | CH6 | SR6 | -GPIO4 is reserved for relay output-enable on this board, so the DS18B20 OneWire bus is moved to GPIO14. +GPIO4 is reserved for relay output-enable on this board, so the DS18B20 OneWire +bus uses GPIO15. Avoid GPIO35-GPIO37 on the LilyGO T-Relay-S3 because they are used by Octal SPI flash. diff --git a/docs/PARITY_MATRIX.md b/docs/PARITY_MATRIX.md index 27455c7..2963b64 100644 --- a/docs/PARITY_MATRIX.md +++ b/docs/PARITY_MATRIX.md @@ -1,6 +1,8 @@ # Command Parity Matrix -This document tracks feature parity across the three control surfaces. +This document tracks the intended command model across the three control +surfaces. HTTP and USB serial are active. UART JSON is a compile-time optional +service interface and is disabled in the current Cargo build. Control surfaces: @@ -42,10 +44,14 @@ Relays: relay_1 relay_2 + relay_3 + relay_4 + relay_5 + relay_6 Temperature sensors: - temp_1 through temp_8 + temp_1 through temp_4 Preferred relay command shape: @@ -64,12 +70,7 @@ Preferred HTTP relay endpoint: POST /api/v1/relay/set -Legacy root HTTP relay routes remain for compatibility: - - GET /relay/relay_1/on - GET /relay/relay_1/off - GET /relay/relay_2/on - GET /relay/relay_2/off +Only the versioned HTTP API is registered; root relay routes are not supported. ## Response Shape Standard @@ -88,9 +89,9 @@ Status/config responses should preserve the generic data model used by `/status` # Project Status -API/UART/USB parity status: +API/USB serial parity status: - COMPLETE + ACTIVE Covered: @@ -103,12 +104,8 @@ Covered: Save Config Factory Reset -Future additions must be implemented on: - - USB Serial - UART JSON - HTTP API - -before parity is considered maintained. +Future additions must be implemented on HTTP and USB serial. Implement them on +UART JSON only when that optional interface is enabled for a supported service +workflow. - Temperature sensor config/status parity now includes the `weather` boolean flag for outside-air display selection. diff --git a/docs/README.md b/docs/README.md index 96da645..a275cae 100644 --- a/docs/README.md +++ b/docs/README.md @@ -12,8 +12,6 @@ This folder contains project documentation for Overland Controller. ## Project Tracking -- `CHATGPT_HANDOFF.md` - Concise assistant handoff with current status, goals, constraints, and validation notes -- `project-state.md` - Current project state - `roadmap.md` - Roadmap and future plans - `decisions.md` - Architecture and implementation decisions @@ -30,29 +28,12 @@ Older or duplicate documents have been moved to `archive/`. Archived documents are kept for history, but the primary documents above should be treated as the current source of truth. -## Parity - -- `PARITY_MATRIX.md` - Command parity across USB serial, UART JSON, and HTTP API +## Supporting References +- `PARITY_MATRIX.md` - Command parity across USB serial, optional UART JSON, and HTTP API - `controller-roles.md` - Cargo ESP vs Dashboard ESP32-S3 responsibility boundaries +- `SENSOR_NODE_PROTOCOL.md` - XIAO ESP32-C6 BNO086/MAX-M10S RS485 telemetry contract +- `waveshare-5b-bringup-checklist.md` - Waveshare ESP32-S3 Touch LCD 5B bench checklist -- `../archive/legacy-pico-dashboard/` - Archived Pico dashboard implementation kept for reference only. -- `../firmware/esp32-s3-dashboard/` - Current ESP32-S3 dashboard firmware placeholder. - -- `repo-cleanup-audit.md` - Active repo audit for stale Pico/UART dashboard references and DS18B20 documentation status. -- `API.md` - High-level API notes and telemetry ownership. - -- `cargo-api-contract.md` - Cargo ESP API ownership and expected API areas for WebUI/dashboard clients. - -- `pre-lilygo-baseline-checklist.md` - Checklist for creating a known-good Cargo ESP 2-channel baseline before future LilyGO migration. - -## LilyGO Transition - -The LILYGO T-Relay-S3 6-way board has been ordered as a future Cargo ESP candidate. - -Current development remains on the 2-channel relay board while the API and docs are prepared for output-count-agnostic operation. - -- `api-v1-audit.md` - Audit of legacy API paths vs `/api/v1` namespace. -- `SENSOR_NODE_PROTOCOL.md` - XIAO ESP32-C6 BNO086/MAX-M10S RS485 telemetry contract. - -- `waveshare-5b-bringup-checklist.md` - Bench bring-up checklist for the Waveshare ESP32-S3 Touch LCD 5B dashboard. +The active dashboard firmware lives in `../firmware/esp32-s3-dashboard/`. +The active Cargo hardware profile is the LILYGO T-Relay-S3 6-relay board. diff --git a/docs/SERIAL_COMMANDS.md b/docs/SERIAL_COMMANDS.md index 173d248..56255d1 100644 --- a/docs/SERIAL_COMMANDS.md +++ b/docs/SERIAL_COMMANDS.md @@ -160,7 +160,7 @@ text OK relay renamed Temperature sensor IDs: -text temp_1 temp_2 temp_3 temp_4 temp_5 temp_6 temp_7 temp_8 +text temp_1 temp_2 temp_3 temp_4 --- @@ -449,6 +449,6 @@ Wiring reminder: DS18B20 red -> 3.3V DS18B20 black -> GND - DS18B20 yellow -> GPIO4 + DS18B20 yellow -> GPIO15 -A single 4.7k resistor is required between 3.3V and GPIO4/data. +A single 4.7k resistor is required between 3.3V and GPIO15/data. diff --git a/docs/TEMP_SETUP.md b/docs/TEMP_SETUP.md index 2541d83..efae7d8 100644 --- a/docs/TEMP_SETUP.md +++ b/docs/TEMP_SETUP.md @@ -6,7 +6,7 @@ All DS18B20 sensors share a single 1-Wire bus. ESP32: - GPIO4 = DATA + GPIO15 = DATA 3.3V = VCC GND = GND @@ -20,7 +20,7 @@ Example: | 4.7k | - GPIO4 ----+---------------- Sensor Yellow + GPIO15 ---+---------------- Sensor Yellow GND ----------------------- Sensor Black diff --git a/docs/UART_PROTOCOL.md b/docs/UART_PROTOCOL.md index e9646e1..e5b2c4e 100644 --- a/docs/UART_PROTOCOL.md +++ b/docs/UART_PROTOCOL.md @@ -36,10 +36,14 @@ Relays: relay_1 relay_2 + relay_3 + relay_4 + relay_5 + relay_6 Temperature sensors: - temp_1 through temp_8 + temp_1 through temp_4 ## Status Request @@ -282,12 +286,5 @@ Active dashboard communication is WiFi/HTTP using `/api/v1`. The old Pico/dashboard UART path is retired from active hardware use. USB Serial remains available for development, debug, and manual configuration from a computer. -Current Cargo ESP32 GPIO plan: - -- GPIO 16: Relay 1 trigger output -- GPIO 17: Relay 2 trigger output -- GPIO 4: DS18B20 OneWire temperature bus -- GPIO 34: Ignition sense input -- GPIO 21: SSD1306 OLED I2C SDA -- GPIO 22: SSD1306 OLED I2C SCL -- GPIO 25: OLED setup/status button +The active Cargo profile is `lilygo_trelay_s3_6ch`: relay control uses the +onboard 74HC595, GPIO4 is relay output-enable, and DS18B20 OneWire uses GPIO15. diff --git a/docs/api-v1-audit.md b/docs/archive/api-v1-audit-2026-06.md similarity index 100% rename from docs/api-v1-audit.md rename to docs/archive/api-v1-audit-2026-06.md diff --git a/docs/cargo-api-contract.md b/docs/archive/cargo-api-contract-pre-lilygo.md similarity index 100% rename from docs/cargo-api-contract.md rename to docs/archive/cargo-api-contract-pre-lilygo.md diff --git a/docs/CHATGPT_HANDOFF.md b/docs/archive/chatgpt-handoff-2026-06.md similarity index 100% rename from docs/CHATGPT_HANDOFF.md rename to docs/archive/chatgpt-handoff-2026-06.md diff --git a/docs/gps-m9n.md b/docs/archive/gps-m9n-direct-dashboard-plan.md similarity index 100% rename from docs/gps-m9n.md rename to docs/archive/gps-m9n-direct-dashboard-plan.md diff --git a/docs/pre-lilygo-baseline-checklist.md b/docs/archive/pre-lilygo-baseline-checklist.md similarity index 100% rename from docs/pre-lilygo-baseline-checklist.md rename to docs/archive/pre-lilygo-baseline-checklist.md diff --git a/docs/project-state.md b/docs/archive/project-state-2026-06.md similarity index 100% rename from docs/project-state.md rename to docs/archive/project-state-2026-06.md diff --git a/docs/repo-cleanup-audit.md b/docs/archive/repo-cleanup-audit-2026-06.md similarity index 100% rename from docs/repo-cleanup-audit.md rename to docs/archive/repo-cleanup-audit-2026-06.md diff --git a/docs/dashboard-esp32s3.md b/docs/dashboard-esp32s3.md index f738d01..fa0f187 100644 --- a/docs/dashboard-esp32s3.md +++ b/docs/dashboard-esp32s3.md @@ -18,7 +18,7 @@ Cargo ESP32 Controller Waveshare ESP32-S3 Dashboard - Connects to cargo ESP32 AP -- Polls /status +- Polls `/api/v1/status` - Renders LVGL dashboard - Sends relay commands over HTTP @@ -165,15 +165,9 @@ Active dashboard communication is WiFi/HTTP using `/api/v1`. The old Pico/dashboard UART path is retired from active hardware use. USB Serial remains available for development, debug, and manual configuration from a computer. -Current Cargo ESP32 GPIO plan: - -- GPIO 16: Relay 1 trigger output -- GPIO 17: Relay 2 trigger output -- GPIO 4: DS18B20 OneWire temperature bus -- GPIO 34: Ignition sense input -- GPIO 21: SSD1306 OLED I2C SDA -- GPIO 22: SSD1306 OLED I2C SCL -- GPIO 25: OLED setup/status button +The dashboard does not use the Cargo controller's relay or OneWire GPIO. The +active Cargo profile is `lilygo_trelay_s3_6ch`; see `docs/HARDWARE.md` for its +current pin map. ## Not Dashboard Responsibilities @@ -195,7 +189,8 @@ DS18B20 sensors are already implemented on the Cargo ESP/WebUI/API side. For v1, ## API Dependency -The ESP32-S3 dashboard depends on the Cargo ESP API contract documented in `docs/cargo-api-contract.md`. +The ESP32-S3 dashboard depends on the Cargo ESP API contract documented in +`docs/API.md`. For v1, the dashboard should consume: @@ -243,14 +238,12 @@ Implemented: - WiFi signal strength display - Cargo ESP connectivity indicator -Planned next work: +Next work: - Temperature card redesign -- Swipe/page navigation -- Battery detail page - Vehicle data page -- CAN/OBD-II integration -- BNO085/BNO086 tilt visualization +- Validate coolant data from passive CAN captures +- BNO086/MAX-M10S off-road visualization ### Temperature Sensor Grouping @@ -295,9 +288,11 @@ Each temperature sensor supports optional high-temperature alerting: When enabled and the live sensor temperature exceeds the configured threshold, the Cargo ESP includes `high_alert: true` for that sensor in `/api/v1/status`. The ESP32-S3 dashboard colors the affected grouped temperature tile red if any sensor in that displayed group is in alert. -## M9N GPS Module +## Sensor-node GPS and IMU -The dashboard enclosure will include an M9N GPS module connected to the ESP32-S3 dashboard over UART. It will provide GPS fix status, satellite count, position, speed, and UTC time. Future work will use GPS time/location for automatic timezone and DST handling. +The dashboard already receives MAX-M10S GPS and BNO086 IMU telemetry from the +XIAO ESP32-C6 over RS485. A dedicated vehicle/off-road page is the remaining +product work. ### Hidden Dashboard Diagnostics diff --git a/docs/decisions.md b/docs/decisions.md index 7e751f8..0d84b77 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -70,15 +70,12 @@ Firmware uses generic identifiers: relay_1 relay_2 + relay_3 + relay_4 + relay_5 + relay_6 - temp_1 - temp_2 - temp_3 - temp_4 - temp_5 - temp_6 - temp_7 - temp_8 + temp_1 through temp_4 Reason: diff --git a/docs/roadmap.md b/docs/roadmap.md index 7952395..73d1809 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -1,6 +1,6 @@ # Roadmap -## Phase 1: Solid Local Cargo Controller +## Phase 1: Solid Local Cargo Controller β€” established - Reliable relay control - Reliable DS18B20 temps @@ -10,14 +10,12 @@ - Stable HTTP API - Clear status/config/control model -## Phase 2: Waveshare ESP32-S3 Dashboard +## Phase 2: Waveshare ESP32-S3 Dashboard β€” in progress -- LVGL project scaffold -- WiFi client to Cargo ESP32 AP -- Poll /status -- Display battery, relays, temps, and alarms -- Send relay commands -- Handle offline/stale/failed-command states +- LVGL dashboard, WiFi client, HTTP status polling, relay commands, and stale + state handling are implemented. +- Continue dashboard UX and vehicle-data integration without moving Cargo + control authority. UI direction: @@ -28,13 +26,11 @@ UI direction: - Smooth subtle animations - No stock LVGL demo look -## Phase 3: Vehicle Data +## Phase 3: Vehicle Data β€” in progress -- Connect Waveshare CAN to OBD-II CAN-H/CAN-L -- Keep CAN termination disabled -- Read coolant temp via PID 0105 -- Read RPM via PID 010C -- Read vehicle speed via PID 010D +- Passive CAN capture and coolant PID diagnostics are implemented on the + dashboard; keep CAN termination disabled. +- Validate coolant data before adding RPM, speed, or any active OBD polling. ## Phase 4: Transmission Temperature @@ -136,22 +132,16 @@ Active dashboard communication is WiFi/HTTP using `/api/v1`. The old Pico/dashboard UART path is retired from active hardware use. USB Serial remains available for development, debug, and manual configuration from a computer. -Current Cargo ESP32 GPIO plan: - -- GPIO 16: Relay 1 trigger output -- GPIO 17: Relay 2 trigger output -- GPIO 4: DS18B20 OneWire temperature bus -- GPIO 34: Ignition sense input -- GPIO 21: SSD1306 OLED I2C SDA -- GPIO 22: SSD1306 OLED I2C SCL -- GPIO 25: OLED setup/status button +The active Cargo profile is `lilygo_trelay_s3_6ch`. Relays are driven by the +onboard 74HC595; GPIO4 is relay output-enable and DS18B20 OneWire uses GPIO15. +See `docs/HARDWARE.md` for the full pin map. ## Future Wishlist Parking Lot These are intentionally not committed v1 architecture until explicitly promoted: -- BNO085/BNO086 tilt sensor -- CAN sniffing beyond standard OBD-II polling +- Dedicated off-road visualization for the existing BNO086/MAX-M10S RS485 node +- CAN signal identification beyond the current passive capture and coolant work - Fault-code support - Standalone dashboard mode - Additional cargo outputs @@ -183,15 +173,15 @@ Next Dashboard Milestones: - Temperature card redesign - Swipe navigation -- Battery detail page - Vehicle page -- OBD-II integration -- CAN integration -- BNO085/BNO086 off-road attitude display +- Validate coolant data from captured vehicle traffic +- BNO086/MAX-M10S off-road attitude display -## M9N GPS Module +## Sensor-node GPS and IMU -The dashboard enclosure will include an M9N GPS module connected to the ESP32-S3 dashboard over UART. It will provide GPS fix status, satellite count, position, speed, and UTC time. Future work will use GPS time/location for automatic timezone and DST handling. +The XIAO ESP32-C6 sensor node already provides MAX-M10S GPS and BNO086 IMU +telemetry to the dashboard over RS485. Future work is a dedicated vehicle/off-road +presentation, not a second dashboard-local GPS design. ## Planned: WebSocket live dashboard updates @@ -220,6 +210,6 @@ Rationale: - [x] Expand cargo relay model from 2 outputs to 6 outputs. - [x] Replace direct GPIO relay writes with LilyGO 74HC595 shift-register writes. - [x] Map relay_1 through relay_6 to CH1 through CH6. -- [x] Move DS18B20 OneWire default from GPIO4 to GPIO14 because GPIO4 is relay nOE. +- [x] Move DS18B20 OneWire from GPIO4 to GPIO15 because GPIO4 is relay nOE. - [ ] Bench test relay boot behavior with no vehicle loads connected. - [ ] Confirm CH1-CH6 order with a meter or test lamp before wiring vehicle loads. diff --git a/firmware/esp32-s3-dashboard/README.md b/firmware/esp32-s3-dashboard/README.md index 075d740..10b0c70 100644 --- a/firmware/esp32-s3-dashboard/README.md +++ b/firmware/esp32-s3-dashboard/README.md @@ -11,18 +11,14 @@ Target Hardware: Current Status: -- Basic dashboard bring-up sketch created +- Functional LVGL dashboard with WiFi/API integration, relay controls, battery + detail navigation, passive CAN diagnostics, and XIAO RS485 telemetry reception -Upcoming milestones: +Next milestones: -1. Serial bring-up -2. Display bring-up -3. Touch validation -4. WiFi connection -5. Cargo ESP API integration -6. LVGL dashboard -7. CAN integration -8. Vehicle telemetry +1. Vehicle/off-road dashboard page +2. Validate coolant data from passive CAN captures +3. Present XIAO GPS/IMU telemetry outside the diagnostics overlay Cargo ESP API Base: @@ -48,10 +44,10 @@ Current screen shows: - Waveshare ESP32-S3 Touch LCD 5B hardware target - 1024x600 display note - `/api/v1` Cargo API base -- WiFi placeholder +- WiFi and Cargo API connection state - Touch test button -This is intentionally not connected to WiFi or the Cargo ESP yet. +The screen is shown while the dashboard connects to the Cargo ESP API. ## Firmware Structure diff --git a/firmware/esp32/overland-controller/overland-controller.ino b/firmware/esp32/overland-controller/overland-controller.ino index 5da1c61..b71ef55 100644 --- a/firmware/esp32/overland-controller/overland-controller.ino +++ b/firmware/esp32/overland-controller/overland-controller.ino @@ -3616,8 +3616,8 @@ void handleCapabilities() { features["wifi_config"] = true; features["config_backup_restore"] = true; features["bms_setup"] = true; - features["uart_json"] = true; - features["root_compatibility_aliases"] = true; + features["uart_json"] = DASHBOARD_UART_ENABLED == 1; + features["root_compatibility_aliases"] = false; String output; serializeJson(doc, output); diff --git a/hardware/bom.md b/hardware/bom.md index 91fdd6c..805a085 100644 --- a/hardware/bom.md +++ b/hardware/bom.md @@ -1,19 +1,28 @@ # Hardware BOM -## Ordered +## Active Controller -- ESP32 2-Channel Relay Board +- LILYGO T-Relay-S3 6-relay board +- External fused automotive relays/contactors or a suitable fused distribution layer for major loads ## Required - 4x DS18B20 Waterproof Sensors -- Waveshare ESP32-S3-Touch-LCD-5 dashboard +- Waveshare ESP32-S3 Touch LCD 5B dashboard - Fused ACC switched 12V dashboard power -- Bosch Relay Sockets -- 30A/40A Bosch Relays - Automotive Fuse Block - Assorted ATC Fuses +## Load Switching Pending Selection + +The Cargo controller drives low-current control outputs only. Select and bench +test one fused load-switching implementation before purchasing a final install +BOM: + +- Bosch relay sockets with 30A/40A relays +- WUPP-style fused relay/distribution module +- Suitable smart high-side switching + ## Future / Optional Fallback - Pi Zero for long-term logging and local integrations diff --git a/tests/test_documentation_consistency.py b/tests/test_documentation_consistency.py new file mode 100644 index 0000000..f2dc50d --- /dev/null +++ b/tests/test_documentation_consistency.py @@ -0,0 +1,43 @@ +from pathlib import Path + + +ROOT = Path(__file__).resolve().parents[1] +APP_CONFIG = ROOT / "firmware" / "esp32" / "overland-controller" / "app_config.h" +CONFIG = ROOT / "firmware" / "esp32" / "overland-controller" / "config.h" +FIRMWARE = ROOT / "firmware" / "esp32" / "overland-controller" / "overland-controller.ino" + + +def test_primary_docs_match_active_hardware_profile(): + app_config = APP_CONFIG.read_text() + config = CONFIG.read_text() + readme = (ROOT / "README.md").read_text() + hardware = (ROOT / "docs" / "HARDWARE.md").read_text() + architecture = (ROOT / "docs" / "ARCHITECTURE.md").read_text() + + assert '#define MAX_RELAYS 6' in app_config + assert '#define HARDWARE_PROFILE "lilygo_trelay_s3_6ch"' in app_config + assert '#define ONEWIRE_PIN 15' in config + + for document in (readme, hardware, architecture): + assert "LILYGO T-Relay-S3" in document + + assert "1024x600" in hardware + assert "GPIO15" in hardware + assert "800x480" not in hardware + assert "GPIO 16: Relay" not in hardware + assert "GPIO 4: DS18B20" not in hardware + + +def test_api_docs_match_versioned_route_contract(): + api = (ROOT / "docs" / "API.md").read_text() + parity = (ROOT / "docs" / "PARITY_MATRIX.md").read_text() + firmware = FIRMWARE.read_text() + + assert 'features["root_compatibility_aliases"] = false;' in firmware + assert 'features["uart_json"] = DASHBOARD_UART_ENABLED == 1;' in firmware + assert '"relay_count": 6' in api + assert '"temperature_sensor_count": 4' in api + assert '"root_compatibility_aliases": false' in api + assert '"uart_json": false' in api + assert "Legacy GET relay routes" not in api + assert "Legacy root HTTP relay routes" not in parity