Another big refactoring

This commit is contained in:
Bertrand Songis
2016-08-02 22:15:29 +02:00
parent 52435703a0
commit 7fbd963b3f
140 changed files with 1311 additions and 1292 deletions
+7 -2
View File
@@ -75,11 +75,13 @@
#if defined(FLIGHT_MODES)
void displayFlightModes(coord_t x, coord_t y, FlightModesType value, uint8_t attr);
FlightModesType editFlightModes(coord_t x, coord_t y, evt_t event, FlightModesType value, uint8_t attr);
FlightModesType editFlightModes(coord_t x, coord_t y, event_t event, FlightModesType value, uint8_t attr);
#else
#define displayFlightModes(...)
#define displayFlightModes(...)
#endif
#define ALERT_SOUND_ARG , uint8_t sound
// Curve functions
coord_t getCurveYCoord(FnFuncP fn, int x, int width);
void drawFunction(FnFuncP fn, int offset);
@@ -91,6 +93,9 @@ void drawCurvePoint(int x, int y, LcdFlags color);
extern Layout * customScreens[MAX_CUSTOM_SCREENS];
extern Topbar * topbar;
void drawAlertBox(const char * title, const char * text, const char * action);
void showAlertBox(const pm_char * title, const pm_char * text, const char * action, uint8_t sound);
#define IS_MAIN_VIEW_DISPLAYED() menuHandlers[0] == menuMainView
#define IS_TELEMETRY_VIEW_DISPLAYED() false
#define IS_OTHER_VIEW_DISPLAYED() false
+6 -6
View File
@@ -32,20 +32,20 @@ const MenuHandlerFunc menuTabModel[] = {
CASE_GVARS(menuModelGVars)
#endif
menuModelLogicalSwitches,
menuModelCustomFunctions,
menuModelSpecialFunctions,
#if defined(LUA_MODEL_SCRIPTS)
menuModelCustomScripts,
#endif
CASE_FRSKY(menuModelTelemetry)
CASE_MAVLINK(menuTelemetryMavlinkSetup)
CASE_FRSKY(menuModelTelemetryFrsky)
CASE_MAVLINK(menuModelTelemetryMavlink)
CASE_TEMPLATES(menuModelTemplates)
};
extern uint8_t s_curveChan;
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, evt_t event, uint8_t attr);
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, uint8_t attr);
uint8_t editDelay(const coord_t x, const coord_t y, const evt_t event, const uint8_t attr, uint8_t delay)
uint8_t editDelay(const coord_t x, const coord_t y, const event_t event, const uint8_t attr, uint8_t delay)
{
lcdDrawNumber(x+MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT);
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, delay, DELAY_MAX);
@@ -60,7 +60,7 @@ uint8_t s_copySrcCh;
uint8_t editNameCursorPos = 0;
void editName(coord_t x, coord_t y, char * name, uint8_t size, evt_t event, uint8_t active, LcdFlags flags)
void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, uint8_t active, LcdFlags flags)
{
if (active && s_editMode <= 0) {
flags |= INVERS;
+9 -9
View File
@@ -21,16 +21,16 @@
#include "opentx.h"
const MenuHandlerFunc menuTabGeneral[] = {
menuGeneralSetup,
menuGeneralSdManager,
menuGeneralCustomFunctions,
menuGeneralTrainer,
menuGeneralHardware,
menuGeneralVersion,
menuRadioSetup,
menuRadioSdManager,
menuRadioSpecialFunctions,
menuRadioTrainer,
menuRadioHardware,
menuRadioVersion,
};
bool menuGeneralCustomFunctions(evt_t event)
bool menuRadioSpecialFunctions(event_t event)
{
MENU(STR_MENUGLOBALFUNCS, RADIO_ICONS, menuTabGeneral, e_GeneralCustomFunctions, NUM_CFN, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ });
return menuCustomFunctions(event, g_eeGeneral.customFn, globalFunctionsContext);
MENU(STR_MENUSPECIALFUNCS, RADIO_ICONS, menuTabGeneral, MENU_RADIO_SPECIAL_FUNCTIONS, NUM_CFN, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ });
return menuSpecialFunctions(event, g_eeGeneral.customFn, globalFunctionsContext);
}
+3 -3
View File
@@ -21,7 +21,7 @@
#include "opentx.h"
MenuHandlerFunc menuHandlers[5];
evt_t menuEvent = 0;
event_t menuEvent = 0;
uint8_t menuVerticalPositions[4];
uint8_t menuLevel = 0;
@@ -47,7 +47,7 @@ void pushMenu(MenuHandlerFunc newMenu)
killEvents(KEY_ENTER);
if (menuLevel == 0) {
if (newMenu == menuGeneralSetup)
if (newMenu == menuRadioSetup)
menuVerticalPositions[0] = 1;
if (newMenu == menuModelSetup)
menuVerticalPositions[0] = 0;
@@ -66,7 +66,7 @@ void pushMenu(MenuHandlerFunc newMenu)
TRACE("pushMenu(%d, %p)", menuLevel, newMenu);
}
bool menuModelNotes(evt_t event)
bool menuModelNotes(event_t event)
{
if (event == EVT_ENTRY) {
strcpy(s_text_file, MODELS_PATH "/");
+76 -79
View File
@@ -24,13 +24,10 @@
#include "keys.h"
#define MENU_COLUMNS 2
#define MENU_COLUMN2_X 280
#define MIXES_2ND_COLUMN 140
#define COLUMN_HEADER_X 150
typedef evt_t & check_event_t;
extern uint8_t menuPageIndex;
extern uint8_t menuPageCount;
extern uint16_t linesCount;
@@ -44,12 +41,12 @@ extern uint8_t noHighlightCounter;
#define NO_HIGHLIGHT() (noHighlightCounter > 0)
#define START_NO_HIGHLIGHT() do { noHighlightCounter = 25; } while(0)
typedef bool (*MenuHandlerFunc)(evt_t event);
typedef bool (*MenuHandlerFunc)(event_t event);
extern MenuHandlerFunc menuHandlers[5];
extern uint8_t menuVerticalPositions[4];
extern uint8_t menuLevel;
extern evt_t menuEvent;
extern event_t menuEvent;
/// goto given Menu, but substitute current menu in menuStack
void chainMenu(MenuHandlerFunc newMenu);
@@ -104,21 +101,21 @@ enum MenuIcons {
};
enum EnumTabModel {
e_ModelSetup,
CASE_HELI(e_Heli)
CASE_FLIGHT_MODES(e_FlightModesAll)
e_InputsAll,
e_MixAll,
e_Limits,
CASE_CURVES(e_CurvesAll)
CASE_GVARS(e_GVars)
e_LogicalSwitches,
e_CustomFunctions,
MENU_MODEL_SETUP,
CASE_HELI(MENU_MODEL_HELI)
CASE_FLIGHT_MODES(MENU_MODEL_FLIGHT_MODES)
MENU_MODEL_INPUTS,
MENU_MODEL_MIXES,
MENU_MODEL_OUTPUTS,
CASE_CURVES(MENU_MODEL_CURVES)
CASE_GVARS(MENU_MODEL_GVARS)
MENU_MODEL_LOGICAL_SWITCHES,
MENU_MODEL_SPECIAL_FUNCTIONS,
#if defined(LUA_MODEL_SCRIPTS)
e_CustomScripts,
MENU_MODEL_CUSTOM_SCRIPTS,
#endif
CASE_FRSKY(e_Telemetry)
e_TabModelPagesCount
CASE_FRSKY(MENU_MODEL_TELEMETRY_FRSKY)
MENU_MODEL_PAGES_COUNT
};
const uint8_t RADIO_ICONS[] = {
@@ -168,44 +165,44 @@ const uint8_t MONITOR_ICONS[] = {
ICON_MONITOR_LOGICAL_SWITCHES
};
bool menuModelSetup(evt_t event);
bool menuModelHeli(evt_t event);
bool menuModelFlightModesAll(evt_t event);
bool menuModelExposAll(evt_t event);
bool menuModelMixAll(evt_t event);
bool menuModelLimits(evt_t event);
bool menuModelCurvesAll(evt_t event);
bool menuModelCurveOne(evt_t event);
bool menuModelGVars(evt_t event);
bool menuModelLogicalSwitches(evt_t event);
bool menuModelCustomFunctions(evt_t event);
bool menuModelCustomScripts(evt_t event);
bool menuModelTelemetry(evt_t event);
bool menuModelExpoOne(evt_t event);
bool menuModelSetup(event_t event);
bool menuModelHeli(event_t event);
bool menuModelFlightModesAll(event_t event);
bool menuModelExposAll(event_t event);
bool menuModelMixAll(event_t event);
bool menuModelLimits(event_t event);
bool menuModelCurvesAll(event_t event);
bool menuModelCurveOne(event_t event);
bool menuModelGVars(event_t event);
bool menuModelLogicalSwitches(event_t event);
bool menuModelSpecialFunctions(event_t event);
bool menuModelCustomScripts(event_t event);
bool menuModelTelemetryFrsky(event_t event);
bool menuModelExpoOne(event_t event);
extern const MenuHandlerFunc menuTabModel[e_TabModelPagesCount];
extern const MenuHandlerFunc menuTabModel[MENU_MODEL_PAGES_COUNT];
enum EnumTabRadio {
e_Setup,
e_Sd,
e_GeneralCustomFunctions,
e_Trainer,
e_Hardware,
e_Vers,
e_TabRadioPagesCount
MENU_RADIO_SETUP,
MENU_RADIO_SD_MANAGER,
MENU_RADIO_SPECIAL_FUNCTIONS,
MENU_RADIO_TRAINER,
MENU_RADIO_HARDWARE,
MENU_RADIO_VERSION,
MENU_RADIO_PAGES_COUNT
};
bool menuGeneralSetup(evt_t event);
bool menuGeneralSdManager(evt_t event);
bool menuGeneralCustomFunctions(evt_t event);
bool menuGeneralTrainer(evt_t event);
bool menuGeneralVersion(evt_t event);
bool menuGeneralHardware(evt_t event);
bool menuGeneralCalib(evt_t event);
bool menuRadioSetup(event_t event);
bool menuRadioSdManager(event_t event);
bool menuRadioSpecialFunctions(event_t event);
bool menuRadioTrainer(event_t event);
bool menuRadioVersion(event_t event);
bool menuRadioHardware(event_t event);
bool menuRadioCalibration(event_t event);
extern const MenuHandlerFunc menuTabGeneral[e_TabRadioPagesCount];
extern const MenuHandlerFunc menuTabGeneral[MENU_RADIO_PAGES_COUNT];
enum EnumTabDiag
enum MenuRadioIndexes
{
e_StatsGraph,
e_StatsDebug,
@@ -215,10 +212,10 @@ enum EnumTabDiag
#endif
};
bool menuStatsGraph(evt_t event);
bool menuStatsDebug(evt_t event);
bool menuStatsAnalogs(evt_t event);
bool menuStatsTraces(evt_t event);
bool menuStatsGraph(event_t event);
bool menuStatsDebug(event_t event);
bool menuStatsAnalogs(event_t event);
bool menuStatsTraces(event_t event);
static const MenuHandlerFunc menuTabStats[] PROGMEM = {
menuStatsGraph,
@@ -247,14 +244,14 @@ extern void drawSingleOutputBar(coord_t, coord_t, coord_t, coord_t, uint8_t);
extern const MenuHandlerFunc menuTabScreensSetup[1+MAX_CUSTOM_SCREENS] PROGMEM;
bool menuFirstCalib(evt_t event);
bool menuMainView(evt_t event);
bool menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunctionsContext & functionsContext);
bool menuModelSelect(evt_t event);
bool menuAboutView(evt_t event);
bool menuMainViewChannelsMonitor(evt_t event);
bool menuTextView(evt_t event);
bool menuScreensTheme(evt_t event);
bool menuFirstCalib(event_t event);
bool menuMainView(event_t event);
bool menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomFunctionsContext & functionsContext);
bool menuModelSelect(event_t event);
bool menuAboutView(event_t event);
bool menuMainViewChannelsMonitor(event_t event);
bool menuTextView(event_t event);
bool menuScreensTheme(event_t event);
typedef uint16_t FlightModesType;
@@ -315,7 +312,7 @@ extern const CheckIncDecStops &stopsSwitch;
#define CATEGORY_END(val) \
(val), (val+1)
int checkIncDec(evt_t event, int val, int i_min, int i_max, unsigned int i_flags=0, IsValueAvailable isValueAvailable=NULL, const CheckIncDecStops &stops=stops100);
int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_flags=0, IsValueAvailable isValueAvailable=NULL, const CheckIncDecStops &stops=stops100);
swsrc_t checkIncDecMovedSwitch(swsrc_t val);
#define checkIncDecModel(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_MODEL)
#define checkIncDecModelZero(event, i_val, i_max) checkIncDec(event, i_val, 0, i_max, EE_MODEL)
@@ -351,10 +348,10 @@ swsrc_t checkIncDecMovedSwitch(swsrc_t val);
#define CHECK_INCDEC_PARAM(event, var, min, max) \
checkIncDec(event, var, min, max, incdecFlag, isValueAvailable)
int8_t navigate(evt_t event, int count, int rows, int columns=1, bool loop=true);
bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, int maxrow, uint8_t flags=0);
bool check_simple(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, int maxrow);
bool check_submenu_simple(check_event_t event, uint8_t maxrow);
int8_t navigate(event_t event, int count, int rows, int columns=1, bool loop=true);
bool check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, int maxrow, uint8_t flags=0);
bool check_simple(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, int maxrow);
bool check_submenu_simple(event_t event, uint8_t maxrow);
#define MENU_TAB(...) const uint8_t mstate_tab[] = __VA_ARGS__
@@ -404,8 +401,8 @@ bool check_submenu_simple(check_event_t event, uint8_t maxrow);
typedef int select_menu_value_t;
select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char * values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, evt_t event);
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, LcdFlags attr, evt_t event);
select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char * values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, event_t event);
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, LcdFlags attr, event_t event);
#if defined(GVARS)
#define GVAR_MENU_ITEM(x, y, v, min, max, lcdattr, editflags, event) editGVarFieldValue(x, y, v, min, max, lcdattr, editflags, event)
@@ -414,18 +411,18 @@ uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, LcdFlags attr, evt_t e
#endif
#if defined(GVARS)
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, evt_t event);
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, event_t event);
#define displayGVar(x, y, v, min, max) GVAR_MENU_ITEM(x, y, v, min, max, 0, 0, 0)
#else
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, evt_t event);
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, event_t event);
#define displayGVar(x, y, v, min, max) lcdDrawNumber(x, y, v)
#endif
extern uint8_t editNameCursorPos;
void editName(coord_t x, coord_t y, char *name, uint8_t size, evt_t event, uint8_t active, LcdFlags flags=ZCHAR);
void editName(coord_t x, coord_t y, char *name, uint8_t size, event_t event, uint8_t active, LcdFlags flags=ZCHAR);
uint8_t editDelay(const coord_t x, const coord_t y, const evt_t event, const uint8_t attr, uint8_t delay);
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, evt_t event, uint8_t attr);
uint8_t editDelay(const coord_t x, const coord_t y, const event_t event, const uint8_t attr, uint8_t delay);
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, uint8_t attr);
extern uint8_t s_curveChan;
@@ -472,18 +469,18 @@ void insertMix(uint8_t idx);
void copySelection(char * dst, const char * src, uint8_t size);
void displayPopup(const char * title);
void displayWarning(evt_t event);
void showMessageBox(const char * title);
void runPopupWarning(event_t event);
extern void (* popupFunc)(evt_t event);
extern void (* popupFunc)(event_t event);
extern int16_t warningInputValue;
extern int16_t warningInputValueMin;
extern int16_t warningInputValueMax;
extern uint8_t warningInfoFlags;
#define DISPLAY_WARNING (*popupFunc)
#define POPUP_WARNING(s) (warningType = WARNING_TYPE_ASTERISK, warningText = s, warningInfoText = 0, popupFunc = displayWarning)
#define POPUP_CONFIRMATION(s) (warningText = s, warningType = WARNING_TYPE_CONFIRM, warningInfoText = 0, popupFunc = displayWarning)
#define POPUP_WARNING(s) (warningType = WARNING_TYPE_ASTERISK, warningText = s, warningInfoText = 0, popupFunc = runPopupWarning)
#define POPUP_CONFIRMATION(s) (warningText = s, warningType = WARNING_TYPE_CONFIRM, warningInfoText = 0, popupFunc = runPopupWarning)
#define POPUP_INPUT(s, func, start, min, max) (warningText = s, warningType = WARNING_TYPE_INPUT, popupFunc = func, warningInputValue = start, warningInputValueMin = min, warningInputValueMax = max)
#define WARNING_INFO_FLAGS warningInfoFlags
#define SET_WARNING_INFO(info, len, flags) (warningInfoText = info, warningInfoLength = len, warningInfoFlags = flags)
@@ -503,7 +500,7 @@ enum {
MENU_OFFSET_EXTERNAL
};
extern uint8_t popupMenuOffsetType;
const char * runPopupMenu(evt_t event);
const char * runPopupMenu(event_t event);
extern void (*popupMenuHandler)(const char * result);
#define TEXT_FILENAME_MAXLEN 40
+6 -6
View File
@@ -86,9 +86,9 @@ void resetCustomCurveX(int8_t * points, int noPoints)
}
}
void displayPresetChoice(evt_t event)
void displayPresetChoice(event_t event)
{
displayWarning(event);
runPopupWarning(event);
lcdDrawNumber(WARNING_LINE_X, WARNING_INFOLINE_Y-10, 45*warningInputValue/4, LEFT|INVERS, 0, NULL, "@");
if (warningResult) {
@@ -140,7 +140,7 @@ enum MenuModelCurveOneItems {
ITEM_CURVE_COORDS2,
};
bool menuModelCurveOne(evt_t event)
bool menuModelCurveOne(event_t event)
{
static uint8_t pointsOfs = 0;
CurveData & crv = g_model.curves[s_curveChan];
@@ -312,7 +312,7 @@ bool menuModelCurveOne(evt_t event)
return true;
}
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, evt_t event, uint8_t attr)
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, uint8_t attr)
{
lcdDrawTextAtIndex(x, y, "\004DiffExpoFuncCstm", curve.type, (menuHorizontalPosition==0 ? attr : 0));
if (attr && menuHorizontalPosition==0) {
@@ -346,9 +346,9 @@ void editCurveRef(coord_t x, coord_t y, CurveRef & curve, evt_t event, uint8_t a
#define CURVES_NAME_POS 60
#define CURVES_POINTS_POS 120
bool menuModelCurvesAll(evt_t event)
bool menuModelCurvesAll(event_t event)
{
SIMPLE_MENU(STR_MENUCURVES, MODEL_ICONS, menuTabModel, e_CurvesAll, MAX_CURVES);
SIMPLE_MENU(STR_MENUCURVES, MODEL_ICONS, menuTabModel, MENU_MODEL_CURVES, MAX_CURVES);
int8_t sub = menuVerticalPosition;
@@ -47,7 +47,7 @@ enum menuModelCustomScriptItems {
#define SCRIPT_ONE_2ND_COLUMN_POS (120)
#define SCRIPT_ONE_3RD_COLUMN_POS (240)
bool menuModelCustomScriptOne(evt_t event)
bool menuModelCustomScriptOne(event_t event)
{
ScriptData &sd = g_model.scriptsData[s_currIdx];
@@ -122,12 +122,12 @@ bool menuModelCustomScriptOne(evt_t event)
#define SCRIPTS_COLUMN_NAME 160
#define SCRIPTS_COLUMN_STATE 300
bool menuModelCustomScripts(evt_t event)
bool menuModelCustomScripts(event_t event)
{
// lcdDrawNumber(19*FW, 0, luaGetMemUsed(), 0);
// lcdDrawText(19*FW+1, 0, STR_BYTES);
MENU(STR_MENUCUSTOMSCRIPTS, MODEL_ICONS, menuTabModel, e_CustomScripts, MAX_SCRIPTS, { NAVIGATION_LINE_BY_LINE|3/*repeated*/ });
MENU(STR_MENUCUSTOMSCRIPTS, MODEL_ICONS, menuTabModel, MENU_MODEL_CUSTOM_SCRIPTS, MAX_SCRIPTS, { NAVIGATION_LINE_BY_LINE|3/*repeated*/ });
int8_t sub = menuVerticalPosition;
+3 -3
View File
@@ -34,7 +34,7 @@ void displayFlightModes(coord_t x, coord_t y, FlightModesType value, uint8_t att
}
}
FlightModesType editFlightModes(coord_t x, coord_t y, evt_t event, FlightModesType value, uint8_t attr)
FlightModesType editFlightModes(coord_t x, coord_t y, event_t event, FlightModesType value, uint8_t attr)
{
displayFlightModes(x, y, value, attr);
@@ -76,9 +76,9 @@ bool isTrimModeAvailable(int mode)
#define FLIGHT_MODES_FADEIN_COLUMN 420
#define FLIGHT_MODES_FADEOUT_COLUMN 460
bool menuModelFlightModesAll(evt_t event)
bool menuModelFlightModesAll(event_t event)
{
MENU(STR_MENUFLIGHTPHASES, MODEL_ICONS, menuTabModel, e_FlightModesAll, MAX_FLIGHT_MODES+1, { NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, 0});
MENU(STR_MENUFLIGHTPHASES, MODEL_ICONS, menuTabModel, MENU_MODEL_FLIGHT_MODES, MAX_FLIGHT_MODES+1, { NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, 0});
if (menuVerticalPosition==0 && menuHorizontalPosition==ITEM_FLIGHT_MODES_SWITCH) {
menuHorizontalPosition += CURSOR_MOVED_LEFT(event) ? -1 : +1;
+2 -2
View File
@@ -42,9 +42,9 @@ void onGVARSMenu(const char *result)
#define GVARS_FM_COLUMN(p) (160 + (p)*38)
bool menuModelGVars(evt_t event)
bool menuModelGVars(event_t event)
{
MENU(STR_MENUGLOBALVARS, MODEL_ICONS, menuTabModel, e_GVars/* TODO, first2seconds ? CHECK_FLAG_NO_SCREEN_INDEX : 0*/, MAX_GVARS, { NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES});
MENU(STR_MENUGLOBALVARS, MODEL_ICONS, menuTabModel, MENU_MODEL_GVARS/* TODO, first2seconds ? CHECK_FLAG_NO_SCREEN_INDEX : 0*/, MAX_GVARS, { NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES});
int sub = menuVerticalPosition;
+2 -2
View File
@@ -34,9 +34,9 @@ enum menuModelHeliItems {
#define MODEL_HELI_2ND_COLUMN (230)
bool menuModelHeli(evt_t event)
bool menuModelHeli(event_t event)
{
SIMPLE_MENU(STR_MENUHELISETUP, MODEL_ICONS, menuTabModel, e_Heli, ITEM_HELI_MAX);
SIMPLE_MENU(STR_MENUHELISETUP, MODEL_ICONS, menuTabModel, MENU_MODEL_HELI, ITEM_HELI_MAX);
int sub = menuVerticalPosition;
+3 -3
View File
@@ -171,7 +171,7 @@ enum ExposFields {
#define CURVE_ROWS 1
bool menuModelExpoOne(evt_t event)
bool menuModelExpoOne(event_t event)
{
ExpoData * ed = expoAddress(s_currIdx);
@@ -359,7 +359,7 @@ void displayExpoLine(coord_t y, ExpoData *ed)
}
}
bool menuModelExposAll(evt_t event)
bool menuModelExposAll(event_t event)
{
int sub = menuVerticalPosition;
@@ -370,7 +370,7 @@ bool menuModelExposAll(evt_t event)
uint8_t chn = expoAddress(s_currIdx)->chn + 1;
int linesCount = getExposLinesCount();
SIMPLE_MENU(STR_MENUINPUTS, MODEL_ICONS, menuTabModel, e_InputsAll, linesCount);
SIMPLE_MENU(STR_MENUINPUTS, MODEL_ICONS, menuTabModel, MENU_MODEL_INPUTS, linesCount);
switch (event) {
case EVT_ENTRY:
@@ -72,11 +72,11 @@ void onLogicalSwitchesMenu(const char *result)
}
}
bool menuModelLogicalSwitches(evt_t event)
bool menuModelLogicalSwitches(event_t event)
{
INCDEC_DECLARE_VARS(EE_MODEL);
MENU(STR_MENULOGICALSWITCHES, MODEL_ICONS, menuTabModel, e_LogicalSwitches, NUM_LOGICAL_SWITCH, { NAVIGATION_LINE_BY_LINE|LS_FIELD_LAST/*repeated...*/} );
MENU(STR_MENULOGICALSWITCHES, MODEL_ICONS, menuTabModel, MENU_MODEL_LOGICAL_SWITCHES, NUM_LOGICAL_SWITCH, { NAVIGATION_LINE_BY_LINE|LS_FIELD_LAST/*repeated...*/} );
LogicalSwitchData * cs = lswAddress(menuVerticalPosition);
uint8_t cstate = lswFamily(cs->func);
+4 -4
View File
@@ -162,7 +162,7 @@ enum MixFields {
MIX_FIELD_COUNT
};
void gvarWeightItem(coord_t x, coord_t y, MixData *md, LcdFlags attr, evt_t event)
void gvarWeightItem(coord_t x, coord_t y, MixData *md, LcdFlags attr, event_t event)
{
u_int8int16_t weight;
MD_WEIGHT_TO_UNION(md, weight);
@@ -170,7 +170,7 @@ void gvarWeightItem(coord_t x, coord_t y, MixData *md, LcdFlags attr, evt_t even
MD_UNION_TO_WEIGHT(weight, md);
}
bool menuModelMixOne(evt_t event)
bool menuModelMixOne(event_t event)
{
MixData * md2 = mixAddress(s_currIdx) ;
@@ -381,7 +381,7 @@ void displayMixStatus(uint8_t channel)
drawSingleOutputBar(MIX_STATUS_OUT_BAR, MENU_FOOTER_TOP + 4, MIX_STATUS_BAR_W, MIX_STATUS_BAR_H, channel);
}
bool menuModelMixAll(evt_t event)
bool menuModelMixAll(event_t event)
{
BitmapBuffer * mpx_mode[] = {
mixerSetupAddBitmap,
@@ -399,7 +399,7 @@ bool menuModelMixAll(evt_t event)
uint8_t chn = mixAddress(s_currIdx)->destCh + 1;
int linesCount = getMixesLinesCount();
SIMPLE_MENU(STR_MIXER, MODEL_ICONS, menuTabModel, e_MixAll, linesCount);
SIMPLE_MENU(STR_MIXER, MODEL_ICONS, menuTabModel, MENU_MODEL_MIXES, linesCount);
switch (event) {
case EVT_ENTRY:
+2 -2
View File
@@ -91,9 +91,9 @@ void onLimitsMenu(const char *result)
}
}
bool menuModelLimits(evt_t event)
bool menuModelLimits(event_t event)
{
MENU(STR_MENULIMITS, MODEL_ICONS, menuTabModel, e_Limits, NUM_CHNOUT+1,
MENU(STR_MENULIMITS, MODEL_ICONS, menuTabModel, MENU_MODEL_OUTPUTS, NUM_CHNOUT+1,
{ NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW,
NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW,
NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW,
+1 -1
View File
@@ -179,7 +179,7 @@ void initModelsList()
}
}
bool menuModelSelect(evt_t event)
bool menuModelSelect(event_t event)
{
if (warningResult) {
warningResult = 0;
+6 -6
View File
@@ -21,7 +21,7 @@
#include "opentx.h"
uint8_t g_moduleIdx;
bool menuModelFailsafe(evt_t event);
bool menuModelFailsafe(event_t event);
enum menuModelSetupItems {
ITEM_MODEL_NAME,
@@ -103,7 +103,7 @@ void onModelSetupBitmapMenu(const char *result)
}
}
void editTimerMode(int timerIdx, coord_t y, LcdFlags attr, evt_t event)
void editTimerMode(int timerIdx, coord_t y, LcdFlags attr, event_t event)
{
TimerData & timer = g_model.timers[timerIdx];
if (attr && menuHorizontalPosition < 0) {
@@ -143,7 +143,7 @@ void editTimerMode(int timerIdx, coord_t y, LcdFlags attr, evt_t event)
}
}
void editTimerCountdown(int timerIdx, coord_t y, LcdFlags attr, evt_t event)
void editTimerCountdown(int timerIdx, coord_t y, LcdFlags attr, event_t event)
{
TimerData & timer = g_model.timers[timerIdx];
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BEEPCOUNTDOWN);
@@ -219,7 +219,7 @@ int getSwitchWarningsCount()
#define SW_WARN_ITEMS() uint8_t(NAVIGATION_LINE_BY_LINE|(getSwitchWarningsCount()-1))
#define POT_WARN_ITEMS() ((g_model.potsWarnMode >> 6) ? (uint8_t)NUM_POTS : (uint8_t)0)
bool menuModelSetup(evt_t event)
bool menuModelSetup(event_t event)
{
int l_posHorz = menuHorizontalPosition;
bool CURSOR_ON_CELL = (menuHorizontalPosition >= 0);
@@ -231,7 +231,7 @@ bool menuModelSetup(evt_t event)
g_model.moduleData[INTERNAL_MODULE].ppm.pulsePol = XJT_EXTERNAL_ANTENNA;
}
MENU(STR_MENUSETUP, MODEL_ICONS, menuTabModel, e_ModelSetup, ITEM_MODEL_SETUP_MAX,
MENU(STR_MENUSETUP, MODEL_ICONS, menuTabModel, MENU_MODEL_SETUP, ITEM_MODEL_SETUP_MAX,
{ 0, 0, TIMERS_ROWS, 0, 1, 0, 0,
LABEL(Throttle), 0, 0, 0,
LABEL(PreflightCheck), 0, 0, SW_WARN_ITEMS(), POT_WARN_ITEMS(), NAVIGATION_LINE_BY_LINE|(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1), 0,
@@ -892,7 +892,7 @@ bool menuModelSetup(evt_t event)
return true;
}
bool menuModelFailsafe(evt_t event)
bool menuModelFailsafe(event_t event)
{
uint8_t ch = 0;
uint8_t channelStart = g_model.moduleData[g_moduleIdx].channelsStart;
@@ -32,7 +32,7 @@ void onCustomFunctionsFileSelectionMenu(const char * result)
CustomFunctionData * cf;
uint8_t eeFlags;
if (menuHandlers[menuLevel] == menuModelCustomFunctions) {
if (menuHandlers[menuLevel] == menuModelSpecialFunctions) {
cf = &g_model.customFn[menuVerticalPosition];
eeFlags = EE_MODEL;
}
@@ -71,7 +71,7 @@ void onCustomFunctionsMenu(const char *result)
CustomFunctionData * cfn;
uint8_t eeFlags;
if (menuHandlers[menuLevel] == menuModelCustomFunctions) {
if (menuHandlers[menuLevel] == menuModelSpecialFunctions) {
cfn = &g_model.customFn[menuVerticalPosition];
eeFlags = EE_MODEL;
}
@@ -143,7 +143,7 @@ enum SpecialFunctionsItems {
ITEM_SPECIAL_FUNCTIONS_LAST = ITEM_SPECIAL_FUNCTIONS_COUNT-1
};
bool menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunctionsContext & functionsContext)
bool menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomFunctionsContext & functionsContext)
{
uint8_t eeFlags = (functions == g_model.customFn) ? EE_MODEL : EE_GENERAL;
@@ -413,8 +413,8 @@ bool menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunc
return true;
}
bool menuModelCustomFunctions(evt_t event)
bool menuModelSpecialFunctions(event_t event)
{
MENU(STR_MENUCUSTOMFUNC, MODEL_ICONS, menuTabModel, e_CustomFunctions, NUM_CFN, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ });
return menuCustomFunctions(event, g_model.customFn, modelFunctionsContext);
MENU(STR_MENUCUSTOMFUNC, MODEL_ICONS, menuTabModel, MENU_MODEL_SPECIAL_FUNCTIONS, NUM_CFN, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ });
return menuSpecialFunctions(event, g_model.customFn, modelFunctionsContext);
}
+4 -4
View File
@@ -20,7 +20,7 @@
#include "opentx.h"
enum menuModelTelemetryItems {
enum MenuModelTelemetryFrskyItems {
ITEM_TELEMETRY_PROTOCOL_TYPE,
ITEM_TELEMETRY_RSSI_LABEL,
ITEM_TELEMETRY_RSSI_ALARM1,
@@ -123,7 +123,7 @@ enum SensorFields {
#define SENSOR_FILTER_ROWS (sensor->isConfigurable() ? (uint8_t)0 : HIDDEN_ROW)
#define SENSOR_PERSISTENT_ROWS (sensor->type == TELEM_TYPE_CALCULATED ? (uint8_t)0 : HIDDEN_ROW)
bool menuModelSensor(evt_t event)
bool menuModelSensor(event_t event)
{
TelemetrySensor * sensor = &g_model.telemetrySensors[s_currIdx];
@@ -398,7 +398,7 @@ void onSensorMenu(const char *result)
}
}
bool menuModelTelemetry(evt_t event)
bool menuModelTelemetryFrsky(event_t event)
{
if (warningResult) {
warningResult = 0;
@@ -407,7 +407,7 @@ bool menuModelTelemetry(evt_t event)
}
}
MENU(STR_MENUTELEMETRY, MODEL_ICONS, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX, { TELEMETRY_TYPE_ROWS RSSI_ROWS SENSORS_ROWS VARIO_ROWS });
MENU(STR_MENUTELEMETRY, MODEL_ICONS, menuTabModel, MENU_MODEL_TELEMETRY_FRSKY, ITEM_TELEMETRY_MAX, { TELEMETRY_TYPE_ROWS RSSI_ROWS SENSORS_ROWS VARIO_ROWS });
for (int i=0; i<NUM_BODY_LINES; i++) {
coord_t y = MENU_CONTENT_TOP + i*FH;
+6 -6
View File
@@ -106,7 +106,7 @@ void onSwitchLongEnterPress(const char *result)
checkIncDecSelection = SWSRC_INVERT;
}
int checkIncDec(evt_t event, int val, int i_min, int i_max, unsigned int i_flags, IsValueAvailable isValueAvailable, const CheckIncDecStops &stops)
int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_flags, IsValueAvailable isValueAvailable, const CheckIncDecStops &stops)
{
int newval = val;
@@ -298,7 +298,7 @@ uint8_t menuPageIndex;
uint8_t menuPageCount;
uint16_t linesCount;
int8_t navigate(evt_t event, int count, int rows, int columns, bool loop)
int8_t navigate(event_t event, int count, int rows, int columns, bool loop)
{
int8_t result = 0;
@@ -356,7 +356,7 @@ int8_t navigate(evt_t event, int count, int rows, int columns, bool loop)
return (prevPosHorz != menuHorizontalPosition || prevPosVert != menuVerticalPosition) ? result : 0;
}
bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const pm_uint8_t * horTab, uint8_t horTabMax, int rowcount, uint8_t flags)
bool check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const pm_uint8_t * horTab, uint8_t horTabMax, int rowcount, uint8_t flags)
{
uint8_t maxcol = MAXCOL(menuVerticalPosition);
@@ -563,17 +563,17 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
return true;
}
bool check_simple(check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, int rowcount)
bool check_simple(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, int rowcount)
{
return check(event, curr, menuTab, menuTabSize, NULL, 0, rowcount);
}
bool check_submenu_simple(check_event_t event, uint8_t rowcount)
bool check_submenu_simple(event_t event, uint8_t rowcount)
{
return check_simple(event, 0, NULL, 0, rowcount);
}
void repeatLastCursorMove(evt_t event)
void repeatLastCursorMove(event_t event)
{
if (CURSOR_MOVED_LEFT(event) || CURSOR_MOVED_RIGHT(event)) {
putEvent(event);
+6 -6
View File
@@ -29,7 +29,7 @@ uint8_t warningInfoFlags = ZCHAR;
int16_t warningInputValue;
int16_t warningInputValueMin;
int16_t warningInputValueMax;
void (*popupFunc)(evt_t event) = NULL;
void (*popupFunc)(event_t event) = NULL;
const char *popupMenuItems[POPUP_MENU_MAX_LINES];
uint8_t s_menu_item = 0;
uint16_t popupMenuNoItems = 0;
@@ -37,7 +37,7 @@ uint16_t popupMenuOffset = 0;
uint8_t popupMenuOffsetType = MENU_OFFSET_INTERNAL;
void (*popupMenuHandler)(const char * result);
void displayWarningBox()
void runPopupWarningBox()
{
// theme->drawMessageBox("", "", "", MESSAGEBOX_TYPE_WARNING);
// lcdDrawSolidFilledRect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, TEXT_BGCOLOR);
@@ -58,7 +58,7 @@ void drawAlertBox(const char * title, const char * text, const char * action)
theme->drawMessageBox(title, text, action, WARNING_TYPE_ALERT);
}
void message(const pm_char * title, const pm_char * text, const char * action, uint8_t sound)
void showAlertBox(const char * title, const char * text, const char * action, uint8_t sound)
{
drawAlertBox(title, text, action);
AUDIO_ERROR_MESSAGE(sound);
@@ -67,14 +67,14 @@ void message(const pm_char * title, const pm_char * text, const char * action, u
clearKeyEvents();
}
void displayPopup(const char * title)
void showMessageBox(const char * title)
{
// displayMessageBox();
lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y, title, WARNING_LINE_LEN, DBLSIZE|WARNING_COLOR);
lcdRefresh();
}
void displayWarning(evt_t event)
void runPopupWarning(event_t event)
{
warningResult = false;
@@ -99,7 +99,7 @@ void displayWarning(evt_t event)
}
}
const char * runPopupMenu(evt_t event)
const char * runPopupMenu(event_t event)
{
const char * result = NULL;
+3 -3
View File
@@ -77,7 +77,7 @@ void drawMouse()
drawStick(STICK_LEFT_X, STICKS_Y+100, background, calibratedStick[11], calibratedStick[12]);
}
bool menuCommonCalib(evt_t event)
bool menuCommonCalib(event_t event)
{
drawMenuTemplate(NULL, ICON_RADIO_CALIBRATION, NULL, OPTION_MENU_NO_FOOTER);
@@ -227,7 +227,7 @@ bool menuCommonCalib(evt_t event)
return true;
}
bool menuGeneralCalib(evt_t event)
bool menuRadioCalibration(event_t event)
{
if (event == EVT_ENTRY || event == EVT_ENTRY_UP) TRACE("Menu %s displayed ...", STR_MENUCALIBRATION);
if (calibrationState == CALIB_FINISHED) {
@@ -244,7 +244,7 @@ bool menuGeneralCalib(evt_t event)
return menuCommonCalib(READ_ONLY() ? 0 : event);
}
bool menuFirstCalib(evt_t event)
bool menuFirstCalib(event_t event)
{
if (event == EVT_KEY_BREAK(KEY_EXIT) || calibrationState == CALIB_FINISHED) {
calibrationState = CALIB_START;
+4 -4
View File
@@ -20,7 +20,7 @@
#include "opentx.h"
enum menuGeneralHwItems {
enum menuRadioHwItems {
ITEM_SETUP_HW_CALIBRATION,
ITEM_SETUP_HW_LABEL_STICKS,
ITEM_SETUP_HW_STICK1,
@@ -57,9 +57,9 @@ enum menuGeneralHwItems {
#define BLUETOOTH_ROWS 1,
#define SWITCH_TYPE_MAX(sw) ((MIXSRC_SF-MIXSRC_FIRST_SWITCH == sw || MIXSRC_SH-MIXSRC_FIRST_SWITCH == sw) ? SWITCH_2POS : SWITCH_3POS)
bool menuGeneralHardware(evt_t event)
bool menuRadioHardware(event_t event)
{
MENU(STR_HARDWARE, RADIO_ICONS, menuTabGeneral, e_Hardware, ITEM_SETUP_HW_MAX, { 0, LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, BLUETOOTH_ROWS 0 });
MENU(STR_HARDWARE, RADIO_ICONS, menuTabGeneral, MENU_RADIO_HARDWARE, ITEM_SETUP_HW_MAX, { 0, LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, BLUETOOTH_ROWS 0 });
uint8_t sub = menuVerticalPosition;
@@ -75,7 +75,7 @@ bool menuGeneralHardware(evt_t event)
case ITEM_SETUP_HW_CALIBRATION:
lcdDrawText(MENUS_MARGIN_LEFT, y, "Calibration", attr);
if (attr && s_editMode>0) {
pushMenu(menuGeneralCalib);
pushMenu(menuRadioCalibration);
}
break;
case ITEM_SETUP_HW_LABEL_STICKS:
+6 -6
View File
@@ -29,7 +29,7 @@
int currentBitmapIndex = 0;
BitmapBuffer * currentBitmap = NULL;
bool menuGeneralSdManagerInfo(evt_t event)
bool menuRadioSdManagerInfo(event_t event)
{
SIMPLE_SUBMENU(STR_SD_INFO_TITLE, ICON_RADIO_SD_BROWSER, 1);
@@ -80,7 +80,7 @@ void onSdManagerMenu(const char * result)
char *line = reusableBuffer.sdmanager.lines[index];
if (result == STR_SD_INFO) {
pushMenu(menuGeneralSdManagerInfo);
pushMenu(menuRadioSdManagerInfo);
}
else if (result == STR_SD_FORMAT) {
POPUP_CONFIRMATION(STR_CONFIRM_FORMAT);
@@ -153,11 +153,11 @@ void onSdManagerMenu(const char * result)
#endif
}
bool menuGeneralSdManager(evt_t _event)
bool menuRadioSdManager(event_t _event)
{
if (warningResult) {
warningResult = 0;
displayPopup(STR_FORMATTING);
showMessageBox(STR_FORMATTING);
closeLogs();
audioQueue.stopSD();
if (f_mkfs(0, 1, 0) == FR_OK) {
@@ -169,8 +169,8 @@ bool menuGeneralSdManager(evt_t _event)
}
}
evt_t event = (EVT_KEY_MASK(_event) == KEY_ENTER ? 0 : _event);
SIMPLE_MENU(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, RADIO_ICONS, menuTabGeneral, e_Sd, reusableBuffer.sdmanager.count);
event_t event = (EVT_KEY_MASK(_event) == KEY_ENTER ? 0 : _event);
SIMPLE_MENU(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, RADIO_ICONS, menuTabGeneral, MENU_RADIO_SD_MANAGER, reusableBuffer.sdmanager.count);
int index = menuVerticalPosition-menuVerticalOffset;
+4 -4
View File
@@ -24,7 +24,7 @@
#define RADIO_SETUP_2ND_COLUMN 220
int8_t editSlider(coord_t x, coord_t y, evt_t event, int8_t value, int8_t min, int8_t max, LcdFlags attr)
int8_t editSlider(coord_t x, coord_t y, event_t event, int8_t value, int8_t min, int8_t max, LcdFlags attr)
{
drawHorizontalSlider(x, y, 100, value, min, max, 0, OPTION_SLIDER_DBL_COLOR|attr);
return selectMenuItem(x, y, NULL, value, min, max, attr, event);
@@ -38,7 +38,7 @@ int8_t editSlider(coord_t x, coord_t y, evt_t event, int8_t value, int8_t min, i
#define CASE_SPLASH_PARAM(x)
#endif
enum menuGeneralSetupItems {
enum menuRadioSetupItems {
ITEM_SETUP_DATE,
ITEM_SETUP_TIME,
ITEM_SETUP_BATT_RANGE,
@@ -86,7 +86,7 @@ enum menuGeneralSetupItems {
ITEM_SETUP_MAX
};
bool menuGeneralSetup(evt_t event)
bool menuRadioSetup(event_t event)
{
#if defined(RTCLOCK)
struct gtm t;
@@ -108,7 +108,7 @@ bool menuGeneralSetup(evt_t event)
}
#endif
MENU(STR_MENURADIOSETUP, RADIO_ICONS, menuTabGeneral, e_Setup, ITEM_SETUP_MAX, {
MENU(STR_MENURADIOSETUP, RADIO_ICONS, menuTabGeneral, MENU_RADIO_SETUP, ITEM_SETUP_MAX, {
2|NAVIGATION_LINE_BY_LINE, 2|NAVIGATION_LINE_BY_LINE, 1|NAVIGATION_LINE_BY_LINE,
LABEL(SOUND), 0, 0, 0, 0, 0, 0, 0,
CASE_VARIO(LABEL(VARIO)) CASE_VARIO(0) CASE_VARIO(0) CASE_VARIO(0) CASE_VARIO(0)
+2 -2
View File
@@ -25,12 +25,12 @@
#define TRAINER_COLUMN_2 TRAINER_COLUMN_1+TRAINER_COLUMN_WIDTH
#define TRAINER_COLUMN_3 TRAINER_COLUMN_2+TRAINER_COLUMN_WIDTH
bool menuGeneralTrainer(evt_t event)
bool menuRadioTrainer(event_t event)
{
uint8_t y;
bool slave = SLAVE_MODE();
MENU(STR_MENUTRAINER, RADIO_ICONS, menuTabGeneral, e_Trainer, (slave ? 0 : 6), { 2, 2, 2, 2, 0/*, 0*/ });
MENU(STR_MENUTRAINER, RADIO_ICONS, menuTabGeneral, MENU_RADIO_TRAINER, (slave ? 0 : 6), { 2, 2, 2, 2, 0/*, 0*/ });
if (slave) {
// TODO lcd_putsCenter(5*FH, STR_SLAVE, TEXT_COLOR);
+2 -2
View File
@@ -20,11 +20,11 @@
#include "opentx.h"
bool menuGeneralVersion(evt_t event)
bool menuRadioVersion(event_t event)
{
DEBUG_TIMER_START(debugTimerVersion);
DEBUG_TIMER_START(debugTimerSimpleMenu);
SIMPLE_MENU(STR_MENUVERSION, RADIO_ICONS, menuTabGeneral, e_Vers, 0);
SIMPLE_MENU(STR_MENUVERSION, RADIO_ICONS, menuTabGeneral, MENU_RADIO_VERSION, 0);
DEBUG_TIMER_STOP(debugTimerSimpleMenu);
DEBUG_TIMER_START(debugTimerDrawText);
+11 -11
View File
@@ -42,7 +42,7 @@ char fileSelection[LEN_ZONE_OPTION_STRING];
uint8_t fileSelectionDone;
int updateMainviewsMenu();
bool menuScreenAdd(evt_t event);
bool menuScreenAdd(event_t event);
void onScreenSetupMenu(const char * result);
void onZoneOptionFileSelectionMenu(const char * result)
@@ -68,7 +68,7 @@ uint8_t getZoneOptionColumns(const ZoneOption * option)
}
}
bool editZoneOption(coord_t y, const ZoneOption * option, ZoneOptionValue * value, LcdFlags attr, uint32_t i_flags, evt_t event)
bool editZoneOption(coord_t y, const ZoneOption * option, ZoneOptionValue * value, LcdFlags attr, uint32_t i_flags, event_t event)
{
lcdDrawText(MENUS_MARGIN_LEFT, y, option->name);
@@ -174,7 +174,7 @@ int getOptionsCount(const ZoneOption * options)
}
template <class T>
bool menuSettings(const char * title, const T * object, uint32_t i_flags, evt_t event)
bool menuSettings(const char * title, const T * object, uint32_t i_flags, event_t event)
{
const ZoneOption * options = object->getOptions();
linesCount = getOptionsCount(options);
@@ -202,12 +202,12 @@ bool menuSettings(const char * title, const T * object, uint32_t i_flags, evt_t
return true;
}
bool menuWidgetSettings(evt_t event)
bool menuWidgetSettings(event_t event)
{
return menuSettings<Widget>("Widget settings", currentWidget, EE_MODEL, event);
}
bool menuWidgetChoice(evt_t event)
bool menuWidgetChoice(event_t event)
{
static Widget * previousWidget;
static Widget::PersistentData tempData;
@@ -296,7 +296,7 @@ void onZoneMenu(const char * result)
}
}
bool menuWidgetsSetup(evt_t event)
bool menuWidgetsSetup(event_t event)
{
switch (event) {
case EVT_ENTRY:
@@ -351,7 +351,7 @@ bool menuWidgetsSetup(evt_t event)
}
template <class T>
T * editThemeChoice(coord_t x, coord_t y, T * array[], uint8_t count, T * current, bool needsOffsetCheck, LcdFlags attr, evt_t event)
T * editThemeChoice(coord_t x, coord_t y, T * array[], uint8_t count, T * current, bool needsOffsetCheck, LcdFlags attr, event_t event)
{
static uint8_t menuHorizontalOffset;
@@ -416,7 +416,7 @@ enum menuScreensThemeItems {
ITEM_SCREEN_SETUP_THEME_OPTION1 = ITEM_SCREEN_SETUP_THEME+2
};
bool menuScreensTheme(evt_t event)
bool menuScreensTheme(event_t event)
{
bool needsOffsetCheck = (menuVerticalPosition != 0 || menuHorizontalPosition < 0);
const ZoneOption * options = theme->getOptions();
@@ -486,7 +486,7 @@ enum MenuScreenSetupItems {
ITEM_SCREEN_SETUP_LAYOUT_OPTION1,
};
bool menuScreenSetup(int index, evt_t event)
bool menuScreenSetup(int index, event_t event)
{
if (customScreens[index] == NULL) {
return menuScreenAdd(event);
@@ -578,7 +578,7 @@ bool menuScreenSetup(int index, evt_t event)
}
template<int N>
bool menuCustomScreenSetup(evt_t event)
bool menuCustomScreenSetup(event_t event)
{
return menuScreenSetup(N, event);
}
@@ -606,7 +606,7 @@ int updateMainviewsMenu()
return 1+MAX_CUSTOM_SCREENS;
}
bool menuScreenAdd(evt_t event)
bool menuScreenAdd(event_t event)
{
menuPageCount = updateMainviewsMenu();
+1 -1
View File
@@ -38,7 +38,7 @@ enum AboutScreens {
#define ABOUT_X 62
#define ABOUT_INDENT 16
bool menuAboutView(evt_t event)
bool menuAboutView(event_t event)
{
static uint8_t screenIndex = 0;
static uint8_t greyIndex = 0;
+4 -4
View File
@@ -30,11 +30,11 @@
#define Y_MIXBAR 28
#define LEG_COLORBOX 15
bool menuChannelsMonitor(evt_t event, uint8_t page);
bool menuLogicalSwitches(evt_t);
bool menuChannelsMonitor(event_t event, uint8_t page);
bool menuLogicalSwitches(event_t);
template<int index>
bool menuChannelsMonitor(evt_t event)
bool menuChannelsMonitor(event_t event)
{
lastMonitorPage = e_MonChannelsFirst + index;
MENU(STR_MONITOR_CHANNELS[index], MONITOR_ICONS, menuTabMonitors, lastMonitorPage, 0, { 0 });
@@ -158,7 +158,7 @@ coord_t drawChannelsMonitorLegend(coord_t x, const pm_char * s, int color)
return x + 25 + getTextWidth(s);
}
bool menuChannelsMonitor(evt_t event, uint8_t page)
bool menuChannelsMonitor(event_t event, uint8_t page)
{
uint8_t channel = 8 * page;
coord_t x, y = Y_OFFSET;
@@ -87,7 +87,7 @@ void displayLogicalSwitchedDetails(coord_t x, coord_t y, uint8_t idx)
}
}
bool menuLogicalSwitchesMonitor(evt_t event)
bool menuLogicalSwitchesMonitor(event_t event)
{
char lsString[] = "L64";
lcdColorTable[CUSTOM_COLOR_INDEX] = RGB(160, 160, 160);
@@ -109,7 +109,7 @@ bool menuLogicalSwitchesMonitor(evt_t event)
return true;
}
bool menuLogicalSwitches(evt_t event)
bool menuLogicalSwitches(event_t event)
{
MENU(STR_MONITOR_SWITCHES, MONITOR_ICONS, menuTabMonitors, e_MonLogicalSwitches, 1, { NUM_LOGICAL_SWITCH - 1 });
lastMonitorPage = e_MonLogicalSwitches;
+2 -2
View File
@@ -128,7 +128,7 @@ int getMainViewsCount()
return MAX_CUSTOM_SCREENS;
}
bool menuMainView(evt_t event)
bool menuMainView(event_t event)
{
switch (event) {
case EVT_ENTRY:
@@ -202,7 +202,7 @@ bool menuMainView(evt_t event)
}
#if 0
bool menuMainViewChannelsMonitor(evt_t event)
bool menuMainViewChannelsMonitor(event_t event)
{
switch (event) {
case EVT_KEY_BREAK(KEY_EXIT):
+4 -4
View File
@@ -25,7 +25,7 @@
#define MENU_STATS_COLUMN2 (LCD_W/2)
#define MENU_STATS_COLUMN3 (LCD_W/2 + 120)
bool menuStatsGraph(evt_t event)
bool menuStatsGraph(event_t event)
{
switch(event) {
case EVT_KEY_LONG(KEY_ENTER):
@@ -94,7 +94,7 @@ bool menuStatsGraph(evt_t event)
return true;
}
bool menuStatsDebug(evt_t event)
bool menuStatsDebug(event_t event)
{
switch(event)
{
@@ -146,7 +146,7 @@ bool menuStatsDebug(evt_t event)
return true;
}
bool menuStatsAnalogs(evt_t event)
bool menuStatsAnalogs(event_t event)
{
MENU("Analogs", STATS_ICONS, menuTabStats, e_StatsAnalogs, 0, { 0 });
@@ -181,7 +181,7 @@ bool menuStatsAnalogs(evt_t event)
#define STATS_TRACES_EVENT_POS MENUS_MARGIN_LEFT + 14*10
#define STATS_TRACES_DATA_POS MENUS_MARGIN_LEFT + 20*10
bool menuStatsTraces(evt_t event)
bool menuStatsTraces(event_t event)
{
switch(event)
{
+1 -1
View File
@@ -87,7 +87,7 @@ void readTextFile(int & lines_count)
}
}
bool menuTextView(evt_t event)
bool menuTextView(event_t event)
{
static int lines_count;
+5 -5
View File
@@ -178,20 +178,20 @@ void drawMenuTemplate(const char * title, uint8_t icon, const uint8_t * icons, u
}
}
select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char * values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, evt_t event)
select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char * values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, event_t event)
{
if (attr) value = checkIncDec(event, value, min, max, (menuVerticalPositions[0] == 0) ? EE_MODEL : EE_GENERAL);
if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr);
return value;
}
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, LcdFlags attr, evt_t event)
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, LcdFlags attr, event_t event)
{
drawCheckBox(x, y, value, attr);
return selectMenuItem(x, y, NULL, value, 0, 1, attr, event);
}
swsrc_t switchMenuItem(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, evt_t event)
swsrc_t switchMenuItem(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, event_t event)
{
if (attr) CHECK_INCDEC_MODELSWITCH(event, value, SWSRC_FIRST_IN_MIXES, SWSRC_LAST_IN_MIXES, isSwitchAvailableInMixes);
putsSwitches(x, y, value, attr);
@@ -334,7 +334,7 @@ bool noZero(int val)
return val != 0;
}
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, evt_t event)
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, event_t event)
{
uint16_t delta = GV_GET_GV1_VALUE(max);
bool invers = (attr & INVERS);
@@ -376,7 +376,7 @@ int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int
return value;
}
#else
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, evt_t event)
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, event_t event)
{
if (attr & INVERS) value = checkIncDec(event, value, min, max, EE_MODEL);
lcdDrawNumber(x, y, value, attr, 0, NULL, "%");
+5 -5
View File
@@ -60,13 +60,13 @@ void drawHorizontalSlider(coord_t x, coord_t y, int len, int val, int min, int m
void drawSlider(coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options);
#define drawStatusLine(...)
select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char * values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, evt_t event);
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, LcdFlags attr, evt_t event);
swsrc_t switchMenuItem(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, evt_t event);
select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char * values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, event_t event);
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, LcdFlags attr, event_t event);
swsrc_t switchMenuItem(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, event_t event);
#if defined(GVARS)
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, evt_t event);
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, event_t event);
#else
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, evt_t event);
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, event_t event);
#endif
// Screen templates