docs: align active hardware and API guidance
This commit is contained in:
1 parent
ab5424d82e
commit
6b39e7e438
24 files changed
+219
-261
No files matched your search
@@ -0,0 +1,49 @@
|
||||
# API v1 Audit
|
||||
|
||||
Generated: 2026-06-09
|
||||
|
||||
This audit checks for legacy `/api/...` references that should use `/api/v1/...`.
|
||||
|
||||
Valid `/api/v1/...` references are intentionally ignored.
|
||||
|
||||
## Potential Legacy References
|
||||
|
||||
| File | Line | Matched legacy path | Content |
|
||||
|------|------|---------------------|---------|
|
||||
| `tests/test_http_api_contract.py` | 31 | `/api/v1{match.group` | (f"/api/v1{match.group(1)}", match.group(2) or "ANY") |
|
||||
| `tests/test_http_api_contract.py` | 82 | `/api/v1` | assert 'const API_BASE="/api/v1";' in source |
|
||||
| `docs/project-state.md` | 192 | `/api/v1` | Active dashboard communication is WiFi/HTTP using `/api/v1`. |
|
||||
| `docs/HARDWARE.md` | 148 | `/api/v1` | Active dashboard communication is WiFi/HTTP using `/api/v1`. |
|
||||
| `docs/ARCHITECTURE.md` | 200 | `/api/v1` | Active dashboard communication is WiFi/HTTP using `/api/v1`. |
|
||||
| `docs/API.md` | 14 | `/api/v1` | /api/v1 |
|
||||
| `docs/API.md` | 60 | `/api/v1` | Pre-versioned root routes remain registered as compatibility aliases for existing local clients. New clients should use `/api/v1`. |
|
||||
| `docs/API.md` | 837 | `/api/v1` | Current stable API prefix is `/api/v1`, for example `GET /api/v1/status`. |
|
||||
| `docs/CHATGPT_HANDOFF.md` | 49 | `/api/v1` | - HTTP API base path is `/api/v1`. |
|
||||
| `docs/CHATGPT_HANDOFF.md` | 67 | `/api/v1` | New clients should use `/api/v1`. |
|
||||
| `docs/CHATGPT_HANDOFF.md` | 98 | `/api/v1` | - The project recently standardized current HTTP routes under `/api/v1`. |
|
||||
| `docs/CHATGPT_HANDOFF.md` | 100 | `/api/v1` | - The embedded WebUI uses `const API_BASE="/api/v1";`. |
|
||||
| `docs/CHATGPT_HANDOFF.md` | 136 | `/api/v1` | Active dashboard communication is WiFi/HTTP using `/api/v1`. |
|
||||
| `docs/api-v1-audit.md` | 5 | `/api/...` | This audit checks for legacy `/api/...` references that should likely use `/api/v1/...`. |
|
||||
| `docs/api-v1-audit.md` | 11 | `/api/v1{match.group` | \| `tests/test_http_api_contract.py` \| 31 \| (f"/api/v1{match.group(1)}", match.group(2) or "ANY") \| |
|
||||
| `docs/api-v1-audit.md` | 12 | `/api/v1` | \| `tests/test_http_api_contract.py` \| 82 \| assert 'const API_BASE="/api/v1";' in source \| |
|
||||
| `docs/api-v1-audit.md` | 13 | `/api/v1` | \| `docs/project-state.md` \| 192 \| Active dashboard communication is WiFi/HTTP using `/api/v1`. \| |
|
||||
| `docs/api-v1-audit.md` | 14 | `/api/v1` | \| `docs/HARDWARE.md` \| 148 \| Active dashboard communication is WiFi/HTTP using `/api/v1`. \| |
|
||||
| `docs/api-v1-audit.md` | 15 | `/api/v1` | \| `docs/ARCHITECTURE.md` \| 200 \| Active dashboard communication is WiFi/HTTP using `/api/v1`. \| |
|
||||
| `docs/api-v1-audit.md` | 16 | `/api/v1` | \| `docs/API.md` \| 14 \| /api/v1 \| |
|
||||
| `docs/api-v1-audit.md` | 17 | `/api/v1` | \| `docs/API.md` \| 60 \| Pre-versioned root routes remain registered as compatibility aliases for existing local clients. New clients should use `/api/v1`. \| |
|
||||
| `docs/api-v1-audit.md` | 18 | `/api/v1` | \| `docs/CHATGPT_HANDOFF.md` \| 49 \| - HTTP API base path is `/api/v1`. \| |
|
||||
| `docs/api-v1-audit.md` | 19 | `/api/v1` | \| `docs/CHATGPT_HANDOFF.md` \| 67 \| New clients should use `/api/v1`. \| |
|
||||
| `docs/api-v1-audit.md` | 20 | `/api/v1` | \| `docs/CHATGPT_HANDOFF.md` \| 98 \| - The project recently standardized current HTTP routes under `/api/v1`. \| |
|
||||
| `docs/api-v1-audit.md` | 21 | `/api/v1` | \| `docs/CHATGPT_HANDOFF.md` \| 100 \| - The embedded WebUI uses `const API_BASE="/api/v1";`. \| |
|
||||
| `docs/api-v1-audit.md` | 22 | `/api/v1` | \| `docs/CHATGPT_HANDOFF.md` \| 136 \| Active dashboard communication is WiFi/HTTP using `/api/v1`. \| |
|
||||
| `docs/api-v1-audit.md` | 23 | `/api/v1` | \| `docs/dashboard-esp32s3.md` \| 161 \| Active dashboard communication is WiFi/HTTP using `/api/v1`. \| |
|
||||
| `docs/api-v1-audit.md` | 24 | `/api/v1` | \| `docs/roadmap.md` \| 135 \| Active dashboard communication is WiFi/HTTP using `/api/v1`. \| |
|
||||
| `docs/api-v1-audit.md` | 25 | `/api/v1` | \| `docs/UART_PROTOCOL.md` \| 281 \| Active dashboard communication is WiFi/HTTP using `/api/v1`. \| |
|
||||
| `docs/api-v1-audit.md` | 26 | `/api/v1` | \| `firmware/esp32/overland-controller/overland-controller.ino` \| 664 \| const API_BASE="/api/v1"; \| |
|
||||
| `docs/api-v1-audit.md` | 27 | `/api/v1` | \| `firmware/esp32/overland-controller/overland-controller.ino` \| 1342 \| #define API_V1(path) "/api/v1" path \| |
|
||||
| `docs/dashboard-esp32s3.md` | 161 | `/api/v1` | Active dashboard communication is WiFi/HTTP using `/api/v1`. |
|
||||
| `docs/README.md` | 55 | `/api/v1` | - `api-v1-audit.md` - Audit of legacy API paths vs `/api/v1` namespace. |
|
||||
| `docs/roadmap.md` | 135 | `/api/v1` | Active dashboard communication is WiFi/HTTP using `/api/v1`. |
|
||||
| `docs/UART_PROTOCOL.md` | 281 | `/api/v1` | Active dashboard communication is WiFi/HTTP using `/api/v1`. |
|
||||
| `firmware/esp32/overland-controller/overland-controller.ino` | 664 | `/api/v1` | const API_BASE="/api/v1"; |
|
||||
| `firmware/esp32/overland-controller/overland-controller.ino` | 1342 | `/api/v1` | #define API_V1(path) "/api/v1" path |
|
||||
@@ -0,0 +1,208 @@
|
||||
# Cargo ESP API Contract
|
||||
|
||||
The Cargo ESP32 is the source of truth for power-system state.
|
||||
|
||||
The WebUI, ESP32-S3 dashboard, and future clients should consume this API rather than reading sensors or relay state directly.
|
||||
|
||||
## Ownership
|
||||
|
||||
Cargo ESP32 owns:
|
||||
|
||||
- Relay/output state
|
||||
- DS18B20 temperature readings
|
||||
- BMS telemetry
|
||||
- Alarm/fault state
|
||||
- Local configuration
|
||||
- WebUI/API service
|
||||
|
||||
Dashboard ESP32-S3 consumes:
|
||||
|
||||
- Status
|
||||
- Battery/BMS telemetry
|
||||
- Temperature telemetry
|
||||
- Relay/output state
|
||||
- Alarm/fault state
|
||||
|
||||
The dashboard may request relay changes through the API, but the Cargo ESP remains authoritative.
|
||||
|
||||
## Expected API Areas
|
||||
|
||||
### System Status
|
||||
|
||||
Used by clients to determine whether the Cargo ESP is online and healthy.
|
||||
|
||||
Expected data:
|
||||
|
||||
- Device name
|
||||
- Firmware version
|
||||
- Uptime
|
||||
- WiFi/AP status
|
||||
- API version
|
||||
- Alarm/fault summary
|
||||
|
||||
### Battery / BMS
|
||||
|
||||
Used for house battery display.
|
||||
|
||||
Expected data:
|
||||
|
||||
- Voltage
|
||||
- Current
|
||||
- State of charge
|
||||
- Charging/discharging state
|
||||
- Cell data when available
|
||||
- BMS online/offline status
|
||||
- Protection/fault state
|
||||
|
||||
### Temperatures
|
||||
|
||||
DS18B20 support is already implemented in the Cargo ESP/WebUI/API path.
|
||||
|
||||
Expected data:
|
||||
|
||||
- Sensor ID
|
||||
- Display name
|
||||
- Enabled state
|
||||
- Online/offline state
|
||||
- Temperature value
|
||||
- Temperature unit
|
||||
- Role/location, such as fridge, cargo, ambient, or spare
|
||||
|
||||
The ESP32-S3 dashboard should display this data from the Cargo ESP API. It should not directly own cargo/fridge DS18B20 sensor wiring for v1.
|
||||
|
||||
### Relays / Outputs
|
||||
|
||||
Used for fridge, Starlink, lights, spare, and future switched outputs.
|
||||
|
||||
Expected data:
|
||||
|
||||
- Output ID
|
||||
- Display name
|
||||
- Enabled state
|
||||
- Current state
|
||||
- Requested state
|
||||
- Fault/lockout state when available
|
||||
- Optional output type or role
|
||||
|
||||
Relay/output writes should go through the Cargo ESP API.
|
||||
|
||||
### Configuration
|
||||
|
||||
Configuration should remain owned by the Cargo ESP.
|
||||
|
||||
Expected future areas:
|
||||
|
||||
- Output names
|
||||
- Output enabled/disabled state
|
||||
- Temperature sensor names
|
||||
- Temperature sensor roles
|
||||
- Alarm thresholds
|
||||
- Network/AP settings
|
||||
- OTA settings
|
||||
|
||||
## v1 Client Communication
|
||||
|
||||
Current v1 client path:
|
||||
|
||||
ESP32-S3 Dashboard
|
||||
<-> WiFi / HTTP REST
|
||||
Cargo ESP32 AP
|
||||
|
||||
Not v1 API transport:
|
||||
|
||||
- ESP-NOW
|
||||
- MQTT
|
||||
- UART dashboard link
|
||||
- CAN between controllers
|
||||
|
||||
## Compatibility Rule
|
||||
|
||||
When possible, future changes should add fields rather than rename or remove existing fields.
|
||||
|
||||
Dashboard firmware should tolerate unknown fields.
|
||||
|
||||
Cargo ESP firmware should preserve stable field names once dashboard implementation begins.
|
||||
|
||||
## Output Hardware Profiles
|
||||
|
||||
The Cargo ESP API should describe outputs generically instead of assuming a fixed relay board.
|
||||
|
||||
Current active hardware:
|
||||
|
||||
- Generic ESP32 with 2-channel relay board
|
||||
- Used for ongoing development and testing
|
||||
|
||||
Ordered/future hardware:
|
||||
|
||||
- LILYGO T-Relay-S3 6-way
|
||||
- Intended to trigger the 6 relays on the WUPP fuse/relay block
|
||||
- Not active firmware target until hardware arrives and is bench tested
|
||||
|
||||
API clients should not assume exactly 2 outputs or exactly 6 outputs.
|
||||
|
||||
Instead, clients should read the output list exposed by the Cargo ESP and render whatever outputs are available.
|
||||
|
||||
Expected output object fields:
|
||||
|
||||
- `id`
|
||||
- `name`
|
||||
- `role`
|
||||
- `enabled`
|
||||
- `state`
|
||||
- `requested_state`
|
||||
- `available`
|
||||
- `hardware_channel`
|
||||
- `hardware_profile`
|
||||
|
||||
Example 2-channel profile:
|
||||
|
||||
{
|
||||
"hardware_profile": "lilygo_t_relay_s3_6ch",
|
||||
"outputs": [
|
||||
{"id": 1, "name": "Fridge", "role": "fridge", "hardware_channel": 1},
|
||||
{"id": 2, "name": "Starlink", "role": "starlink", "hardware_channel": 2}
|
||||
]
|
||||
}
|
||||
|
||||
Example future 6-channel profile:
|
||||
|
||||
{
|
||||
"hardware_profile": "lilygo_t_relay_s3_6ch_wupp",
|
||||
"outputs": [
|
||||
{"id": 1, "name": "Fridge", "role": "fridge", "hardware_channel": 1},
|
||||
{"id": 2, "name": "Starlink", "role": "starlink", "hardware_channel": 2},
|
||||
{"id": 3, "name": "Lights", "role": "lights", "hardware_channel": 3},
|
||||
{"id": 4, "name": "Spare 1", "role": "spare", "hardware_channel": 4},
|
||||
{"id": 5, "name": "Spare 2", "role": "spare", "hardware_channel": 5},
|
||||
{"id": 6, "name": "Spare 3", "role": "spare", "hardware_channel": 6}
|
||||
]
|
||||
}
|
||||
|
||||
Compatibility rule:
|
||||
|
||||
- The API should support the current 2-channel board while allowing a future 6-output profile without changing dashboard/client assumptions.
|
||||
- Clients should render outputs dynamically from the API response.
|
||||
- Clients should not hardcode relay count.
|
||||
|
||||
## Implemented Output Compatibility Layer
|
||||
|
||||
The Cargo ESP firmware now exposes relay/output state as an output-count-agnostic list.
|
||||
|
||||
The current active hardware profile remains:
|
||||
|
||||
lilygo_t_relay_s3_6ch
|
||||
|
||||
The API includes:
|
||||
|
||||
- `hardware_profile`
|
||||
- `output_count`
|
||||
- `relays[]`
|
||||
- `relays[].role`
|
||||
- `relays[].hardware_channel`
|
||||
- `relays[].hardware_profile`
|
||||
- `relays[].available`
|
||||
- `relays[].state`
|
||||
|
||||
This keeps the current 2-channel relay board working while preparing the API shape for the future LilyGO T-Relay-S3 6-way profile.
|
||||
|
||||
When the LilyGO board arrives, the expected migration should be a hardware profile and relay driver change, not a dashboard/API redesign.
|
||||
@@ -0,0 +1,199 @@
|
||||
# ChatGPT Handoff
|
||||
|
||||
Last updated: 2026-06-07
|
||||
|
||||
Use this document to bring a new ChatGPT/Codex session up to speed quickly. Keep it current when project goals, architecture, APIs, hardware assumptions, validation status, or near-term priorities change.
|
||||
|
||||
## How to Use This
|
||||
|
||||
At the start of a new assistant session, provide this file along with:
|
||||
|
||||
- `AGENTS.md`
|
||||
- `docs/project-state.md`
|
||||
- `docs/ARCHITECTURE.md`
|
||||
- `docs/HARDWARE.md`
|
||||
- `docs/API.md`
|
||||
- `docs/ROADMAP.md`
|
||||
|
||||
The assistant should treat the Cargo ESP32 firmware and primary docs as the source of truth, then update this handoff before finishing any meaningful change.
|
||||
|
||||
## Non-Negotiable Constraints
|
||||
|
||||
- Cargo ESP32 remains the controller, API server, WebUI host, and source of truth.
|
||||
- Waveshare ESP32-S3 dashboard is a client only.
|
||||
- Do not move relay, BMS, or control authority into the dashboard.
|
||||
- Do not modify JBD/Xiaoxiang BLE behavior without explicit approval.
|
||||
- Do not change BLE timeout, reconnect, scan, or BMS-selection behavior without approval.
|
||||
- Do not hardcode install-specific names into firmware.
|
||||
- Preserve API compatibility when practical.
|
||||
- Prefer HTTP API integration over custom protocols.
|
||||
- ESP32 relay board outputs trigger external fused automotive relays/contactors only.
|
||||
- Do not route fridge, Starlink, inverter, or other major load current through the ESP32 relay board.
|
||||
- Dashboard target is Waveshare ESP32-S3-Touch-LCD-5.
|
||||
- Dashboard connects to Cargo ESP32 AP over WiFi and is powered from ACC switched 12V into VIN.
|
||||
- Do not power dashboard from OBD-II pin 16 in the permanent install.
|
||||
- CAN termination must stay disabled when connected to vehicle CAN.
|
||||
|
||||
## Current Status
|
||||
|
||||
Current firmware version:
|
||||
|
||||
```text
|
||||
0.5.0
|
||||
```
|
||||
|
||||
Current architecture:
|
||||
|
||||
- ESP32 relay board is the cargo controller.
|
||||
- Embedded WebUI is served by the Cargo ESP32.
|
||||
- HTTP API base path is `/api/v1`.
|
||||
- Root HTTP routes remain as compatibility aliases for existing local clients.
|
||||
- Dashboard direction is Waveshare ESP32-S3 over WiFi/HTTP, not Pico/UART.
|
||||
- UART JSON remains optional for diagnostics or alternate clients.
|
||||
|
||||
Current working feature areas:
|
||||
|
||||
- Relay control through WebUI, HTTP API, UART JSON, and USB serial.
|
||||
- JBD/Xiaoxiang BLE BMS telemetry.
|
||||
- DS18B20 temperature scan, assignment, clear, and configured naming workflow.
|
||||
- WiFi AP recovery network at `192.168.4.1`.
|
||||
- STA mode with saved WiFi networks and priorities.
|
||||
- Config-driven generic relay and temperature IDs.
|
||||
- Config backup/restore API.
|
||||
- BMS setup workflow API.
|
||||
|
||||
## API Direction
|
||||
|
||||
New clients should use `/api/v1`.
|
||||
|
||||
Dashboard MVP should initially consume only:
|
||||
|
||||
```text
|
||||
GET /api/v1/status
|
||||
POST /api/v1/relay/set
|
||||
```
|
||||
|
||||
Other current HTTP API areas include:
|
||||
|
||||
- Health and capability discovery.
|
||||
- Configuration read/update/save/factory-reset.
|
||||
- Config export/import.
|
||||
- WiFi config/connect/clear.
|
||||
- Temperature scan/assign/clear.
|
||||
- BMS setup enter/exit, scan, and select.
|
||||
|
||||
See `docs/API.md` for the current contract and `tests/test_http_api_contract.py` for contract coverage.
|
||||
|
||||
## Near-Term Goals
|
||||
|
||||
1. Verify WebUI setup workflow after a fresh flash.
|
||||
2. Clean up DS18B20 physical distribution hardware.
|
||||
3. Test 2-4 temperature probes after the distribution board is installed.
|
||||
4. Start the Waveshare ESP32-S3 dashboard MVP over WiFi/HTTP.
|
||||
5. Improve BMS out-of-range handling only with explicit approval for BLE behavior changes.
|
||||
6. Define future Pi Zero logging/integration role without moving control authority off the Cargo ESP32.
|
||||
|
||||
## Recent Context
|
||||
|
||||
- The project recently standardized current HTTP routes under `/api/v1`.
|
||||
- Health, capabilities, config backup/restore, configuration update, WiFi, temperature setup, and BMS setup endpoints are documented in `docs/API.md`.
|
||||
- The embedded WebUI uses `const API_BASE="/api/v1";`.
|
||||
- Pre-versioned HTTP routes remain registered as compatibility aliases.
|
||||
- `docs/archive/` contains older or superseded planning material and should not override the primary docs.
|
||||
|
||||
## Validation Status
|
||||
|
||||
Available validation is driven by:
|
||||
|
||||
```text
|
||||
python3 run_tests.py
|
||||
```
|
||||
|
||||
The script performs Python compile checks for the dashboard code, then runs:
|
||||
|
||||
```text
|
||||
python3 -m pytest tests/test_pico_core.py
|
||||
python3 -m pytest tests/test_http_api_contract.py
|
||||
```
|
||||
|
||||
As of this update, the compile step passes in the local environment, but full test execution is blocked because `pytest` is not installed for the active `python3`.
|
||||
|
||||
## Handoff Maintenance Checklist
|
||||
|
||||
Update this document when any of these change:
|
||||
|
||||
- Active project phase or near-term goals.
|
||||
- Cargo ESP32 vs dashboard responsibility boundaries.
|
||||
- Current firmware version.
|
||||
- HTTP API route list, response shape, or compatibility policy.
|
||||
- Hardware assumptions, wiring, power, relay, CAN, or dashboard target.
|
||||
- Validation commands, dependencies, or current test status.
|
||||
- Important decisions that a future assistant should not rediscover from scratch.
|
||||
|
||||
|
||||
## Current communications and GPIO decision
|
||||
|
||||
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 Architecture Guardrails
|
||||
|
||||
- Inspect the repo before proposing code or documentation changes.
|
||||
- Preserve the Cargo ESP vs Dashboard ESP32-S3 role split.
|
||||
- Cargo ESP32 does not own CAN, OBD-II, tilt sensing, vehicle data, or dashboard rendering.
|
||||
- Dashboard ESP32-S3 does not own relay authority, BMS authority, alarm authority, or persistent cargo-controller configuration.
|
||||
- v1 dashboard communication is WiFi/HTTP REST only.
|
||||
- ESP-NOW, MQTT, UART dashboard link, and CAN-between-controllers are not v1 architecture.
|
||||
- Load-switching hardware is not finalized. Bosch relays, WUPP-style fused distribution, smart high-side switching, and custom PCB options remain implementation choices until explicitly selected.
|
||||
|
||||
## Legacy Pico Dashboard Archive
|
||||
|
||||
The old Pico dashboard implementation has been archived at `archive/legacy-pico-dashboard/`.
|
||||
|
||||
Do not treat it as active firmware. It may be referenced for old HTTP/state/alarm/UI ideas, but new dashboard work should target the ESP32-S3 dashboard path.
|
||||
|
||||
Default validation should use the repo-local virtual environment:
|
||||
|
||||
source .venv/bin/activate
|
||||
python run_tests.py
|
||||
|
||||
## DS18B20 Implementation Note
|
||||
|
||||
DS18B20 temperature support is already implemented in the Cargo ESP/WebUI/API path.
|
||||
|
||||
Do not suggest adding DS18B20 support as if it is missing. Future work should preserve existing Cargo ESP temperature ownership and expose/display that telemetry through the API and ESP32-S3 dashboard.
|
||||
|
||||
## Cargo API Contract Guardrail
|
||||
|
||||
The Cargo ESP API contract is documented in `docs/cargo-api-contract.md`.
|
||||
|
||||
Before making dashboard firmware changes, inspect the current API tests and this contract. Do not move relay, BMS, DS18B20, alarm, or configuration ownership from the Cargo ESP to the dashboard.
|
||||
|
||||
## Pre-LilyGO Baseline Checklist
|
||||
|
||||
Before suggesting a release/tag prior to Cargo ESP hardware migration, check `docs/pre-lilygo-baseline-checklist.md`.
|
||||
|
||||
Do not suggest migrating active Cargo ESP firmware to LilyGO hardware until the user explicitly decides to buy/use that board.
|
||||
|
||||
## LilyGO Transition Guardrail
|
||||
|
||||
The user has ordered a LILYGO T-Relay-S3 6-way board, but it will not arrive for a couple weeks.
|
||||
|
||||
Until the user confirms hardware is available and bench tested:
|
||||
|
||||
- Keep the existing 2-channel relay board as the active test target.
|
||||
- Do not remove 2-channel support.
|
||||
- Do not assume LilyGO firmware is active.
|
||||
- Prepare API/config/docs for output-count-agnostic operation.
|
||||
- Treat LilyGO migration as a future hardware-profile change.
|
||||
@@ -0,0 +1,52 @@
|
||||
# M9N GPS Module Plan
|
||||
|
||||
## Role
|
||||
|
||||
The M9N GPS module will live in the dashboard enclosure and provide:
|
||||
|
||||
- GPS position
|
||||
- GPS speed
|
||||
- Satellite/fix status
|
||||
- UTC time
|
||||
- Future automatic timezone/DST support
|
||||
- Optional GPS fallback speed display
|
||||
|
||||
## Location
|
||||
|
||||
Preferred mounting location:
|
||||
|
||||
- Inside the top dashboard enclosure
|
||||
- Under the windshield
|
||||
- Near the ESP32-S3 dashboard display
|
||||
|
||||
This should provide a clean enough sky view for normal vehicle GPS use.
|
||||
|
||||
## Wiring
|
||||
|
||||
Planned connection to dashboard ESP32-S3:
|
||||
|
||||
- GPS TX -> ESP32 UART RX
|
||||
- GPS RX -> ESP32 UART TX, optional
|
||||
- GPS VCC -> 3.3V or 5V depending on module board
|
||||
- GPS GND -> dashboard ground
|
||||
|
||||
PPS is optional and not required for v1.
|
||||
|
||||
## V1 Data Goals
|
||||
|
||||
Initial GPS fields:
|
||||
|
||||
- Fix valid
|
||||
- Satellite count
|
||||
- Latitude
|
||||
- Longitude
|
||||
- Speed
|
||||
- UTC time
|
||||
|
||||
## Future Features
|
||||
|
||||
- Automatic timezone lookup
|
||||
- Automatic DST handling
|
||||
- Trip logging
|
||||
- GPS-based speed fallback
|
||||
- GPS diagnostics screen
|
||||
@@ -0,0 +1,54 @@
|
||||
# Pre-LilyGO Baseline Checklist
|
||||
|
||||
Use this checklist before creating a release/tag for the current Cargo ESP 2-channel baseline.
|
||||
|
||||
## Goal
|
||||
|
||||
Capture a known-good project state before migrating Cargo ESP hardware to a LilyGO T-Relay-S3 board or other expanded-output controller.
|
||||
|
||||
## Required Before Tagging
|
||||
|
||||
- [ ] Tests pass with `source .venv/bin/activate && python run_tests.py`
|
||||
- [ ] Working Cargo ESP WebUI confirmed
|
||||
- [ ] Relay/output control confirmed on current 2-channel board
|
||||
- [ ] DS18B20 temperature display confirmed in WebUI
|
||||
- [ ] Cargo ESP API contract documented
|
||||
- [ ] Controller roles documented
|
||||
- [ ] Pico dashboard archived
|
||||
- [ ] Waveshare ESP32-S3 Touch LCD 5B dashboard target documented
|
||||
- [ ] Load-switching hardware boundaries documented
|
||||
- [ ] No stale active Pico/UART dashboard references remain
|
||||
- [ ] Repo is clean: `git status --short`
|
||||
|
||||
## Suggested Tag Name
|
||||
|
||||
v0.1.0-cargo-esp32-2ch-baseline
|
||||
|
||||
## Suggested Release Title
|
||||
|
||||
Cargo ESP32 2-Channel Relay Board Baseline
|
||||
|
||||
## Suggested Release Notes
|
||||
|
||||
Baseline working release before future Cargo ESP hardware migration.
|
||||
|
||||
This release captures the current Cargo ESP32 controller architecture using the 2-channel relay board.
|
||||
|
||||
Includes:
|
||||
|
||||
- Cargo ESP WebUI/API architecture
|
||||
- DS18B20 temperature support
|
||||
- Relay/output control
|
||||
- HTTP API contract tests
|
||||
- Legacy Pico dashboard archived
|
||||
- ESP32-S3 Waveshare 5B dashboard direction documented
|
||||
- Controller roles clarified
|
||||
- Load-switching hardware boundaries documented
|
||||
|
||||
Known future work:
|
||||
|
||||
- LilyGO T-Relay-S3 hardware evaluation
|
||||
- Expanded relay/output mapping
|
||||
- OTA workflow
|
||||
- ESP32-S3 dashboard firmware
|
||||
- Dashboard screen mockups
|
||||
@@ -0,0 +1,370 @@
|
||||
# Project State
|
||||
|
||||
Last updated: 2026-06-07
|
||||
|
||||
## Version
|
||||
|
||||
Current firmware version:
|
||||
|
||||
0.5.0
|
||||
|
||||
## Current Architecture
|
||||
|
||||
The project is now an ESP32-based overland controller with a lightweight embedded WebUI.
|
||||
|
||||
Core controller:
|
||||
|
||||
ESP32 relay board
|
||||
|
||||
Current dashboard plan:
|
||||
|
||||
Waveshare ESP32-S3-Touch-LCD-5 over WiFi/HTTP
|
||||
|
||||
Optional future expansion:
|
||||
|
||||
Pi Zero for long-term logging, charts, and local integrations
|
||||
|
||||
## ESP32 Responsibilities
|
||||
|
||||
The ESP32 is the source of truth for:
|
||||
|
||||
- Relay control
|
||||
- JBD/Xiaoxiang BLE BMS telemetry
|
||||
- DS18B20 temperature sensors
|
||||
- Persistent configuration
|
||||
- HTTP API
|
||||
- Embedded WebUI
|
||||
- WiFi AP recovery network
|
||||
- WiFi STA client mode
|
||||
- Optional UART JSON protocol for diagnostics or alternate clients
|
||||
|
||||
## Current Working Features
|
||||
|
||||
- BMS live data from Greta/JBD BMS
|
||||
- Relay control
|
||||
- Embedded phone-friendly WebUI
|
||||
- AP mode at `192.168.4.1`
|
||||
- STA mode on saved WiFi networks
|
||||
- Multiple saved WiFi networks with priority
|
||||
- WiFi reconnect/failover behavior
|
||||
- DS18B20 scan/assign/config workflow
|
||||
- One DS18B20 probe verified working
|
||||
- Generic relay IDs
|
||||
- Generic temperature IDs
|
||||
- Config-driven relay names
|
||||
- Config-driven temperature names
|
||||
- WebUI setup workflow
|
||||
- HTTP API
|
||||
- UART JSON protocol
|
||||
- USB serial maintenance commands
|
||||
|
||||
## WebUI Tabs
|
||||
|
||||
### Overview
|
||||
|
||||
Shows:
|
||||
|
||||
- Battery SOC
|
||||
- Voltage
|
||||
- Current
|
||||
- Estimated runtime / charging time-to-full
|
||||
- Temperature sensors
|
||||
- Relay controls
|
||||
- Network status
|
||||
- Alarm summary
|
||||
|
||||
### Battery
|
||||
|
||||
Shows:
|
||||
|
||||
- BMS online/offline
|
||||
- Source
|
||||
- Remaining Ah
|
||||
- Capacity Ah
|
||||
- Battery temperature
|
||||
- Cycle count
|
||||
- Cell count
|
||||
- Cell delta
|
||||
- Individual cell voltages
|
||||
- BMS enable/disable controls
|
||||
|
||||
### Config
|
||||
|
||||
Supports:
|
||||
|
||||
- Device name editing
|
||||
- BMS name/address/address type editing
|
||||
- BMS reconnect
|
||||
- Temperature probe scan
|
||||
- Temperature probe assignment
|
||||
- Relay renaming
|
||||
- Temperature sensor enabled count
|
||||
- Temperature sensor renaming
|
||||
- WiFi network configuration
|
||||
- Restart
|
||||
- Factory reset
|
||||
|
||||
## Hardware Direction
|
||||
|
||||
Current rear enclosure target:
|
||||
|
||||
- ESP32 relay board
|
||||
- Compact fuse block
|
||||
- Ground bus
|
||||
- CAT6 keystone
|
||||
- DS18B20 terminal/distribution board
|
||||
- Built-in relay outputs for Starlink Mini and fridge
|
||||
|
||||
Relay strategy:
|
||||
|
||||
ESP32 relay board output
|
||||
-> external fused automotive relay or contactor trigger
|
||||
-> fused load circuit
|
||||
|
||||
The ESP32 relay board outputs are control/trigger outputs only. Fridge, Starlink, inverter, and other major loads must use properly fused automotive relay or contactor circuits.
|
||||
|
||||
## Temperature Sensor Direction
|
||||
|
||||
DS18B20 bus:
|
||||
|
||||
ESP32 GPIO4 = data
|
||||
ESP32 3.3V = VCC
|
||||
ESP32 GND = ground
|
||||
|
||||
Required:
|
||||
|
||||
One 4.7k pull-up resistor between data and 3.3V
|
||||
|
||||
Final install should use a terminal/distribution board.
|
||||
|
||||
## Network Direction
|
||||
|
||||
Current:
|
||||
|
||||
- AP always available
|
||||
- STA attempts saved networks by priority
|
||||
- AP remains available even when STA is connected
|
||||
|
||||
Examples:
|
||||
|
||||
Priority 1: Starlink
|
||||
Priority 2: Home WiFi
|
||||
|
||||
## Next Recommended Work
|
||||
|
||||
1. Verify WebUI setup workflow after fresh flash.
|
||||
2. Clean up DS18B20 physical distribution hardware.
|
||||
3. Test 2-4 temperature probes after distribution board is installed.
|
||||
4. Start Waveshare ESP32-S3 dashboard MVP over WiFi/HTTP.
|
||||
5. Add config backup/restore.
|
||||
6. Improve BMS out-of-range behavior without changing NimBLE connect timeout.
|
||||
7. Define future Pi Zero logging/integration role without moving control authority off the Cargo ESP32.
|
||||
|
||||
Recent notes:
|
||||
|
||||
- WebUI temperature scan, assign, clear, and weather/outside-air selection are implemented.
|
||||
- DS18B20 slots now require explicit assigned addresses before reporting values.
|
||||
- Relay controls and temperature configuration remain driven by generic IDs plus saved configuration names.
|
||||
|
||||
|
||||
## Dashboard Architecture Update
|
||||
|
||||
Primary dashboard architecture is now:
|
||||
|
||||
Cargo ESP32 Controller
|
||||
→ WiFi AP/STA
|
||||
→ HTTP API
|
||||
→ WebUI
|
||||
|
||||
Dashboard Client:
|
||||
→ Waveshare 5" ESP32-S3 Display
|
||||
→ Connects to cargo ESP32 over WiFi
|
||||
→ Consumes existing HTTP API
|
||||
→ Planned LVGL-based dashboard UI
|
||||
|
||||
There is no planned Pico dashboard path. Existing Pico/UART files are legacy artifacts unless explicitly revived later.
|
||||
|
||||
UART JSON remains optional for diagnostics or alternate clients. New dashboard work should target the Waveshare ESP32-S3 display and the HTTP API.
|
||||
|
||||
|
||||
## Current communications and GPIO decision
|
||||
|
||||
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 Role Boundary
|
||||
|
||||
The authoritative role split is documented in `docs/controller-roles.md`.
|
||||
|
||||
Summary:
|
||||
|
||||
- Cargo ESP32: power-system controller, WebUI, REST API, output control, BMS, DS18B20, local config, optional OLED.
|
||||
- Dashboard ESP32-S3: touchscreen UI, gauges, future CAN/OBD-II, future tilt/roll/off-road visualization.
|
||||
- v1 communications: Dashboard connects to Cargo ESP AP over WiFi/HTTP REST.
|
||||
- Not v1 communications: ESP-NOW, MQTT, UART dashboard link, or CAN between controllers.
|
||||
- Load-switching hardware is still an implementation choice, not frozen architecture.
|
||||
|
||||
## Pico Dashboard Archive Cleanup
|
||||
|
||||
The old `pico-dashboard/` implementation has been moved to `archive/legacy-pico-dashboard/`.
|
||||
|
||||
It is retained as reference material only. It is not active firmware and is no longer part of the default validation path.
|
||||
|
||||
Current dashboard work should target the ESP32-S3 dashboard direction documented in `docs/dashboard-esp32s3.md` and the placeholder at `firmware/esp32-s3-dashboard/`.
|
||||
|
||||
## Selected Dashboard Hardware
|
||||
|
||||
The current dashboard target is the Waveshare ESP32-S3 Touch LCD 5B with a 5-inch 1024x600 touchscreen.
|
||||
|
||||
This replaces the earlier Pico dashboard concept. The Pico dashboard has been archived as reference-only material.
|
||||
|
||||
## Implemented DS18B20/WebUI Support
|
||||
|
||||
DS18B20 support is already implemented in the Cargo ESP/WebUI/API path.
|
||||
|
||||
This is not a future feature to add from scratch.
|
||||
|
||||
Future work should focus on:
|
||||
|
||||
- Keeping the API contract accurate
|
||||
- Displaying existing temperature telemetry on the ESP32-S3 dashboard
|
||||
- Preserving Cargo ESP ownership of cargo/fridge temperature sensors
|
||||
|
||||
## Cargo API Contract
|
||||
|
||||
The current Cargo ESP API ownership and expected endpoint areas are documented in `docs/cargo-api-contract.md`.
|
||||
|
||||
This contract should guide future ESP32-S3 dashboard work so dashboard firmware targets stable Cargo ESP data instead of duplicating sensor or relay ownership.
|
||||
|
||||
## Pre-LilyGO Baseline
|
||||
|
||||
Before migrating Cargo ESP hardware to a LilyGO T-Relay-S3 or other expanded-output controller, use `docs/pre-lilygo-baseline-checklist.md` to confirm the current 2-channel Cargo ESP baseline is stable enough to tag.
|
||||
|
||||
## LilyGO Ordered / Transition Plan
|
||||
|
||||
The LILYGO T-Relay-S3 6-way board has been ordered but is not yet the active hardware target.
|
||||
|
||||
Current testing continues on the original 2-channel relay board.
|
||||
|
||||
Near-term work should prepare the Cargo ESP API and configuration model so the future LilyGO migration is a hardware-profile change instead of an API redesign.
|
||||
|
||||
Primary goal:
|
||||
|
||||
- Keep 2-channel testing functional now.
|
||||
- Support future 6-output rendering/control cleanly through the same API shape.
|
||||
|
||||
## Output-Count-Agnostic Relay API
|
||||
|
||||
The Cargo ESP API now represents relays/outputs as a hardware-profile-aware list instead of hardcoding client assumptions around exactly two relays.
|
||||
|
||||
Current active hardware profile:
|
||||
|
||||
lilygo_t_relay_s3_6ch
|
||||
|
||||
Future planned profile:
|
||||
|
||||
lilygo_t_relay_s3_6ch_wupp
|
||||
|
||||
Current 2-channel testing should continue until the LilyGO board arrives and is bench tested.
|
||||
|
||||
## Waveshare 5B Bring-Up Pending
|
||||
|
||||
The Waveshare ESP32-S3 Touch LCD 5B is expected next.
|
||||
|
||||
Next dashboard work should follow `docs/waveshare-5b-bringup-checklist.md` and start with standalone display/touch validation before any Cargo ESP or vehicle integration.
|
||||
|
||||
## Dashboard MVP Status
|
||||
|
||||
Current dashboard hardware:
|
||||
|
||||
- Waveshare ESP32-S3 Touch LCD 5B
|
||||
- WiFi client to Cargo ESP32 AP
|
||||
- HTTP API consumer
|
||||
|
||||
Current dashboard communication path:
|
||||
|
||||
Dashboard ESP32-S3
|
||||
-> WiFi
|
||||
-> HTTP
|
||||
-> Cargo ESP32
|
||||
-> /api/v1
|
||||
|
||||
Current dashboard features:
|
||||
|
||||
- Boot screen
|
||||
- Dashboard version display
|
||||
- Battery SOC gauge
|
||||
- Charge/discharge current display
|
||||
- Runtime estimation
|
||||
- Time-to-full estimation
|
||||
- Idle battery state
|
||||
- Relay controls
|
||||
- Dynamic relay button sizing
|
||||
- State-colored relay buttons
|
||||
- WiFi signal indicator
|
||||
- Cargo ESP connectivity indicator
|
||||
- Fast status polling using field-filtered API requests
|
||||
|
||||
### Temperature Sensor Grouping
|
||||
|
||||
Temperature sensors now support a `group` field in addition to the existing `weather` flag.
|
||||
|
||||
Supported group values:
|
||||
|
||||
- `cabin`
|
||||
- `fridge`
|
||||
- `outside`
|
||||
- `battery`
|
||||
- `other`
|
||||
|
||||
The dashboard overview combines multiple online sensors in the same group into one tile. For example, two fridge sensors may display as `34°/45°` under a single `Fridge` tile. Sensors marked `weather: true` continue to be treated as the outside/weather sensor for dashboard display.
|
||||
|
||||
### Temperature Sensor Priority
|
||||
|
||||
Temperature sensors support a numeric `priority` field. Lower numbers are displayed first within a grouped dashboard tile.
|
||||
|
||||
Example:
|
||||
|
||||
- Fridge Zone 1: `group=fridge`, `priority=1`
|
||||
- Fridge Zone 2: `group=fridge`, `priority=2`
|
||||
|
||||
The dashboard displays the grouped fridge tile in priority order, for example `34°/45°`.
|
||||
|
||||
### Temperature Slot and Group Display
|
||||
|
||||
The Cargo ESP currently supports 4 temperature sensor slots.
|
||||
|
||||
Temperature sensor `group` values are free-form text in the WebUI. Entering a new group name effectively creates that group. The dashboard overview shows the first two available non-weather groups by priority. Multiple sensors in the same group are combined into one tile, such as `34°/45°`.
|
||||
|
||||
Sensors marked `weather: true` are excluded from the temperature card and shown in the top status strip as `OUT ##°`.
|
||||
|
||||
### Temperature High Alerts
|
||||
|
||||
Each temperature sensor supports optional high-temperature alerting:
|
||||
|
||||
- `high_alert_enabled`
|
||||
- `high_alert_f`
|
||||
- `high_alert`
|
||||
|
||||
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
|
||||
|
||||
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.
|
||||
|
||||
### Hidden Dashboard Diagnostics
|
||||
|
||||
The dashboard has a hidden diagnostics overlay. Tap the top status card five times within roughly three seconds to open it. Double-tap the diagnostics overlay to return to the main dashboard.
|
||||
|
||||
The diagnostics overlay shows dashboard version, uptime, heap, WiFi RSSI/IP, Cargo API status, Cargo firmware version, Cargo uptime, Cargo heap, Cargo AP client count, BMS status, relay count, and basic control-loop state.
|
||||
@@ -0,0 +1,53 @@
|
||||
# Repo Cleanup Audit
|
||||
|
||||
Last updated: 2026-06-09
|
||||
|
||||
## Scope
|
||||
|
||||
This audit checks active repository files for stale Pico/UART dashboard references after the Pico dashboard implementation was archived.
|
||||
|
||||
Excluded paths:
|
||||
|
||||
- `archive/`
|
||||
- `.git/`
|
||||
- `.venv/`
|
||||
- build/cache folders
|
||||
|
||||
## Result
|
||||
|
||||
The following active references still mention Pico/UART dashboard terms.
|
||||
|
||||
These are not automatically wrong. Some may be intentional history or handoff notes, but each should be reviewed before the next baseline release.
|
||||
|
||||
| File | Line | Term | Text |
|
||||
|---|---:|---|---|
|
||||
| `tools/pico_desktop_sim.py` | 5 | `pico-dashboard` | sys.path.insert(0, str(ROOT / "pico-dashboard")) |
|
||||
| `docs/project-state.md` | 185 | `Pico dashboard` | There is no planned Pico dashboard path. Existing Pico/UART files are legacy artifacts unless explicitly revived later. |
|
||||
| `docs/project-state.md` | 215 | `UART dashboard` | - Not v1 communications: ESP-NOW, MQTT, UART dashboard link, or CAN between controllers. |
|
||||
| `docs/project-state.md` | 218 | `Pico Dashboard` | ## Pico Dashboard Archive Cleanup |
|
||||
| `docs/project-state.md` | 220 | `pico-dashboard` | The old `pico-dashboard/` implementation has been moved to `archive/legacy-pico-dashboard/`. |
|
||||
| `docs/project-state.md` | 230 | `Pico dashboard` | This replaces the earlier Pico dashboard concept. The Pico dashboard has been archived as reference-only material. |
|
||||
| `docs/HARDWARE.md` | 202 | `Pico dashboard` | This is the active dashboard platform for the project. The previous Pico dashboard implementation has been archived and is reference-only. |
|
||||
| `docs/ARCHITECTURE.md` | 250 | `Pico dashboard` | This replaces the earlier Pico dashboard concept as the active dashboard architecture. |
|
||||
| `docs/CHATGPT_HANDOFF.md` | 157 | `UART dashboard` | - ESP-NOW, MQTT, UART dashboard link, and CAN-between-controllers are not v1 architecture. |
|
||||
| `docs/CHATGPT_HANDOFF.md` | 160 | `Pico Dashboard` | ## Legacy Pico Dashboard Archive |
|
||||
| `docs/CHATGPT_HANDOFF.md` | 162 | `pico-dashboard` | The old Pico dashboard implementation has been archived at `archive/legacy-pico-dashboard/`. |
|
||||
| `docs/dashboard-esp32s3.md` | 156 | `Pico dashboard` | No Pico dashboard is planned. Existing Pico/UART material is legacy unless explicitly revived for diagnostics or alternate hardware. |
|
||||
| `docs/README.md` | 39 | `pico-dashboard` | - `../archive/legacy-pico-dashboard/` - Archived Pico dashboard implementation kept for reference only. |
|
||||
| `docs/UART_PROTOCOL.md` | 7 | `Pico dashboard` | Keep this protocol for diagnostics, simulator work, service tools, or alternate clients. Do not treat it as evidence that a Pico dashboard is planned. |
|
||||
| `docs/UART_PROTOCOL.md` | 164 | `Pico dashboard` | - No Pico dashboard is currently planned. |
|
||||
| `firmware/esp32-s3-dashboard/README.md` | 44 | `Pico UART` | - Pico UART |
|
||||
| `firmware/esp32-s3-dashboard/README.md` | 64 | `Pico dashboard` | This is the current active dashboard target. The archived Pico dashboard is not active firmware. |
|
||||
| `firmware/esp32/overland-controller/config.h` | 21 | `UART dashboard` | // Legacy UART dashboard support is retired from active hardware use. |
|
||||
|
||||
## Current Dashboard Direction
|
||||
|
||||
Active dashboard work targets the Waveshare ESP32-S3 Touch LCD 5B with a 5-inch 1024x600 touchscreen.
|
||||
|
||||
The archived Pico dashboard is retained only for historical reference and should not be treated as active firmware.
|
||||
|
||||
## Existing DS18B20 Support
|
||||
|
||||
DS18B20 temperature sensor support is already implemented in the Cargo ESP/WebUI/API path.
|
||||
|
||||
Future work should focus on preserving and exposing that existing support cleanly through the API contract and dashboard client, not re-adding DS18B20 support from scratch.
|
||||
Reference in new issue
Block a user