Param interface fixes
authorNathael Pajani <nathael.pajani@ed3l.fr>
Mon, 10 Jul 2023 01:04:01 +0000 (03:04 +0200)
committerNathael Pajani <nathael.pajani@ed3l.fr>
Mon, 10 Jul 2023 01:04:01 +0000 (03:04 +0200)
v10/param.c

index 8337b21..f046fdf 100644 (file)
@@ -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;