/* * Authors (alphabetical order) * - Andre Bernet * - Andreas Weitl * - Bertrand Songis * - Bryan J. Rentoul (Gruvin) * - Cameron Weeks * - Erez Raviv * - Gabriel Birkus * - Jean-Pierre Parisy * - Karl Szmutny * - Michael Blandford * - Michal Hlavinka * - Pat Mackenzie * - Philip Moss * - Rob Thomson * - Romolo Manfredini * - Thomas Husterer * * opentx is based on code named * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, * er9x by Erez Raviv: http://code.google.com/p/er9x/, * and the original (and ongoing) project by * Thomas Husterer, th9x: http://code.google.com/p/th9x/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #ifndef _MENUS_H_ #define _MENUS_H_ #define NO_HI_LEN 25 #define MENUS_SCROLLBAR_WIDTH 0 #define MENU_COLUMNS 1 #define COLUMN_X 0 #define lcd_putsColumnLeft(x, y, str) lcd_putsLeft(y, str) // Menus related stuff ... #if defined(SDCARD) typedef uint16_t vertpos_t; #else typedef uint8_t vertpos_t; #endif typedef uint8_t check_event_t; #define horzpos_t uint8_t #if defined(CPUARM) extern tmr10ms_t menuEntryTime; #endif extern vertpos_t m_posVert; extern horzpos_t m_posHorz; extern vertpos_t s_pgOfs; extern uint8_t s_noHi; extern uint8_t calibrationState; void menu_lcd_onoff(coord_t x, coord_t y, uint8_t value, LcdFlags attr); typedef void (*MenuFuncP)(uint8_t event); extern const MenuFuncP menuTabModel[]; extern const MenuFuncP menuTabGeneral[]; extern MenuFuncP g_menuStack[5]; extern uint8_t g_menuPos[4]; extern uint8_t g_menuStackPtr; extern uint8_t menuEvent; /// goto given Menu, but substitute current menu in menuStack void chainMenu(MenuFuncP newMenu); /// goto given Menu, store current menu in menuStack void pushMenu(MenuFuncP newMenu); /// return to last menu in menustack void popMenu(); ///deliver address of last menu which was popped from inline MenuFuncP lastPopMenu() { return g_menuStack[g_menuStackPtr+1]; } void drawPotsBars(); void doMainScreenGraphics(); void menuFirstCalib(uint8_t event); void onMainViewMenu(const char *result); void menuMainView(uint8_t event); void menuGeneralDiagAna(uint8_t event); #if defined(FRSKY) void menuTelemetryFrsky(uint8_t event); #endif void menuGeneralSetup(uint8_t event); void menuGeneralCalib(uint8_t event); void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext); void menuModelSelect(uint8_t event); void menuModelCustomFunctions(uint8_t event); void menuStatisticsView(uint8_t event); void menuStatisticsDebug(uint8_t event); void menuAboutView(uint8_t event); #if defined(DEBUG_TRACE_BUFFER) void menuTraceBuffer(uint8_t event); #endif #if !defined(CPUM64) void drawSlider(coord_t x, coord_t y, uint8_t value, uint8_t max, uint8_t attr); #elif defined(GRAPHICS) void display5posSlider(coord_t x, coord_t y, uint8_t value, uint8_t attr); #define drawSlider(x, y, value, max, attr) lcd_outdezAtt(x, y, value, attr|LEFT) #else #define drawSlider(x, y, value, max, attr) lcd_outdezAtt(x, y, value, attr|LEFT) #endif #if defined(NAVIGATION_POT1) extern int16_t p1valdiff; #else #define p1valdiff 0 #endif #if defined(NAVIGATION_POT2) extern int8_t p2valdiff; #else #define p2valdiff 0 #endif extern int8_t checkIncDec_Ret; // global helper vars #define EDIT_SELECT_MENU -1 #define EDIT_SELECT_FIELD 0 #define EDIT_MODIFY_FIELD 1 #define EDIT_MODIFY_STRING 2 extern int8_t s_editMode; // global editmode // checkIncDec flags #define EE_GENERAL 0x01 #define EE_MODEL 0x02 #define NO_INCDEC_MARKS 0x04 #define INCDEC_SWITCH 0x08 #define INCDEC_SOURCE 0x10 #define INCDEC_REP10 0x40 #define NO_DBLKEYS 0x80 // mawrow special values #define TITLE_ROW ((uint8_t)-1) #define HIDDEN_ROW ((uint8_t)-2) #if defined(CPUARM) struct CheckIncDecStops { const int count; const int stops[]; int min() const { return stops[0]; } int max() const { return stops[count-1]; } bool contains(int value) const { for (int i=0; i= 0x0e) #define CASE_EVT_ROTARY_BREAK case EVT_ROTARY_BREAK: #define CASE_EVT_ROTARY_LONG case EVT_ROTARY_LONG: #define CASE_EVT_ROTARY_LEFT case EVT_ROTARY_LEFT: #define CASE_EVT_ROTARY_RIGHT case EVT_ROTARY_RIGHT: void repeatLastCursorMove(uint8_t event); #define REPEAT_LAST_CURSOR_MOVE() { if (EVT_KEY_MASK(event) >= 0x0e) putEvent(event); else repeatLastCursorMove(event); } #define MOVE_CURSOR_FROM_HERE() if (m_posHorz > 0) REPEAT_LAST_CURSOR_MOVE() #else #define IS_ROTARY_LEFT(evt) (0) #define IS_ROTARY_RIGHT(evt) (0) #define IS_ROTARY_BREAK(evt) (0) #define IS_ROTARY_LONG(evt) (0) #define IS_ROTARY_EVENT(evt) (0) #define CASE_EVT_ROTARY_BREAK #define CASE_EVT_ROTARY_LONG #define CASE_EVT_ROTARY_LEFT #define CASE_EVT_ROTARY_RIGHT void repeatLastCursorMove(uint8_t event); #define REPEAT_LAST_CURSOR_MOVE() repeatLastCursorMove(event) #define MOVE_CURSOR_FROM_HERE() REPEAT_LAST_CURSOR_MOVE() #endif #define POS_HORZ_INIT(posVert) 0 #define EDIT_MODE_INIT -1 typedef int16_t (*FnFuncP) (int16_t x); void DrawFunction(FnFuncP fn, uint8_t offset=0); #endif // _MENUS_H_