dashboard: split config and status model headers
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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";
|
||||
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
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";
|
||||
};
|
||||
@@ -6,18 +6,12 @@
|
||||
|
||||
#include <lvgl.h>
|
||||
#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)
|
||||
|
||||
Reference in New Issue
Block a user