dashboard: navigate battery detail by double tapping cards
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
static const char *DASHBOARD_VERSION = "0.1.80-page-switch-fix";
|
||||
static const char *DASHBOARD_VERSION = "0.1.81-battery-card-doubletap-nav";
|
||||
|
||||
// Update these if your Cargo ESP AP credentials are different.
|
||||
static const char *CARGO_WIFI_SSID = "OverlandController";
|
||||
|
||||
@@ -555,6 +555,13 @@ static String signed_float_text(float value, int decimals, const char *suffix)
|
||||
return text;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
static void dashboard_root_event_cb(lv_event_t *event)
|
||||
{
|
||||
if (lv_event_get_code(event) != LV_EVENT_GESTURE) return;
|
||||
@@ -661,12 +668,14 @@ static void create_battery_detail_screen()
|
||||
lv_obj_align(page_dots, LV_ALIGN_RIGHT_MID, -10, 0);
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
lv_obj_t *hint_label = nullptr;
|
||||
make_detail_label(hero_card, &hint_label, "Swipe left for main dashboard", &lv_font_montserrat_26, lv_color_hex(0x7D8996), 260, LV_ALIGN_BOTTOM_MID, 0, -28, LV_TEXT_ALIGN_CENTER);
|
||||
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);
|
||||
|
||||
create_battery_metric_tile(screen, "Voltage", &battery_detail_voltage_label, 356, 78);
|
||||
create_battery_metric_tile(screen, "Current", &battery_detail_current_label, 670, 78);
|
||||
|
||||
Reference in New Issue
Block a user