From d1959bb55fa95d61847848758f7cb8ae3e6aa2b2 Mon Sep 17 00:00:00 2001 From: nick Date: Wed, 10 Jun 2026 02:41:09 -0600 Subject: [PATCH] dashboard: force relay strip layout --- .../esp32-s3-dashboard/dashboard_config.h | 2 +- .../esp32-s3-dashboard/esp32-s3-dashboard.ino | 37 +++++++++++-------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/firmware/esp32-s3-dashboard/dashboard_config.h b/firmware/esp32-s3-dashboard/dashboard_config.h index 7cb05d5..f648569 100644 --- a/firmware/esp32-s3-dashboard/dashboard_config.h +++ b/firmware/esp32-s3-dashboard/dashboard_config.h @@ -1,6 +1,6 @@ #pragma once -static const char *DASHBOARD_VERSION = "0.1.28-relay-bottom-anchor"; +static const char *DASHBOARD_VERSION = "0.1.29-force-relay-layout"; // Update these if your Cargo ESP AP credentials are different. static const char *CARGO_WIFI_SSID = "OverlandController"; diff --git a/firmware/esp32-s3-dashboard/esp32-s3-dashboard.ino b/firmware/esp32-s3-dashboard/esp32-s3-dashboard.ino index c539fff..96f36f2 100644 --- a/firmware/esp32-s3-dashboard/esp32-s3-dashboard.ino +++ b/firmware/esp32-s3-dashboard/esp32-s3-dashboard.ino @@ -257,19 +257,17 @@ static void layout_relay_buttons() visible_count = 6; } - int available_width = RELAY_STRIP_W - 28; - int button_width = (available_width - ((visible_count - 1) * RELAY_BUTTON_GAP)) / visible_count; + const int card_width = 960; + const int horizontal_pad = 18; + const int button_gap = 12; + const int button_y = 10; + const int button_height = 178; - if (button_width < 110) { - button_width = 110; - } + int available_width = card_width - (horizontal_pad * 2); + int button_width = (available_width - ((visible_count - 1) * button_gap)) / visible_count; - if (button_width > 210) { - button_width = 210; - } - - int total_width = (button_width * visible_count) + (RELAY_BUTTON_GAP * (visible_count - 1)); - int start_x = (available_width - total_width) / 2; + int total_width = (button_width * visible_count) + (button_gap * (visible_count - 1)); + int start_x = (card_width - total_width) / 2; for (int i = 0; i < 6; i++) { if (relay_buttons[i] == nullptr) { @@ -277,12 +275,19 @@ static void layout_relay_buttons() } if (i < relay_count) { - lv_obj_set_size(relay_buttons[i], button_width, 150); - lv_obj_align(relay_buttons[i], LV_ALIGN_TOP_LEFT, start_x + (i * (button_width + RELAY_BUTTON_GAP)), 18); + lv_obj_set_size(relay_buttons[i], button_width, button_height); + lv_obj_align( + relay_buttons[i], + LV_ALIGN_TOP_LEFT, + start_x + (i * (button_width + button_gap)), + button_y + ); } } } + + static void update_relay_buttons() { lvgl_port_lock(-1); @@ -724,7 +729,7 @@ static void create_overland_overview_screen() lv_obj_t *battery_card = create_card(screen, "", 380, 310, LV_ALIGN_TOP_LEFT, 32, 76); lv_obj_t *temp_card = create_card(screen, "", 260, 310, LV_ALIGN_TOP_LEFT, 426, 76); lv_obj_t *vehicle_card = create_card(screen, "", 274, 310, LV_ALIGN_TOP_RIGHT, -32, 76); - lv_obj_t *relay_card = create_card(screen, "", RELAY_STRIP_W, 126, LV_ALIGN_TOP_LEFT, RELAY_STRIP_X, 408); + lv_obj_t *relay_card = create_card(screen, "", 960, 205, LV_ALIGN_BOTTOM_MID, 0, -8); battery_charge_pulse_arc = lv_arc_create(battery_card); lv_obj_set_size(battery_charge_pulse_arc, 286, 286); @@ -820,8 +825,8 @@ static void create_overland_overview_screen() for (int i = 0; i < 6; i++) { relay_buttons[i] = lv_btn_create(relay_card); - lv_obj_set_size(relay_buttons[i], 140, 150); - lv_obj_align(relay_buttons[i], LV_ALIGN_TOP_LEFT, 14 + (i * 150), 18); + lv_obj_set_size(relay_buttons[i], 200, 178); + lv_obj_align(relay_buttons[i], LV_ALIGN_TOP_LEFT, 18 + (i * 212), 10); lv_obj_add_event_cb( relay_buttons[i], relay_button_event_cb,