From a1f9e782f978980444e193c0cf8d990b3d8a7079 Mon Sep 17 00:00:00 2001 From: nick Date: Wed, 10 Jun 2026 01:53:39 -0600 Subject: [PATCH] dashboard: center battery soc and show estimate --- .../esp32-s3-dashboard/dashboard_config.h | 2 +- .../esp32-s3-dashboard/esp32-s3-dashboard.ino | 35 +++++++++---------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/firmware/esp32-s3-dashboard/dashboard_config.h b/firmware/esp32-s3-dashboard/dashboard_config.h index cdd8122..473a13b 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.14-large-battery-gauge"; +static const char *DASHBOARD_VERSION = "0.1.15-battery-center-estimate"; // 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 1273f06..bd97e31 100644 --- a/firmware/esp32-s3-dashboard/esp32-s3-dashboard.ino +++ b/firmware/esp32-s3-dashboard/esp32-s3-dashboard.ino @@ -487,10 +487,12 @@ static void update_overview_widgets() soc_text += "%"; update_battery_soc_gauge(); + set_label_text_if_changed(battery_soc_label, last_battery_soc_text, soc_text); set_label_text_if_changed(battery_voltage_label, last_battery_voltage_text, voltage_text); update_battery_current_label(current_text, status_model.current); - set_label_text_if_changed(battery_estimate_label, last_battery_estimate_text, estimate_text); + if (battery_estimate_label != nullptr) { + set_label_text_if_changed(battery_estimate_label, last_battery_estimate_text, estimate_text); lvgl_port_lock(-1); if (estimate_text.length() == 0) { lv_obj_add_flag(battery_estimate_label, LV_OBJ_FLAG_HIDDEN); @@ -499,7 +501,6 @@ static void update_overview_widgets() } lvgl_port_unlock(); } - set_label_text_if_changed(battery_soc_label, last_battery_soc_text, soc_text); set_label_text_if_changed(system_status_label, last_system_status_text, last_system_status_text); } @@ -759,38 +760,34 @@ static void create_overland_overview_screen() lv_obj_set_style_arc_color(battery_soc_arc, lv_color_hex(0x84CAFF), LV_PART_INDICATOR); lv_obj_set_style_arc_width(battery_soc_arc, 14, LV_PART_INDICATOR); + battery_estimate_label = lv_label_create(battery_card); + lv_label_set_text(battery_estimate_label, ""); + lv_obj_set_style_text_color(battery_estimate_label, lv_color_hex(0xB8C0C8), 0); + lv_obj_set_width(battery_estimate_label, 320); + lv_obj_set_style_text_align(battery_estimate_label, LV_TEXT_ALIGN_CENTER, 0); + lv_obj_align(battery_estimate_label, LV_ALIGN_TOP_MID, 0, 232); + lv_obj_add_flag(battery_estimate_label, LV_OBJ_FLAG_HIDDEN); + battery_soc_label = lv_label_create(battery_card); lv_label_set_text(battery_soc_label, "--%"); lv_obj_set_style_text_color(battery_soc_label, lv_color_hex(0xFFFFFF), 0); lv_obj_set_style_text_font(battery_soc_label, &lv_font_montserrat_48, 0); - lv_obj_set_style_text_font( - battery_soc_label, - &lv_font_montserrat_30, - 0 - ); - lv_obj_set_width(battery_soc_label, 240); + lv_obj_set_style_text_font(battery_soc_label, &lv_font_montserrat_48, 0); + lv_obj_set_width(battery_soc_label, 280); lv_obj_set_style_text_align(battery_soc_label, LV_TEXT_ALIGN_CENTER, 0); lv_obj_align(battery_soc_label, LV_ALIGN_TOP_MID, 0, 90); battery_voltage_label = lv_label_create(battery_card); lv_label_set_text(battery_voltage_label, "-- V"); lv_obj_set_style_text_color(battery_voltage_label, lv_color_hex(0xB8C0C8), 0); - lv_obj_set_style_text_font( - battery_voltage_label, - &lv_font_montserrat_30, - 0 - ); - lv_obj_set_width(battery_voltage_label, 240); + lv_obj_set_style_text_font(battery_voltage_label, &lv_font_montserrat_36, 0); + lv_obj_set_width(battery_voltage_label, 280); lv_obj_set_style_text_align(battery_voltage_label, LV_TEXT_ALIGN_CENTER, 0); lv_obj_align(battery_voltage_label, LV_ALIGN_TOP_MID, 0, 138); battery_current_label = lv_label_create(battery_card); lv_label_set_text(battery_current_label, ""); - lv_obj_set_style_text_font( - battery_current_label, - &lv_font_montserrat_26, - 0 - ); + lv_obj_set_style_text_font(battery_current_label, &lv_font_montserrat_30, 0); lv_obj_set_width(battery_current_label, 260); lv_obj_set_style_text_align(battery_current_label, LV_TEXT_ALIGN_CENTER, 0); lv_obj_align(battery_current_label, LV_ALIGN_TOP_MID, 0, 166);