From 20d3a7d0ca16e62356100a59731a5220197422bd Mon Sep 17 00:00:00 2001 From: "Schoenberger, Philipp" Date: Tue, 16 Apr 2019 21:30:06 +0200 Subject: [PATCH] improve menu behaviour --- remote/src/state_menu.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/remote/src/state_menu.cpp b/remote/src/state_menu.cpp index fe60e7a..799057f 100644 --- a/remote/src/state_menu.cpp +++ b/remote/src/state_menu.cpp @@ -20,13 +20,13 @@ void LCD_state_menu::enter(void) { void LCD_state_menu::update(void) { - struct { + struct menu_entry { char name[15]; State * state; } menus[] = { { "Flight ", s_fly }, { "Bind ", s_bind }, -#ifdef ENABLE_DBEUG +#ifndef ENABLE_DBEUG { "Joy usb ", s_usb}, #endif { "Joy calib ", s_joy }, @@ -48,8 +48,8 @@ void LCD_state_menu::update(void) if (false == input.is_centered(Input::MENU_UP_DOWN)) { if (input.is_low(Input::MENU_UP_DOWN)){ this->curr_selected +=1; - if ( this->curr_selected > 4) - this->curr_selected = 4; + if ( this->curr_selected > sizeof(menus)/sizeof(menus[0])) + this->curr_selected = sizeof(menus)/sizeof(menus[0]); else wait = true; } @@ -80,7 +80,7 @@ void LCD_state_menu::update(void) } if(wait) - delay(1100); + delay(200); } void LCD_state_menu::leave(void)