dashboard: implement manual double tap navigation

This commit is contained in:
2026-06-15 23:14:15 -06:00
parent d18b3e3eee
commit c128add761
2 changed files with 15 additions and 5 deletions
@@ -557,9 +557,19 @@ static String signed_float_text(float value, int decimals, const char *suffix)
static void battery_nav_doubletap_cb(lv_event_t *event)
{
if (lv_event_get_code(event) != LV_EVENT_DOUBLE_CLICKED) return;
DashboardScreen target = (DashboardScreen)(intptr_t)lv_event_get_user_data(event);
show_dashboard_screen(target);
if (lv_event_get_code(event) != LV_EVENT_CLICKED) return;
static uint32_t last_click_ms = 0;
uint32_t now_ms = millis();
if (now_ms - last_click_ms <= 450) {
last_click_ms = 0;
DashboardScreen target = (DashboardScreen)(intptr_t)lv_event_get_user_data(event);
show_dashboard_screen(target);
return;
}
last_click_ms = now_ms;
}
static void dashboard_root_event_cb(lv_event_t *event)
@@ -669,7 +679,7 @@ static void create_battery_detail_screen()
lv_obj_t *hero_card = create_card(screen, "", 300, 500, LV_ALIGN_TOP_LEFT, 32, 78);
lv_obj_add_flag(hero_card, LV_OBJ_FLAG_CLICKABLE);
lv_obj_add_event_cb(hero_card, battery_nav_doubletap_cb, LV_EVENT_DOUBLE_CLICKED, (void *)SCREEN_OVERVIEW);
lv_obj_add_event_cb(hero_card, battery_nav_doubletap_cb, LV_EVENT_CLICKED, (void *)SCREEN_OVERVIEW);
make_detail_label(hero_card, &battery_detail_status_label, "BMS --", &lv_font_montserrat_26, lv_color_hex(0xB8C0C8), 260, LV_ALIGN_TOP_MID, 0, 30, LV_TEXT_ALIGN_CENTER);
make_detail_label(hero_card, &battery_detail_soc_label, "--%", &lv_font_montserrat_48, lv_color_hex(0xFFFFFF), 260, LV_ALIGN_TOP_MID, 0, 126, LV_TEXT_ALIGN_CENTER);
make_detail_label(hero_card, &battery_detail_estimate_label, "--", &lv_font_montserrat_30, lv_color_hex(0xDDE3EA), 260, LV_ALIGN_TOP_MID, 0, 236, LV_TEXT_ALIGN_CENTER);