dashboard: add transparent battery nav touch overlays

This commit is contained in:
2026-06-16 00:22:11 -06:00
parent 0875cc3f2e
commit 9360aa9e4c
2 changed files with 15 additions and 1 deletions
@@ -1,6 +1,6 @@
#pragma once
static const char *DASHBOARD_VERSION = "0.1.84-doubletap-helper-fix";
static const char *DASHBOARD_VERSION = "0.1.85-battery-nav-overlay";
// Update these if your Cargo ESP AP credentials are different.
static const char *CARGO_WIFI_SSID = "OverlandController";
@@ -580,6 +580,19 @@ static void add_doubletap_nav_target(lv_obj_t *obj, DashboardScreen target)
lv_obj_add_event_cb(obj, battery_nav_doubletap_cb, LV_EVENT_SHORT_CLICKED, (void *)target);
}
static void add_doubletap_overlay(lv_obj_t *parent, int width, int height, DashboardScreen target)
{
lv_obj_t *overlay = lv_obj_create(parent);
lv_obj_set_size(overlay, width, height);
lv_obj_center(overlay);
lv_obj_set_style_bg_opa(overlay, LV_OPA_TRANSP, 0);
lv_obj_set_style_border_opa(overlay, LV_OPA_TRANSP, 0);
lv_obj_set_style_pad_all(overlay, 0, 0);
lv_obj_clear_flag(overlay, LV_OBJ_FLAG_SCROLLABLE);
lv_obj_add_flag(overlay, LV_OBJ_FLAG_CLICKABLE);
lv_obj_add_event_cb(overlay, battery_nav_doubletap_cb, LV_EVENT_RELEASED, (void *)target);
}
static void dashboard_root_event_cb(lv_event_t *event)
{
if (lv_event_get_code(event) != LV_EVENT_GESTURE) return;
@@ -694,6 +707,7 @@ static void create_battery_detail_screen()
add_doubletap_nav_target(battery_detail_status_label, SCREEN_OVERVIEW);
add_doubletap_nav_target(battery_detail_soc_label, SCREEN_OVERVIEW);
add_doubletap_nav_target(battery_detail_estimate_label, SCREEN_OVERVIEW);
add_doubletap_overlay(hero_card, 300, 500, SCREEN_OVERVIEW);
lv_obj_t *hint_label = nullptr;
make_detail_label(hero_card, &hint_label, "Double tap to return", &lv_font_montserrat_26, lv_color_hex(0x7D8996), 260, LV_ALIGN_BOTTOM_MID, 0, -28, LV_TEXT_ALIGN_CENTER);