diff --git a/firmware/esp32-s3-dashboard/README.md b/firmware/esp32-s3-dashboard/README.md index 8ae24ef..cd403df 100644 --- a/firmware/esp32-s3-dashboard/README.md +++ b/firmware/esp32-s3-dashboard/README.md @@ -52,3 +52,16 @@ Current screen shows: - Touch test button This is intentionally not connected to WiFi or the Cargo ESP yet. + + +## Firmware Structure + +Current dashboard firmware files: + +- `esp32-s3-dashboard.ino` - Main Arduino entry point, LVGL screen, WiFi/API loop +- `dashboard_config.h` - Dashboard version, Cargo ESP WiFi credentials, `/api/v1` endpoint URLs +- `dashboard_status_model.h` - Parsed Cargo ESP status data model +- `lvgl_v8_port.cpp/.h` - Waveshare LVGL port support +- `esp_panel_board_custom_conf.h` - Waveshare board/display configuration + +This refactor keeps behavior unchanged while preparing for later `api` and `ui` file splits. diff --git a/firmware/esp32-s3-dashboard/dashboard_config.h b/firmware/esp32-s3-dashboard/dashboard_config.h new file mode 100644 index 0000000..cc9b21c --- /dev/null +++ b/firmware/esp32-s3-dashboard/dashboard_config.h @@ -0,0 +1,10 @@ +#pragma once + +static const char *DASHBOARD_VERSION = "0.0.8-refactor-config-model"; + +// Update these if your Cargo ESP AP credentials are different. +static const char *CARGO_WIFI_SSID = "OverlandController"; +static const char *CARGO_WIFI_PASSWORD = "overland1234"; + +static const char *CARGO_API_STATUS_URL = "http://192.168.4.1/api/v1/status"; +static const char *CARGO_API_RELAY_SET_URL = "http://192.168.4.1/api/v1/relay/set"; diff --git a/firmware/esp32-s3-dashboard/dashboard_status_model.h b/firmware/esp32-s3-dashboard/dashboard_status_model.h new file mode 100644 index 0000000..b1e7c7d --- /dev/null +++ b/firmware/esp32-s3-dashboard/dashboard_status_model.h @@ -0,0 +1,27 @@ +#pragma once + +#include + +struct DashboardStatus { + bool api_ok = false; + int http_code = 0; + + bool bms_connected = false; + int soc = -1; + float voltage = 0.0; + float current = 0.0; + float battery_temp_f = 0.0; + float remaining_ah = 0.0; + float capacity_ah = 0.0; + int cell_delta_mv = -1; + + String temps_text; + String outputs_text; + + String hardware_profile = "unknown"; + int output_count = 0; + String firmware_version = "unknown"; + unsigned long uptime_seconds = 0; + String cargo_ap_ssid = "unknown"; + String cargo_sta_ip = "unknown"; +}; diff --git a/firmware/esp32-s3-dashboard/esp32-s3-dashboard.ino b/firmware/esp32-s3-dashboard/esp32-s3-dashboard.ino index 397f39d..6a546c8 100644 --- a/firmware/esp32-s3-dashboard/esp32-s3-dashboard.ino +++ b/firmware/esp32-s3-dashboard/esp32-s3-dashboard.ino @@ -6,18 +6,12 @@ #include #include "lvgl_v8_port.h" +#include "dashboard_config.h" +#include "dashboard_status_model.h" using namespace esp_panel::drivers; using namespace esp_panel::board; -static const char *DASHBOARD_VERSION = "0.0.7-optimistic-relay-ui"; - -// Update these if your Cargo ESP AP credentials are different. -static const char *CARGO_WIFI_SSID = "OverlandController"; -static const char *CARGO_WIFI_PASSWORD = "overland1234"; -static const char *CARGO_API_STATUS_URL = "http://192.168.4.1/api/v1/status"; -static const char *CARGO_API_RELAY_SET_URL = "http://192.168.4.1/api/v1/relay/set"; - static lv_obj_t *battery_label = nullptr; static lv_obj_t *temps_label = nullptr; static lv_obj_t *outputs_label = nullptr; @@ -42,30 +36,6 @@ static String last_outputs_text; static String last_system_text; static String last_wifi_text; -struct DashboardStatus { - bool api_ok = false; - int http_code = 0; - - bool bms_connected = false; - int soc = -1; - float voltage = 0.0; - float current = 0.0; - float battery_temp_f = 0.0; - float remaining_ah = 0.0; - float capacity_ah = 0.0; - int cell_delta_mv = -1; - - String temps_text; - String outputs_text; - - String hardware_profile = "unknown"; - int output_count = 0; - String firmware_version = "unknown"; - unsigned long uptime_seconds = 0; - String cargo_ap_ssid = "unknown"; - String cargo_sta_ip = "unknown"; -}; - static DashboardStatus status_model; static String on_off(bool value)