diff --git a/firmware/esp32/overland-controller/config.h b/firmware/esp32/overland-controller/config.h index c0a61e9..8bd7398 100644 --- a/firmware/esp32/overland-controller/config.h +++ b/firmware/esp32/overland-controller/config.h @@ -27,3 +27,6 @@ // Bring-up safety: keep AP stable while validating LilyGO hardware. #define WIFI_STA_AUTOCONNECT_ENABLED 0 + +// Bring-up safety: serve a tiny root page to avoid AP client/browser heap crashes. +#define LILYGO_BRINGUP_MINIMAL_WEB 1 diff --git a/firmware/esp32/overland-controller/overland-controller.ino b/firmware/esp32/overland-controller/overland-controller.ino index 371ab9c..0bf31da 100644 --- a/firmware/esp32/overland-controller/overland-controller.ino +++ b/firmware/esp32/overland-controller/overland-controller.ino @@ -4111,7 +4111,17 @@ void setup() { lastStaReconnectAttempt = millis() - STA_RECONNECT_INTERVAL_MS; server.on("/", HTTP_GET, []() { +#if LILYGO_BRINGUP_MINIMAL_WEB + server.send(200, "text/html", + "" + "Overland Controller" + "

Overland Controller

" + "

LilyGO bring-up mode is active.

" + "

Try /api/v1/health or /api/v1/status.

" + ""); +#else server.send_P(200, "text/html", INDEX_HTML); +#endif }); server.on("/ota", HTTP_GET, handleOtaPage); server.on(API_V1("/system/ota"), HTTP_POST, handleOtaUploadDone, handleOtaUploadStream); @@ -4178,6 +4188,12 @@ void setup() { server.on("/bms/scan", HTTP_POST, handleBleScan); server.on("/bms/select", HTTP_POST, handleSelectBms); + server.onNotFound([]() { + Serial.print("HTTP 404: "); + Serial.println(server.uri()); + server.send(404, "application/json", "{\"ok\":false,\"error\":\"not_found\"}"); + }); + server.begin();