From: Nathael Pajani Date: Mon, 10 Jul 2023 01:04:01 +0000 (+0200) Subject: Param interface fixes X-Git-Url: http://git.techno-innov.fr/?a=commitdiff_plain;h=6ddce6fbf955ff61b33ab18c6f5a59b77b7b6f4f;p=soft%2Flpc122x%2Fscialys Param interface fixes --- diff --git a/v10/param.c b/v10/param.c index 8337b21..f046fdf 100644 --- a/v10/param.c +++ b/v10/param.c @@ -202,7 +202,7 @@ int config_interface_handle(void) } if (current_entry >= NB_MENU) { current_entry = 1; - } else if (current_entry == 0) { + } else if (current_entry == 0) { /* For this one, first menu_title is "config" */ current_entry = NB_MENU - 1; } /* Enter sub-menu */ @@ -437,10 +437,10 @@ int config_interface_handle(void) if (button & BUTTON_DOWN) { auto_force_cur_entry += 1; } - if (auto_force_cur_entry >= AUTO_FORCE_NB_MENU) { - auto_force_cur_entry = 0; - } else if (auto_force_cur_entry == 0xFF) { + if (auto_force_cur_entry == 0xFF) { auto_force_cur_entry = AUTO_FORCE_NB_MENU - 1; + } else if (auto_force_cur_entry >= AUTO_FORCE_NB_MENU) { + auto_force_cur_entry = 0; } if (button & (BUTTON_OK | BUTTON_RIGHT)) { auto_force_cur_menu = auto_force_cur_entry; @@ -582,10 +582,10 @@ int config_interface_handle(void) if (button & BUTTON_DOWN) { manual_force_cur_entry += 1; } - if (manual_force_cur_entry >= MANUAL_FORCE_NB_MENU) { - manual_force_cur_entry = 0; - } else if (manual_force_cur_entry == 0xFF) { + if (manual_force_cur_entry == 0xFF) { manual_force_cur_entry = MANUAL_FORCE_NB_MENU - 1; + } else if (manual_force_cur_entry >= MANUAL_FORCE_NB_MENU) { + manual_force_cur_entry = 0; } if (button & (BUTTON_OK | BUTTON_RIGHT)) { manual_force_cur_menu = manual_force_cur_entry; @@ -692,10 +692,10 @@ int config_interface_handle(void) if (button & BUTTON_DOWN) { conf_cur_entry += 1; } - if (conf_cur_entry >= CONF_NB_MENU) { - conf_cur_entry = 0; - } else if (conf_cur_entry == 0xFF) { + if (conf_cur_entry == 0xFF) { conf_cur_entry = CONF_NB_MENU - 1; + } else if (conf_cur_entry >= CONF_NB_MENU) { + conf_cur_entry = 0; } if (button & (BUTTON_OK | BUTTON_RIGHT)) { conf_cur_menu = conf_cur_entry;