hardware: retire dashboard uart and assign oled pins

This commit is contained in:
2026-06-08 09:03:24 -06:00
parent 46d52052e3
commit 75c1d4d909
10 changed files with 165 additions and 10 deletions
+17
View File
@@ -193,3 +193,20 @@ Recovery target:
- A setup/status button on the Cargo ESP enclosure can show AP credentials on the OLED. - A setup/status button on the Cargo ESP enclosure can show AP credentials on the OLED.
- A long hold can restore factory AP credentials or enter recovery mode. - A long hold can restore factory AP credentials or enter recovery mode.
## 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
+17
View File
@@ -129,3 +129,20 @@ Update this document when any of these change:
- Hardware assumptions, wiring, power, relay, CAN, or dashboard target. - Hardware assumptions, wiring, power, relay, CAN, or dashboard target.
- Validation commands, dependencies, or current test status. - Validation commands, dependencies, or current test status.
- Important decisions that a future assistant should not rediscover from scratch. - 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
+17
View File
@@ -141,3 +141,20 @@ Purpose:
- active alarms - active alarms
Firmware support is optional and disabled by default with OLED_ENABLED set to 0. Enable only after the OLED libraries are installed and the display is wired. Firmware support is optional and disabled by default with OLED_ENABLED set to 0. Enable only after the OLED libraries are installed and the display is wired.
## 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
+17
View File
@@ -274,3 +274,20 @@ Alternative:
`status_response.config.temperature_sensors[]` and `status_response.temps[]` include `weather: false`. `status_response.config.temperature_sensors[]` and `status_response.temps[]` include `weather: false`.
`config_temp` may include `weather: true` to mark one configured sensor as the outside/weather sensor. Clients should treat this as optional and default missing values to `false`. `config_temp` may include `weather: true` to mark one configured sensor as the outside/weather sensor. Clients should treat this as optional and default missing values to `false`.
## 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
+17
View File
@@ -154,3 +154,20 @@ Later:
## Out of Scope ## Out of Scope
No Pico dashboard is planned. Existing Pico/UART material is legacy unless explicitly revived for diagnostics or alternate hardware. No Pico dashboard is planned. Existing Pico/UART material is legacy unless explicitly revived for diagnostics or alternate hardware.
## 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
+17
View File
@@ -185,3 +185,20 @@ Dashboard Client:
There is no planned Pico dashboard path. Existing Pico/UART files are legacy artifacts unless explicitly revived later. 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. 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
+17
View File
@@ -128,3 +128,20 @@ Future OLED goals:
- Long press shows AP credentials. - Long press shows AP credentials.
- Extended hold enters recovery/reset mode. - Extended hold enters recovery/reset mode.
- Add first-boot setup screen once AP password generation is finalized. - Add first-boot setup screen once AP password generation is finalized.
## 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
+8 -3
View File
@@ -12,9 +12,14 @@
// Ignition Sense // Ignition Sense
#define IGNITION_PIN 34 #define IGNITION_PIN 34
// UART over CAT5 to Pico dashboard // Cargo OLED service/setup display
#define DASHBOARD_UART_TX_PIN 21 #define OLED_I2C_SDA_PIN 21
#define DASHBOARD_UART_RX_PIN 22 #define OLED_I2C_SCL_PIN 22
#define OLED_SETUP_BUTTON_PIN 25
// Dashboard communication is WiFi/HTTP.
// Legacy UART dashboard support is retired from active hardware use.
#define DASHBOARD_UART_ENABLED 0
#define DASHBOARD_UART_BAUD 115200 #define DASHBOARD_UART_BAUD 115200
// RS-485/MAX3485 is fallback only and not currently planned. // RS-485/MAX3485 is fallback only and not currently planned.
@@ -946,9 +946,10 @@ setInterval(load,3000);
WebServer server(80); WebServer server(80);
#define API_V1(path) "/api/v1" path #define API_V1(path) "/api/v1" path
#if DASHBOARD_UART_ENABLED
HardwareSerial DashboardSerial(2); HardwareSerial DashboardSerial(2);
String uartLineBuffer; String uartLineBuffer;
#endif
Preferences wifiPrefs; Preferences wifiPrefs;
Preferences apPrefs; Preferences apPrefs;
@@ -1180,11 +1181,11 @@ const int OLED_RESET_PIN = -1;
const uint8_t OLED_I2C_ADDR = 0x3C; const uint8_t OLED_I2C_ADDR = 0x3C;
// Default ESP32 I2C pins. Change these if the cargo controller wiring uses a different I2C bus. // Default ESP32 I2C pins. Change these if the cargo controller wiring uses a different I2C bus.
const int OLED_I2C_SDA = 21; const int OLED_I2C_SDA = OLED_I2C_SDA_PIN;
const int OLED_I2C_SCL = 22; const int OLED_I2C_SCL = OLED_I2C_SCL_PIN;
// Optional future setup/status button. Leave disabled until hardware is wired. // Optional future setup/status button. Leave disabled until hardware is wired.
const int OLED_BUTTON_PIN = -1; const int OLED_BUTTON_PIN = OLED_SETUP_BUTTON_PIN;
Adafruit_SSD1306 oled(OLED_SCREEN_WIDTH, OLED_SCREEN_HEIGHT, &Wire, OLED_RESET_PIN); Adafruit_SSD1306 oled(OLED_SCREEN_WIDTH, OLED_SCREEN_HEIGHT, &Wire, OLED_RESET_PIN);
@@ -2013,6 +2014,7 @@ void sendBleScanResponse(Stream& output) {
output.println(); output.println();
} }
#if DASHBOARD_UART_ENABLED
int findRelayConfigIndexForUart(const String& id) { int findRelayConfigIndexForUart(const String& id) {
for (int i = 0; i < MAX_RELAYS; i++) { for (int i = 0; i < MAX_RELAYS; i++) {
if (appConfig.relays[i].id == id) { if (appConfig.relays[i].id == id) {
@@ -2421,6 +2423,8 @@ void pollDashboardUart() {
} }
} }
#endif
void handleDebugSerial() { void handleDebugSerial() {
if (!Serial.available()) return; if (!Serial.available()) return;
@@ -3361,12 +3365,15 @@ void handleStatus() {
void setup() { void setup() {
Serial.begin(115200); Serial.begin(115200);
#if DASHBOARD_UART_ENABLED
DashboardSerial.begin( DashboardSerial.begin(
DASHBOARD_UART_BAUD, DASHBOARD_UART_BAUD,
SERIAL_8N1, SERIAL_8N1,
DASHBOARD_UART_RX_PIN, 0,
DASHBOARD_UART_TX_PIN 0
); );
Serial.println("Legacy dashboard UART enabled");
#endif
Serial.println(); Serial.println();
Serial.println("=================================="); Serial.println("==================================");
@@ -3462,7 +3469,6 @@ void setup() {
server.begin(); server.begin();
Serial.println("Web Server Started"); Serial.println("Web Server Started");
Serial.println("Dashboard UART Started");
} }
void loop() { void loop() {
@@ -3471,7 +3477,9 @@ void loop() {
handleDebugSerial(); handleDebugSerial();
updateBms(); updateBms();
updateAlarms(); updateAlarms();
#if DASHBOARD_UART_ENABLED
pollDashboardUart(); pollDashboardUart();
#endif
oledLoop(); oledLoop();
static unsigned long lastSensorUpdate = 0; static unsigned long lastSensorUpdate = 0;
+23
View File
@@ -425,3 +425,26 @@ def test_cargo_oled_shows_setup_and_service_pages():
assert 'oledClear("Alarms")' in source assert 'oledClear("Alarms")' in source
assert "oledShowSetupPage();" in source assert "oledShowSetupPage();" in source
assert "oledLoop();" in source assert "oledLoop();" in source
def test_gpio_pin_plan_assigns_oled_to_21_22():
config = (ROOT / "firmware" / "esp32" / "overland-controller" / "config.h").read_text()
source = firmware_source()
assert "#define OLED_I2C_SDA_PIN 21" in config
assert "#define OLED_I2C_SCL_PIN 22" in config
assert "#define OLED_SETUP_BUTTON_PIN 25" in config
assert "const int OLED_I2C_SDA = OLED_I2C_SDA_PIN;" in source
assert "const int OLED_I2C_SCL = OLED_I2C_SCL_PIN;" in source
assert "const int OLED_BUTTON_PIN = OLED_SETUP_BUTTON_PIN;" in source
def test_legacy_dashboard_uart_is_disabled_by_default():
config = (ROOT / "firmware" / "esp32" / "overland-controller" / "config.h").read_text()
source = firmware_source()
assert "#define DASHBOARD_UART_ENABLED 0" in config
assert "DASHBOARD_UART_TX_PIN 21" not in config
assert "DASHBOARD_UART_RX_PIN 22" not in config
assert "#if DASHBOARD_UART_ENABLED" in source
assert "pollDashboardUart();" in source