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
+8 -3
View File
@@ -12,9 +12,14 @@
// Ignition Sense
#define IGNITION_PIN 34
// UART over CAT5 to Pico dashboard
#define DASHBOARD_UART_TX_PIN 21
#define DASHBOARD_UART_RX_PIN 22
// Cargo OLED service/setup display
#define OLED_I2C_SDA_PIN 21
#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
// RS-485/MAX3485 is fallback only and not currently planned.
@@ -946,9 +946,10 @@ setInterval(load,3000);
WebServer server(80);
#define API_V1(path) "/api/v1" path
#if DASHBOARD_UART_ENABLED
HardwareSerial DashboardSerial(2);
String uartLineBuffer;
#endif
Preferences wifiPrefs;
Preferences apPrefs;
@@ -1180,11 +1181,11 @@ const int OLED_RESET_PIN = -1;
const uint8_t OLED_I2C_ADDR = 0x3C;
// 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_SCL = 22;
const int OLED_I2C_SDA = OLED_I2C_SDA_PIN;
const int OLED_I2C_SCL = OLED_I2C_SCL_PIN;
// 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);
@@ -2013,6 +2014,7 @@ void sendBleScanResponse(Stream& output) {
output.println();
}
#if DASHBOARD_UART_ENABLED
int findRelayConfigIndexForUart(const String& id) {
for (int i = 0; i < MAX_RELAYS; i++) {
if (appConfig.relays[i].id == id) {
@@ -2421,6 +2423,8 @@ void pollDashboardUart() {
}
}
#endif
void handleDebugSerial() {
if (!Serial.available()) return;
@@ -3361,12 +3365,15 @@ void handleStatus() {
void setup() {
Serial.begin(115200);
#if DASHBOARD_UART_ENABLED
DashboardSerial.begin(
DASHBOARD_UART_BAUD,
SERIAL_8N1,
DASHBOARD_UART_RX_PIN,
DASHBOARD_UART_TX_PIN
0,
0
);
Serial.println("Legacy dashboard UART enabled");
#endif
Serial.println();
Serial.println("==================================");
@@ -3462,7 +3469,6 @@ void setup() {
server.begin();
Serial.println("Web Server Started");
Serial.println("Dashboard UART Started");
}
void loop() {
@@ -3471,7 +3477,9 @@ void loop() {
handleDebugSerial();
updateBms();
updateAlarms();
#if DASHBOARD_UART_ENABLED
pollDashboardUart();
#endif
oledLoop();
static unsigned long lastSensorUpdate = 0;