dashboard: simplify main battery card
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
static const char *DASHBOARD_VERSION = "0.1.16-battery-gauge-cleanup";
|
static const char *DASHBOARD_VERSION = "0.1.17-battery-main-simplified";
|
||||||
|
|
||||||
// Update these if your Cargo ESP AP credentials are different.
|
// Update these if your Cargo ESP AP credentials are different.
|
||||||
static const char *CARGO_WIFI_SSID = "OverlandController";
|
static const char *CARGO_WIFI_SSID = "OverlandController";
|
||||||
|
|||||||
@@ -200,9 +200,16 @@ static void update_battery_soc_gauge()
|
|||||||
|
|
||||||
lv_arc_set_value(battery_soc_arc, soc);
|
lv_arc_set_value(battery_soc_arc, soc);
|
||||||
lv_arc_set_angles(battery_soc_arc, 0, end_angle);
|
lv_arc_set_angles(battery_soc_arc, 0, end_angle);
|
||||||
|
lv_color_t soc_color = lv_color_hex(0x32D583);
|
||||||
|
if (soc < 30) {
|
||||||
|
soc_color = lv_color_hex(0xF97066);
|
||||||
|
} else if (soc < 70) {
|
||||||
|
soc_color = lv_color_hex(0xFDB022);
|
||||||
|
}
|
||||||
|
|
||||||
lv_obj_set_style_arc_color(
|
lv_obj_set_style_arc_color(
|
||||||
battery_soc_arc,
|
battery_soc_arc,
|
||||||
charging ? lv_color_hex(0x32D583) : lv_color_hex(0x84CAFF),
|
soc_color,
|
||||||
LV_PART_INDICATOR
|
LV_PART_INDICATOR
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -463,10 +470,6 @@ static void update_system_status_label()
|
|||||||
|
|
||||||
static void update_overview_widgets()
|
static void update_overview_widgets()
|
||||||
{
|
{
|
||||||
String voltage_text;
|
|
||||||
voltage_text += String(status_model.voltage, 2);
|
|
||||||
voltage_text += " V";
|
|
||||||
|
|
||||||
String current_text = "";
|
String current_text = "";
|
||||||
String estimate_text = "";
|
String estimate_text = "";
|
||||||
|
|
||||||
@@ -489,7 +492,6 @@ static void update_overview_widgets()
|
|||||||
|
|
||||||
update_battery_soc_gauge();
|
update_battery_soc_gauge();
|
||||||
set_label_text_if_changed(battery_soc_label, last_battery_soc_text, soc_text);
|
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);
|
update_battery_current_label(current_text, status_model.current);
|
||||||
|
|
||||||
if (battery_estimate_label != nullptr) {
|
if (battery_estimate_label != nullptr) {
|
||||||
@@ -764,10 +766,10 @@ static void create_overland_overview_screen()
|
|||||||
battery_estimate_label = lv_label_create(battery_card);
|
battery_estimate_label = lv_label_create(battery_card);
|
||||||
lv_label_set_text(battery_estimate_label, "");
|
lv_label_set_text(battery_estimate_label, "");
|
||||||
lv_obj_set_style_text_color(battery_estimate_label, lv_color_hex(0xDDE3EA), 0);
|
lv_obj_set_style_text_color(battery_estimate_label, lv_color_hex(0xDDE3EA), 0);
|
||||||
lv_obj_set_style_text_font(battery_estimate_label, &lv_font_montserrat_26, 0);
|
lv_obj_set_style_text_font(battery_estimate_label, &lv_font_montserrat_30, 0);
|
||||||
lv_obj_set_width(battery_estimate_label, 340);
|
lv_obj_set_width(battery_estimate_label, 340);
|
||||||
lv_obj_set_style_text_align(battery_estimate_label, LV_TEXT_ALIGN_CENTER, 0);
|
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, 246);
|
lv_obj_align(battery_estimate_label, LV_ALIGN_TOP_MID, 0, 202);
|
||||||
lv_obj_add_flag(battery_estimate_label, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_add_flag(battery_estimate_label, LV_OBJ_FLAG_HIDDEN);
|
||||||
|
|
||||||
battery_soc_label = lv_label_create(battery_card);
|
battery_soc_label = lv_label_create(battery_card);
|
||||||
|
|||||||
Reference in New Issue
Block a user