dashboard: show boot screen before wifi overview
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
static const char *DASHBOARD_VERSION = "0.1.5-soc-arc-value";
|
||||
static const char *DASHBOARD_VERSION = "0.1.6-boot-then-overview";
|
||||
|
||||
// Update these if your Cargo ESP AP credentials are different.
|
||||
static const char *CARGO_WIFI_SSID = "OverlandController";
|
||||
|
||||
@@ -39,6 +39,7 @@ static bool api_request_in_progress = false;
|
||||
static bool fast_status_refresh_requested = false;
|
||||
static bool metadata_refresh_requested = true;
|
||||
static bool was_wifi_connected = false;
|
||||
static bool overview_screen_created = false;
|
||||
|
||||
static bool relay_command_pending = false;
|
||||
static String pending_relay_id;
|
||||
@@ -157,6 +158,9 @@ static void request_fast_status_refresh()
|
||||
fast_status_refresh_requested = true;
|
||||
}
|
||||
|
||||
static void create_overland_overview_screen();
|
||||
static void show_boot_screen();
|
||||
|
||||
static void update_relay_buttons()
|
||||
{
|
||||
lvgl_port_lock(-1);
|
||||
@@ -311,6 +315,13 @@ static void update_system_status_label()
|
||||
metadata_refresh_requested = true;
|
||||
last_status_poll_ms = 0;
|
||||
last_metadata_poll_ms = 0;
|
||||
|
||||
if (!overview_screen_created) {
|
||||
lvgl_port_lock(-1);
|
||||
create_overland_overview_screen();
|
||||
lvgl_port_unlock();
|
||||
overview_screen_created = true;
|
||||
}
|
||||
} else if (!wifi_connected) {
|
||||
was_wifi_connected = false;
|
||||
}
|
||||
@@ -546,7 +557,7 @@ static lv_obj_t *create_card(lv_obj_t *parent, const char *title, int width, int
|
||||
return card;
|
||||
}
|
||||
|
||||
static void create_overland_overview_screen()
|
||||
static void show_boot_screen()
|
||||
{
|
||||
lv_obj_t *screen = lv_scr_act();
|
||||
lv_obj_clean(screen);
|
||||
@@ -556,12 +567,40 @@ static void create_overland_overview_screen()
|
||||
lv_label_set_text(title, "Overland Controller");
|
||||
lv_obj_set_style_text_color(title, lv_color_hex(0xFFFFFF), 0);
|
||||
lv_obj_set_style_text_font(title, &lv_font_montserrat_30, 0);
|
||||
lv_obj_align(title, LV_ALIGN_TOP_MID, 0, 16);
|
||||
lv_obj_align(title, LV_ALIGN_CENTER, 0, -70);
|
||||
|
||||
lv_obj_t *battery_card = create_card(screen, "Greta Battery", 300, 255, LV_ALIGN_TOP_LEFT, 32, 80);
|
||||
lv_obj_t *temp_card = create_card(screen, "Temperatures", 300, 255, LV_ALIGN_TOP_MID, 0, 80);
|
||||
lv_obj_t *relay_card = create_card(screen, "Outputs", 300, 255, LV_ALIGN_TOP_RIGHT, -32, 80);
|
||||
lv_obj_t *system_card = create_card(screen, "System", 620, 175, LV_ALIGN_BOTTOM_LEFT, 32, -50);
|
||||
lv_obj_t *subtitle = lv_label_create(screen);
|
||||
lv_label_set_text(subtitle, "ESP32-S3 Dashboard");
|
||||
lv_obj_set_style_text_color(subtitle, lv_color_hex(0xB8C0C8), 0);
|
||||
lv_obj_set_width(subtitle, 700);
|
||||
lv_obj_set_style_text_align(subtitle, LV_TEXT_ALIGN_CENTER, 0);
|
||||
lv_obj_align(subtitle, LV_ALIGN_CENTER, 0, -25);
|
||||
|
||||
lv_obj_t *status = lv_label_create(screen);
|
||||
lv_label_set_text(status, "Connecting to Cargo ESP WiFi...");
|
||||
lv_obj_set_style_text_color(status, lv_color_hex(0x7D8996), 0);
|
||||
lv_obj_set_width(status, 700);
|
||||
lv_obj_set_style_text_align(status, LV_TEXT_ALIGN_CENTER, 0);
|
||||
lv_obj_align(status, LV_ALIGN_CENTER, 0, 35);
|
||||
|
||||
lv_obj_t *api = lv_label_create(screen);
|
||||
lv_label_set_text(api, "/api/v1");
|
||||
lv_obj_set_style_text_color(api, lv_color_hex(0x3A4652), 0);
|
||||
lv_obj_set_width(api, 700);
|
||||
lv_obj_set_style_text_align(api, LV_TEXT_ALIGN_CENTER, 0);
|
||||
lv_obj_align(api, LV_ALIGN_CENTER, 0, 80);
|
||||
}
|
||||
|
||||
static void create_overland_overview_screen()
|
||||
{
|
||||
lv_obj_t *screen = lv_scr_act();
|
||||
lv_obj_clean(screen);
|
||||
lv_obj_set_style_bg_color(screen, lv_color_hex(0x101418), 0);
|
||||
|
||||
lv_obj_t *battery_card = create_card(screen, "Greta Battery", 300, 285, LV_ALIGN_TOP_LEFT, 32, 28);
|
||||
lv_obj_t *temp_card = create_card(screen, "Temperatures", 300, 285, LV_ALIGN_TOP_MID, 0, 28);
|
||||
lv_obj_t *relay_card = create_card(screen, "Outputs", 300, 285, LV_ALIGN_TOP_RIGHT, -32, 28);
|
||||
lv_obj_t *system_card = create_card(screen, "System", 620, 195, LV_ALIGN_BOTTOM_LEFT, 32, -42);
|
||||
|
||||
battery_charge_pulse_arc = lv_arc_create(battery_card);
|
||||
lv_obj_set_size(battery_charge_pulse_arc, 190, 190);
|
||||
@@ -697,10 +736,10 @@ void setup()
|
||||
lvgl_port_init(board->getLCD(), board->getTouch());
|
||||
|
||||
lvgl_port_lock(-1);
|
||||
create_overland_overview_screen();
|
||||
show_boot_screen();
|
||||
lvgl_port_unlock();
|
||||
|
||||
Serial.println("Dashboard overview UI ready");
|
||||
Serial.println("Dashboard boot screen ready");
|
||||
}
|
||||
|
||||
void loop()
|
||||
|
||||
Reference in New Issue
Block a user