Bsongis/menus refactoring (#6463)

Menus refactoring
This commit is contained in:
Bertrand Songis
2019-05-29 16:04:09 +02:00
committed by GitHub
parent 1b71b7fcbc
commit 670e101fa5
36 changed files with 845 additions and 684 deletions
+1 -32
View File
@@ -22,42 +22,16 @@
#define _MENUS_H_
#include "keys.h"
#include "common/stdlcd/menus.h"
#if defined(PCBTARANIS)
typedef int8_t horzpos_t;
#define NAVIGATION_LINE_BY_LINE 0x40
#define IS_LINE_SELECTED(sub, k) ((sub)==(k) && menuHorizontalPosition < 0)
#else
typedef uint8_t horzpos_t;
#define NAVIGATION_LINE_BY_LINE 0
#define IS_LINE_SELECTED(sub, k) (false)
#endif
#if defined(SDCARD)
typedef uint16_t vertpos_t;
#else
typedef uint8_t vertpos_t;
#endif
typedef void (*MenuHandlerFunc)(event_t event);
extern tmr10ms_t menuEntryTime;
extern vertpos_t menuVerticalPosition;
extern horzpos_t menuHorizontalPosition;
extern vertpos_t menuVerticalOffset;
extern uint8_t menuCalibrationState;
extern MenuHandlerFunc menuHandlers[5];
extern uint8_t menuVerticalPositions[4];
extern uint8_t menuLevel;
extern uint8_t menuEvent;
void chainMenu(MenuHandlerFunc newMenu);
void pushMenu(MenuHandlerFunc newMenu);
void popMenu();
void abortPopMenu();
inline bool isRadioMenuDisplayed()
{
return menuVerticalPositions[0] == 1;
@@ -68,11 +42,6 @@ inline bool isModelMenuDisplayed()
return menuVerticalPositions[0] == 0;
}
inline MenuHandlerFunc lastPopMenu()
{
return menuHandlers[menuLevel+1];
}
void onMainViewMenu(const char * result);
void menuFirstCalib(event_t event);
void menuMainView(event_t event);