Skip to content

Commit 265daab

Browse files
Fix missing button up unregister
1 parent e0b3873 commit 265daab

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

firmware/src/screens/menu_screen.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@ void add_main_menu_navigation_buttons(lv_obj_t *body_item) {
7878

7979
for (uint32_t i = 0; i < total_buttons; i++) {
8080
lv_obj_t *item = NULL;
81+
8182
if (lv_obj_get_child_cnt(body_item) > i) {
8283
item = lv_obj_get_child(body_item, i);
84+
8385
if (item == NULL) {
8486
item = lv_btn_create(body_item);
8587
}
@@ -104,20 +106,24 @@ void add_main_menu_navigation_buttons(lv_obj_t *body_item) {
104106
if (button_entries[i].short_press) {
105107
lv_obj_add_event_cb(item, button_entries[i].short_press, LV_EVENT_CLICKED, NULL);
106108
}
109+
107110
if (button_entries[i].long_press) {
108111
lv_obj_add_event_cb(item, button_entries[i].long_press, LV_EVENT_LONG_PRESSED, NULL);
109112
}
113+
110114
if (button_entries[i].down) {
111115
lv_obj_add_event_cb(item, button_entries[i].down, LV_EVENT_PRESSED, NULL);
112116
}
113117

114118
lv_obj_t *label = NULL;
119+
115120
if (lv_obj_get_child_cnt(item) > 0) {
116121
label = lv_obj_get_child(item, 0);
117122
}
118123
else {
119124
label = lv_label_create(item);
120125
}
126+
121127
lv_obj_set_width(label, LV_SIZE_CONTENT);
122128
lv_obj_set_height(label, LV_SIZE_CONTENT);
123129
lv_obj_set_align(label, LV_ALIGN_CENTER);

firmware/src/screens/stats_screen.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,9 @@ static bool button_long_press_handler() {
609609

610610
static bool button_up_handler() {
611611
ESP_LOGI(TAG, "Stats screen button up");
612+
612613
long_press_handled = false;
614+
613615
return true;
614616
}
615617

@@ -645,10 +647,13 @@ void stats_screen_loaded(lv_event_t *e) {
645647

646648
void stats_screen_unload_start(lv_event_t *e) {
647649
ESP_LOGI(TAG, "Stats screen unload start");
650+
648651
stats_unregister_update_cb(stats_update_screen_display);
652+
649653
unregister_primary_button_cb(BUTTON_EVENT_PRESS);
650654
unregister_primary_button_cb(BUTTON_EVENT_DOUBLE_PRESS);
651655
unregister_primary_button_cb(BUTTON_EVENT_LONG_PRESS_HOLD);
656+
unregister_primary_button_cb(BUTTON_EVENT_UP);
652657
}
653658

654659
bool proceed_with_gesture() {

0 commit comments

Comments
 (0)