dashboard: reset overview cache after page return

This commit is contained in:
2026-06-18 23:48:29 -06:00
parent 74dd0da406
commit 018d747a52
2 changed files with 26 additions and 3 deletions
@@ -1,6 +1,6 @@
#pragma once
static const char *DASHBOARD_VERSION = "0.1.99-overlay-return-cache-reset";
static const char *DASHBOARD_VERSION = "0.1.100-real-cache-reset";
// Update these if your Cargo ESP AP credentials are different.
//static const char *CARGO_WIFI_SSID = "OverlandController";
@@ -673,7 +673,11 @@ static void close_battery_detail_screen()
}
current_dashboard_screen = SCREEN_OVERVIEW;
invalidate_overview_widget_cache();
reset_overview_widget_cache();
fast_status_refresh_requested = true;
metadata_refresh_requested = true;
invalidate_overview_widget_cache();
refresh_dashboard_widgets();
}
@@ -1150,6 +1154,23 @@ static void fuel_bar_draw_value_cb(lv_event_t *e)
lv_draw_label(dsc->draw_ctx, &label_dsc, &txt_area, buf, NULL);
}
static void reset_overview_widget_cache()
{
last_battery_current_text = "__force_current__";
last_battery_estimate_text = "__force_estimate__";
last_battery_soc_text = "__force_soc__";
last_system_status_text = "__force_system__";
last_outside_status_temp_text = "__force_outside__";
last_battery_card_alert = !last_battery_card_alert;
last_cargo_api_ok = !last_cargo_api_ok;
for (int i = 0; i < 2; i++) {
last_temp_tile_value_text[i] = "__force_temp_value__";
last_temp_tile_name_text[i] = "__force_temp_name__";
last_temp_tile_alert[i] = !last_temp_tile_alert[i];
}
}
static void update_temp_tile_alert_style(int index, bool alert)
{
if (index < 0 || index >= 2 || temp_tile_objs[index] == nullptr) {
@@ -1616,7 +1637,9 @@ static void create_overland_overview_screen()
lv_obj_t *screen = lv_scr_act();
lv_obj_clean(screen);
current_dashboard_screen = SCREEN_OVERVIEW;
reset_overview_widget_cache();
current_dashboard_screen = SCREEN_OVERVIEW;
lv_obj_set_style_bg_color(screen, lv_color_hex(0x101418), 0);