Fix possible error in menu implementation

This commit is contained in:
Mario Hüttel 2020-06-04 21:47:31 +02:00
parent 92c0c5cd8c
commit fc2372f754
2 changed files with 4 additions and 3 deletions

View File

@ -24,7 +24,6 @@
#include <stdint.h>
#include <reflow-controller/button.h>
#include <stdbool.h>
#include <reflow-controller/ui/lcd.h>
struct lcd_menu;

View File

@ -31,13 +31,15 @@ void menu_handle(struct lcd_menu *menu, uint16_t rotary_encoder_delta, enum butt
menu->inputs.push_button = push_button;
menu->inputs.rotary_encoder_delta = rotary_encoder_delta;
if (menu->active_entry == NULL)
menu->active_entry = menu->root_entry;
tmp = menu->active_entry;
if (menu->active_entry_type == MENU_ENTRY_FIRST_ENTER) {
if (menu->active_entry)
menu->active_entry(menu, menu->active_entry_type, menu->init_parent);
} else {
if (menu->active_entry)
menu->active_entry(menu, menu->active_entry_type, NULL);
}