/* * 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_ #include "../../keys.h" #define NO_HI_LEN 25 #if defined(TRANSLATIONS_FR) #define MENU_COLUMNS 1 #define COLUMN_X 0 #else #define MENU_COLUMNS 2 #endif #define MENU_COLUMN2_X 280 #define lcd_putsColumnLeft(x, y, str) lcd_puts((x > MENU_COLUMN2_X+MENUS_MARGIN_LEFT+68) ? MENU_COLUMN2_X+MENUS_MARGIN_LEFT : MENUS_MARGIN_LEFT, y, str) typedef int16_t vertpos_t; typedef evt_t & check_event_t; #define horzpos_t int8_t extern uint8_t menuPageIndex; extern uint8_t menuPageCount; extern uint16_t linesCount; 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 drawCheckBox(coord_t x, coord_t y, uint8_t value, LcdFlags attr); typedef void (*MenuFuncP)(evt_t event); typedef void (*MenuFuncP_PROGMEM)(evt_t event); extern const MenuFuncP_PROGMEM menuTabModel[]; extern const MenuFuncP_PROGMEM menuTabGeneral[]; extern MenuFuncP g_menuStack[5]; extern uint8_t g_menuPos[4]; extern uint8_t g_menuStackPtr; extern evt_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(); void menuFirstCalib(evt_t event); void onMainViewMenu(const char *result); void menuMainView(evt_t event); void menuGeneralDiagAna(evt_t event); void menuTelemetryFrsky(evt_t event); void menuGeneralSetup(evt_t event); void menuGeneralCalib(evt_t event); void menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunctionsContext & functionsContext); void menuModelSelect(evt_t event); void menuModelSetup(evt_t event); void menuModelCustomFunctions(evt_t event); void menuStatisticsView(evt_t event); void menuStatisticsDebug(evt_t event); void menuAboutView(evt_t event); #if defined(DEBUG_TRACE_BUFFER) void menuTraceBuffer(evt_t event); #endif void drawSlider(coord_t x, coord_t y, uint8_t value, uint8_t max, uint8_t attr); void menuMainViewChannelsMonitor(evt_t event); void menuChannelsView(evt_t event); 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) 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 0) REPEAT_LAST_CURSOR_MOVE() #define MENU_FIRST_LINE_EDIT (MAXCOL((uint16_t)0) >= HIDDEN_ROW ? (MAXCOL((uint16_t)1) >= HIDDEN_ROW ? 2 : 1) : 0) #define POS_HORZ_INIT(posVert) ((COLATTR(posVert) & NAVIGATION_LINE_BY_LINE) ? -1 : 0) #define EDIT_MODE_INIT 0 // TODO enum typedef int (*FnFuncP) (int x); void DrawFunction(FnFuncP fn, int offset=0); #endif // _MENUS_H_