From 13de355800db93be642340515edeb87a4790c6dc Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Fri, 1 Nov 2019 08:01:34 +0100 Subject: [PATCH] In MENU_EDIT mode now the left encoder works as "back" button. --- UI.hpp | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/UI.hpp b/UI.hpp index b9012af..6e87878 100644 --- a/UI.hpp +++ b/UI.hpp @@ -455,15 +455,7 @@ void lcdml_menu_control(void) } else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_R]) >= g_LCDML_CONTROL_button_long_press) { - LCDML.BT_quit(); - if (menu_state == MENU_EDIT) - { - LCDML.BT_quit(); - } - else if (menu_state == MENU_VOICE) - { - encoder_right_button_long(); - } + encoder_right_button_long(); } else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_R]) >= g_LCDML_CONTROL_button_short_press) { @@ -662,10 +654,9 @@ void encoder_right_down(void) void encoder_right_button_long(void) { #ifdef DEBUG - Serial.println(F("State: MENU_VOICE, button long press")); -#else - ; + Serial.println(F("Encoder right long press")); #endif + LCDML.BT_quit(); } void encoder_right_button_short(void) @@ -724,9 +715,17 @@ void encoder_left_button_long(void) { #ifdef DEBUG Serial.println(F("Encoder left long press")); -#else - ; #endif + if (menu_state == MENU_EDIT) + { + menu_state = MENU_VOICE; + UI_func_voice_selection(0); + } + else if (menu_state == MENU_VOICE) + { + menu_state = MENU_EDIT; + LCDML.MENU_goRoot(); + } } void encoder_left_button_short(void) @@ -736,8 +735,8 @@ void encoder_left_button_short(void) #endif if (menu_state == MENU_EDIT) { - menu_state = MENU_VOICE; - UI_func_voice_selection(0); + //LCDML.FUNC_goBackToMenu(); + LCDML.BT_quit(); } else if (menu_state == MENU_VOICE) {