1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-16 21:05:26 +03:00

Another big refactoring

This commit is contained in:
Bertrand Songis 2016-08-02 18:35:00 +02:00
parent 52435703a0
commit 7fbd963b3f
140 changed files with 1311 additions and 1292 deletions

View file

@ -58,13 +58,24 @@ inline void drawSleepBitmap()
void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible); void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
#endif #endif
#if defined(PCBTARANIS)
void drawAlertBox(const char * title, const char * text, const char * action);
#endif
#if defined(VOICE)
#define ALERT_SOUND_ARG , uint8_t sound
#else
#define ALERT_SOUND_ARG
#endif
void showAlertBox(const pm_char * title, const pm_char * text, const char * action ALERT_SOUND_ARG);
#define SET_SCROLLBAR_X(x) #define SET_SCROLLBAR_X(x)
#define LOAD_MODEL_BITMAP() #define LOAD_MODEL_BITMAP()
#define IS_MAIN_VIEW_DISPLAYED() menuHandlers[0] == menuMainView #define IS_MAIN_VIEW_DISPLAYED() menuHandlers[0] == menuMainView
#if defined(TELEMETRY_FRSKY) #if defined(TELEMETRY_FRSKY)
#define IS_TELEMETRY_VIEW_DISPLAYED() menuHandlers[0] == menuTelemetryFrsky #define IS_TELEMETRY_VIEW_DISPLAYED() menuHandlers[0] == menuViewTelemetryFrsky
#else #else
#define IS_TELEMETRY_VIEW_DISPLAYED() false #define IS_TELEMETRY_VIEW_DISPLAYED() false
#endif #endif

View file

@ -280,7 +280,7 @@ void lcdDrawText(coord_t x, coord_t y, const pm_char * s)
lcdDrawText(x, y, s, 0); lcdDrawText(x, y, s, 0);
} }
void lcd_putsLeft(coord_t y, const pm_char * s) void lcdDrawTextAlignedLeft(coord_t y, const pm_char * s)
{ {
lcdDrawText(0, y, s); lcdDrawText(0, y, s);
} }

View file

@ -156,7 +156,7 @@ void lcdDrawTextAtIndex(coord_t x, coord_t y, const pm_char * s, uint8_t idx, Lc
void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, unsigned char len, LcdFlags flags); void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, unsigned char len, LcdFlags flags);
void lcdDrawText(coord_t x, coord_t y, const pm_char * s); void lcdDrawText(coord_t x, coord_t y, const pm_char * s);
void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, unsigned char len); void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, unsigned char len);
void lcd_putsLeft(coord_t y, const pm_char * s); void lcdDrawTextAlignedLeft(coord_t y, const pm_char * s);
#define lcd_putsCenter(y, s) lcdDrawText((LCD_W-sizeof(TR_##s)*FW+FW+1)/2, y, STR_##s) #define lcd_putsCenter(y, s) lcdDrawText((LCD_W-sizeof(TR_##s)*FW+FW+1)/2, y, STR_##s)

View file

@ -26,7 +26,7 @@
uint8_t editDelay(const coord_t y, const uint8_t event, const uint8_t attr, const pm_char *str, uint8_t delay) uint8_t editDelay(const coord_t y, const uint8_t event, const uint8_t attr, const pm_char *str, uint8_t delay)
{ {
lcd_putsLeft(y, str); lcdDrawTextAlignedLeft(y, str);
lcdDrawNumber(MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT); lcdDrawNumber(MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT);
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, delay, DELAY_MAX); if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, delay, DELAY_MAX);
return delay; return delay;
@ -46,7 +46,7 @@ void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uin
{ {
#if defined(CPUM64) #if defined(CPUM64)
// in order to save flash // in order to save flash
lcd_putsLeft(y, STR_NAME); lcdDrawTextAlignedLeft(y, STR_NAME);
#endif #endif
uint8_t mode = 0; uint8_t mode = 0;
@ -129,7 +129,7 @@ void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uin
#if !defined(CPUM64) #if !defined(CPUM64)
void editSingleName(coord_t x, coord_t y, const pm_char *label, char *name, uint8_t size, uint8_t event, uint8_t active) void editSingleName(coord_t x, coord_t y, const pm_char *label, char *name, uint8_t size, uint8_t event, uint8_t active)
{ {
lcd_putsLeft(y, label); lcdDrawTextAlignedLeft(y, label);
editName(x, y, name, size, event, active); editName(x, y, name, size, event, active);
} }
#endif #endif

View file

@ -21,9 +21,9 @@
#include "opentx.h" #include "opentx.h"
#if defined(CPUARM) #if defined(CPUARM)
void menuGeneralCustomFunctions(uint8_t event) void menuRadioSpecialFunctions(uint8_t event)
{ {
MENU(STR_MENUGLOBALFUNCS, menuTabGeneral, e_GeneralCustomFunctions, NUM_CFN+1, {0, NAVIGATION_LINE_BY_LINE|4/*repeated*/}); MENU(STR_MENUSPECIALFUNCS, menuTabGeneral, MENU_RADIO_SPECIAL_FUNCTIONS, NUM_CFN+1, {0, NAVIGATION_LINE_BY_LINE|4/*repeated*/});
return menuCustomFunctions(event, g_eeGeneral.customFn, &globalFunctionsContext); return menuSpecialFunctions(event, g_eeGeneral.customFn, &globalFunctionsContext);
} }
#endif #endif

View file

@ -43,7 +43,7 @@ void pushMenu(MenuHandlerFunc newMenu)
killEvents(KEY_ENTER); killEvents(KEY_ENTER);
if (menuLevel == 0) { if (menuLevel == 0) {
if (newMenu == menuGeneralSetup) if (newMenu == menuRadioSetup)
menuVerticalPositions[0] = 1; menuVerticalPositions[0] = 1;
if (newMenu == menuModelSelect) if (newMenu == menuModelSelect)
menuVerticalPositions[0] = 0; menuVerticalPositions[0] = 0;

View file

@ -21,10 +21,12 @@
#ifndef _MENUS_H_ #ifndef _MENUS_H_
#define _MENUS_H_ #define _MENUS_H_
#include "keys.h"
#define MENUS_SCROLLBAR_WIDTH 0 #define MENUS_SCROLLBAR_WIDTH 0
#define MENU_COLUMNS 1 #define MENU_COLUMNS 1
#define COLUMN_X 0 #define COLUMN_X 0
#define lcd_putsColumnLeft(x, y, str) lcd_putsLeft(y, str) #define drawFieldLabel(x, y, str) lcdDrawTextAlignedLeft(y, str)
// Menus related stuff ... // Menus related stuff ...
#if defined(SDCARD) #if defined(SDCARD)
@ -33,7 +35,6 @@
typedef uint8_t vertpos_t; typedef uint8_t vertpos_t;
#endif #endif
typedef uint8_t check_event_t;
#define horzpos_t uint8_t #define horzpos_t uint8_t
#if defined(CPUARM) #if defined(CPUARM)
@ -77,60 +78,62 @@ void menuFirstCalib(uint8_t event);
void onMainViewMenu(const char * result); void onMainViewMenu(const char * result);
void menuMainView(uint8_t event); void menuMainView(uint8_t event);
void menuTelemetryFrsky(uint8_t event); void menuViewTelemetryFrsky(uint8_t event);
void menuTelemetryMavlinkSetup(uint8_t event); void menuViewTelemetryMavlink(uint8_t event);
void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext); void menuSpecialFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext);
enum EnumTabDiag enum MenuRadioIndexes
{ {
e_Setup, MENU_RADIO_SETUP,
CASE_SDCARD(e_Sd) CASE_SDCARD(MENU_RADIO_SD_MANAGER)
CASE_CPUARM(e_GeneralCustomFunctions) CASE_CPUARM(MENU_RADIO_SPECIAL_FUNCTIONS)
e_Trainer, MENU_RADIO_TRAINER,
e_Vers, MENU_RADIO_VERSION,
e_Keys, MENU_RADIO_DIAG_KEYS,
e_Ana, MENU_RADIO_DIAG_ANALOGS,
CASE_CPUARM(e_Hardware) CASE_CPUARM(MENU_RADIO_HARDWARE)
e_Calib MENU_RADIO_CALIBRATION,
MENU_RADIO_PAGES_COUNT
}; };
void menuGeneralSetup(uint8_t event); void menuRadioSetup(uint8_t event);
void menuGeneralSdManager(uint8_t event); void menuRadioSdManager(uint8_t event);
void menuGeneralCustomFunctions(uint8_t event); void menuRadioSpecialFunctions(uint8_t event);
void menuGeneralTrainer(uint8_t event); void menuRadioTrainer(uint8_t event);
void menuGeneralVersion(uint8_t event); void menuRadioVersion(uint8_t event);
void menuGeneralDiagKeys(uint8_t event); void menuRadioDiagKeys(uint8_t event);
void menuGeneralDiagAna(uint8_t event); void menuRadioDiagAnalogs(uint8_t event);
void menuGeneralHardware(uint8_t event); void menuRadioHardware(uint8_t event);
void menuGeneralCalib(uint8_t event); void menuRadioCalibration(uint8_t event);
static const MenuHandlerFunc menuTabGeneral[] PROGMEM = { static const MenuHandlerFunc menuTabGeneral[] PROGMEM = {
menuGeneralSetup, menuRadioSetup,
CASE_SDCARD(menuGeneralSdManager) CASE_SDCARD(menuRadioSdManager)
CASE_CPUARM(menuGeneralCustomFunctions) CASE_CPUARM(menuRadioSpecialFunctions)
menuGeneralTrainer, menuRadioTrainer,
menuGeneralVersion, menuRadioVersion,
menuGeneralDiagKeys, menuRadioDiagKeys,
menuGeneralDiagAna, menuRadioDiagAnalogs,
CASE_CPUARM(menuGeneralHardware) CASE_CPUARM(menuRadioHardware)
menuGeneralCalib menuRadioCalibration
}; };
enum EnumTabModel { enum EnumTabModel {
e_ModelSelect, MENU_MODEL_SELECT,
e_ModelSetup, MENU_MODEL_SETUP,
CASE_HELI(e_Heli) CASE_HELI(MENU_MODEL_HELI)
CASE_FLIGHT_MODES(e_FlightModesAll) CASE_FLIGHT_MODES(MENU_MODEL_FLIGHT_MODES)
e_InputsAll, MENU_MODEL_INPUTS,
e_MixAll, MENU_MODEL_MIXES,
e_Limits, MENU_MODEL_OUTPUTS,
CASE_CURVES(e_CurvesAll) CASE_CURVES(MENU_MODEL_CURVES)
e_LogicalSwitches, MENU_MODEL_LOGICAL_SWITCHES,
e_CustomFunctions, MENU_MODEL_SPECIAL_FUNCTIONS,
CASE_FRSKY(e_Telemetry) CASE_FRSKY(MENU_MODEL_TELEMETRY_FRSKY)
CASE_MAVLINK(e_MavSetup) CASE_MAVLINK(MENU_MODEL_TELEMETRY_MAVLINK)
CASE_TEMPLATES(e_Templates) CASE_TEMPLATES(MENU_MODEL_TEMPLATES)
MENU_MODEL_PAGES_COUNT
}; };
void menuModelSelect(uint8_t event); void menuModelSelect(uint8_t event);
@ -144,8 +147,9 @@ void menuModelCurvesAll(uint8_t event);
void menuModelCurveOne(uint8_t event); void menuModelCurveOne(uint8_t event);
void menuModelGVars(uint8_t event); void menuModelGVars(uint8_t event);
void menuModelLogicalSwitches(uint8_t event); void menuModelLogicalSwitches(uint8_t event);
void menuModelCustomFunctions(uint8_t event); void menuModelSpecialFunctions(uint8_t event);
void menuModelTelemetry(uint8_t event); void menuModelTelemetryFrsky(uint8_t event);
void menuModelTelemetryMavlink(uint8_t event);
void menuModelTemplates(uint8_t event); void menuModelTemplates(uint8_t event);
void menuModelExpoOne(uint8_t event); void menuModelExpoOne(uint8_t event);
@ -159,9 +163,9 @@ static const MenuHandlerFunc menuTabModel[] PROGMEM = {
menuModelLimits, menuModelLimits,
CASE_CURVES(menuModelCurvesAll) CASE_CURVES(menuModelCurvesAll)
menuModelLogicalSwitches, menuModelLogicalSwitches,
menuModelCustomFunctions, menuModelSpecialFunctions,
CASE_FRSKY(menuModelTelemetry) CASE_FRSKY(menuModelTelemetryFrsky)
CASE_MAVLINK(menuTelemetryMavlinkSetup) CASE_MAVLINK(menuModelTelemetryMavlink)
CASE_TEMPLATES(menuModelTemplates) CASE_TEMPLATES(menuModelTemplates)
}; };
@ -334,9 +338,9 @@ int8_t checkIncDecMovedSwitch(int8_t val);
#define NAVIGATION_LINE_BY_LINE 0 #define NAVIGATION_LINE_BY_LINE 0
#define CURSOR_ON_LINE() (0) #define CURSOR_ON_LINE() (0)
void check(check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow); void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow);
void check_simple(check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, vertpos_t maxrow); void check_simple(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, vertpos_t maxrow);
void check_submenu_simple(check_event_t event, uint8_t maxrow); void check_submenu_simple(event_t event, uint8_t maxrow);
void title(const pm_char * s); void title(const pm_char * s);
#define TITLE(str) title(str) #define TITLE(str) title(str)
@ -446,8 +450,8 @@ extern uint8_t s_curveChan;
#define WARNING_LINE_Y 3*FH #define WARNING_LINE_Y 3*FH
void drawMessageBox(); void drawMessageBox();
void displayPopup(const pm_char * pstr); void showMessageBox(const pm_char * pstr);
void displayWarning(uint8_t event); void runPopupWarning(uint8_t event);
#if defined(CPUARM) #if defined(CPUARM)
extern void (*popupFunc)(uint8_t event); extern void (*popupFunc)(uint8_t event);
@ -466,13 +470,13 @@ void displayWarning(uint8_t event);
#define SET_WARNING_INFO(...) #define SET_WARNING_INFO(...)
#elif defined(CPUARM) #elif defined(CPUARM)
#define DISPLAY_WARNING (*popupFunc) #define DISPLAY_WARNING (*popupFunc)
#define POPUP_WARNING(s) (warningText = s, warningInfoText = 0, popupFunc = displayWarning) #define POPUP_WARNING(s) (warningText = s, warningInfoText = 0, popupFunc = runPopupWarning)
#define POPUP_CONFIRMATION(s) (warningText = s, warningType = WARNING_TYPE_CONFIRM, warningInfoText = 0, popupFunc = displayWarning) #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 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 WARNING_INFO_FLAGS warningInfoFlags
#define SET_WARNING_INFO(info, len, flags) (warningInfoText = info, warningInfoLength = len, warningInfoFlags = flags) #define SET_WARNING_INFO(info, len, flags) (warningInfoText = info, warningInfoLength = len, warningInfoFlags = flags)
#else #else
#define DISPLAY_WARNING displayWarning #define DISPLAY_WARNING runPopupWarning
#define POPUP_WARNING(s) warningText = s #define POPUP_WARNING(s) warningText = s
#define POPUP_CONFIRMATION(s) (warningText = s, warningType = WARNING_TYPE_CONFIRM) #define POPUP_CONFIRMATION(s) (warningText = s, warningType = WARNING_TYPE_CONFIRM)
#define WARNING_INFO_FLAGS ZCHAR #define WARNING_INFO_FLAGS ZCHAR

View file

@ -171,7 +171,7 @@ void menuModelCurveOne(uint8_t event)
break; break;
} }
lcd_putsLeft(7*FH, STR_TYPE); lcdDrawTextAlignedLeft(7*FH, STR_TYPE);
uint8_t attr = (s_editMode <= 0 ? INVERS : 0); uint8_t attr = (s_editMode <= 0 ? INVERS : 0);
lcdDrawNumber(5*FW-2, 7*FH, crv.points, LEFT|attr); lcdDrawNumber(5*FW-2, 7*FH, crv.points, LEFT|attr);
lcdDrawText(lcdLastPos, 7*FH, crv.custom ? PSTR("pt'") : PSTR("pt"), attr); lcdDrawText(lcdLastPos, 7*FH, crv.custom ? PSTR("pt'") : PSTR("pt"), attr);
@ -212,9 +212,9 @@ void menuModelCurveOne(uint8_t event)
void menuModelCurvesAll(uint8_t event) void menuModelCurvesAll(uint8_t event)
{ {
#if defined(GVARS) && defined(PCBSTD) #if defined(GVARS) && defined(PCBSTD)
SIMPLE_MENU(STR_MENUCURVES, menuTabModel, e_CurvesAll, 1+MAX_CURVES+MAX_GVARS); SIMPLE_MENU(STR_MENUCURVES, menuTabModel, MENU_MODEL_CURVES, 1+MAX_CURVES+MAX_GVARS);
#else #else
SIMPLE_MENU(STR_MENUCURVES, menuTabModel, e_CurvesAll, 1+MAX_CURVES); SIMPLE_MENU(STR_MENUCURVES, menuTabModel, MENU_MODEL_CURVES, 1+MAX_CURVES);
#endif #endif
int8_t sub = menuVerticalPosition - 1; int8_t sub = menuVerticalPosition - 1;

View file

@ -98,7 +98,7 @@ void menuModelPhaseOne(uint8_t event)
fm->swtch = switchMenuItem(MIXES_2ND_COLUMN, y, fm->swtch, attr, event); fm->swtch = switchMenuItem(MIXES_2ND_COLUMN, y, fm->swtch, attr, event);
break; break;
case ITEM_MODEL_PHASE_TRIMS: case ITEM_MODEL_PHASE_TRIMS:
lcd_putsLeft(y, STR_TRIMS); lcdDrawTextAlignedLeft(y, STR_TRIMS);
for (uint8_t t=0; t<NUM_STICKS; t++) { for (uint8_t t=0; t<NUM_STICKS; t++) {
putsTrimMode(MIXES_2ND_COLUMN+(t*FW), y, s_currIdx, t, menuHorizontalPosition==t ? attr : 0); putsTrimMode(MIXES_2ND_COLUMN+(t*FW), y, s_currIdx, t, menuHorizontalPosition==t ? attr : 0);
if (attr && menuHorizontalPosition==t && ((editMode>0) || p1valdiff)) { if (attr && menuHorizontalPosition==t && ((editMode>0) || p1valdiff)) {
@ -115,7 +115,7 @@ void menuModelPhaseOne(uint8_t event)
#if ROTARY_ENCODERS > 0 #if ROTARY_ENCODERS > 0
case ITEM_MODEL_PHASE_ROTARY_ENCODERS: case ITEM_MODEL_PHASE_ROTARY_ENCODERS:
lcd_putsLeft(y, STR_ROTARY_ENCODER); lcdDrawTextAlignedLeft(y, STR_ROTARY_ENCODER);
for (uint8_t t=0; t<NUM_ROTARY_ENCODERS; t++) { for (uint8_t t=0; t<NUM_ROTARY_ENCODERS; t++) {
putsRotaryEncoderMode(MIXES_2ND_COLUMN+(t*FW), y, s_currIdx, t, menuHorizontalPosition==t ? attr : 0); putsRotaryEncoderMode(MIXES_2ND_COLUMN+(t*FW), y, s_currIdx, t, menuHorizontalPosition==t ? attr : 0);
if (attr && menuHorizontalPosition==t && ((editMode>0) || p1valdiff)) { if (attr && menuHorizontalPosition==t && ((editMode>0) || p1valdiff)) {
@ -141,7 +141,7 @@ void menuModelPhaseOne(uint8_t event)
#if defined(GVARS) && !defined(PCBSTD) #if defined(GVARS) && !defined(PCBSTD)
case ITEM_MODEL_PHASE_GVARS_LABEL: case ITEM_MODEL_PHASE_GVARS_LABEL:
lcd_putsLeft(y, STR_GLOBAL_VARS); lcdDrawTextAlignedLeft(y, STR_GLOBAL_VARS);
break; break;
default: default:
@ -205,7 +205,7 @@ void menuModelPhaseOne(uint8_t event)
void menuModelFlightModesAll(uint8_t event) void menuModelFlightModesAll(uint8_t event)
{ {
SIMPLE_MENU(STR_MENUFLIGHTPHASES, menuTabModel, e_FlightModesAll, 1+MAX_FLIGHT_MODES+1); SIMPLE_MENU(STR_MENUFLIGHTPHASES, menuTabModel, MENU_MODEL_FLIGHT_MODES, 1+MAX_FLIGHT_MODES+1);
int8_t sub = menuVerticalPosition - 1; int8_t sub = menuVerticalPosition - 1;
@ -262,7 +262,7 @@ void menuModelFlightModesAll(uint8_t event)
if (menuVerticalOffset != MAX_FLIGHT_MODES-(LCD_LINES-2)) return; if (menuVerticalOffset != MAX_FLIGHT_MODES-(LCD_LINES-2)) return;
#endif #endif
lcd_putsLeft((LCD_LINES-1)*FH+1, STR_CHECKTRIMS); lcdDrawTextAlignedLeft((LCD_LINES-1)*FH+1, STR_CHECKTRIMS);
putsFlightMode(OFS_CHECKTRIMS, (LCD_LINES-1)*FH+1, mixerCurrentFlightMode+1); putsFlightMode(OFS_CHECKTRIMS, (LCD_LINES-1)*FH+1, mixerCurrentFlightMode+1);
if (sub==MAX_FLIGHT_MODES && !trimsCheckTimer) { if (sub==MAX_FLIGHT_MODES && !trimsCheckTimer) {
lcdInvertLastLine(); lcdInvertLastLine();

View file

@ -33,7 +33,7 @@ enum menuModelHeliItems {
void menuModelHeli(uint8_t event) void menuModelHeli(uint8_t event)
{ {
SIMPLE_MENU(STR_MENUHELISETUP, menuTabModel, e_Heli, 7); SIMPLE_MENU(STR_MENUHELISETUP, menuTabModel, MENU_MODEL_HELI, 7);
uint8_t sub = menuVerticalPosition - 1; uint8_t sub = menuVerticalPosition - 1;
@ -51,7 +51,7 @@ void menuModelHeli(uint8_t event)
break; break;
case ITEM_HELI_SWASHRING: case ITEM_HELI_SWASHRING:
lcd_putsLeft(y, STR_SWASHRING); lcdDrawTextAlignedLeft(y, STR_SWASHRING);
lcdDrawNumber(HELI_PARAM_OFS, y, g_model.swashR.value, LEFT|attr); lcdDrawNumber(HELI_PARAM_OFS, y, g_model.swashR.value, LEFT|attr);
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.swashR.value, 100); if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.swashR.value, 100);
break; break;

View file

@ -27,7 +27,7 @@
void displayFlightModes(coord_t x, coord_t y, FlightModesType value); void displayFlightModes(coord_t x, coord_t y, FlightModesType value);
FlightModesType editFlightModes(coord_t x, coord_t y, uint8_t event, FlightModesType value, uint8_t attr) FlightModesType editFlightModes(coord_t x, coord_t y, uint8_t event, FlightModesType value, uint8_t attr)
{ {
lcd_putsColumnLeft(x, y, STR_FLMODE); drawFieldLabel(x, y, STR_FLMODE);
uint8_t posHorz = menuHorizontalPosition; uint8_t posHorz = menuHorizontalPosition;
@ -288,12 +288,12 @@ void menuModelExpoOne(uint8_t event)
#endif #endif
case EXPO_FIELD_WEIGHT: case EXPO_FIELD_WEIGHT:
lcd_putsLeft(y, STR_WEIGHT); lcdDrawTextAlignedLeft(y, STR_WEIGHT);
ed->weight = GVAR_MENU_ITEM(EXPO_ONE_2ND_COLUMN, y, ed->weight, MIN_EXPO_WEIGHT, 100, attr, 0, event); ed->weight = GVAR_MENU_ITEM(EXPO_ONE_2ND_COLUMN, y, ed->weight, MIN_EXPO_WEIGHT, 100, attr, 0, event);
break; break;
case EXPO_FIELD_EXPO: case EXPO_FIELD_EXPO:
lcd_putsLeft(y, STR_EXPO); lcdDrawTextAlignedLeft(y, STR_EXPO);
if (ed->curveMode==MODE_EXPO || ed->curveParam==0) { if (ed->curveMode==MODE_EXPO || ed->curveParam==0) {
ed->curveMode = MODE_EXPO; ed->curveMode = MODE_EXPO;
ed->curveParam = GVAR_MENU_ITEM(EXPO_ONE_2ND_COLUMN, y, ed->curveParam, -100, 100, attr, 0, event); ed->curveParam = GVAR_MENU_ITEM(EXPO_ONE_2ND_COLUMN, y, ed->curveParam, -100, 100, attr, 0, event);
@ -305,7 +305,7 @@ void menuModelExpoOne(uint8_t event)
#if defined(CURVES) #if defined(CURVES)
case EXPO_FIELD_CURVE: case EXPO_FIELD_CURVE:
lcd_putsLeft(y, STR_CURVE); lcdDrawTextAlignedLeft(y, STR_CURVE);
if (ed->curveMode!=MODE_EXPO || ed->curveParam==0) { if (ed->curveMode!=MODE_EXPO || ed->curveParam==0) {
drawCurveName(EXPO_ONE_2ND_COLUMN-3*FW, y, ed->curveParam, attr); drawCurveName(EXPO_ONE_2ND_COLUMN-3*FW, y, ed->curveParam, attr);
if (attr) { if (attr) {
@ -491,17 +491,17 @@ void menuModelMixOne(uint8_t event)
break; break;
#endif #endif
case MIX_FIELD_SOURCE: case MIX_FIELD_SOURCE:
lcd_putsColumnLeft(COLUMN_X, y, NO_INDENT(STR_SOURCE)); drawFieldLabel(COLUMN_X, y, NO_INDENT(STR_SOURCE));
putsMixerSource(COLUMN_X+MIXES_2ND_COLUMN, y, md2->srcRaw, STREXPANDED|attr); putsMixerSource(COLUMN_X+MIXES_2ND_COLUMN, y, md2->srcRaw, STREXPANDED|attr);
if (attr) CHECK_INCDEC_MODELSOURCE(event, md2->srcRaw, 1, MIXSRC_LAST); if (attr) CHECK_INCDEC_MODELSOURCE(event, md2->srcRaw, 1, MIXSRC_LAST);
break; break;
case MIX_FIELD_WEIGHT: case MIX_FIELD_WEIGHT:
lcd_putsColumnLeft(COLUMN_X, y, STR_WEIGHT); drawFieldLabel(COLUMN_X, y, STR_WEIGHT);
gvarWeightItem(COLUMN_X+MIXES_2ND_COLUMN, y, md2, attr|LEFT, event); gvarWeightItem(COLUMN_X+MIXES_2ND_COLUMN, y, md2, attr|LEFT, event);
break; break;
case MIX_FIELD_OFFSET: case MIX_FIELD_OFFSET:
{ {
lcd_putsColumnLeft(COLUMN_X, y, NO_INDENT(STR_OFFSET)); drawFieldLabel(COLUMN_X, y, NO_INDENT(STR_OFFSET));
u_int8int16_t offset; u_int8int16_t offset;
MD_OFFSET_TO_UNION(md2, offset); MD_OFFSET_TO_UNION(md2, offset);
offset.word = GVAR_MENU_ITEM(COLUMN_X+MIXES_2ND_COLUMN, y, offset.word, GV_RANGELARGE_OFFSET_NEG, GV_RANGELARGE_OFFSET, attr|LEFT, 0, event); offset.word = GVAR_MENU_ITEM(COLUMN_X+MIXES_2ND_COLUMN, y, offset.word, GV_RANGELARGE_OFFSET_NEG, GV_RANGELARGE_OFFSET, attr|LEFT, 0, event);
@ -516,7 +516,7 @@ void menuModelMixOne(uint8_t event)
{ {
uint8_t not_stick = (md2->srcRaw > NUM_STICKS); uint8_t not_stick = (md2->srcRaw > NUM_STICKS);
int8_t carryTrim = -md2->carryTrim; int8_t carryTrim = -md2->carryTrim;
lcd_putsColumnLeft(COLUMN_X, y, STR_TRIM); drawFieldLabel(COLUMN_X, y, STR_TRIM);
lcdDrawTextAtIndex((not_stick ? COLUMN_X+MIXES_2ND_COLUMN : COLUMN_X+6*FW-3), y, STR_VMIXTRIMS, (not_stick && carryTrim == 0) ? 0 : carryTrim+1, menuHorizontalPosition==0 ? attr : 0); lcdDrawTextAtIndex((not_stick ? COLUMN_X+MIXES_2ND_COLUMN : COLUMN_X+6*FW-3), y, STR_VMIXTRIMS, (not_stick && carryTrim == 0) ? 0 : carryTrim+1, menuHorizontalPosition==0 ? attr : 0);
if (attr && menuHorizontalPosition==0 && (not_stick || editMode>0)) md2->carryTrim = -checkIncDecModel(event, carryTrim, not_stick ? TRIM_ON : -TRIM_OFF, -TRIM_AIL); if (attr && menuHorizontalPosition==0 && (not_stick || editMode>0)) md2->carryTrim = -checkIncDecModel(event, carryTrim, not_stick ? TRIM_ON : -TRIM_OFF, -TRIM_AIL);
if (!not_stick) { if (!not_stick) {
@ -533,7 +533,7 @@ void menuModelMixOne(uint8_t event)
#if defined(CURVES) #if defined(CURVES)
case MIX_FIELD_CURVE: case MIX_FIELD_CURVE:
{ {
lcd_putsColumnLeft(COLUMN_X, y, STR_CURVE); drawFieldLabel(COLUMN_X, y, STR_CURVE);
int8_t curveParam = md2->curveParam; int8_t curveParam = md2->curveParam;
if (md2->curveMode == MODE_CURVE) { if (md2->curveMode == MODE_CURVE) {
drawCurveName(COLUMN_X+MIXES_2ND_COLUMN, y, curveParam, attr); drawCurveName(COLUMN_X+MIXES_2ND_COLUMN, y, curveParam, attr);
@ -573,7 +573,7 @@ void menuModelMixOne(uint8_t event)
md2->swtch = switchMenuItem(COLUMN_X+MIXES_2ND_COLUMN, y, md2->swtch, attr, event); md2->swtch = switchMenuItem(COLUMN_X+MIXES_2ND_COLUMN, y, md2->swtch, attr, event);
break; break;
case MIX_FIELD_WARNING: case MIX_FIELD_WARNING:
lcd_putsColumnLeft(COLUMN_X+MIXES_2ND_COLUMN, y, STR_MIXWARNING); drawFieldLabel(COLUMN_X+MIXES_2ND_COLUMN, y, STR_MIXWARNING);
if (md2->mixWarn) if (md2->mixWarn)
lcdDrawNumber(COLUMN_X+MIXES_2ND_COLUMN, y, md2->mixWarn, attr|LEFT); lcdDrawNumber(COLUMN_X+MIXES_2ND_COLUMN, y, md2->mixWarn, attr|LEFT);
else else
@ -877,7 +877,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
lcdDrawNumber(FW*max(sizeof(TR_MENUINPUTS), sizeof(TR_MIXER))+FW+FW/2, 0, getExpoMixCount(expo)); lcdDrawNumber(FW*max(sizeof(TR_MENUINPUTS), sizeof(TR_MIXER))+FW+FW/2, 0, getExpoMixCount(expo));
lcdDrawText(FW*max(sizeof(TR_MENUINPUTS), sizeof(TR_MIXER))+FW+FW/2, 0, expo ? STR_MAX(MAX_EXPOS) : STR_MAX(MAX_MIXERS)); lcdDrawText(FW*max(sizeof(TR_MENUINPUTS), sizeof(TR_MIXER))+FW+FW/2, 0, expo ? STR_MAX(MAX_EXPOS) : STR_MAX(MAX_MIXERS));
SIMPLE_MENU(expo ? STR_MENUINPUTS : STR_MIXER, menuTabModel, expo ? e_InputsAll : e_MixAll, s_maxLines); SIMPLE_MENU(expo ? STR_MENUINPUTS : STR_MIXER, menuTabModel, expo ? MENU_MODEL_INPUTS : MENU_MODEL_MIXES, s_maxLines);
sub = menuVerticalPosition; sub = menuVerticalPosition;
s_currCh = 0; s_currCh = 0;

View file

@ -81,7 +81,7 @@ void menuModelLogicalSwitchOne(uint8_t event)
uint8_t cstate = lswFamily(cs->func); uint8_t cstate = lswFamily(cs->func);
switch(i) { switch(i) {
case LS_FIELD_FUNCTION: case LS_FIELD_FUNCTION:
lcd_putsLeft(y, STR_FUNC); lcdDrawTextAlignedLeft(y, STR_FUNC);
lcdDrawTextAtIndex(CSWONE_2ND_COLUMN, y, STR_VCSWFUNC, cs->func, attr); lcdDrawTextAtIndex(CSWONE_2ND_COLUMN, y, STR_VCSWFUNC, cs->func, attr);
if (attr) { if (attr) {
cs->func = checkIncDec(event, cs->func, 0, LS_FUNC_MAX, EE_MODEL, isLogicalSwitchFunctionAvailable); cs->func = checkIncDec(event, cs->func, 0, LS_FUNC_MAX, EE_MODEL, isLogicalSwitchFunctionAvailable);
@ -101,7 +101,7 @@ void menuModelLogicalSwitchOne(uint8_t event)
break; break;
case LS_FIELD_V1: case LS_FIELD_V1:
{ {
lcd_putsLeft(y, STR_V1); lcdDrawTextAlignedLeft(y, STR_V1);
int v1_min=0, v1_max=MIXSRC_LAST_TELEM; int v1_min=0, v1_max=MIXSRC_LAST_TELEM;
if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY || cstate == LS_FAMILY_EDGE) { if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY || cstate == LS_FAMILY_EDGE) {
putsSwitches(CSWONE_2ND_COLUMN, y, v1_val, attr); putsSwitches(CSWONE_2ND_COLUMN, y, v1_val, attr);
@ -125,7 +125,7 @@ void menuModelLogicalSwitchOne(uint8_t event)
} }
case LS_FIELD_V2: case LS_FIELD_V2:
{ {
lcd_putsLeft(y, STR_V2); lcdDrawTextAlignedLeft(y, STR_V2);
int v2_min=0, v2_max=MIXSRC_LAST_TELEM; int v2_min=0, v2_max=MIXSRC_LAST_TELEM;
if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY) { if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY) {
putsSwitches(CSWONE_2ND_COLUMN, y, cs->v2, attr); putsSwitches(CSWONE_2ND_COLUMN, y, cs->v2, attr);
@ -185,12 +185,12 @@ void menuModelLogicalSwitchOne(uint8_t event)
break; break;
} }
case LS_FIELD_ANDSW: case LS_FIELD_ANDSW:
lcd_putsLeft(y, STR_AND_SWITCH); lcdDrawTextAlignedLeft(y, STR_AND_SWITCH);
putsSwitches(CSWONE_2ND_COLUMN, y, cs->andsw, attr); putsSwitches(CSWONE_2ND_COLUMN, y, cs->andsw, attr);
if (attr) CHECK_INCDEC_MODELVAR(event, cs->andsw, -MAX_LS_ANDSW, MAX_LS_ANDSW); if (attr) CHECK_INCDEC_MODELVAR(event, cs->andsw, -MAX_LS_ANDSW, MAX_LS_ANDSW);
break; break;
case LS_FIELD_DURATION: case LS_FIELD_DURATION:
lcd_putsLeft(y, STR_DURATION); lcdDrawTextAlignedLeft(y, STR_DURATION);
if (cs->duration > 0) if (cs->duration > 0)
lcdDrawNumber(CSWONE_2ND_COLUMN, y, cs->duration, attr|PREC1|LEFT); lcdDrawNumber(CSWONE_2ND_COLUMN, y, cs->duration, attr|PREC1|LEFT);
else else
@ -198,7 +198,7 @@ void menuModelLogicalSwitchOne(uint8_t event)
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, cs->duration, MAX_LS_DURATION); if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, cs->duration, MAX_LS_DURATION);
break; break;
case LS_FIELD_DELAY: case LS_FIELD_DELAY:
lcd_putsLeft(y, STR_DELAY); lcdDrawTextAlignedLeft(y, STR_DELAY);
if (cs->delay > 0) if (cs->delay > 0)
lcdDrawNumber(CSWONE_2ND_COLUMN, y, cs->delay, attr|PREC1|LEFT); lcdDrawNumber(CSWONE_2ND_COLUMN, y, cs->delay, attr|PREC1|LEFT);
else else
@ -211,7 +211,7 @@ void menuModelLogicalSwitchOne(uint8_t event)
void menuModelLogicalSwitches(uint8_t event) void menuModelLogicalSwitches(uint8_t event)
{ {
SIMPLE_MENU(STR_MENULOGICALSWITCHES, menuTabModel, e_LogicalSwitches, NUM_LOGICAL_SWITCH+1); SIMPLE_MENU(STR_MENULOGICALSWITCHES, menuTabModel, MENU_MODEL_LOGICAL_SWITCHES, NUM_LOGICAL_SWITCH+1);
coord_t y = 0; coord_t y = 0;
uint8_t k = 0; uint8_t k = 0;
@ -290,7 +290,7 @@ void menuModelLogicalSwitches(uint8_t event)
{ {
INCDEC_DECLARE_VARS(EE_MODEL); INCDEC_DECLARE_VARS(EE_MODEL);
MENU(STR_MENULOGICALSWITCHES, menuTabModel, e_LogicalSwitches, NUM_LOGICAL_SWITCH+1, {0, NAVIGATION_LINE_BY_LINE|LS_FIELD_LAST/*repeated...*/}); MENU(STR_MENULOGICALSWITCHES, menuTabModel, MENU_MODEL_LOGICAL_SWITCHES, NUM_LOGICAL_SWITCH+1, {0, NAVIGATION_LINE_BY_LINE|LS_FIELD_LAST/*repeated...*/});
uint8_t k = 0; uint8_t k = 0;
int8_t sub = menuVerticalPosition - 1; int8_t sub = menuVerticalPosition - 1;

View file

@ -101,9 +101,9 @@ void menuModelLimits(uint8_t event)
} }
#if defined(CPUARM) #if defined(CPUARM)
MENU(STR_MENULIMITS, menuTabModel, e_Limits, 1+NUM_CHNOUT+1, {0, 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, 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, 0}); MENU(STR_MENULIMITS, menuTabModel, MENU_MODEL_OUTPUTS, 1+NUM_CHNOUT+1, {0, 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, 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, 0});
#else #else
MENU(STR_MENULIMITS, menuTabModel, e_Limits, 1+NUM_CHNOUT+1, {0, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, 0}); MENU(STR_MENULIMITS, menuTabModel, MENU_MODEL_OUTPUTS, 1+NUM_CHNOUT+1, {0, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, 0});
#endif #endif
if (warningResult) { if (warningResult) {

View file

@ -184,7 +184,7 @@ void menuModelSelect(uint8_t event)
} }
} }
else if (s_copyMode && (s_copyTgtOfs || s_copySrcRow>=0)) { else if (s_copyMode && (s_copyTgtOfs || s_copySrcRow>=0)) {
displayPopup(s_copyMode==COPY_MODE ? STR_COPYINGMODEL : STR_MOVINGMODEL); showMessageBox(s_copyMode==COPY_MODE ? STR_COPYINGMODEL : STR_MOVINGMODEL);
storageCheck(true); // force writing of current model data before this is changed storageCheck(true); // force writing of current model data before this is changed
uint8_t cur = (MAX_MODELS + sub + s_copyTgtOfs) % MAX_MODELS; uint8_t cur = (MAX_MODELS + sub + s_copyTgtOfs) % MAX_MODELS;
@ -309,9 +309,9 @@ void menuModelSelect(uint8_t event)
#endif #endif
#if defined(ROTARY_ENCODER_NAVIGATION) #if defined(ROTARY_ENCODER_NAVIGATION)
drawScreenIndex(e_ModelSelect, DIM(menuTabModel), (sub == g_eeGeneral.currModel) ? ((IS_RE_NAVIGATION_ENABLE() && s_editMode < 0) ? INVERS|BLINK : INVERS) : 0); drawScreenIndex(MENU_MODEL_SELECT, DIM(menuTabModel), (sub == g_eeGeneral.currModel) ? ((IS_RE_NAVIGATION_ENABLE() && s_editMode < 0) ? INVERS|BLINK : INVERS) : 0);
#else #else
drawScreenIndex(e_ModelSelect, DIM(menuTabModel), (sub == g_eeGeneral.currModel) ? INVERS : 0); drawScreenIndex(MENU_MODEL_SELECT, DIM(menuTabModel), (sub == g_eeGeneral.currModel) ? INVERS : 0);
#endif #endif
TITLE(STR_MENUMODELSEL); TITLE(STR_MENUMODELSEL);

View file

@ -172,7 +172,7 @@ void menuModelSetup(uint8_t event)
MENU_TAB({ 0, 0, 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 0, 1, 0, 0, 0, 0, 0, NUM_SWITCHES, NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1, FIELD_PROTOCOL_MAX, 2, CASE_PCBSKY9X(1) CASE_PCBSKY9X(2) }); MENU_TAB({ 0, 0, 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 0, 1, 0, 0, 0, 0, 0, NUM_SWITCHES, NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1, FIELD_PROTOCOL_MAX, 2, CASE_PCBSKY9X(1) CASE_PCBSKY9X(2) });
#endif #endif
MENU_CHECK(menuTabModel, e_ModelSetup, MODEL_SETUP_MAX_LINES); MENU_CHECK(menuTabModel, MENU_MODEL_SETUP, MODEL_SETUP_MAX_LINES);
#if defined(CPUARM) && (defined(DSM2) || defined(PXX)) #if defined(CPUARM) && (defined(DSM2) || defined(PXX))
if (menuEvent) { if (menuEvent) {
@ -389,7 +389,7 @@ void menuModelSetup(uint8_t event)
case ITEM_MODEL_THROTTLE_TRACE: case ITEM_MODEL_THROTTLE_TRACE:
{ {
lcd_putsLeft(y, STR_TTRACE); lcdDrawTextAlignedLeft(y, STR_TTRACE);
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.thrTraceSrc, NUM_POTS+NUM_CHNOUT); if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.thrTraceSrc, NUM_POTS+NUM_CHNOUT);
uint8_t idx = g_model.thrTraceSrc + MIXSRC_Thr; uint8_t idx = g_model.thrTraceSrc + MIXSRC_Thr;
if (idx > MIXSRC_Thr) if (idx > MIXSRC_Thr)
@ -406,7 +406,7 @@ void menuModelSetup(uint8_t event)
#if defined(CPUARM) #if defined(CPUARM)
case ITEM_MODEL_PREFLIGHT_LABEL: case ITEM_MODEL_PREFLIGHT_LABEL:
lcd_putsLeft(y, STR_PREFLIGHT); lcdDrawTextAlignedLeft(y, STR_PREFLIGHT);
break; break;
case ITEM_MODEL_CHECKLIST_DISPLAY: case ITEM_MODEL_CHECKLIST_DISPLAY:
@ -420,7 +420,7 @@ void menuModelSetup(uint8_t event)
case ITEM_MODEL_SWITCHES_WARNING: case ITEM_MODEL_SWITCHES_WARNING:
{ {
lcd_putsLeft(y, STR_SWITCHWARNING); lcdDrawTextAlignedLeft(y, STR_SWITCHWARNING);
swarnstate_t states = g_model.switchWarningState; swarnstate_t states = g_model.switchWarningState;
char c; char c;
if (attr) { if (attr) {
@ -491,7 +491,7 @@ void menuModelSetup(uint8_t event)
} }
case ITEM_MODEL_BEEP_CENTER: case ITEM_MODEL_BEEP_CENTER:
lcd_putsLeft(y, STR_BEEPCTR); lcdDrawTextAlignedLeft(y, STR_BEEPCTR);
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS; i++) { for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS; i++) {
// TODO flash saving, \001 not needed in STR_RETA123 // TODO flash saving, \001 not needed in STR_RETA123
coord_t x = MODEL_SETUP_2ND_COLUMN+i*FW; coord_t x = MODEL_SETUP_2ND_COLUMN+i*FW;
@ -510,7 +510,7 @@ void menuModelSetup(uint8_t event)
#if defined(CPUARM) #if defined(CPUARM)
case ITEM_MODEL_USE_GLOBAL_FUNCTIONS: case ITEM_MODEL_USE_GLOBAL_FUNCTIONS:
lcd_putsLeft(y, STR_USE_GLOBAL_FUNCS); lcdDrawTextAlignedLeft(y, STR_USE_GLOBAL_FUNCS);
drawCheckBox(MODEL_SETUP_2ND_COLUMN, y, !g_model.noGlobalFunctions, attr); drawCheckBox(MODEL_SETUP_2ND_COLUMN, y, !g_model.noGlobalFunctions, attr);
if (attr) g_model.noGlobalFunctions = !checkIncDecModel(event, !g_model.noGlobalFunctions, 0, 1); if (attr) g_model.noGlobalFunctions = !checkIncDecModel(event, !g_model.noGlobalFunctions, 0, 1);
break; break;
@ -518,17 +518,17 @@ void menuModelSetup(uint8_t event)
#if defined(PCBSKY9X) #if defined(PCBSKY9X)
case ITEM_MODEL_EXTRA_MODULE_LABEL: case ITEM_MODEL_EXTRA_MODULE_LABEL:
lcd_putsLeft(y, "RF Port 2 (PPM)"); lcdDrawTextAlignedLeft(y, "RF Port 2 (PPM)");
break; break;
#endif #endif
#if defined(CPUARM) #if defined(CPUARM)
case ITEM_MODEL_EXTERNAL_MODULE_LABEL: case ITEM_MODEL_EXTERNAL_MODULE_LABEL:
lcd_putsLeft(y, TR_EXTERNALRF); lcdDrawTextAlignedLeft(y, TR_EXTERNALRF);
break; break;
case ITEM_MODEL_EXTERNAL_MODULE_MODE: case ITEM_MODEL_EXTERNAL_MODULE_MODE:
lcd_putsLeft(y, STR_MODE); lcdDrawTextAlignedLeft(y, STR_MODE);
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_TARANIS_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].type, menuHorizontalPosition==0 ? attr : 0); lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_TARANIS_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].type, menuHorizontalPosition==0 ? attr : 0);
if (IS_MODULE_XJT(EXTERNAL_MODULE)) if (IS_MODULE_XJT(EXTERNAL_MODULE))
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+5*FW, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[EXTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 0); lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+5*FW, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[EXTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 0);
@ -585,10 +585,11 @@ void menuModelSetup(uint8_t event)
} }
break; break;
#endif #endif
#if defined(MULTIMODULE) #if defined(MULTIMODULE)
case ITEM_MODEL_EXTERNAL_MODULE_SUBTYPE: case ITEM_MODEL_EXTERNAL_MODULE_SUBTYPE:
{ {
lcd_putsLeft(y, STR_SUBTYPE); lcdDrawTextAlignedLeft(y, STR_SUBTYPE);
int8_t multi_rfProto = min<int8_t>(g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol, (uint8_t) MM_RF_PROTO_CUSTOM); int8_t multi_rfProto = min<int8_t>(g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol, (uint8_t) MM_RF_PROTO_CUSTOM);
switch (multi_rfProto) { switch (multi_rfProto) {
case MM_RF_PROTO_FLYSKY: case MM_RF_PROTO_FLYSKY:
@ -677,7 +678,7 @@ void menuModelSetup(uint8_t event)
{ {
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k); uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
ModuleData & moduleData = g_model.moduleData[moduleIdx]; ModuleData & moduleData = g_model.moduleData[moduleIdx];
lcd_putsLeft(y, STR_CHANNELRANGE); lcdDrawTextAlignedLeft(y, STR_CHANNELRANGE);
if ((int8_t)PORT_CHANNELS_ROWS(moduleIdx) >= 0) { if ((int8_t)PORT_CHANNELS_ROWS(moduleIdx) >= 0) {
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, STR_CH, menuHorizontalPosition==0 ? attr : 0); lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, STR_CH, menuHorizontalPosition==0 ? attr : 0);
lcdDrawNumber(lcdLastPos, y, moduleData.channelsStart+1, LEFT | (menuHorizontalPosition==0 ? attr : 0)); lcdDrawNumber(lcdLastPos, y, moduleData.channelsStart+1, LEFT | (menuHorizontalPosition==0 ? attr : 0));
@ -710,7 +711,7 @@ void menuModelSetup(uint8_t event)
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k); uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
ModuleData & moduleData = g_model.moduleData[moduleIdx]; ModuleData & moduleData = g_model.moduleData[moduleIdx];
if (IS_MODULE_PPM(moduleIdx)) { if (IS_MODULE_PPM(moduleIdx)) {
lcd_putsLeft(y, STR_PPMFRAME); lcdDrawTextAlignedLeft(y, STR_PPMFRAME);
lcdDrawText(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_MS); lcdDrawText(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_MS);
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, (int16_t)moduleData.ppm.frameLength*5 + 225, (menuHorizontalPosition<=0 ? attr : 0) | PREC1|LEFT); lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, (int16_t)moduleData.ppm.frameLength*5 + 225, (menuHorizontalPosition<=0 ? attr : 0) | PREC1|LEFT);
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, 'u'); lcdDrawChar(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, 'u');
@ -736,11 +737,11 @@ void menuModelSetup(uint8_t event)
coord_t xOffsetBind = MODEL_SETUP_BIND_OFS; coord_t xOffsetBind = MODEL_SETUP_BIND_OFS;
if (IS_MODULE_XJT(moduleIdx) && IS_D8_RX(moduleIdx)) { if (IS_MODULE_XJT(moduleIdx) && IS_D8_RX(moduleIdx)) {
xOffsetBind = 0; xOffsetBind = 0;
lcd_putsLeft(y, STR_RECEIVER); lcdDrawTextAlignedLeft(y, STR_RECEIVER);
if (attr) l_posHorz += 1; if (attr) l_posHorz += 1;
} }
else { else {
lcd_putsLeft(y, STR_RECEIVER_NUM); lcdDrawTextAlignedLeft(y, STR_RECEIVER_NUM);
} }
if (IS_MODULE_XJT(moduleIdx) || IS_MODULE_DSM2(moduleIdx) || IS_MODULE_MULTIMODULE(moduleIdx)) { if (IS_MODULE_XJT(moduleIdx) || IS_MODULE_DSM2(moduleIdx) || IS_MODULE_MULTIMODULE(moduleIdx)) {
if (xOffsetBind) lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, g_model.header.modelId[moduleIdx], (l_posHorz==0 ? attr : 0) | LEADING0|LEFT, 2); if (xOffsetBind) lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, g_model.header.modelId[moduleIdx], (l_posHorz==0 ? attr : 0) | LEADING0|LEFT, 2);
@ -788,7 +789,8 @@ void menuModelSetup(uint8_t event)
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k); uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
ModuleData & moduleData = g_model.moduleData[moduleIdx]; ModuleData & moduleData = g_model.moduleData[moduleIdx];
if (IS_MODULE_XJT(moduleIdx)) { if (IS_MODULE_XJT(moduleIdx)) {
lcd_putsLeft(y, TR_FAILSAFE); lcdDrawTextAlignedLeft(y, STR_FAILSAFE);
lcdDrawTextAlignedLeft(y, TR_FAILSAFE);
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VFAILSAFE, moduleData.failsafeMode, menuHorizontalPosition == 0 lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VFAILSAFE, moduleData.failsafeMode, menuHorizontalPosition == 0
? attr : 0); ? attr : 0);
if (moduleData.failsafeMode == FAILSAFE_CUSTOM) if (moduleData.failsafeMode == FAILSAFE_CUSTOM)
@ -821,16 +823,16 @@ void menuModelSetup(uint8_t event)
{ {
case MM_RF_PROTO_FRSKY: case MM_RF_PROTO_FRSKY:
case MM_RF_PROTO_SFHSS: case MM_RF_PROTO_SFHSS:
lcd_putsLeft(y, STR_MULTI_RFTUNE); lcdDrawTextAlignedLeft(y, STR_MULTI_RFTUNE);
break; break;
case MM_RF_PROTO_HUBSAN: case MM_RF_PROTO_HUBSAN:
lcd_putsLeft(y, STR_MULTI_VIDFREQ); lcdDrawTextAlignedLeft(y, STR_MULTI_VIDFREQ);
break; break;
case MM_RF_PROTO_DSM2: case MM_RF_PROTO_DSM2:
g_model.moduleData[moduleIdx].multi.optionValue = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_MULTI_DSMFRAME, STR_OPTIONS_DSM, g_model.moduleData[moduleIdx].multi.optionValue, 0, 12, attr, event); g_model.moduleData[moduleIdx].multi.optionValue = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_MULTI_DSMFRAME, STR_OPTIONS_DSM, g_model.moduleData[moduleIdx].multi.optionValue, 0, 12, attr, event);
break; break;
default: default:
lcd_putsLeft(y, STR_MULTI_OPTION); lcdDrawTextAlignedLeft(y, STR_MULTI_OPTION);
break; break;
} }
if (g_model.moduleData[moduleIdx].multi.rfProtocol != MM_RF_PROTO_DSM2) { if (g_model.moduleData[moduleIdx].multi.rfProtocol != MM_RF_PROTO_DSM2) {
@ -856,7 +858,7 @@ void menuModelSetup(uint8_t event)
#if !defined(CPUARM) #if !defined(CPUARM)
case ITEM_MODEL_PPM1_PROTOCOL: case ITEM_MODEL_PPM1_PROTOCOL:
lcd_putsLeft(y, NO_INDENT(STR_PROTO)); lcdDrawTextAlignedLeft(y, NO_INDENT(STR_PROTO));
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VPROTOS, protocol, menuHorizontalPosition<=0 ? attr : 0); lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VPROTOS, protocol, menuHorizontalPosition<=0 ? attr : 0);
if (IS_PPM_PROTOCOL(protocol)) { if (IS_PPM_PROTOCOL(protocol)) {
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+7*FW, y, STR_NCHANNELS, g_model.ppmNCH+2, menuHorizontalPosition!=0 ? attr : 0); lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+7*FW, y, STR_NCHANNELS, g_model.ppmNCH+2, menuHorizontalPosition!=0 ? attr : 0);
@ -880,7 +882,7 @@ void menuModelSetup(uint8_t event)
#if 0 #if 0
case ITEM_MODEL_PPM2_PROTOCOL: case ITEM_MODEL_PPM2_PROTOCOL:
lcd_putsLeft(y, PSTR("Port2")); lcdDrawTextAlignedLeft(y, PSTR("Port2"));
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VPROTOS, 0, 0); lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VPROTOS, 0, 0);
lcdDrawText(MODEL_SETUP_2ND_COLUMN+4*FW+3, y, STR_CH, menuHorizontalPosition<=0 ? attr : 0); lcdDrawText(MODEL_SETUP_2ND_COLUMN+4*FW+3, y, STR_CH, menuHorizontalPosition<=0 ? attr : 0);
lcdDrawNumber(lcdLastPos, y, g_model.moduleData[1].channelsStart+1, LEFT | (menuHorizontalPosition<=0 ? attr : 0)); lcdDrawNumber(lcdLastPos, y, g_model.moduleData[1].channelsStart+1, LEFT | (menuHorizontalPosition<=0 ? attr : 0));
@ -901,7 +903,7 @@ void menuModelSetup(uint8_t event)
break; break;
case ITEM_MODEL_PPM2_PARAMS: case ITEM_MODEL_PPM2_PARAMS:
lcd_putsLeft(y, STR_PPMFRAME); lcdDrawTextAlignedLeft(y, STR_PPMFRAME);
lcdDrawText(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_MS); lcdDrawText(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_MS);
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, (int16_t)g_model.moduleData[1].ppmFrameLength*5 + 225, (menuHorizontalPosition<=0 ? attr : 0) | PREC1|LEFT); lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, (int16_t)g_model.moduleData[1].ppmFrameLength*5 + 225, (menuHorizontalPosition<=0 ? attr : 0) | PREC1|LEFT);
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, 'u'); lcdDrawChar(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, 'u');
@ -926,7 +928,7 @@ void menuModelSetup(uint8_t event)
#if !defined(CPUARM) #if !defined(CPUARM)
case ITEM_MODEL_PPM1_PARAMS: case ITEM_MODEL_PPM1_PARAMS:
if (IS_PPM_PROTOCOL(protocol)) { if (IS_PPM_PROTOCOL(protocol)) {
lcd_putsLeft(y, STR_PPMFRAME); lcdDrawTextAlignedLeft(y, STR_PPMFRAME);
lcdDrawText(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_MS); lcdDrawText(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_MS);
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, (int16_t)g_model.ppmFrameLength*5 + 225, (menuHorizontalPosition<=0 ? attr : 0) | PREC1|LEFT); lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, (int16_t)g_model.ppmFrameLength*5 + 225, (menuHorizontalPosition<=0 ? attr : 0) | PREC1|LEFT);
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, 'u'); lcdDrawChar(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, 'u');
@ -951,7 +953,7 @@ void menuModelSetup(uint8_t event)
if (attr && menuHorizontalPosition > 1) { if (attr && menuHorizontalPosition > 1) {
REPEAT_LAST_CURSOR_MOVE(); // limit 3 column row to 2 colums (Rx_Num and RANGE fields) REPEAT_LAST_CURSOR_MOVE(); // limit 3 column row to 2 colums (Rx_Num and RANGE fields)
} }
lcd_putsLeft(y, STR_RECEIVER_NUM); lcdDrawTextAlignedLeft(y, STR_RECEIVER_NUM);
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, g_model.header.modelId[0], (menuHorizontalPosition<=0 ? attr : 0) | LEADING0|LEFT, 2); lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, g_model.header.modelId[0], (menuHorizontalPosition<=0 ? attr : 0) | LEADING0|LEFT, 2);
if (attr && (menuHorizontalPosition==0 && (editMode>0 || p1valdiff))) { if (attr && (menuHorizontalPosition==0 && (editMode>0 || p1valdiff))) {
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.header.modelId[0], 99); CHECK_INCDEC_MODELVAR_ZERO(event, g_model.header.modelId[0], 99);
@ -982,7 +984,7 @@ void menuModelSetup(uint8_t event)
#if defined(CPUARM) && defined(PXX) #if defined(CPUARM) && defined(PXX)
if (IS_RANGECHECK_ENABLE()) { if (IS_RANGECHECK_ENABLE()) {
displayPopup("RSSI: "); showMessageBox("RSSI: ");
lcdDrawNumber(16+4*FW, 5*FH, TELEMETRY_RSSI(), BOLD); lcdDrawNumber(16+4*FW, 5*FH, TELEMETRY_RSSI(), BOLD);
} }
#endif #endif

View file

@ -37,7 +37,7 @@ void onCustomFunctionsFileSelectionMenu(const char *result)
CustomFunctionData * cfn; CustomFunctionData * cfn;
uint8_t eeFlags; uint8_t eeFlags;
if (menuHandlers[menuLevel] == menuModelCustomFunctions) { if (menuHandlers[menuLevel] == menuModelSpecialFunctions) {
cfn = &g_model.customFn[sub]; cfn = &g_model.customFn[sub];
eeFlags = EE_MODEL; eeFlags = EE_MODEL;
} }
@ -70,7 +70,7 @@ void onCustomFunctionsFileSelectionMenu(const char *result)
} }
#endif #endif
void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext) void menuSpecialFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext)
{ {
int8_t sub = menuVerticalPosition - 1; int8_t sub = menuVerticalPosition - 1;
@ -375,8 +375,8 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
} }
} }
void menuModelCustomFunctions(uint8_t event) void menuModelSpecialFunctions(uint8_t event)
{ {
MENU(STR_MENUCUSTOMFUNC, menuTabModel, e_CustomFunctions, NUM_CFN+1, {0, NAVIGATION_LINE_BY_LINE|4/*repeated*/}); MENU(STR_MENUCUSTOMFUNC, menuTabModel, MENU_MODEL_SPECIAL_FUNCTIONS, NUM_CFN+1, {0, NAVIGATION_LINE_BY_LINE|4/*repeated*/});
return menuCustomFunctions(event, g_model.customFn, &modelFunctionsContext); return menuSpecialFunctions(event, g_model.customFn, &modelFunctionsContext);
} }

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
enum menuModelTelemetryItems { enum MenuModelTelemetryFrskyItems {
CASE_CPUARM(ITEM_TELEMETRY_PROTOCOL_TYPE) CASE_CPUARM(ITEM_TELEMETRY_PROTOCOL_TYPE)
#if defined(REVX) #if defined(REVX)
ITEM_TELEMETRY_INVERTED_SERIAL, ITEM_TELEMETRY_INVERTED_SERIAL,
@ -264,7 +264,7 @@ void menuModelSensor(uint8_t event)
case SENSOR_FIELD_ID: case SENSOR_FIELD_ID:
if (sensor->type == TELEM_TYPE_CUSTOM) { if (sensor->type == TELEM_TYPE_CUSTOM) {
lcd_putsLeft(y, STR_ID); lcdDrawTextAlignedLeft(y, STR_ID);
lcdDrawHexNumber(SENSOR_2ND_COLUMN, y, sensor->id, LEFT|(menuHorizontalPosition==0 ? attr : 0)); lcdDrawHexNumber(SENSOR_2ND_COLUMN, y, sensor->id, LEFT|(menuHorizontalPosition==0 ? attr : 0));
lcdDrawNumber(SENSOR_3RD_COLUMN, y, sensor->instance, LEFT|(menuHorizontalPosition==1 ? attr : 0)); lcdDrawNumber(SENSOR_3RD_COLUMN, y, sensor->instance, LEFT|(menuHorizontalPosition==1 ? attr : 0));
if (attr) { if (attr) {
@ -300,7 +300,7 @@ void menuModelSensor(uint8_t event)
break; break;
case SENSOR_FIELD_UNIT: case SENSOR_FIELD_UNIT:
lcd_putsLeft(y, "Unit"); lcdDrawTextAlignedLeft(y, "Unit");
// TODO flash saving with selectMenuItem where I copied those 2 lines? // TODO flash saving with selectMenuItem where I copied those 2 lines?
lcdDrawTextAtIndex(SENSOR_2ND_COLUMN, y, STR_VTELEMUNIT, sensor->unit, attr); lcdDrawTextAtIndex(SENSOR_2ND_COLUMN, y, STR_VTELEMUNIT, sensor->unit, attr);
if (attr) { if (attr) {
@ -321,7 +321,7 @@ void menuModelSensor(uint8_t event)
case SENSOR_FIELD_PARAM1: case SENSOR_FIELD_PARAM1:
if (sensor->type == TELEM_TYPE_CALCULATED) { if (sensor->type == TELEM_TYPE_CALCULATED) {
if (sensor->formula == TELEM_FORMULA_CELL) { if (sensor->formula == TELEM_FORMULA_CELL) {
lcd_putsLeft(y, STR_CELLSENSOR); lcdDrawTextAlignedLeft(y, STR_CELLSENSOR);
putsMixerSource(SENSOR_2ND_COLUMN, y, sensor->cell.source ? MIXSRC_FIRST_TELEM+3*(sensor->cell.source-1) : 0, attr); putsMixerSource(SENSOR_2ND_COLUMN, y, sensor->cell.source ? MIXSRC_FIRST_TELEM+3*(sensor->cell.source-1) : 0, attr);
if (attr) { if (attr) {
sensor->cell.source = checkIncDec(event, sensor->cell.source, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isCellsSensor); sensor->cell.source = checkIncDec(event, sensor->cell.source, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isCellsSensor);
@ -329,7 +329,7 @@ void menuModelSensor(uint8_t event)
break; break;
} }
else if (sensor->formula == TELEM_FORMULA_DIST) { else if (sensor->formula == TELEM_FORMULA_DIST) {
lcd_putsLeft(y, STR_GPSSENSOR); lcdDrawTextAlignedLeft(y, STR_GPSSENSOR);
putsMixerSource(SENSOR_2ND_COLUMN, y, sensor->dist.gps ? MIXSRC_FIRST_TELEM+3*(sensor->dist.gps-1) : 0, attr); putsMixerSource(SENSOR_2ND_COLUMN, y, sensor->dist.gps ? MIXSRC_FIRST_TELEM+3*(sensor->dist.gps-1) : 0, attr);
if (attr) { if (attr) {
sensor->dist.gps = checkIncDec(event, sensor->dist.gps, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isGPSSensor); sensor->dist.gps = checkIncDec(event, sensor->dist.gps, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isGPSSensor);
@ -337,7 +337,7 @@ void menuModelSensor(uint8_t event)
break; break;
} }
else if (sensor->formula == TELEM_FORMULA_CONSUMPTION) { else if (sensor->formula == TELEM_FORMULA_CONSUMPTION) {
lcd_putsLeft(y, STR_CURRENTSENSOR); lcdDrawTextAlignedLeft(y, STR_CURRENTSENSOR);
putsMixerSource(SENSOR_2ND_COLUMN, y, sensor->consumption.source ? MIXSRC_FIRST_TELEM+3*(sensor->consumption.source-1) : 0, attr); putsMixerSource(SENSOR_2ND_COLUMN, y, sensor->consumption.source ? MIXSRC_FIRST_TELEM+3*(sensor->consumption.source-1) : 0, attr);
if (attr) { if (attr) {
sensor->consumption.source = checkIncDec(event, sensor->consumption.source, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isCurrentSensor); sensor->consumption.source = checkIncDec(event, sensor->consumption.source, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isCurrentSensor);
@ -347,13 +347,13 @@ void menuModelSensor(uint8_t event)
} }
else { else {
if (sensor->unit == UNIT_RPMS) { if (sensor->unit == UNIT_RPMS) {
lcd_putsLeft(y, NO_INDENT(STR_BLADES)); lcdDrawTextAlignedLeft(y, NO_INDENT(STR_BLADES));
if (attr) CHECK_INCDEC_MODELVAR(event, sensor->custom.ratio, 1, 30000); if (attr) CHECK_INCDEC_MODELVAR(event, sensor->custom.ratio, 1, 30000);
lcdDrawNumber(SENSOR_2ND_COLUMN, y, sensor->custom.ratio, LEFT|attr); lcdDrawNumber(SENSOR_2ND_COLUMN, y, sensor->custom.ratio, LEFT|attr);
break; break;
} }
else { else {
lcd_putsLeft(y, STR_RATIO); lcdDrawTextAlignedLeft(y, STR_RATIO);
if (attr) CHECK_INCDEC_MODELVAR(event, sensor->custom.ratio, 0, 30000); if (attr) CHECK_INCDEC_MODELVAR(event, sensor->custom.ratio, 0, 30000);
if (sensor->custom.ratio == 0) if (sensor->custom.ratio == 0)
lcdDrawChar(SENSOR_2ND_COLUMN, y, '-', attr); lcdDrawChar(SENSOR_2ND_COLUMN, y, '-', attr);
@ -371,7 +371,7 @@ void menuModelSensor(uint8_t event)
break; break;
} }
else if (sensor->formula == TELEM_FORMULA_DIST) { else if (sensor->formula == TELEM_FORMULA_DIST) {
lcd_putsLeft(y, STR_ALTSENSOR); lcdDrawTextAlignedLeft(y, STR_ALTSENSOR);
putsMixerSource(SENSOR_2ND_COLUMN, y, sensor->dist.alt ? MIXSRC_FIRST_TELEM+3*(sensor->dist.alt-1) : 0, attr); putsMixerSource(SENSOR_2ND_COLUMN, y, sensor->dist.alt ? MIXSRC_FIRST_TELEM+3*(sensor->dist.alt-1) : 0, attr);
if (attr) { if (attr) {
sensor->dist.alt = checkIncDec(event, sensor->dist.alt, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isAltSensor); sensor->dist.alt = checkIncDec(event, sensor->dist.alt, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isAltSensor);
@ -380,7 +380,7 @@ void menuModelSensor(uint8_t event)
} }
} }
else { else {
lcd_putsLeft(y, NO_INDENT(STR_OFFSET)); lcdDrawTextAlignedLeft(y, NO_INDENT(STR_OFFSET));
if (attr) CHECK_INCDEC_MODELVAR(event, sensor->custom.offset, -30000, +30000); if (attr) CHECK_INCDEC_MODELVAR(event, sensor->custom.offset, -30000, +30000);
if (sensor->prec > 0) attr |= (sensor->prec == 2 ? PREC2 : PREC1); if (sensor->prec > 0) attr |= (sensor->prec == 2 ? PREC2 : PREC1);
lcdDrawNumber(SENSOR_2ND_COLUMN, y, sensor->custom.offset, LEFT|attr); lcdDrawNumber(SENSOR_2ND_COLUMN, y, sensor->custom.offset, LEFT|attr);
@ -468,7 +468,7 @@ void onSensorMenu(const char *result)
} }
#endif #endif
void menuModelTelemetry(uint8_t event) void menuModelTelemetryFrsky(uint8_t event)
{ {
#if defined(CPUARM) #if defined(CPUARM)
if (warningResult) { if (warningResult) {
@ -479,7 +479,7 @@ void menuModelTelemetry(uint8_t event)
} }
#endif #endif
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX+1, {0, TELEMETRY_TYPE_ROWS CHANNELS_ROWS RSSI_ROWS SENSORS_ROWS USRDATA_ROWS CASE_VARIO(LABEL(Vario)) CASE_VARIO(0) CASE_VARIO(VARIO_RANGE_ROWS) TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1), CASE_CPUARM(TELEMETRY_SCREEN_ROWS(2)) CASE_CPUARM(TELEMETRY_SCREEN_ROWS(3))}); MENU(STR_MENUTELEMETRY, menuTabModel, MENU_MODEL_TELEMETRY_FRSKY, ITEM_TELEMETRY_MAX+1, {0, TELEMETRY_TYPE_ROWS CHANNELS_ROWS RSSI_ROWS SENSORS_ROWS USRDATA_ROWS CASE_VARIO(LABEL(Vario)) CASE_VARIO(0) CASE_VARIO(VARIO_RANGE_ROWS) TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1), CASE_CPUARM(TELEMETRY_SCREEN_ROWS(2)) CASE_CPUARM(TELEMETRY_SCREEN_ROWS(3))});
uint8_t sub = menuVerticalPosition - 1; uint8_t sub = menuVerticalPosition - 1;
@ -553,7 +553,7 @@ void menuModelTelemetry(uint8_t event)
switch (k) { switch (k) {
#if defined(CPUARM) #if defined(CPUARM)
case ITEM_TELEMETRY_PROTOCOL_TYPE: case ITEM_TELEMETRY_PROTOCOL_TYPE:
lcd_putsLeft(y, STR_TELEMETRY_TYPE); lcdDrawTextAlignedLeft(y, STR_TELEMETRY_TYPE);
lcdDrawTextAtIndex(TELEM_COL2, y, STR_TELEMETRY_PROTOCOLS, g_model.telemetryProtocol, attr); lcdDrawTextAtIndex(TELEM_COL2, y, STR_TELEMETRY_PROTOCOLS, g_model.telemetryProtocol, attr);
g_model.telemetryProtocol = checkIncDec(event, g_model.telemetryProtocol, PROTOCOL_TELEMETRY_FIRST, PROTOCOL_TELEMETRY_LAST, EE_MODEL, isTelemetryProtocolAvailable); g_model.telemetryProtocol = checkIncDec(event, g_model.telemetryProtocol, PROTOCOL_TELEMETRY_FIRST, PROTOCOL_TELEMETRY_LAST, EE_MODEL, isTelemetryProtocolAvailable);
break; break;
@ -566,7 +566,7 @@ void menuModelTelemetry(uint8_t event)
#if defined(CPUARM) #if defined(CPUARM)
case ITEM_TELEMETRY_SENSORS_LABEL: case ITEM_TELEMETRY_SENSORS_LABEL:
lcd_putsLeft(y, STR_TELEMETRY_SENSORS); lcdDrawTextAlignedLeft(y, STR_TELEMETRY_SENSORS);
break; break;
case ITEM_TELEMETRY_DISCOVER_SENSORS: case ITEM_TELEMETRY_DISCOVER_SENSORS:
@ -609,14 +609,14 @@ void menuModelTelemetry(uint8_t event)
#if !defined(CPUARM) #if !defined(CPUARM)
case ITEM_TELEMETRY_A1_LABEL: case ITEM_TELEMETRY_A1_LABEL:
case ITEM_TELEMETRY_A2_LABEL: case ITEM_TELEMETRY_A2_LABEL:
lcd_putsLeft(y, STR_ACHANNEL); lcdDrawTextAlignedLeft(y, STR_ACHANNEL);
lcdDrawNumber(2*FW, y, ch+1, 0); lcdDrawNumber(2*FW, y, ch+1, 0);
putsTelemetryChannelValue(TELEM_COL2+6*FW, y, dest, telemetryData.analog[ch].value, LEFT); putsTelemetryChannelValue(TELEM_COL2+6*FW, y, dest, telemetryData.analog[ch].value, LEFT);
break; break;
case ITEM_TELEMETRY_A1_RANGE: case ITEM_TELEMETRY_A1_RANGE:
case ITEM_TELEMETRY_A2_RANGE: case ITEM_TELEMETRY_A2_RANGE:
lcd_putsLeft(y, STR_RANGE); lcdDrawTextAlignedLeft(y, STR_RANGE);
putsTelemetryChannelValue(TELEM_COL2, y, dest, 255-channel.offset, (menuHorizontalPosition<=0 ? attr : 0)|NO_UNIT|LEFT); putsTelemetryChannelValue(TELEM_COL2, y, dest, 255-channel.offset, (menuHorizontalPosition<=0 ? attr : 0)|NO_UNIT|LEFT);
lcdDrawTextAtIndex(lcdLastPos, y, STR_VTELEMUNIT, channel.type, menuHorizontalPosition!=0 ? attr : 0); lcdDrawTextAtIndex(lcdLastPos, y, STR_VTELEMUNIT, channel.type, menuHorizontalPosition!=0 ? attr : 0);
if (attr && (s_editMode>0 || p1valdiff)) { if (attr && (s_editMode>0 || p1valdiff)) {
@ -642,7 +642,7 @@ void menuModelTelemetry(uint8_t event)
case ITEM_TELEMETRY_A1_OFFSET: case ITEM_TELEMETRY_A1_OFFSET:
case ITEM_TELEMETRY_A2_OFFSET: case ITEM_TELEMETRY_A2_OFFSET:
lcd_putsLeft(y, STR_OFFSET); lcdDrawTextAlignedLeft(y, STR_OFFSET);
putsTelemetryChannelValue(TELEM_COL2, y, dest, 0, LEFT|attr); putsTelemetryChannelValue(TELEM_COL2, y, dest, 0, LEFT|attr);
if (attr) channel.offset = checkIncDec(event, channel.offset, -256, 256, EE_MODEL); if (attr) channel.offset = checkIncDec(event, channel.offset, -256, 256, EE_MODEL);
break; break;
@ -653,7 +653,7 @@ void menuModelTelemetry(uint8_t event)
case ITEM_TELEMETRY_A2_ALARM2: case ITEM_TELEMETRY_A2_ALARM2:
{ {
uint8_t alarm = ((k==ITEM_TELEMETRY_A1_ALARM1 || k==ITEM_TELEMETRY_A2_ALARM1) ? 0 : 1); uint8_t alarm = ((k==ITEM_TELEMETRY_A1_ALARM1 || k==ITEM_TELEMETRY_A2_ALARM1) ? 0 : 1);
lcd_putsLeft(y, STR_ALARM); lcdDrawTextAlignedLeft(y, STR_ALARM);
lcdDrawTextAtIndex(TELEM_COL2, y, STR_VALARM, ALARM_LEVEL(ch, alarm), menuHorizontalPosition<=0 ? attr : 0); lcdDrawTextAtIndex(TELEM_COL2, y, STR_VALARM, ALARM_LEVEL(ch, alarm), menuHorizontalPosition<=0 ? attr : 0);
lcdDrawTextAtIndex(TELEM_COL2+4*FW, y, STR_VALARMFN, ALARM_GREATER(ch, alarm), (CURSOR_ON_LINE() || menuHorizontalPosition==1) ? attr : 0); lcdDrawTextAtIndex(TELEM_COL2+4*FW, y, STR_VALARMFN, ALARM_GREATER(ch, alarm), (CURSOR_ON_LINE() || menuHorizontalPosition==1) ? attr : 0);
putsTelemetryChannelValue(TELEM_COL2+6*FW, y, dest, channel.alarms_value[alarm], ((CURSOR_ON_LINE() || menuHorizontalPosition==2) ? attr : 0) | LEFT); putsTelemetryChannelValue(TELEM_COL2+6*FW, y, dest, channel.alarms_value[alarm], ((CURSOR_ON_LINE() || menuHorizontalPosition==2) ? attr : 0) | LEFT);
@ -682,13 +682,13 @@ void menuModelTelemetry(uint8_t event)
#endif #endif
case ITEM_TELEMETRY_RSSI_LABEL: case ITEM_TELEMETRY_RSSI_LABEL:
lcd_putsLeft(y, PSTR("RSSI")); lcdDrawTextAlignedLeft(y, PSTR("RSSI"));
break; break;
case ITEM_TELEMETRY_RSSI_ALARM1: case ITEM_TELEMETRY_RSSI_ALARM1:
case ITEM_TELEMETRY_RSSI_ALARM2: { case ITEM_TELEMETRY_RSSI_ALARM2: {
uint8_t alarm = k-ITEM_TELEMETRY_RSSI_ALARM1; uint8_t alarm = k-ITEM_TELEMETRY_RSSI_ALARM1;
lcd_putsLeft(y, STR_ALARM); lcdDrawTextAlignedLeft(y, STR_ALARM);
lcdDrawTextAtIndex(TELEM_COL2, y, STR_VALARM, ((2+alarm+g_model.frsky.rssiAlarms[alarm].level)%4), menuHorizontalPosition<=0 ? attr : 0); lcdDrawTextAtIndex(TELEM_COL2, y, STR_VALARM, ((2+alarm+g_model.frsky.rssiAlarms[alarm].level)%4), menuHorizontalPosition<=0 ? attr : 0);
lcdDrawChar(TELEM_COL2+4*FW, y, '<'); lcdDrawChar(TELEM_COL2+4*FW, y, '<');
lcdDrawNumber(TELEM_COL2+6*FW, y, getRssiAlarmValue(alarm), LEFT|(menuHorizontalPosition!=0 ? attr : 0), 3); lcdDrawNumber(TELEM_COL2+6*FW, y, getRssiAlarmValue(alarm), LEFT|(menuHorizontalPosition!=0 ? attr : 0), 3);
@ -709,37 +709,37 @@ void menuModelTelemetry(uint8_t event)
#if !defined(CPUARM) #if !defined(CPUARM)
#if defined(FRSKY_HUB) || defined(WS_HOW_HIGH) #if defined(FRSKY_HUB) || defined(WS_HOW_HIGH)
case ITEM_TELEMETRY_USR_LABEL: case ITEM_TELEMETRY_USR_LABEL:
lcd_putsLeft(y, STR_USRDATA); lcdDrawTextAlignedLeft(y, STR_USRDATA);
break; break;
case ITEM_TELEMETRY_USR_PROTO: case ITEM_TELEMETRY_USR_PROTO:
lcd_putsLeft(y, STR_PROTO); lcdDrawTextAlignedLeft(y, STR_PROTO);
lcdDrawTextAtIndex(TELEM_COL2, y, STR_VTELPROTO, g_model.frsky.usrProto, attr); lcdDrawTextAtIndex(TELEM_COL2, y, STR_VTELPROTO, g_model.frsky.usrProto, attr);
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.frsky.usrProto, USR_PROTO_LAST); if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.frsky.usrProto, USR_PROTO_LAST);
break; break;
case ITEM_TELEMETRY_USR_BLADES: case ITEM_TELEMETRY_USR_BLADES:
lcd_putsLeft(y, STR_BLADES); lcdDrawTextAlignedLeft(y, STR_BLADES);
lcdDrawNumber(TELEM_COL2+FWNUM, y, 2+g_model.frsky.blades, attr); lcdDrawNumber(TELEM_COL2+FWNUM, y, 2+g_model.frsky.blades, attr);
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.frsky.blades, MAX_BLADES); if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.frsky.blades, MAX_BLADES);
break; break;
#endif #endif
case ITEM_TELEMETRY_USR_VOLTAGE_SOURCE: case ITEM_TELEMETRY_USR_VOLTAGE_SOURCE:
lcd_putsLeft(y, STR_VOLTAGE); lcdDrawTextAlignedLeft(y, STR_VOLTAGE);
lcdDrawTextAtIndex(TELEM_COL2, y, STR_AMPSRC, g_model.frsky.voltsSource+1, attr); lcdDrawTextAtIndex(TELEM_COL2, y, STR_AMPSRC, g_model.frsky.voltsSource+1, attr);
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.frsky.voltsSource, FRSKY_VOLTS_SOURCE_LAST); if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.frsky.voltsSource, FRSKY_VOLTS_SOURCE_LAST);
break; break;
case ITEM_TELEMETRY_USR_CURRENT_SOURCE: case ITEM_TELEMETRY_USR_CURRENT_SOURCE:
lcd_putsLeft(y, STR_CURRENT); lcdDrawTextAlignedLeft(y, STR_CURRENT);
lcdDrawTextAtIndex(TELEM_COL2, y, STR_AMPSRC, g_model.frsky.currentSource, attr); lcdDrawTextAtIndex(TELEM_COL2, y, STR_AMPSRC, g_model.frsky.currentSource, attr);
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.frsky.currentSource, FRSKY_CURRENT_SOURCE_LAST); if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.frsky.currentSource, FRSKY_CURRENT_SOURCE_LAST);
break; break;
#if defined(FAS_OFFSET) || !defined(CPUM64) #if defined(FAS_OFFSET) || !defined(CPUM64)
case ITEM_TELEMETRY_FAS_OFFSET: case ITEM_TELEMETRY_FAS_OFFSET:
lcd_putsLeft(y, STR_FAS_OFFSET); lcdDrawTextAlignedLeft(y, STR_FAS_OFFSET);
lcdDrawNumber(TELEM_COL2, y, g_model.frsky.fasOffset, attr|LEFT|PREC1); lcdDrawNumber(TELEM_COL2, y, g_model.frsky.fasOffset, attr|LEFT|PREC1);
lcdDrawNumber(TELEM_COL2+6*FW, y, telemetryData.hub.current, LEFT|PREC1); lcdDrawNumber(TELEM_COL2+6*FW, y, telemetryData.hub.current, LEFT|PREC1);
lcdDrawChar(TELEM_COL2+8*FW, y, 'A'); lcdDrawChar(TELEM_COL2+8*FW, y, 'A');
@ -750,11 +750,11 @@ void menuModelTelemetry(uint8_t event)
#if defined(VARIO) #if defined(VARIO)
case ITEM_TELEMETRY_VARIO_LABEL: case ITEM_TELEMETRY_VARIO_LABEL:
lcd_putsLeft(y, STR_VARIO); lcdDrawTextAlignedLeft(y, STR_VARIO);
break; break;
case ITEM_TELEMETRY_VARIO_SOURCE: case ITEM_TELEMETRY_VARIO_SOURCE:
lcd_putsLeft(y, STR_SOURCE); lcdDrawTextAlignedLeft(y, STR_SOURCE);
#if defined(CPUARM) #if defined(CPUARM)
putsMixerSource(TELEM_COL2, y, g_model.frsky.varioSource ? MIXSRC_FIRST_TELEM+3*(g_model.frsky.varioSource-1) : 0, attr); putsMixerSource(TELEM_COL2, y, g_model.frsky.varioSource ? MIXSRC_FIRST_TELEM+3*(g_model.frsky.varioSource-1) : 0, attr);
if (attr) { if (attr) {
@ -767,7 +767,7 @@ void menuModelTelemetry(uint8_t event)
break; break;
case ITEM_TELEMETRY_VARIO_RANGE: case ITEM_TELEMETRY_VARIO_RANGE:
lcd_putsLeft(y, STR_LIMIT); lcdDrawTextAlignedLeft(y, STR_LIMIT);
#if defined(PCBSTD) #if defined(PCBSTD)
lcdDrawNumber(TELEM_COL2, y, 5+g_model.frsky.varioCenterMax, (menuHorizontalPosition==0 ? attr : 0)|PREC1|LEFT); lcdDrawNumber(TELEM_COL2, y, 5+g_model.frsky.varioCenterMax, (menuHorizontalPosition==0 ? attr : 0)|PREC1|LEFT);
lcdDrawNumber(TELEM_COL2+8*FW, y, 10+g_model.frsky.varioMax, (menuHorizontalPosition==1 ? attr : 0)); lcdDrawNumber(TELEM_COL2+8*FW, y, 10+g_model.frsky.varioMax, (menuHorizontalPosition==1 ? attr : 0));

View file

@ -22,7 +22,7 @@
void menuModelTemplates(uint8_t event) void menuModelTemplates(uint8_t event)
{ {
SIMPLE_MENU(STR_MENUTEMPLATES, menuTabModel, e_Templates, 1+TMPL_COUNT); SIMPLE_MENU(STR_MENUTEMPLATES, menuTabModel, MENU_MODEL_TEMPLATES, 1+TMPL_COUNT);
uint8_t sub = menuVerticalPosition - 1; uint8_t sub = menuVerticalPosition - 1;

View file

@ -316,7 +316,7 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max)
tmr10ms_t menuEntryTime; tmr10ms_t menuEntryTime;
#endif #endif
void check(check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow) void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow)
{ {
vertpos_t l_posVert = menuVerticalPosition; vertpos_t l_posVert = menuVerticalPosition;
horzpos_t l_posHorz = menuHorizontalPosition; horzpos_t l_posHorz = menuHorizontalPosition;
@ -671,12 +671,12 @@ void check(check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, ui
#endif #endif
} }
void check_simple(check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, vertpos_t maxrow) void check_simple(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, vertpos_t maxrow)
{ {
check(event, curr, menuTab, menuTabSize, 0, 0, maxrow); check(event, curr, menuTab, menuTabSize, 0, 0, maxrow);
} }
void check_submenu_simple(check_event_t event, uint8_t maxrow) void check_submenu_simple(event_t event, uint8_t maxrow)
{ {
check_simple(event, 0, 0, 0, maxrow); check_simple(event, 0, 0, 0, maxrow);
} }

View file

@ -45,7 +45,7 @@ void drawMessageBox()
// could be a place for a warningInfoText // could be a place for a warningInfoText
} }
void displayPopup(const pm_char * pstr) void showMessageBox(const pm_char * pstr)
{ {
warningText = pstr; warningText = pstr;
drawMessageBox(); drawMessageBox();
@ -57,7 +57,7 @@ const pm_uchar asterisk_lbm[] PROGMEM = {
#include "asterisk.lbm" #include "asterisk.lbm"
}; };
void message(const pm_char *title, const pm_char *t, const char *last MESSAGE_SOUND_ARG) void showAlertBox(const pm_char * title, const pm_char * text, const char * action ALERT_SOUND_ARG)
{ {
lcdClear(); lcdClear();
lcd_img(2, 0, asterisk_lbm, 0, 0); lcd_img(2, 0, asterisk_lbm, 0, 0);
@ -73,11 +73,13 @@ void message(const pm_char *title, const pm_char *t, const char *last MESSAGE_SO
#endif #endif
lcdDrawFilledRect(0, 0, LCD_W, 32); lcdDrawFilledRect(0, 0, LCD_W, 32);
if (t) lcd_putsLeft(5*FH, t); if (text) {
if (last) { lcdDrawTextAlignedLeft(5*FH, text);
lcd_putsLeft(7*FH, last);
AUDIO_ERROR_MESSAGE(sound);
} }
if (action) {
lcdDrawTextAlignedLeft(7*FH, action);
}
AUDIO_ERROR_MESSAGE(sound);
#undef MESSAGE_LCD_OFFSET #undef MESSAGE_LCD_OFFSET
@ -86,7 +88,7 @@ void message(const pm_char *title, const pm_char *t, const char *last MESSAGE_SO
clearKeyEvents(); clearKeyEvents();
} }
void displayWarning(uint8_t event) void runPopupWarning(uint8_t event)
{ {
warningResult = false; warningResult = false;
drawMessageBox(); drawMessageBox();

View file

@ -61,14 +61,14 @@ void menuCommonCalib(uint8_t event)
case CALIB_START: case CALIB_START:
// START CALIBRATION // START CALIBRATION
if (!READ_ONLY()) { if (!READ_ONLY()) {
lcd_putsLeft(MENU_HEADER_HEIGHT+2*FH, STR_MENUTOSTART); lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+2*FH, STR_MENUTOSTART);
} }
break; break;
case CALIB_SET_MIDPOINT: case CALIB_SET_MIDPOINT:
// SET MIDPOINT // SET MIDPOINT
lcdDrawText(0*FW, MENU_HEADER_HEIGHT+FH, STR_SETMIDPOINT, INVERS); lcdDrawText(0*FW, MENU_HEADER_HEIGHT+FH, STR_SETMIDPOINT, INVERS);
lcd_putsLeft(MENU_HEADER_HEIGHT+2*FH, STR_MENUWHENDONE); lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+2*FH, STR_MENUWHENDONE);
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) { for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) {
reusableBuffer.calib.loVals[i] = 15000; reusableBuffer.calib.loVals[i] = 15000;
@ -81,7 +81,7 @@ void menuCommonCalib(uint8_t event)
// MOVE STICKS/POTS // MOVE STICKS/POTS
STICK_SCROLL_DISABLE(); STICK_SCROLL_DISABLE();
lcdDrawText(0*FW, MENU_HEADER_HEIGHT+FH, STR_MOVESTICKSPOTS, INVERS); lcdDrawText(0*FW, MENU_HEADER_HEIGHT+FH, STR_MOVESTICKSPOTS, INVERS);
lcd_putsLeft(MENU_HEADER_HEIGHT+2*FH, STR_MENUWHENDONE); lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+2*FH, STR_MENUWHENDONE);
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) { for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) {
if (abs(reusableBuffer.calib.loVals[i]-reusableBuffer.calib.hiVals[i]) > 50) { if (abs(reusableBuffer.calib.loVals[i]-reusableBuffer.calib.hiVals[i]) > 50) {
@ -108,9 +108,9 @@ void menuCommonCalib(uint8_t event)
doMainScreenGraphics(); doMainScreenGraphics();
} }
void menuGeneralCalib(uint8_t event) void menuRadioCalibration(uint8_t event)
{ {
check_simple(event, e_Calib, menuTabGeneral, DIM(menuTabGeneral), 0); check_simple(event, MENU_RADIO_CALIBRATION, menuTabGeneral, DIM(menuTabGeneral), 0);
if (menuEvent) { if (menuEvent) {
calibrationState = CALIB_START; calibrationState = CALIB_START;

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
void menuGeneralDiagAna(uint8_t event) void menuRadioDiagAnalogs(uint8_t event)
{ {
#if defined(TX_CAPACITY_MEASUREMENT) #if defined(TX_CAPACITY_MEASUREMENT)
#define ANAS_ITEMS_COUNT 4 #define ANAS_ITEMS_COUNT 4
@ -30,7 +30,7 @@ void menuGeneralDiagAna(uint8_t event)
#define ANAS_ITEMS_COUNT 2 #define ANAS_ITEMS_COUNT 2
#endif #endif
SIMPLE_MENU(STR_MENUANA, menuTabGeneral, e_Ana, ANAS_ITEMS_COUNT); SIMPLE_MENU(STR_MENUANA, menuTabGeneral, MENU_RADIO_DIAG_ANALOGS, ANAS_ITEMS_COUNT);
STICK_SCROLL_DISABLE(); STICK_SCROLL_DISABLE();
@ -58,27 +58,27 @@ void menuGeneralDiagAna(uint8_t event)
#endif #endif
#if defined(PCBSKY9X) #if defined(PCBSKY9X)
lcd_putsLeft(MENU_HEADER_HEIGHT+1+4*FH, STR_BATT_CALIB); lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+1+4*FH, STR_BATT_CALIB);
static int32_t adcBatt; static int32_t adcBatt;
adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 8; adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 8;
uint32_t batCalV = (adcBatt + adcBatt*(g_eeGeneral.txVoltageCalibration)/128) * 4191; uint32_t batCalV = (adcBatt + adcBatt*(g_eeGeneral.txVoltageCalibration)/128) * 4191;
batCalV /= 55296; batCalV /= 55296;
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, MENU_HEADER_HEIGHT+1+4*FH, batCalV, (menuVerticalPosition==1 ? INVERS : 0)); putsVolts(LEN_CALIB_FIELDS*FW+4*FW, MENU_HEADER_HEIGHT+1+4*FH, batCalV, (menuVerticalPosition==1 ? INVERS : 0));
#elif defined(PCBGRUVIN9X) #elif defined(PCBGRUVIN9X)
lcd_putsLeft(6*FH-2, STR_BATT_CALIB); lcdDrawTextAlignedLeft(6*FH-2, STR_BATT_CALIB);
// Gruvin wants 2 decimal places and instant update of volts calib field when button pressed // Gruvin wants 2 decimal places and instant update of volts calib field when button pressed
static uint16_t adcBatt; static uint16_t adcBatt;
adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 8; // running average, sourced directly (to avoid unending debate :P) adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 8; // running average, sourced directly (to avoid unending debate :P)
uint32_t batCalV = ((uint32_t)adcBatt*1390 + (10*(int32_t)adcBatt*g_eeGeneral.txVoltageCalibration)/8) / BandGap; uint32_t batCalV = ((uint32_t)adcBatt*1390 + (10*(int32_t)adcBatt*g_eeGeneral.txVoltageCalibration)/8) / BandGap;
lcdDrawNumber(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, batCalV, PREC2|(menuVerticalPosition==1 ? INVERS : 0)); lcdDrawNumber(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, batCalV, PREC2|(menuVerticalPosition==1 ? INVERS : 0));
#else #else
lcd_putsLeft(6*FH-2, STR_BATT_CALIB); lcdDrawTextAlignedLeft(6*FH-2, STR_BATT_CALIB);
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, g_vbat100mV, (menuVerticalPosition==1 ? INVERS : 0)); putsVolts(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, g_vbat100mV, (menuVerticalPosition==1 ? INVERS : 0));
#endif #endif
if (menuVerticalPosition==1) CHECK_INCDEC_GENVAR(event, g_eeGeneral.txVoltageCalibration, -127, 127); if (menuVerticalPosition==1) CHECK_INCDEC_GENVAR(event, g_eeGeneral.txVoltageCalibration, -127, 127);
#if defined(TX_CAPACITY_MEASUREMENT) #if defined(TX_CAPACITY_MEASUREMENT)
lcd_putsLeft(6*FH+1, STR_CURRENT_CALIB); lcdDrawTextAlignedLeft(6*FH+1, STR_CURRENT_CALIB);
putsValueWithUnit(LEN_CALIB_FIELDS*FW+4*FW, 6*FH+1, getCurrent(), UNIT_MILLIAMPS, (menuVerticalPosition==2 ? INVERS : 0)) ; putsValueWithUnit(LEN_CALIB_FIELDS*FW+4*FW, 6*FH+1, getCurrent(), UNIT_MILLIAMPS, (menuVerticalPosition==2 ? INVERS : 0)) ;
if (menuVerticalPosition==2) CHECK_INCDEC_GENVAR(event, g_eeGeneral.txCurrentCalibration, -49, 49); if (menuVerticalPosition==2) CHECK_INCDEC_GENVAR(event, g_eeGeneral.txCurrentCalibration, -49, 49);
#endif #endif
@ -92,7 +92,7 @@ void menuGeneralDiagAna(uint8_t event)
#define TEMP_CALIB_MENU_POS 2 #define TEMP_CALIB_MENU_POS 2
#endif #endif
lcd_putsLeft(TEMP_CALIB_POS, STR_TEMP_CALIB); lcdDrawTextAlignedLeft(TEMP_CALIB_POS, STR_TEMP_CALIB);
putsValueWithUnit(LEN_CALIB_FIELDS*FW+4*FW, TEMP_CALIB_POS, getTemperature(), UNIT_TEMPERATURE, (menuVerticalPosition==TEMP_CALIB_MENU_POS ? INVERS : 0)) ; putsValueWithUnit(LEN_CALIB_FIELDS*FW+4*FW, TEMP_CALIB_POS, getTemperature(), UNIT_TEMPERATURE, (menuVerticalPosition==TEMP_CALIB_MENU_POS ? INVERS : 0)) ;
if (menuVerticalPosition==TEMP_CALIB_MENU_POS) CHECK_INCDEC_GENVAR(event, g_eeGeneral.temperatureCalib, -100, 100); if (menuVerticalPosition==TEMP_CALIB_MENU_POS) CHECK_INCDEC_GENVAR(event, g_eeGeneral.temperatureCalib, -100, 100);
#endif #endif

View file

@ -26,9 +26,9 @@ void displayKeyState(uint8_t x, uint8_t y, EnumKeys key)
lcdDrawChar(x, y, t+'0', t ? INVERS : 0); lcdDrawChar(x, y, t+'0', t ? INVERS : 0);
} }
void menuGeneralDiagKeys(uint8_t event) void menuRadioDiagKeys(uint8_t event)
{ {
SIMPLE_MENU(STR_MENUDIAG, menuTabGeneral, e_Keys, 1); SIMPLE_MENU(STR_MENUDIAG, menuTabGeneral, MENU_RADIO_DIAG_KEYS, 1);
lcdDrawText(14*FW, MENU_HEADER_HEIGHT+2*FH, STR_VTRIM); lcdDrawText(14*FW, MENU_HEADER_HEIGHT+2*FH, STR_VTRIM);

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
enum menuGeneralHwItems { enum menuRadioHwItems {
ITEM_SETUP_HW_OPTREX_DISPLAY, ITEM_SETUP_HW_OPTREX_DISPLAY,
ITEM_SETUP_HW_STICKS_GAINS_LABELS, ITEM_SETUP_HW_STICKS_GAINS_LABELS,
ITEM_SETUP_HW_STICK_LV_GAIN, ITEM_SETUP_HW_STICK_LV_GAIN,
@ -33,9 +33,9 @@ enum menuGeneralHwItems {
}; };
#define GENERAL_HW_PARAM_OFS (2+(15*FW)) #define GENERAL_HW_PARAM_OFS (2+(15*FW))
void menuGeneralHardware(uint8_t event) void menuRadioHardware(uint8_t event)
{ {
MENU(STR_HARDWARE, menuTabGeneral, e_Hardware, ITEM_SETUP_HW_MAX+1, {0, 0, (uint8_t)-1, 0, 0, 0, IF_ROTARY_ENCODERS(0) CASE_BLUETOOTH(0)}); MENU(STR_HARDWARE, menuTabGeneral, MENU_RADIO_HARDWARE, ITEM_SETUP_HW_MAX+1, {0, 0, (uint8_t)-1, 0, 0, 0, IF_ROTARY_ENCODERS(0) CASE_BLUETOOTH(0)});
uint8_t sub = menuVerticalPosition - 1; uint8_t sub = menuVerticalPosition - 1;
@ -51,7 +51,7 @@ void menuGeneralHardware(uint8_t event)
break; break;
case ITEM_SETUP_HW_STICKS_GAINS_LABELS: case ITEM_SETUP_HW_STICKS_GAINS_LABELS:
lcd_putsLeft(y, PSTR("Sticks")); lcdDrawTextAlignedLeft(y, PSTR("Sticks"));
break; break;
case ITEM_SETUP_HW_STICK_LV_GAIN: case ITEM_SETUP_HW_STICK_LV_GAIN:

View file

@ -20,18 +20,18 @@
#include "opentx.h" #include "opentx.h"
void menuGeneralSdManagerInfo(uint8_t event) void menuRadioSdManagerInfo(uint8_t event)
{ {
SIMPLE_SUBMENU(STR_SD_INFO_TITLE, 1); SIMPLE_SUBMENU(STR_SD_INFO_TITLE, 1);
lcd_putsLeft(2*FH, STR_SD_TYPE); lcdDrawTextAlignedLeft(2*FH, STR_SD_TYPE);
lcdDrawText(10*FW, 2*FH, SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD); lcdDrawText(10*FW, 2*FH, SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD);
lcd_putsLeft(3*FH, STR_SD_SIZE); lcdDrawTextAlignedLeft(3*FH, STR_SD_SIZE);
lcdDrawNumber(10*FW, 3*FH, sdGetSize(), LEFT); lcdDrawNumber(10*FW, 3*FH, sdGetSize(), LEFT);
lcdDrawChar(lcdLastPos, 3*FH, 'M'); lcdDrawChar(lcdLastPos, 3*FH, 'M');
lcd_putsLeft(4*FH, STR_SD_SECTORS); lcdDrawTextAlignedLeft(4*FH, STR_SD_SECTORS);
#if defined(SD_GET_FREE_BLOCKNR) #if defined(SD_GET_FREE_BLOCKNR)
lcdDrawNumber(10*FW, 4*FH, SD_GET_FREE_BLOCKNR()/1000, LEFT); lcdDrawNumber(10*FW, 4*FH, SD_GET_FREE_BLOCKNR()/1000, LEFT);
lcdDrawChar(lcdLastPos, 4*FH, '/'); lcdDrawChar(lcdLastPos, 4*FH, '/');
@ -41,7 +41,7 @@ void menuGeneralSdManagerInfo(uint8_t event)
#endif #endif
lcdDrawChar(lcdLastPos, 4*FH, 'k'); lcdDrawChar(lcdLastPos, 4*FH, 'k');
lcd_putsLeft(5*FH, STR_SD_SPEED); lcdDrawTextAlignedLeft(5*FH, STR_SD_SPEED);
lcdDrawNumber(10*FW, 5*FH, SD_GET_SPEED()/1000, LEFT); lcdDrawNumber(10*FW, 5*FH, SD_GET_SPEED()/1000, LEFT);
lcdDrawText(lcdLastPos, 5*FH, "kb/s"); lcdDrawText(lcdLastPos, 5*FH, "kb/s");
} }
@ -62,7 +62,7 @@ void onSdManagerMenu(const char *result)
uint8_t index = menuVerticalPosition-1-menuVerticalOffset; uint8_t index = menuVerticalPosition-1-menuVerticalOffset;
if (result == STR_SD_INFO) { if (result == STR_SD_INFO) {
pushMenu(menuGeneralSdManagerInfo); pushMenu(menuRadioSdManagerInfo);
} }
else if (result == STR_SD_FORMAT) { else if (result == STR_SD_FORMAT) {
POPUP_CONFIRMATION(STR_CONFIRM_FORMAT); POPUP_CONFIRMATION(STR_CONFIRM_FORMAT);
@ -95,7 +95,7 @@ void onSdManagerMenu(const char *result)
#endif #endif
} }
void menuGeneralSdManager(uint8_t _event) void menuRadioSdManager(uint8_t _event)
{ {
FILINFO fno; FILINFO fno;
DIR dir; DIR dir;
@ -107,7 +107,7 @@ void menuGeneralSdManager(uint8_t _event)
#if defined(SDCARD) #if defined(SDCARD)
if (warningResult) { if (warningResult) {
warningResult = 0; warningResult = 0;
displayPopup(STR_FORMATTING); showMessageBox(STR_FORMATTING);
closeLogs(); closeLogs();
#if defined(PCBSKY9X) #if defined(PCBSKY9X)
Card_state = SD_ST_DATA; Card_state = SD_ST_DATA;
@ -126,7 +126,7 @@ void menuGeneralSdManager(uint8_t _event)
#endif #endif
uint8_t event = ((READ_ONLY() && EVT_KEY_MASK(_event) == KEY_ENTER) ? 0 : _event); uint8_t event = ((READ_ONLY() && EVT_KEY_MASK(_event) == KEY_ENTER) ? 0 : _event);
SIMPLE_MENU(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, menuTabGeneral, e_Sd, 1+reusableBuffer.sdmanager.count); SIMPLE_MENU(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, menuTabGeneral, MENU_RADIO_SD_MANAGER, 1+reusableBuffer.sdmanager.count);
if (s_editMode > 0) if (s_editMode > 0)
s_editMode = 0; s_editMode = 0;

View file

@ -58,7 +58,7 @@ const pm_uchar sticks[] PROGMEM = {
#define CASE_BATTGRAPH(x) #define CASE_BATTGRAPH(x)
#endif #endif
enum menuGeneralSetupItems { enum menuRadioSetupItems {
CASE_RTCLOCK(ITEM_SETUP_DATE) CASE_RTCLOCK(ITEM_SETUP_DATE)
CASE_RTCLOCK(ITEM_SETUP_TIME) CASE_RTCLOCK(ITEM_SETUP_TIME)
CASE_BATTGRAPH(ITEM_SETUP_BATT_RANGE) CASE_BATTGRAPH(ITEM_SETUP_BATT_RANGE)
@ -117,7 +117,7 @@ enum menuGeneralSetupItems {
#define COL_TX_MODE LABEL(TX_MODE) #define COL_TX_MODE LABEL(TX_MODE)
#endif #endif
void menuGeneralSetup(uint8_t event) void menuRadioSetup(uint8_t event)
{ {
#if defined(RTCLOCK) #if defined(RTCLOCK)
struct gtm t; struct gtm t;
@ -139,7 +139,7 @@ void menuGeneralSetup(uint8_t event)
} }
#endif #endif
MENU(STR_MENURADIOSETUP, menuTabGeneral, e_Setup, ITEM_SETUP_MAX+1, {0, CASE_RTCLOCK(2) CASE_RTCLOCK(2) CASE_BATTGRAPH(1) LABEL(SOUND), CASE_AUDIO(0) CASE_BUZZER(0) CASE_VOICE(0) CASE_CPUARM(0) CASE_CPUARM(0) CASE_CPUARM(0) 0, CASE_AUDIO(0) CASE_VARIO_CPUARM(LABEL(VARIO)) CASE_VARIO_CPUARM(0) CASE_VARIO_CPUARM(0) CASE_VARIO_CPUARM(0) CASE_VARIO_CPUARM(0) CASE_HAPTIC(LABEL(HAPTIC)) CASE_HAPTIC(0) CASE_HAPTIC(0) CASE_HAPTIC(0) 0, LABEL(ALARMS), 0, CASE_CAPACITY(0) CASE_PCBSKY9X(0) 0, 0, 0, IF_ROTARY_ENCODERS(0) LABEL(BACKLIGHT), 0, 0, CASE_CPUARM(0) CASE_PWM_BACKLIGHT(0) CASE_PWM_BACKLIGHT(0) 0, CASE_SPLASH_PARAM(0) CASE_GPS(0) CASE_GPS(0) CASE_PXX(0) CASE_CPUARM(0) CASE_CPUARM(0) IF_FAI_CHOICE(0) CASE_MAVLINK(0) CASE_CPUARM(0) 0, COL_TX_MODE, 1/*to force edit mode*/}); MENU(STR_MENURADIOSETUP, menuTabGeneral, MENU_RADIO_SETUP, ITEM_SETUP_MAX+1, {0, CASE_RTCLOCK(2) CASE_RTCLOCK(2) CASE_BATTGRAPH(1) LABEL(SOUND), CASE_AUDIO(0) CASE_BUZZER(0) CASE_VOICE(0) CASE_CPUARM(0) CASE_CPUARM(0) CASE_CPUARM(0) 0, CASE_AUDIO(0) CASE_VARIO_CPUARM(LABEL(VARIO)) CASE_VARIO_CPUARM(0) CASE_VARIO_CPUARM(0) CASE_VARIO_CPUARM(0) CASE_VARIO_CPUARM(0) CASE_HAPTIC(LABEL(HAPTIC)) CASE_HAPTIC(0) CASE_HAPTIC(0) CASE_HAPTIC(0) 0, LABEL(ALARMS), 0, CASE_CAPACITY(0) CASE_PCBSKY9X(0) 0, 0, 0, IF_ROTARY_ENCODERS(0) LABEL(BACKLIGHT), 0, 0, CASE_CPUARM(0) CASE_PWM_BACKLIGHT(0) CASE_PWM_BACKLIGHT(0) 0, CASE_SPLASH_PARAM(0) CASE_GPS(0) CASE_GPS(0) CASE_PXX(0) CASE_CPUARM(0) CASE_CPUARM(0) IF_FAI_CHOICE(0) CASE_MAVLINK(0) CASE_CPUARM(0) 0, COL_TX_MODE, 1/*to force edit mode*/});
if (event == EVT_ENTRY) { if (event == EVT_ENTRY) {
reusableBuffer.generalSettings.stickMode = g_eeGeneral.stickMode; reusableBuffer.generalSettings.stickMode = g_eeGeneral.stickMode;
@ -156,7 +156,7 @@ void menuGeneralSetup(uint8_t event)
switch(k) { switch(k) {
#if defined(RTCLOCK) #if defined(RTCLOCK)
case ITEM_SETUP_DATE: case ITEM_SETUP_DATE:
lcd_putsLeft(y, STR_DATE); lcdDrawTextAlignedLeft(y, STR_DATE);
lcdDrawChar(RADIO_SETUP_DATE_COLUMN, y, '-'); lcdDrawChar(RADIO_SETUP_DATE_COLUMN+3*FW-2, y, '-'); lcdDrawChar(RADIO_SETUP_DATE_COLUMN, y, '-'); lcdDrawChar(RADIO_SETUP_DATE_COLUMN+3*FW-2, y, '-');
for (uint8_t j=0; j<3; j++) { for (uint8_t j=0; j<3; j++) {
uint8_t rowattr = (menuHorizontalPosition==j ? attr : 0); uint8_t rowattr = (menuHorizontalPosition==j ? attr : 0);
@ -187,7 +187,7 @@ void menuGeneralSetup(uint8_t event)
break; break;
case ITEM_SETUP_TIME: case ITEM_SETUP_TIME:
lcd_putsLeft(y, STR_TIME); lcdDrawTextAlignedLeft(y, STR_TIME);
lcdDrawChar(RADIO_SETUP_TIME_COLUMN+1, y, ':'); lcdDrawChar(RADIO_SETUP_TIME_COLUMN+3*FW-2, y, ':'); lcdDrawChar(RADIO_SETUP_TIME_COLUMN+1, y, ':'); lcdDrawChar(RADIO_SETUP_TIME_COLUMN+3*FW-2, y, ':');
for (uint8_t j=0; j<3; j++) { for (uint8_t j=0; j<3; j++) {
uint8_t rowattr = (menuHorizontalPosition==j ? attr : 0); uint8_t rowattr = (menuHorizontalPosition==j ? attr : 0);
@ -213,7 +213,7 @@ void menuGeneralSetup(uint8_t event)
#if defined(BATTGRAPH) #if defined(BATTGRAPH)
case ITEM_SETUP_BATT_RANGE: case ITEM_SETUP_BATT_RANGE:
lcd_putsLeft(y, STR_BATTERY_RANGE); lcdDrawTextAlignedLeft(y, STR_BATTERY_RANGE);
putsVolts(RADIO_SETUP_2ND_COLUMN, y, 90+g_eeGeneral.vBatMin, (menuHorizontalPosition==0 ? attr : 0)|LEFT|NO_UNIT); putsVolts(RADIO_SETUP_2ND_COLUMN, y, 90+g_eeGeneral.vBatMin, (menuHorizontalPosition==0 ? attr : 0)|LEFT|NO_UNIT);
lcdDrawChar(lcdLastPos, y, '-'); lcdDrawChar(lcdLastPos, y, '-');
putsVolts(lcdLastPos+FW, y, 120+g_eeGeneral.vBatMax, (menuHorizontalPosition>0 ? attr : 0)|LEFT|NO_UNIT); putsVolts(lcdLastPos+FW, y, 120+g_eeGeneral.vBatMax, (menuHorizontalPosition>0 ? attr : 0)|LEFT|NO_UNIT);
@ -227,7 +227,7 @@ void menuGeneralSetup(uint8_t event)
#endif #endif
case ITEM_SETUP_SOUND_LABEL: case ITEM_SETUP_SOUND_LABEL:
lcd_putsLeft(y, STR_SOUND_LABEL); lcdDrawTextAlignedLeft(y, STR_SOUND_LABEL);
break; break;
#if defined(AUDIO) #if defined(AUDIO)
@ -258,7 +258,7 @@ void menuGeneralSetup(uint8_t event)
#if defined(VOICE) #if defined(VOICE)
case ITEM_SETUP_SPEAKER_VOLUME: case ITEM_SETUP_SPEAKER_VOLUME:
{ {
lcd_putsLeft(y, STR_SPEAKER_VOLUME); lcdDrawTextAlignedLeft(y, STR_SPEAKER_VOLUME);
uint8_t b = g_eeGeneral.speakerVolume+VOLUME_LEVEL_DEF; uint8_t b = g_eeGeneral.speakerVolume+VOLUME_LEVEL_DEF;
drawSlider(RADIO_SETUP_2ND_COLUMN, y, b, VOLUME_LEVEL_MAX, attr); drawSlider(RADIO_SETUP_2ND_COLUMN, y, b, VOLUME_LEVEL_MAX, attr);
if (attr) { if (attr) {
@ -292,7 +292,7 @@ void menuGeneralSetup(uint8_t event)
#if defined(AUDIO) #if defined(AUDIO)
case ITEM_SETUP_SPEAKER_PITCH: case ITEM_SETUP_SPEAKER_PITCH:
lcd_putsLeft( y, STR_SPKRPITCH); lcdDrawTextAlignedLeft( y, STR_SPKRPITCH);
#if defined(CPUARM) #if defined(CPUARM)
lcdDrawChar(RADIO_SETUP_2ND_COLUMN, y, '+', attr); lcdDrawChar(RADIO_SETUP_2ND_COLUMN, y, '+', attr);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN+FW, y, g_eeGeneral.speakerPitch*15, attr|LEFT); lcdDrawNumber(RADIO_SETUP_2ND_COLUMN+FW, y, g_eeGeneral.speakerPitch*15, attr|LEFT);
@ -308,25 +308,25 @@ void menuGeneralSetup(uint8_t event)
#if defined(CPUARM) && defined(VARIO) #if defined(CPUARM) && defined(VARIO)
case ITEM_SETUP_VARIO_LABEL: case ITEM_SETUP_VARIO_LABEL:
lcd_putsLeft(y, STR_VARIO); lcdDrawTextAlignedLeft(y, STR_VARIO);
break; break;
case ITEM_SETUP_VARIO_VOLUME: case ITEM_SETUP_VARIO_VOLUME:
SLIDER_5POS(y, g_eeGeneral.varioVolume, TR_SPEAKER_VOLUME, event, attr); SLIDER_5POS(y, g_eeGeneral.varioVolume, TR_SPEAKER_VOLUME, event, attr);
break; break;
case ITEM_SETUP_VARIO_PITCH: case ITEM_SETUP_VARIO_PITCH:
lcd_putsLeft(y, STR_PITCH_AT_ZERO); lcdDrawTextAlignedLeft(y, STR_PITCH_AT_ZERO);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, VARIO_FREQUENCY_ZERO+(g_eeGeneral.varioPitch*10), attr|LEFT); lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, VARIO_FREQUENCY_ZERO+(g_eeGeneral.varioPitch*10), attr|LEFT);
lcdDrawText(lcdLastPos, y, "Hz", attr); lcdDrawText(lcdLastPos, y, "Hz", attr);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.varioPitch, -40, 40); if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.varioPitch, -40, 40);
break; break;
case ITEM_SETUP_VARIO_RANGE: case ITEM_SETUP_VARIO_RANGE:
lcd_putsLeft(y, STR_PITCH_AT_MAX); lcdDrawTextAlignedLeft(y, STR_PITCH_AT_MAX);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, VARIO_FREQUENCY_ZERO+(g_eeGeneral.varioPitch*10)+VARIO_FREQUENCY_RANGE+(g_eeGeneral.varioRange*10), attr|LEFT); lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, VARIO_FREQUENCY_ZERO+(g_eeGeneral.varioPitch*10)+VARIO_FREQUENCY_RANGE+(g_eeGeneral.varioRange*10), attr|LEFT);
lcdDrawText(lcdLastPos, y, "Hz", attr); lcdDrawText(lcdLastPos, y, "Hz", attr);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.varioRange, -80, 80); if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.varioRange, -80, 80);
break; break;
case ITEM_SETUP_VARIO_REPEAT: case ITEM_SETUP_VARIO_REPEAT:
lcd_putsLeft(y, STR_REPEAT_AT_ZERO); lcdDrawTextAlignedLeft(y, STR_REPEAT_AT_ZERO);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, VARIO_REPEAT_ZERO+(g_eeGeneral.varioRepeat*10), attr|LEFT); lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, VARIO_REPEAT_ZERO+(g_eeGeneral.varioRepeat*10), attr|LEFT);
lcdDrawText(lcdLastPos, y, STR_MS, attr); lcdDrawText(lcdLastPos, y, STR_MS, attr);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.varioRepeat, -30, 50); if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.varioRepeat, -30, 50);
@ -335,7 +335,7 @@ void menuGeneralSetup(uint8_t event)
#if defined(HAPTIC) #if defined(HAPTIC)
case ITEM_SETUP_HAPTIC_LABEL: case ITEM_SETUP_HAPTIC_LABEL:
lcd_putsLeft(y, STR_HAPTIC_LABEL); lcdDrawTextAlignedLeft(y, STR_HAPTIC_LABEL);
break; break;
case ITEM_SETUP_HAPTIC_MODE: case ITEM_SETUP_HAPTIC_MODE:
@ -352,7 +352,7 @@ void menuGeneralSetup(uint8_t event)
#endif #endif
case ITEM_SETUP_CONTRAST: case ITEM_SETUP_CONTRAST:
lcd_putsLeft(y, STR_CONTRAST); lcdDrawTextAlignedLeft(y, STR_CONTRAST);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.contrast, attr|LEFT); lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.contrast, attr|LEFT);
if (attr) { if (attr) {
CHECK_INCDEC_GENVAR(event, g_eeGeneral.contrast, CONTRAST_MIN, CONTRAST_MAX); CHECK_INCDEC_GENVAR(event, g_eeGeneral.contrast, CONTRAST_MIN, CONTRAST_MAX);
@ -361,11 +361,11 @@ void menuGeneralSetup(uint8_t event)
break; break;
case ITEM_SETUP_ALARMS_LABEL: case ITEM_SETUP_ALARMS_LABEL:
lcd_putsLeft(y, STR_ALARMS_LABEL); lcdDrawTextAlignedLeft(y, STR_ALARMS_LABEL);
break; break;
case ITEM_SETUP_BATTERY_WARNING: case ITEM_SETUP_BATTERY_WARNING:
lcd_putsLeft(y, STR_BATTERYWARNING); lcdDrawTextAlignedLeft(y, STR_BATTERYWARNING);
putsVolts(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.vBatWarn, attr|LEFT); putsVolts(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.vBatWarn, attr|LEFT);
if(attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatWarn, 40, 120); //4-12V if(attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatWarn, 40, 120); //4-12V
break; break;
@ -386,7 +386,7 @@ void menuGeneralSetup(uint8_t event)
#if defined(TX_CAPACITY_MEASUREMENT) #if defined(TX_CAPACITY_MEASUREMENT)
case ITEM_SETUP_CAPACITY_WARNING: case ITEM_SETUP_CAPACITY_WARNING:
lcd_putsLeft(y, STR_CAPAWARNING); lcdDrawTextAlignedLeft(y, STR_CAPAWARNING);
putsValueWithUnit(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.mAhWarn*50, UNIT_MAH, attr|LEFT) ; putsValueWithUnit(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.mAhWarn*50, UNIT_MAH, attr|LEFT) ;
if(attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.mAhWarn, 0, 100); if(attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.mAhWarn, 0, 100);
break; break;
@ -394,14 +394,14 @@ void menuGeneralSetup(uint8_t event)
#if defined(PCBSKY9X) #if defined(PCBSKY9X)
case ITEM_SETUP_TEMPERATURE_WARNING: case ITEM_SETUP_TEMPERATURE_WARNING:
lcd_putsLeft(y, STR_TEMPWARNING); lcdDrawTextAlignedLeft(y, STR_TEMPWARNING);
putsValueWithUnit(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.temperatureWarn, UNIT_TEMPERATURE, attr|LEFT) ; putsValueWithUnit(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.temperatureWarn, UNIT_TEMPERATURE, attr|LEFT) ;
if(attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.temperatureWarn, 0, 120); // 0 means no alarm if(attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.temperatureWarn, 0, 120); // 0 means no alarm
break; break;
#endif #endif
case ITEM_SETUP_INACTIVITY_ALARM: case ITEM_SETUP_INACTIVITY_ALARM:
lcd_putsLeft(y, STR_INACTIVITYALARM); lcdDrawTextAlignedLeft(y, STR_INACTIVITYALARM);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.inactivityTimer, attr|LEFT); lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.inactivityTimer, attr|LEFT);
lcdDrawChar(lcdLastPos, y, 'm'); lcdDrawChar(lcdLastPos, y, 'm');
if(attr) g_eeGeneral.inactivityTimer = checkIncDec(event, g_eeGeneral.inactivityTimer, 0, 250, EE_GENERAL); //0..250minutes if(attr) g_eeGeneral.inactivityTimer = checkIncDec(event, g_eeGeneral.inactivityTimer, 0, 250, EE_GENERAL); //0..250minutes
@ -417,7 +417,7 @@ void menuGeneralSetup(uint8_t event)
#endif #endif
case ITEM_SETUP_BACKLIGHT_LABEL: case ITEM_SETUP_BACKLIGHT_LABEL:
lcd_putsLeft(y, STR_BACKLIGHT_LABEL); lcdDrawTextAlignedLeft(y, STR_BACKLIGHT_LABEL);
break; break;
case ITEM_SETUP_BACKLIGHT_MODE: case ITEM_SETUP_BACKLIGHT_MODE:
@ -429,7 +429,7 @@ void menuGeneralSetup(uint8_t event)
break; break;
case ITEM_SETUP_BACKLIGHT_DELAY: case ITEM_SETUP_BACKLIGHT_DELAY:
lcd_putsLeft(y, STR_BLDELAY); lcdDrawTextAlignedLeft(y, STR_BLDELAY);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.lightAutoOff*5, attr|LEFT); lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.lightAutoOff*5, attr|LEFT);
lcdDrawChar(lcdLastPos, y, 's'); lcdDrawChar(lcdLastPos, y, 's');
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.lightAutoOff, 0, 600/5); if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.lightAutoOff, 0, 600/5);
@ -437,7 +437,7 @@ void menuGeneralSetup(uint8_t event)
#if defined(CPUARM) #if defined(CPUARM)
case ITEM_SETUP_BRIGHTNESS: case ITEM_SETUP_BRIGHTNESS:
lcd_putsLeft(y, STR_BRIGHTNESS); lcdDrawTextAlignedLeft(y, STR_BRIGHTNESS);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 100-g_eeGeneral.backlightBright, attr|LEFT) ; lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 100-g_eeGeneral.backlightBright, attr|LEFT) ;
if (attr) { if (attr) {
uint8_t b = 100 - g_eeGeneral.backlightBright; uint8_t b = 100 - g_eeGeneral.backlightBright;
@ -449,13 +449,13 @@ void menuGeneralSetup(uint8_t event)
#if defined(PWM_BACKLIGHT) #if defined(PWM_BACKLIGHT)
case ITEM_SETUP_BACKLIGHT_BRIGHTNESS_OFF: case ITEM_SETUP_BACKLIGHT_BRIGHTNESS_OFF:
lcd_putsLeft(y, STR_BLOFFBRIGHTNESS); lcdDrawTextAlignedLeft(y, STR_BLOFFBRIGHTNESS);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.blOffBright, attr|LEFT); lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.blOffBright, attr|LEFT);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.blOffBright, 0, 15); if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.blOffBright, 0, 15);
break; break;
case ITEM_SETUP_BACKLIGHT_BRIGHTNESS_ON: case ITEM_SETUP_BACKLIGHT_BRIGHTNESS_ON:
lcd_putsLeft(y, STR_BLONBRIGHTNESS); lcdDrawTextAlignedLeft(y, STR_BLONBRIGHTNESS);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 15-g_eeGeneral.blOnBright, attr|LEFT); lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 15-g_eeGeneral.blOnBright, attr|LEFT);
if (attr) g_eeGeneral.blOnBright = 15 - checkIncDecGen(event, 15-g_eeGeneral.blOnBright, 0, 15); if (attr) g_eeGeneral.blOnBright = 15 - checkIncDecGen(event, 15-g_eeGeneral.blOnBright, 0, 15);
break; break;
@ -472,7 +472,7 @@ void menuGeneralSetup(uint8_t event)
#if defined(TELEMETRY_FRSKY) && defined(FRSKY_HUB) && defined(GPS) #if defined(TELEMETRY_FRSKY) && defined(FRSKY_HUB) && defined(GPS)
case ITEM_SETUP_TIMEZONE: case ITEM_SETUP_TIMEZONE:
lcd_putsLeft(y, STR_TIMEZONE); lcdDrawTextAlignedLeft(y, STR_TIMEZONE);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.timezone, attr|LEFT); lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.timezone, attr|LEFT);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.timezone, -12, 12); if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.timezone, -12, 12);
break; break;
@ -490,7 +490,7 @@ void menuGeneralSetup(uint8_t event)
#if defined(CPUARM) #if defined(CPUARM)
case ITEM_SETUP_LANGUAGE: case ITEM_SETUP_LANGUAGE:
lcd_putsLeft(y, STR_VOICELANG); lcdDrawTextAlignedLeft(y, STR_VOICELANG);
lcdDrawText(RADIO_SETUP_2ND_COLUMN, y, currentLanguagePack->name, attr); lcdDrawText(RADIO_SETUP_2ND_COLUMN, y, currentLanguagePack->name, attr);
if (attr) { if (attr) {
currentLanguagePackIdx = checkIncDec(event, currentLanguagePackIdx, 0, DIM(languagePacks)-2, EE_GENERAL); currentLanguagePackIdx = checkIncDec(event, currentLanguagePackIdx, 0, DIM(languagePacks)-2, EE_GENERAL);
@ -526,7 +526,7 @@ void menuGeneralSetup(uint8_t event)
#if defined(CPUARM) #if defined(CPUARM)
case ITEM_SETUP_SWITCHES_DELAY: case ITEM_SETUP_SWITCHES_DELAY:
lcd_putsLeft(y, STR_SWITCHES_DELAY); lcdDrawTextAlignedLeft(y, STR_SWITCHES_DELAY);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 10*SWITCHES_DELAY(), attr|LEFT); lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 10*SWITCHES_DELAY(), attr|LEFT);
lcdDrawText(lcdLastPos, y, STR_MS, attr); lcdDrawText(lcdLastPos, y, STR_MS, attr);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.switchesDelay, -15, +15); if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.switchesDelay, -15, +15);
@ -534,7 +534,7 @@ void menuGeneralSetup(uint8_t event)
#endif #endif
case ITEM_SETUP_RX_CHANNEL_ORD: case ITEM_SETUP_RX_CHANNEL_ORD:
lcd_putsLeft(y, STR_RXCHANNELORD); // RAET->AETR lcdDrawTextAlignedLeft(y, STR_RXCHANNELORD); // RAET->AETR
for (uint8_t i=1; i<=4; i++) { for (uint8_t i=1; i<=4; i++) {
putsChnLetter(RADIO_SETUP_2ND_COLUMN - FW + i*FW, y, channel_order(i), attr); putsChnLetter(RADIO_SETUP_2ND_COLUMN - FW + i*FW, y, channel_order(i), attr);
} }
@ -542,7 +542,7 @@ void menuGeneralSetup(uint8_t event)
break; break;
case ITEM_SETUP_STICK_MODE_LABELS: case ITEM_SETUP_STICK_MODE_LABELS:
lcd_putsLeft(y, NO_INDENT(STR_MODE)); lcdDrawTextAlignedLeft(y, NO_INDENT(STR_MODE));
for (uint8_t i=0; i<4; i++) { for (uint8_t i=0; i<4; i++) {
lcd_img((6+4*i)*FW, y, sticks, i, 0); lcd_img((6+4*i)*FW, y, sticks, i, 0);
#if defined(FRSKY_STICKS) #if defined(FRSKY_STICKS)

View file

@ -22,12 +22,12 @@
#define TRAINER_CALIB_POS 8 #define TRAINER_CALIB_POS 8
void menuGeneralTrainer(uint8_t event) void menuRadioTrainer(uint8_t event)
{ {
uint8_t y; uint8_t y;
bool slave = SLAVE_MODE(); bool slave = SLAVE_MODE();
MENU(STR_MENUTRAINER, menuTabGeneral, e_Trainer, (slave ? 1 : 7), {0, 2, 2, 2, 2, 0/*, 0*/}); MENU(STR_MENUTRAINER, menuTabGeneral, MENU_RADIO_TRAINER, (slave ? 1 : 7), {0, 2, 2, 2, 2, 0/*, 0*/});
if (slave) { if (slave) {
lcdDrawText(7*FW, 4*FH, STR_SLAVE); lcdDrawText(7*FW, 4*FH, STR_SLAVE);
@ -71,7 +71,7 @@ void menuGeneralTrainer(uint8_t event)
} }
attr = (menuVerticalPosition==5) ? blink : 0; attr = (menuVerticalPosition==5) ? blink : 0;
lcd_putsLeft(MENU_HEADER_HEIGHT+1+5*FH, STR_MULTIPLIER); lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+1+5*FH, STR_MULTIPLIER);
lcdDrawNumber(LEN_MULTIPLIER*FW+3*FW, MENU_HEADER_HEIGHT+1+5*FH, g_eeGeneral.PPM_Multiplier+10, attr|PREC1); lcdDrawNumber(LEN_MULTIPLIER*FW+3*FW, MENU_HEADER_HEIGHT+1+5*FH, g_eeGeneral.PPM_Multiplier+10, attr|PREC1);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.PPM_Multiplier, -10, 40); if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.PPM_Multiplier, -10, 40);

View file

@ -20,19 +20,19 @@
#include "opentx.h" #include "opentx.h"
void menuGeneralVersion(uint8_t event) void menuRadioVersion(uint8_t event)
{ {
SIMPLE_MENU(STR_MENUVERSION, menuTabGeneral, e_Vers, 1); SIMPLE_MENU(STR_MENUVERSION, menuTabGeneral, MENU_RADIO_VERSION, 1);
lcd_putsLeft(MENU_HEADER_HEIGHT+FH, vers_stamp); lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+FH, vers_stamp);
#if defined(COPROCESSOR) #if defined(COPROCESSOR)
if (Coproc_valid == 1) { if (Coproc_valid == 1) {
lcd_putsLeft(6*FH, PSTR("CoPr:")); lcdDrawTextAlignedLeft(6*FH, PSTR("CoPr:"));
lcdDraw8bitsNumber(10*FW, 6*FH, Coproc_read); lcdDraw8bitsNumber(10*FW, 6*FH, Coproc_read);
} }
else { else {
lcd_putsLeft(6*FH, PSTR("CoPr: ---")); lcdDrawTextAlignedLeft(6*FH, PSTR("CoPr: ---"));
} }
#endif #endif
} }

View file

@ -356,7 +356,7 @@ void menuMainView(uint8_t event)
CASE_EVT_ROTARY_LONG CASE_EVT_ROTARY_LONG
case EVT_KEY_GENERAL_MENU: case EVT_KEY_GENERAL_MENU:
pushMenu(menuGeneralSetup); pushMenu(menuRadioSetup);
killEvents(event); killEvents(event);
break; break;
#endif #endif
@ -375,18 +375,18 @@ void menuMainView(uint8_t event)
case EVT_KEY_TELEMETRY: case EVT_KEY_TELEMETRY:
#if defined(TELEMETRY_FRSKY) #if defined(TELEMETRY_FRSKY)
if (!IS_FAI_ENABLED()) if (!IS_FAI_ENABLED())
chainMenu(menuTelemetryFrsky); chainMenu(menuViewTelemetryFrsky);
#elif defined(TELEMETRY_JETI) #elif defined(TELEMETRY_JETI)
JETI_EnableRXD(); // enable JETI-Telemetry reception JETI_EnableRXD(); // enable JETI-Telemetry reception
chainMenu(menuTelemetryJeti); chainMenu(menuViewTelemetryJeti);
#elif defined(TELEMETRY_ARDUPILOT) #elif defined(TELEMETRY_ARDUPILOT)
ARDUPILOT_EnableRXD(); // enable ArduPilot-Telemetry reception ARDUPILOT_EnableRXD(); // enable ArduPilot-Telemetry reception
chainMenu(menuTelemetryArduPilot); chainMenu(menuViewTelemetryArduPilot);
#elif defined(TELEMETRY_NMEA) #elif defined(TELEMETRY_NMEA)
NMEA_EnableRXD(); // enable NMEA-Telemetry reception NMEA_EnableRXD(); // enable NMEA-Telemetry reception
chainMenu(menuTelemetryNMEA); chainMenu(menuViewTelemetryNMEA);
#elif defined(TELEMETRY_MAVLINK) #elif defined(TELEMETRY_MAVLINK)
chainMenu(menuTelemetryMavlink); chainMenu(menuViewTelemetryMavlink);
#else #else
chainMenu(menuStatisticsDebug); chainMenu(menuStatisticsDebug);
#endif #endif

View file

@ -35,7 +35,7 @@ uint8_t MAVLINK_menu = MENU_INFO;
* lanuched by the menu button. On exit (with exit button) the mavlink * lanuched by the menu button. On exit (with exit button) the mavlink
* extension is reinitialized. * extension is reinitialized.
*/ */
void menuTelemetryMavlink(uint8_t event) { void menuViewTelemetryMavlink(uint8_t event) {
switch (event) // new event received, branch accordingly switch (event) // new event received, branch accordingly
{ {
@ -481,9 +481,9 @@ void menuTelemetryMavlinkDump(uint8_t event) {
* This funcion is called from the model setup menus, not directly by the * This funcion is called from the model setup menus, not directly by the
* telemetry menus * telemetry menus
*/ */
void menuTelemetryMavlinkSetup(uint8_t event) { void menuModelTelemetryMavlink(uint8_t event) {
MENU(STR_MAVMENUSETUP_TITLE, menuTabModel, e_MavSetup, ITEM_MAVLINK_MAX + 1, {0, 0, 1/*to force edit mode*/}); MENU(STR_MAVMENUSETUP_TITLE, menuTabModel, MENU_MODEL_TELEMETRY_MAVLINK, ITEM_MAVLINK_MAX + 1, {0, 0, 1/*to force edit mode*/});
uint8_t sub = menuVerticalPosition - 1; uint8_t sub = menuVerticalPosition - 1;
@ -494,7 +494,7 @@ void menuTelemetryMavlinkSetup(uint8_t event) {
uint8_t attr = (sub == k ? blink : 0); uint8_t attr = (sub == k ? blink : 0);
switch(k) { switch(k) {
case ITEM_MAVLINK_RC_RSSI_SCALE: case ITEM_MAVLINK_RC_RSSI_SCALE:
lcd_putsLeft(y, STR_MAVLINK_RC_RSSI_SCALE_LABEL); lcdDrawTextAlignedLeft(y, STR_MAVLINK_RC_RSSI_SCALE_LABEL);
lcdDrawNumber(VIEW_MAVLINK_2ND_COLUMN, y, (25 + g_model.mavlink.rc_rssi_scale * 5), attr|LEFT); lcdDrawNumber(VIEW_MAVLINK_2ND_COLUMN, y, (25 + g_model.mavlink.rc_rssi_scale * 5), attr|LEFT);
lcdDrawChar(lcdLastPos, y, '%'); lcdDrawChar(lcdLastPos, y, '%');
if (attr) CHECK_INCDEC_MODELVAR(event, g_model.mavlink.rc_rssi_scale, 0, 15); if (attr) CHECK_INCDEC_MODELVAR(event, g_model.mavlink.rc_rssi_scale, 0, 15);

View file

@ -31,8 +31,7 @@
#define APSIZE (BSS | DBLSIZE) #define APSIZE (BSS | DBLSIZE)
void menuTelemetryMavlink(uint8_t event); void menuViewTelemetryMavlink(uint8_t event);
void drawScreenIndex(uint8_t index, uint8_t count, uint8_t attr);
void lcd_outdezFloat(uint8_t x, uint8_t y, float val, uint8_t precis, uint8_t mode = 0); void lcd_outdezFloat(uint8_t x, uint8_t y, float val, uint8_t precis, uint8_t mode = 0);
void mav_title(const pm_char * s, uint8_t index); void mav_title(const pm_char * s, uint8_t index);
void menuTelemetryMavlinkInfos(void); void menuTelemetryMavlinkInfos(void);
@ -64,7 +63,7 @@ enum mavlink_menu_ {
//! \brief Pointer array to mavlink settings menus. //! \brief Pointer array to mavlink settings menus.
const MenuHandlerFunc menuTabMav[] PROGMEM = { const MenuHandlerFunc menuTabMav[] PROGMEM = {
menuTelemetryMavlinkSetup menuViewTelemetryMavlink
}; };
//! \brief Mavlink setup menu configuration items list. //! \brief Mavlink setup menu configuration items list.

View file

@ -132,25 +132,25 @@ void menuStatisticsDebug(uint8_t event)
#if defined(TX_CAPACITY_MEASUREMENT) #if defined(TX_CAPACITY_MEASUREMENT)
// current // current
lcd_putsLeft(MENU_DEBUG_Y_CURRENT, STR_CPU_CURRENT); lcdDrawTextAlignedLeft(MENU_DEBUG_Y_CURRENT, STR_CPU_CURRENT);
putsValueWithUnit(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_CURRENT, getCurrent(), UNIT_MILLIAMPS, LEFT); putsValueWithUnit(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_CURRENT, getCurrent(), UNIT_MILLIAMPS, LEFT);
uint32_t current_scale = 488 + g_eeGeneral.txCurrentCalibration; uint32_t current_scale = 488 + g_eeGeneral.txCurrentCalibration;
lcdDrawChar(MENU_DEBUG_COL2_OFS, MENU_DEBUG_Y_CURRENT, '>'); lcdDrawChar(MENU_DEBUG_COL2_OFS, MENU_DEBUG_Y_CURRENT, '>');
putsValueWithUnit(MENU_DEBUG_COL2_OFS+FW+1, MENU_DEBUG_Y_CURRENT, Current_max*10*current_scale/8192, UNIT_RAW, LEFT); putsValueWithUnit(MENU_DEBUG_COL2_OFS+FW+1, MENU_DEBUG_Y_CURRENT, Current_max*10*current_scale/8192, UNIT_RAW, LEFT);
// consumption // consumption
lcd_putsLeft(MENU_DEBUG_Y_MAH, STR_CPU_MAH); lcdDrawTextAlignedLeft(MENU_DEBUG_Y_MAH, STR_CPU_MAH);
putsValueWithUnit(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_MAH, g_eeGeneral.mAhUsed + Current_used*current_scale/8192/36, UNIT_MAH, LEFT|PREC1); putsValueWithUnit(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_MAH, g_eeGeneral.mAhUsed + Current_used*current_scale/8192/36, UNIT_MAH, LEFT|PREC1);
#endif #endif
#if defined(PCBSKY9X) #if defined(PCBSKY9X)
lcd_putsLeft(MENU_DEBUG_Y_CPU_TEMP, STR_CPU_TEMP); lcdDrawTextAlignedLeft(MENU_DEBUG_Y_CPU_TEMP, STR_CPU_TEMP);
putsValueWithUnit(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_CPU_TEMP, getTemperature(), UNIT_TEMPERATURE, LEFT); putsValueWithUnit(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_CPU_TEMP, getTemperature(), UNIT_TEMPERATURE, LEFT);
lcdDrawChar(MENU_DEBUG_COL2_OFS, MENU_DEBUG_Y_CPU_TEMP, '>'); lcdDrawChar(MENU_DEBUG_COL2_OFS, MENU_DEBUG_Y_CPU_TEMP, '>');
putsValueWithUnit(MENU_DEBUG_COL2_OFS+FW+1, MENU_DEBUG_Y_CPU_TEMP, maxTemperature+g_eeGeneral.temperatureCalib, UNIT_TEMPERATURE, LEFT); putsValueWithUnit(MENU_DEBUG_COL2_OFS+FW+1, MENU_DEBUG_Y_CPU_TEMP, maxTemperature+g_eeGeneral.temperatureCalib, UNIT_TEMPERATURE, LEFT);
#endif #endif
#if defined(COPROCESSOR) #if defined(COPROCESSOR)
lcd_putsLeft(MENU_DEBUG_Y_COPROC, STR_COPROC_TEMP); lcdDrawTextAlignedLeft(MENU_DEBUG_Y_COPROC, STR_COPROC_TEMP);
if (Coproc_read==0) { if (Coproc_read==0) {
lcdDrawText(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, PSTR("Co Proc NACK"),INVERS); lcdDrawText(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, PSTR("Co Proc NACK"),INVERS);
@ -168,13 +168,13 @@ void menuStatisticsDebug(uint8_t event)
#endif #endif
#if defined(CPUARM) #if defined(CPUARM)
lcd_putsLeft(MENU_DEBUG_Y_MIXMAX, STR_TMIXMAXMS); lcdDrawTextAlignedLeft(MENU_DEBUG_Y_MIXMAX, STR_TMIXMAXMS);
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_MIXMAX, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT); lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_MIXMAX, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT);
lcdDrawText(lcdLastPos, MENU_DEBUG_Y_MIXMAX, "ms"); lcdDrawText(lcdLastPos, MENU_DEBUG_Y_MIXMAX, "ms");
#endif #endif
#if defined(CPUARM) #if defined(CPUARM)
lcd_putsLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB); lcdDrawTextAlignedLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB);
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+2, menusStack.available(), UNSIGN|LEFT|TINSIZE); lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+2, menusStack.available(), UNSIGN|LEFT|TINSIZE);
lcdDrawText(lcdLastPos, MENU_DEBUG_Y_RTOS, "/"); lcdDrawText(lcdLastPos, MENU_DEBUG_Y_RTOS, "/");
lcdDrawNumber(lcdLastPos, MENU_DEBUG_Y_RTOS+2, mixerStack.available(), UNSIGN|LEFT|TINSIZE); lcdDrawNumber(lcdLastPos, MENU_DEBUG_Y_RTOS+2, mixerStack.available(), UNSIGN|LEFT|TINSIZE);
@ -183,15 +183,15 @@ void menuStatisticsDebug(uint8_t event)
#endif #endif
#if !defined(CPUARM) #if !defined(CPUARM)
lcd_putsLeft(1*FH, STR_TMR1LATMAXUS); lcdDrawTextAlignedLeft(1*FH, STR_TMR1LATMAXUS);
lcdDraw8bitsNumber(MENU_DEBUG_COL1_OFS , 1*FH, g_tmr1Latency_max/2 ); lcdDraw8bitsNumber(MENU_DEBUG_COL1_OFS , 1*FH, g_tmr1Latency_max/2 );
lcd_putsLeft(2*FH, STR_TMR1LATMINUS); lcdDrawTextAlignedLeft(2*FH, STR_TMR1LATMINUS);
lcdDraw8bitsNumber(MENU_DEBUG_COL1_OFS , 2*FH, g_tmr1Latency_min/2 ); lcdDraw8bitsNumber(MENU_DEBUG_COL1_OFS , 2*FH, g_tmr1Latency_min/2 );
lcd_putsLeft(3*FH, STR_TMR1JITTERUS); lcdDrawTextAlignedLeft(3*FH, STR_TMR1JITTERUS);
lcdDraw8bitsNumber(MENU_DEBUG_COL1_OFS , 3*FH, (g_tmr1Latency_max - g_tmr1Latency_min) /2 ); lcdDraw8bitsNumber(MENU_DEBUG_COL1_OFS , 3*FH, (g_tmr1Latency_max - g_tmr1Latency_min) /2 );
lcd_putsLeft(4*FH, STR_TMIXMAXMS); lcdDrawTextAlignedLeft(4*FH, STR_TMIXMAXMS);
lcdDrawNumber(MENU_DEBUG_COL1_OFS, 4*FH, DURATION_MS_PREC2(maxMixerDuration), PREC2); lcdDrawNumber(MENU_DEBUG_COL1_OFS, 4*FH, DURATION_MS_PREC2(maxMixerDuration), PREC2);
lcd_putsLeft(5*FH, STR_FREESTACKMINB); lcdDrawTextAlignedLeft(5*FH, STR_FREESTACKMINB);
lcdDrawNumber(14*FW, 5*FH, stackAvailable(), UNSIGN) ; lcdDrawNumber(14*FW, 5*FH, stackAvailable(), UNSIGN) ;
#endif #endif

View file

@ -39,7 +39,7 @@ void displayRssiLine()
uint8_t rssi; uint8_t rssi;
#if !defined(CPUARM) #if !defined(CPUARM)
rssi = min((uint8_t)99, telemetryData.rssi[1].value); rssi = min((uint8_t)99, telemetryData.rssi[1].value);
lcd_putsLeft(STATUS_BAR_Y, STR_TX); lcdDrawNumber(4*FW+1, STATUS_BAR_Y, rssi, LEADING0, 2); lcdDrawTextAlignedLeft(STATUS_BAR_Y, STR_TX); lcdDrawNumber(4*FW+1, STATUS_BAR_Y, rssi, LEADING0, 2);
lcdDrawRect(BAR_LEFT+1, 57, 38, 7); lcdDrawRect(BAR_LEFT+1, 57, 38, 7);
lcdDrawFilledRect(BAR_LEFT+1, 58, 4*rssi/11, 5, (rssi < getRssiAlarmValue(0)) ? DOTTED : SOLID); lcdDrawFilledRect(BAR_LEFT+1, 58, 4*rssi/11, 5, (rssi < getRssiAlarmValue(0)) ? DOTTED : SOLID);
#endif #endif
@ -197,17 +197,17 @@ void displayAfterFlightScreen()
uint8_t line=1*FH+1; uint8_t line=1*FH+1;
if (IS_GPS_AVAILABLE()) { if (IS_GPS_AVAILABLE()) {
// Latitude // Latitude
lcd_putsLeft(line, STR_LATITUDE); lcdDrawTextAlignedLeft(line, STR_LATITUDE);
displayGpsCoord(line, telemetryData.hub.gpsLatitudeNS, telemetryData.hub.gpsLatitude_bp, telemetryData.hub.gpsLatitude_ap); displayGpsCoord(line, telemetryData.hub.gpsLatitudeNS, telemetryData.hub.gpsLatitude_bp, telemetryData.hub.gpsLatitude_ap);
// Longitude // Longitude
line+=1*FH+1; line+=1*FH+1;
lcd_putsLeft(line, STR_LONGITUDE); lcdDrawTextAlignedLeft(line, STR_LONGITUDE);
displayGpsCoord(line, telemetryData.hub.gpsLongitudeEW, telemetryData.hub.gpsLongitude_bp, telemetryData.hub.gpsLongitude_ap); displayGpsCoord(line, telemetryData.hub.gpsLongitudeEW, telemetryData.hub.gpsLongitude_bp, telemetryData.hub.gpsLongitude_ap);
displayGpsTime(); displayGpsTime();
line+=1*FH+1; line+=1*FH+1;
} }
// Rssi // Rssi
lcd_putsLeft(line, STR_MINRSSI); lcdDrawTextAlignedLeft(line, STR_MINRSSI);
lcdDrawText(TELEM_2ND_COLUMN, line, STR_TX); lcdDrawText(TELEM_2ND_COLUMN, line, STR_TX);
lcdDrawNumber(TELEM_2ND_COLUMN+3*FW, line, telemetryData.rssi[1].min, LEFT|LEADING0, 2); lcdDrawNumber(TELEM_2ND_COLUMN+3*FW, line, telemetryData.rssi[1].min, LEFT|LEADING0, 2);
lcdDrawText(TELEM_2ND_COLUMN+6*FW, line, STR_RX); lcdDrawText(TELEM_2ND_COLUMN+6*FW, line, STR_RX);
@ -371,7 +371,7 @@ bool displayNumbersTelemetryScreen(FrSkyScreenData & screen)
if (TELEMETRY_STREAMING()) { if (TELEMETRY_STREAMING()) {
#if defined(FRSKY_HUB) #if defined(FRSKY_HUB)
if (field == TELEM_ACC) { if (field == TELEM_ACC) {
lcd_putsLeft(STATUS_BAR_Y, STR_ACCEL); lcdDrawTextAlignedLeft(STATUS_BAR_Y, STR_ACCEL);
lcdDrawNumber(4*FW, STATUS_BAR_Y, telemetryData.hub.accelX, LEFT|PREC2); lcdDrawNumber(4*FW, STATUS_BAR_Y, telemetryData.hub.accelX, LEFT|PREC2);
lcdDrawNumber(10*FW, STATUS_BAR_Y, telemetryData.hub.accelY, LEFT|PREC2); lcdDrawNumber(10*FW, STATUS_BAR_Y, telemetryData.hub.accelY, LEFT|PREC2);
lcdDrawNumber(16*FW, STATUS_BAR_Y, telemetryData.hub.accelZ, LEFT|PREC2); lcdDrawNumber(16*FW, STATUS_BAR_Y, telemetryData.hub.accelZ, LEFT|PREC2);
@ -490,7 +490,7 @@ void incrTelemetryScreen()
} }
#endif #endif
void menuTelemetryFrsky(uint8_t event) void menuViewTelemetryFrsky(uint8_t event)
{ {
#if defined(CPUARM) #if defined(CPUARM)
enum NavigationDirection direction = none; enum NavigationDirection direction = none;

View file

@ -74,7 +74,7 @@ void title(const pm_char * s)
select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char *label, const pm_char *values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, uint8_t event) select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char *label, const pm_char *values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, uint8_t event)
{ {
lcd_putsColumnLeft(x, y, label); drawFieldLabel(x, y, label);
if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr); if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr);
if (attr) value = checkIncDec(event, value, min, max, (menuVerticalPositions[0] == 0) ? EE_MODEL : EE_GENERAL); if (attr) value = checkIncDec(event, value, min, max, (menuVerticalPositions[0] == 0) ? EE_MODEL : EE_GENERAL);
return value; return value;
@ -92,7 +92,7 @@ uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const pm_char *label,
int8_t switchMenuItem(coord_t x, coord_t y, int8_t value, LcdFlags attr, uint8_t event) int8_t switchMenuItem(coord_t x, coord_t y, int8_t value, LcdFlags attr, uint8_t event)
{ {
lcd_putsColumnLeft(x, y, STR_SWITCH); drawFieldLabel(x, y, STR_SWITCH);
putsSwitches(x, y, value, attr); putsSwitches(x, y, value, attr);
if (attr) CHECK_INCDEC_MODELSWITCH(event, value, SWSRC_FIRST_IN_MIXES, SWSRC_LAST_IN_MIXES, isSwitchAvailableInMixes); if (attr) CHECK_INCDEC_MODELSWITCH(event, value, SWSRC_FIRST_IN_MIXES, SWSRC_LAST_IN_MIXES, isSwitchAvailableInMixes);
return value; return value;

View file

@ -30,25 +30,35 @@
#define MENU_HEADER_HEIGHT FH #define MENU_HEADER_HEIGHT FH
#define MENU_INIT_VPOS 0 #define MENU_INIT_VPOS 0
#define BITMAP_BUFFER_SIZE(width, height) (2 + (width) * (((height)+7)/8)*4) #define BITMAP_BUFFER_SIZE(w, h) (2 + (w) * (((h)+7)/8)*4)
#define MODEL_BITMAP_WIDTH 64 #define MODEL_BITMAP_WIDTH 64
#define MODEL_BITMAP_HEIGHT 32 #define MODEL_BITMAP_HEIGHT 32
#define MODEL_BITMAP_SIZE BITMAP_BUFFER_SIZE(MODEL_BITMAP_WIDTH, MODEL_BITMAP_HEIGHT)
#define LOAD_MODEL_BITMAP() loadModelBitmap(g_model.header.bitmap, modelBitmap)
#define WCHART (LCD_H/2) #define WCHART (LCD_H/2)
#define X0 (LCD_W-WCHART-2) #define X0 (LCD_W-WCHART-2)
#define Y0 (LCD_H/2) #define Y0 (LCD_H/2)
#define MENUS_SCROLLBAR_WIDTH 2 #if defined(TRANSLATIONS_FR)
#define MENU_COLUMN2_X (8 + LCD_W / 2) #define MENU_COLUMNS 1
#else
#define MENU_COLUMNS 2
#endif
#if MENU_COLUMNS < 2 #if MENU_COLUMNS == 1
#define MIXES_2ND_COLUMN (18*FW) #define MIXES_2ND_COLUMN (18*FW)
#else #else
#define MIXES_2ND_COLUMN (9*FW) #define MIXES_2ND_COLUMN (9*FW)
#endif #endif
#define MODEL_BITMAP_SIZE BITMAP_BUFFER_SIZE(MODEL_BITMAP_WIDTH, MODEL_BITMAP_HEIGHT) #define MENUS_SCROLLBAR_WIDTH 2
#define LOAD_MODEL_BITMAP() loadModelBitmap(g_model.header.bitmap, modelBitmap)
#define MENU_COLUMN2_X (8 + LCD_W / 2)
inline void drawFieldLabel(coord_t x, coord_t y, const char * str)
{
lcdDrawText((x > (LCD_W-10*FW-MENUS_SCROLLBAR_WIDTH)) ? MENU_COLUMN2_X : 0, y, str);
}
extern uint8_t modelBitmap[MODEL_BITMAP_SIZE]; extern uint8_t modelBitmap[MODEL_BITMAP_SIZE];
bool loadModelBitmap(char * name, uint8_t * bitmap); bool loadModelBitmap(char * name, uint8_t * bitmap);
@ -58,6 +68,13 @@ struct MenuItem {
const MenuHandlerFunc action; const MenuHandlerFunc action;
}; };
// Temporary no highlight
extern uint8_t noHighlightCounter;
#define NO_HIGHLIGHT() (noHighlightCounter > 0)
#define START_NO_HIGHLIGHT() do { noHighlightCounter = 25; } while(0)
void drawCheckBox(coord_t x, coord_t y, uint8_t value, LcdFlags attr);
void drawSlider(coord_t x, coord_t y, uint8_t value, uint8_t max, uint8_t attr);
void drawSplash(); void drawSplash();
void drawScreenIndex(uint8_t index, uint8_t count, uint8_t attr); void drawScreenIndex(uint8_t index, uint8_t count, uint8_t attr);
void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible); void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
@ -68,6 +85,308 @@ void drawGauge(coord_t x, coord_t y, coord_t w, coord_t h, int32_t val, int32_t
void drawColumnHeader(const char * const * headers, uint8_t index); void drawColumnHeader(const char * const * headers, uint8_t index);
void drawStick(coord_t centrex, int16_t xval, int16_t yval); void drawStick(coord_t centrex, int16_t xval, int16_t yval);
void drawAlertBox(const char * title, const char * text, const char * action);
#define ALERT_SOUND_ARG , uint8_t sound
void showAlertBox(const char * title, const char * text, const char * action, uint8_t sound);
void doMainScreenGraphics();
typedef uint16_t FlightModesType;
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
#define INCDEC_DECLARE_VARS(f) uint8_t incdecFlag = (f); IsValueAvailable isValueAvailable = NULL
#define INCDEC_SET_FLAG(f) incdecFlag = (f)
#define INCDEC_ENABLE_CHECK(fn) isValueAvailable = fn
#define CHECK_INCDEC_PARAM(event, var, min, max) checkIncDec(event, var, min, max, incdecFlag, isValueAvailable)
// 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<count; ++i) {
int stop = stops[i];
if (value == stop)
return true;
else if (value < stop)
return false;
}
return false;
}
};
extern const CheckIncDecStops &stops100;
extern const CheckIncDecStops &stops1000;
extern const CheckIncDecStops &stopsSwitch;
#define INIT_STOPS(var, ...) \
const int _ ## var[] = { __VA_ARGS__ }; \
const CheckIncDecStops &var = (const CheckIncDecStops&)_ ## var;
#define CATEGORY_END(val) \
(val), (val+1)
int checkIncDec(unsigned int 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)
#define checkIncDecGen(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_GENERAL)
#define CHECK_INCDEC_MODELVAR(event, var, min, max) \
var = checkIncDecModel(event, var, min, max)
#define CHECK_INCDEC_MODELVAR_ZERO(event, var, max) \
var = checkIncDecModelZero(event, var, max)
#define CHECK_INCDEC_MODELVAR_CHECK(event, var, min, max, check) \
var = checkIncDec(event, var, min, max, EE_MODEL, check)
#define CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, var, max, check) \
var = checkIncDec(event, var, 0, max, EE_MODEL, check)
#define AUTOSWITCH_ENTER_LONG() (attr && event==EVT_KEY_LONG(KEY_ENTER))
#define CHECK_INCDEC_SWITCH(event, var, min, max, flags, available) \
var = checkIncDec(event, var, min, max, (flags)|INCDEC_SWITCH, available)
#define CHECK_INCDEC_MODELSWITCH(event, var, min, max, available) \
CHECK_INCDEC_SWITCH(event, var, min, max, EE_MODEL, available)
#define CHECK_INCDEC_MODELSOURCE(event, var, min, max) \
var = checkIncDec(event, var, min, max, EE_MODEL|INCDEC_SOURCE|NO_INCDEC_MARKS, isSourceAvailable)
#define CHECK_INCDEC_GENVAR(event, var, min, max) \
var = checkIncDecGen(event, var, min, max)
#define NAVIGATION_LINE_BY_LINE 0x40
#define CURSOR_ON_LINE() (menuHorizontalPosition<0)
#define CHECK_FLAG_NO_SCREEN_INDEX 1
void check(const char *title, event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow, uint8_t flags=0);
void check_simple(const char *title, event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, vertpos_t maxrow);
void check_submenu_simple(const char *title, event_t event, uint8_t maxrow);
void title(const pm_char * s);
#define TITLE(str) title(str)
#define MENU_TAB(...) const uint8_t mstate_tab[] = __VA_ARGS__
#define MENU_CHECK(title, tab, menu, lines_count) \
check(title, event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, lines_count)
#define MENU_CHECK_FLAGS(title, tab, menu, flags, lines_count) \
check(title, event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, lines_count, flags)
#define MENU(title, tab, menu, lines_count, ...) \
MENU_TAB(__VA_ARGS__); \
MENU_CHECK(title, tab, menu, lines_count)
#define MENU_FLAGS(title, tab, menu, flags, lines_count, ...) \
MENU_TAB(__VA_ARGS__); \
MENU_CHECK_FLAGS(title, tab, menu, flags, lines_count)
#define SIMPLE_MENU_FLAGS(title, tab, menu, flags, lines_count, ...) \
check(title, event, menu, tab, DIM(tab), NULL, 0, lines_count, flags)
#define SIMPLE_MENU(title, tab, menu, lines_count) \
check_simple(title, event, menu, tab, DIM(tab), lines_count)
#define SUBMENU_NOTITLE(lines_count, ...) { \
MENU_TAB(__VA_ARGS__); \
check(NULL, event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, lines_count); \
}
#define SUBMENU(title, lines_count, ...) \
MENU_TAB(__VA_ARGS__); \
check(title, event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, lines_count)
#define SIMPLE_SUBMENU_NOTITLE(lines_count) \
check_submenu_simple(NULL, event, lines_count);
#define SIMPLE_SUBMENU(title, lines_count) \
check_submenu_simple(title, event, lines_count)
typedef int select_menu_value_t;
select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char *label, const pm_char *values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, uint8_t event);
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const pm_char *label, LcdFlags attr, uint8_t event);
swsrc_t switchMenuItem(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, uint8_t event);
#define ON_OFF_MENU_ITEM(value, x, y, label, attr, event) value = editCheckBox(value, x, y, label, attr, event)
#if defined(GVARS)
void drawGVarName(coord_t x, coord_t y, int8_t index, LcdFlags flags=0);
void drawGVarValue(coord_t x, coord_t y, uint8_t gvar, gvar_t value, LcdFlags flags=0);
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, uint8_t event);
#define GVAR_MENU_ITEM(x, y, v, min, max, lcdattr, editflags, event) editGVarFieldValue(x, y, v, min, max, lcdattr, editflags, event)
#define displayGVar(x, y, v, min, max) GVAR_MENU_ITEM(x, y, v, min, max, 0, 0, 0)
#else
#define GVAR_MENU_ITEM(x, y, v, min, max, lcdattr, editflags, event) editGVarFieldValue(x, y, v, min, max, lcdattr, event)
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t event);
#define displayGVar(x, y, v, min, max) lcdDrawNumber(x, y, v)
#endif
extern uint8_t s_curveChan;
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, uint8_t event, uint8_t attr);
extern uint8_t editNameCursorPos;
void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uint8_t active, uint8_t attr=ZCHAR);
void editSingleName(coord_t x, coord_t y, const pm_char *label, char *name, uint8_t size, uint8_t event, uint8_t active);
#if MENU_COLUMNS > 1
uint8_t editDelay(const coord_t x, const coord_t y, const uint8_t event, const uint8_t attr, const pm_char *str, uint8_t delay);
#define EDIT_DELAY(x, y, event, attr, str, delay) editDelay(x, y, event, attr, str, delay)
#else
uint8_t editDelay(const coord_t y, const uint8_t event, const uint8_t attr, const pm_char *str, uint8_t delay);
#define EDIT_DELAY(x, y, event, attr, str, delay) editDelay(y, event, attr, str, delay)
#endif
#define WARNING_TYPE_ASTERISK 0
#define WARNING_TYPE_CONFIRM 1
#define WARNING_TYPE_INPUT 2
void copySelection(char * dst, const char * src, uint8_t size);
extern const pm_char * warningText;
extern const pm_char * warningInfoText;
extern uint8_t warningInfoLength;
extern uint8_t warningResult;
extern uint8_t warningType;
#define COPY_MODE 1
#define MOVE_MODE 2
extern uint8_t s_copyMode;
extern int8_t s_copySrcRow;
extern int8_t s_copyTgtOfs;
extern uint8_t s_currIdx;
extern uint8_t s_maxLines;
extern uint8_t s_copySrcIdx;
extern uint8_t s_copySrcCh;
extern int8_t s_currCh;
uint8_t getExposCount();
void deleteExpo(uint8_t idx);
void insertExpo(uint8_t idx);
uint8_t getMixesCount();
void deleteMix(uint8_t idx);
void insertMix(uint8_t idx);
#define MENU_X 30
#define MENU_Y 16
#define MENU_W LCD_W-(2*MENU_X)
#define WARNING_LINE_LEN 32
#define WARNING_LINE_X 16
#define WARNING_LINE_Y 3*FH
void drawMessageBox(const char * title);
void showMessageBox(const char * title);
void runPopupWarning(uint8_t event);
extern void (*popupFunc)(uint8_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) (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)
#define NAVIGATION_MENUS
#define POPUP_MENU_ADD_ITEM(s) do { popupMenuOffsetType = MENU_OFFSET_INTERNAL; if (popupMenuNoItems < POPUP_MENU_MAX_LINES) popupMenuItems[popupMenuNoItems++] = s; } while (0)
#define POPUP_MENU_START(func) do { popupMenuHandler = (func); AUDIO_KEY_PRESS(); } while(0)
#define POPUP_MENU_MAX_LINES 12
#define MENU_MAX_DISPLAY_LINES 6
#define POPUP_MENU_ADD_SD_ITEM(s) POPUP_MENU_ADD_ITEM(s)
#define MENU_LINE_LENGTH (LEN_MODEL_NAME+12)
#define POPUP_MENU_ITEMS_FROM_BSS()
extern const char * popupMenuItems[POPUP_MENU_MAX_LINES];
extern uint16_t popupMenuNoItems;
extern uint16_t popupMenuOffset;
enum {
MENU_OFFSET_INTERNAL,
MENU_OFFSET_EXTERNAL
};
extern uint8_t popupMenuOffsetType;
const char * runPopupMenu(uint8_t event);
extern void (*popupMenuHandler)(const char *result);
#define STATUS_LINE_LENGTH 32
extern char statusLineMsg[STATUS_LINE_LENGTH];
void showStatusLine();
void drawStatusLine();
#define TEXT_FILENAME_MAXLEN 40
extern char s_text_file[TEXT_FILENAME_MAXLEN];
void menuTextView(uint8_t event);
void pushMenuTextView(const char *filename);
void pushModelNotes();
void menuChannelsView(uint8_t event);
#define LABEL(...) (uint8_t)-1
#if defined(PCBX9E) && !defined(SIMU)
#define KEY_UP KEY_MINUS
#define KEY_DOWN KEY_PLUS
#define KEY_RIGHT KEY_PLUS
#define KEY_LEFT KEY_MINUS
#define CURSOR_MOVED_LEFT(event) (EVT_KEY_MASK(event) == KEY_LEFT)
#define CURSOR_MOVED_RIGHT(event) (EVT_KEY_MASK(event) == KEY_RIGHT)
#else
#define KEY_UP KEY_PLUS
#define KEY_DOWN KEY_MINUS
#define KEY_RIGHT KEY_MINUS
#define KEY_LEFT KEY_PLUS
#define CURSOR_MOVED_LEFT(event) (EVT_KEY_MASK(event) == KEY_LEFT)
#define CURSOR_MOVED_RIGHT(event) (EVT_KEY_MASK(event) == KEY_RIGHT)
#endif
#define REPEAT_LAST_CURSOR_MOVE() { if (CURSOR_MOVED_LEFT(event) || CURSOR_MOVED_RIGHT(event)) putEvent(event); else menuHorizontalPosition = 0; }
#define MOVE_CURSOR_FROM_HERE() if (menuHorizontalPosition > 0) REPEAT_LAST_CURSOR_MOVE()
#define MENU_FIRST_LINE_EDIT (menuTab ? (MAXCOL((uint16_t)0) >= HIDDEN_ROW ? (MAXCOL((uint16_t)1) >= HIDDEN_ROW ? 2 : 1) : 0) : 0)
#define POS_HORZ_INIT(posVert) ((COLATTR(posVert) & NAVIGATION_LINE_BY_LINE) ? -1 : 0)
#define EDIT_MODE_INIT 0 // TODO enum
typedef int16_t (*FnFuncP) (int16_t x);
void drawFunction(FnFuncP fn, uint8_t offset=0);
void onSourceLongEnterPress(const char *result);
uint8_t switchToMix(uint8_t source);
extern coord_t scrollbar_X; extern coord_t scrollbar_X;
#define SET_SCROLLBAR_X(x) scrollbar_X = (x); #define SET_SCROLLBAR_X(x) scrollbar_X = (x);
@ -81,7 +400,7 @@ FlightModesType editFlightModes(coord_t x, coord_t y, uint8_t event, FlightModes
#endif #endif
#define IS_MAIN_VIEW_DISPLAYED() menuHandlers[0] == menuMainView #define IS_MAIN_VIEW_DISPLAYED() menuHandlers[0] == menuMainView
#define IS_TELEMETRY_VIEW_DISPLAYED() menuHandlers[0] == menuTelemetryFrsky #define IS_TELEMETRY_VIEW_DISPLAYED() menuHandlers[0] == menuViewTelemetryFrsky
#define IS_OTHER_VIEW_DISPLAYED() (menuHandlers[0] == menuMainViewChannelsMonitor || menuHandlers[0] == menuChannelsView) #define IS_OTHER_VIEW_DISPLAYED() (menuHandlers[0] == menuMainViewChannelsMonitor || menuHandlers[0] == menuChannelsView)
#endif // _GUI_H_ #endif // _GUI_H_

View file

@ -338,7 +338,7 @@ void lcdDrawText(coord_t x, coord_t y, const pm_char * s)
lcdDrawText(x, y, s, 0); lcdDrawText(x, y, s, 0);
} }
void lcd_putsLeft(coord_t y, const pm_char * s) void lcdDrawTextAlignedLeft(coord_t y, const pm_char * s)
{ {
lcdDrawText(0, y, s); lcdDrawText(0, y, s);
} }

View file

@ -122,7 +122,7 @@ void lcdDrawTextAtIndex(coord_t x, coord_t y, const pm_char * s,uint8_t idx, Lcd
void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s,unsigned char len, LcdFlags mode); void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s,unsigned char len, LcdFlags mode);
void lcdDrawText(coord_t x, coord_t y, const pm_char * s); void lcdDrawText(coord_t x, coord_t y, const pm_char * s);
void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, unsigned char len); void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, unsigned char len);
void lcd_putsLeft(coord_t y, const pm_char * s); void lcdDrawTextAlignedLeft(coord_t y, const pm_char * s);
#define lcd_putsCenter(y, s) lcdDrawText((LCD_W-sizeof(TR_##s)*FW+FW+1)/2, y, STR_##s) #define lcd_putsCenter(y, s) lcdDrawText((LCD_W-sizeof(TR_##s)*FW+FW+1)/2, y, STR_##s)

View file

@ -33,12 +33,12 @@ const MenuHandlerFunc menuTabModel[] = {
CASE_GVARS(menuModelGVars) CASE_GVARS(menuModelGVars)
#endif #endif
menuModelLogicalSwitches, menuModelLogicalSwitches,
menuModelCustomFunctions, menuModelSpecialFunctions,
#if defined(LUA_MODEL_SCRIPTS) #if defined(LUA_MODEL_SCRIPTS)
menuModelCustomScripts, menuModelCustomScripts,
#endif #endif
menuModelTelemetry, menuModelTelemetryFrsky,
CASE_MAVLINK(menuTelemetryMavlinkSetup) CASE_MAVLINK(menuModelTelemetryMavlink)
menuModelDisplay menuModelDisplay
}; };
@ -53,7 +53,7 @@ uint8_t editDelay(const coord_t x, const coord_t y, const uint8_t event, const u
#else #else
uint8_t editDelay(const coord_t y, const uint8_t event, const uint8_t attr, const pm_char *str, uint8_t delay) uint8_t editDelay(const coord_t y, const uint8_t event, const uint8_t attr, const pm_char *str, uint8_t delay)
{ {
lcd_putsLeft(y, str); lcdDrawTextAlignedLeft(y, str);
lcdDrawNumber(MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT); lcdDrawNumber(MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT);
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, delay, DELAY_MAX); if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, delay, DELAY_MAX);
return delay; return delay;
@ -161,7 +161,7 @@ void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uin
void editSingleName(coord_t x, coord_t y, const pm_char *label, char *name, uint8_t size, uint8_t event, uint8_t active) void editSingleName(coord_t x, coord_t y, const pm_char *label, char *name, uint8_t size, uint8_t event, uint8_t active)
{ {
lcd_putsLeft(y, label); lcdDrawTextAlignedLeft(y, label);
editName(x, y, name, size, event, active); editName(x, y, name, size, event, active);
} }

View file

@ -21,19 +21,19 @@
#include "opentx.h" #include "opentx.h"
const MenuHandlerFunc menuTabGeneral[] = { const MenuHandlerFunc menuTabGeneral[] = {
menuGeneralSetup, menuRadioSetup,
menuGeneralSdManager, menuRadioSdManager,
menuGeneralCustomFunctions, menuRadioSpecialFunctions,
menuGeneralTrainer, menuRadioTrainer,
menuGeneralVersion, menuRadioVersion,
menuGeneralDiagKeys, menuRadioDiagKeys,
menuGeneralDiagAna, menuRadioDiagAnalogs,
menuGeneralHardware, menuRadioHardware,
menuGeneralCalib menuRadioCalibration
}; };
void menuGeneralCustomFunctions(uint8_t event) void menuRadioSpecialFunctions(uint8_t event)
{ {
MENU(STR_MENUGLOBALFUNCS, menuTabGeneral, e_GeneralCustomFunctions, NUM_CFN, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ }); MENU(STR_MENUSPECIALFUNCS, menuTabGeneral, MENU_RADIO_SPECIAL_FUNCTIONS, NUM_CFN, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ });
return menuCustomFunctions(event, g_eeGeneral.customFn, &globalFunctionsContext); return menuSpecialFunctions(event, g_eeGeneral.customFn, &globalFunctionsContext);
} }

View file

@ -47,7 +47,7 @@ void pushMenu(MenuHandlerFunc newMenu)
killEvents(KEY_ENTER); killEvents(KEY_ENTER);
if (menuLevel == 0) { if (menuLevel == 0) {
if (newMenu == menuGeneralSetup) if (newMenu == menuRadioSetup)
menuVerticalPositions[0] = 1; menuVerticalPositions[0] = 1;
if (newMenu == menuModelSelect) if (newMenu == menuModelSelect)
menuVerticalPositions[0] = 0; menuVerticalPositions[0] = 0;

View file

@ -21,60 +21,37 @@
#ifndef _MENUS_H_ #ifndef _MENUS_H_
#define _MENUS_H_ #define _MENUS_H_
#if defined(TRANSLATIONS_FR) #include "keys.h"
#define MENU_COLUMNS 1
#else
#define MENU_COLUMNS 2
#endif
#define lcd_putsColumnLeft(x, y, str) lcdDrawText((x > (LCD_W-10*FW-MENUS_SCROLLBAR_WIDTH)) ? MENU_COLUMN2_X : 0, y, str)
// Menus related stuff ...
typedef uint16_t vertpos_t; typedef uint16_t vertpos_t;
typedef int8_t horzpos_t;
typedef uint8_t & check_event_t; typedef void (*MenuHandlerFunc)(uint8_t event);
#define horzpos_t int8_t
extern tmr10ms_t menuEntryTime; extern tmr10ms_t menuEntryTime;
extern vertpos_t menuVerticalPosition; extern vertpos_t menuVerticalPosition;
extern horzpos_t menuHorizontalPosition; extern horzpos_t menuHorizontalPosition;
extern vertpos_t menuVerticalOffset; extern vertpos_t menuVerticalOffset;
extern uint8_t calibrationState; extern uint8_t calibrationState;
// Temporary no highlight
extern uint8_t noHighlightCounter;
#define NO_HIGHLIGHT() (noHighlightCounter > 0)
#define START_NO_HIGHLIGHT() do { noHighlightCounter = 25; } while(0)
void drawCheckBox(coord_t x, coord_t y, uint8_t value, LcdFlags attr);
typedef void (*MenuHandlerFunc)(uint8_t event);
extern MenuHandlerFunc menuHandlers[5]; extern MenuHandlerFunc menuHandlers[5];
extern uint8_t menuVerticalPositions[4]; extern uint8_t menuVerticalPositions[4];
extern uint8_t menuLevel; extern uint8_t menuLevel;
extern uint8_t menuEvent; extern uint8_t menuEvent;
/// goto given Menu, but substitute current menu in menuStack
void chainMenu(MenuHandlerFunc newMenu); void chainMenu(MenuHandlerFunc newMenu);
/// goto given Menu, store current menu in menuStack
void pushMenu(MenuHandlerFunc newMenu); void pushMenu(MenuHandlerFunc newMenu);
/// return to last menu in menustack
void popMenu(); void popMenu();
void doMainScreenGraphics();
void menuFirstCalib(uint8_t event);
void onMainViewMenu(const char * result); void onMainViewMenu(const char * result);
void menuFirstCalib(uint8_t event);
void menuMainViewChannelsMonitor(uint8_t event); void menuMainViewChannelsMonitor(uint8_t event);
void menuChannelsView(uint8_t event); void menuChannelsView(uint8_t event);
void menuMainView(uint8_t event); void menuMainView(uint8_t event);
#if defined(TELEMETRY_FRSKY) #if defined(TELEMETRY_FRSKY)
void menuTelemetryFrsky(uint8_t event); void menuViewTelemetryFrsky(uint8_t event);
#endif #endif
void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext); void menuSpecialFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext);
void menuModelNotes(uint8_t event); void menuModelNotes(uint8_t event);
void menuStatisticsView(uint8_t event); void menuStatisticsView(uint8_t event);
void menuStatisticsDebug(uint8_t event); void menuStatisticsDebug(uint8_t event);
@ -84,49 +61,49 @@ void menuTraceBuffer(uint8_t event);
#endif #endif
enum EnumTabRadio { enum EnumTabRadio {
e_Setup, MENU_RADIO_SETUP,
e_Sd, MENU_RADIO_SD_MANAGER,
e_GeneralCustomFunctions, MENU_RADIO_SPECIAL_FUNCTIONS,
e_Trainer, MENU_RADIO_TRAINER,
e_Vers, MENU_RADIO_VERSION,
e_Keys, MENU_RADIO_DIAG_KEYS,
e_Ana, MENU_RADIO_DIAG_ANALOGS,
e_Hardware, MENU_RADIO_HARDWARE,
e_Calib, MENU_RADIO_CALIBRATION,
e_TabRadioPagesCount MENU_RADIO_PAGES_COUNT
}; };
void menuGeneralSetup(uint8_t event); void menuRadioSetup(uint8_t event);
void menuGeneralSdManager(uint8_t event); void menuRadioSdManager(uint8_t event);
void menuGeneralCustomFunctions(uint8_t event); void menuRadioSpecialFunctions(uint8_t event);
void menuGeneralTrainer(uint8_t event); void menuRadioTrainer(uint8_t event);
void menuGeneralVersion(uint8_t event); void menuRadioVersion(uint8_t event);
void menuGeneralDiagKeys(uint8_t event); void menuRadioDiagKeys(uint8_t event);
void menuGeneralDiagAna(uint8_t event); void menuRadioDiagAnalogs(uint8_t event);
void menuGeneralHardware(uint8_t event); void menuRadioHardware(uint8_t event);
void menuGeneralCalib(uint8_t event); void menuRadioCalibration(uint8_t event);
extern const MenuHandlerFunc menuTabGeneral[e_TabRadioPagesCount]; extern const MenuHandlerFunc menuTabGeneral[MENU_RADIO_PAGES_COUNT];
enum EnumTabModel { enum EnumTabModel {
e_ModelSelect, MENU_MODEL_SELECT,
e_ModelSetup, MENU_MODEL_SETUP,
CASE_HELI(e_Heli) CASE_HELI(MENU_MODEL_HELI)
CASE_FLIGHT_MODES(e_FlightModesAll) CASE_FLIGHT_MODES(MENU_MODEL_FLIGHT_MODES)
e_InputsAll, MENU_MODEL_INPUTS,
e_MixAll, MENU_MODEL_MIXES,
e_Limits, MENU_MODEL_OUTPUTS,
CASE_CURVES(e_CurvesAll) CASE_CURVES(MENU_MODEL_CURVES)
CASE_GVARS(e_GVars) CASE_GVARS(MENU_MODEL_GVARS)
e_LogicalSwitches, MENU_MODEL_LOGICAL_SWITCHES,
e_CustomFunctions, MENU_MODEL_SPECIAL_FUNCTIONS,
#if defined(LUA_MODEL_SCRIPTS) #if defined(LUA_MODEL_SCRIPTS)
e_CustomScripts, MENU_MODEL_CUSTOM_SCRIPTS,
#endif #endif
e_Telemetry, MENU_MODEL_TELEMETRY_FRSKY,
CASE_MAVLINK(e_MavSetup) CASE_MAVLINK(MENU_MODEL_TELEMETRY_MAVLINK)
e_Display, MENU_MODEL_DISPLAY,
e_TabModelPagesCount MENU_MODEL_PAGES_COUNT
}; };
void menuModelSelect(uint8_t event); void menuModelSelect(uint8_t event);
@ -140,307 +117,12 @@ void menuModelCurvesAll(uint8_t event);
void menuModelCurveOne(uint8_t event); void menuModelCurveOne(uint8_t event);
void menuModelGVars(uint8_t event); void menuModelGVars(uint8_t event);
void menuModelLogicalSwitches(uint8_t event); void menuModelLogicalSwitches(uint8_t event);
void menuModelCustomFunctions(uint8_t event); void menuModelSpecialFunctions(uint8_t event);
void menuModelCustomScripts(uint8_t event); void menuModelCustomScripts(uint8_t event);
void menuModelTelemetry(uint8_t event); void menuModelTelemetryFrsky(uint8_t event);
void menuModelDisplay(uint8_t event); void menuModelDisplay(uint8_t event);
void menuModelExpoOne(uint8_t event); void menuModelExpoOne(uint8_t event);
extern const MenuHandlerFunc menuTabModel[e_TabModelPagesCount]; extern const MenuHandlerFunc menuTabModel[MENU_MODEL_PAGES_COUNT];
void drawSlider(coord_t x, coord_t y, uint8_t value, uint8_t max, uint8_t attr);
typedef uint16_t FlightModesType;
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
#define INCDEC_DECLARE_VARS(f) uint8_t incdecFlag = (f); IsValueAvailable isValueAvailable = NULL
#define INCDEC_SET_FLAG(f) incdecFlag = (f)
#define INCDEC_ENABLE_CHECK(fn) isValueAvailable = fn
#define CHECK_INCDEC_PARAM(event, var, min, max) checkIncDec(event, var, min, max, incdecFlag, isValueAvailable)
// 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<count; ++i) {
int stop = stops[i];
if (value == stop)
return true;
else if (value < stop)
return false;
}
return false;
}
};
extern const CheckIncDecStops &stops100;
extern const CheckIncDecStops &stops1000;
extern const CheckIncDecStops &stopsSwitch;
#define INIT_STOPS(var, ...) \
const int _ ## var[] = { __VA_ARGS__ }; \
const CheckIncDecStops &var = (const CheckIncDecStops&)_ ## var;
#define CATEGORY_END(val) \
(val), (val+1)
int checkIncDec(unsigned int 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)
#define checkIncDecGen(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_GENERAL)
#define CHECK_INCDEC_MODELVAR(event, var, min, max) \
var = checkIncDecModel(event, var, min, max)
#define CHECK_INCDEC_MODELVAR_ZERO(event, var, max) \
var = checkIncDecModelZero(event, var, max)
#define CHECK_INCDEC_MODELVAR_CHECK(event, var, min, max, check) \
var = checkIncDec(event, var, min, max, EE_MODEL, check)
#define CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, var, max, check) \
var = checkIncDec(event, var, 0, max, EE_MODEL, check)
#define AUTOSWITCH_ENTER_LONG() (attr && event==EVT_KEY_LONG(KEY_ENTER))
#define CHECK_INCDEC_SWITCH(event, var, min, max, flags, available) \
var = checkIncDec(event, var, min, max, (flags)|INCDEC_SWITCH, available)
#define CHECK_INCDEC_MODELSWITCH(event, var, min, max, available) \
CHECK_INCDEC_SWITCH(event, var, min, max, EE_MODEL, available)
#define CHECK_INCDEC_MODELSOURCE(event, var, min, max) \
var = checkIncDec(event, var, min, max, EE_MODEL|INCDEC_SOURCE|NO_INCDEC_MARKS, isSourceAvailable)
#define CHECK_INCDEC_GENVAR(event, var, min, max) \
var = checkIncDecGen(event, var, min, max)
#define NAVIGATION_LINE_BY_LINE 0x40
#define CURSOR_ON_LINE() (menuHorizontalPosition<0)
#define CHECK_FLAG_NO_SCREEN_INDEX 1
void check(const char *title, check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow, uint8_t flags=0);
void check_simple(const char *title, check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, vertpos_t maxrow);
void check_submenu_simple(const char *title, check_event_t event, uint8_t maxrow);
void title(const pm_char * s);
#define TITLE(str) title(str)
#define MENU_TAB(...) const uint8_t mstate_tab[] = __VA_ARGS__
#define MENU_CHECK(title, tab, menu, lines_count) \
check(title, event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, lines_count)
#define MENU_CHECK_FLAGS(title, tab, menu, flags, lines_count) \
check(title, event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, lines_count, flags)
#define MENU(title, tab, menu, lines_count, ...) \
MENU_TAB(__VA_ARGS__); \
MENU_CHECK(title, tab, menu, lines_count)
#define MENU_FLAGS(title, tab, menu, flags, lines_count, ...) \
MENU_TAB(__VA_ARGS__); \
MENU_CHECK_FLAGS(title, tab, menu, flags, lines_count)
#define SIMPLE_MENU_FLAGS(title, tab, menu, flags, lines_count, ...) \
check(title, event, menu, tab, DIM(tab), NULL, 0, lines_count, flags)
#define SIMPLE_MENU(title, tab, menu, lines_count) \
check_simple(title, event, menu, tab, DIM(tab), lines_count)
#define SUBMENU_NOTITLE(lines_count, ...) { \
MENU_TAB(__VA_ARGS__); \
check(NULL, event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, lines_count); \
}
#define SUBMENU(title, lines_count, ...) \
MENU_TAB(__VA_ARGS__); \
check(title, event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, lines_count)
#define SIMPLE_SUBMENU_NOTITLE(lines_count) \
check_submenu_simple(NULL, event, lines_count);
#define SIMPLE_SUBMENU(title, lines_count) \
check_submenu_simple(title, event, lines_count)
typedef int select_menu_value_t;
select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char *label, const pm_char *values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, uint8_t event);
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const pm_char *label, LcdFlags attr, uint8_t event);
swsrc_t switchMenuItem(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, uint8_t event);
#define ON_OFF_MENU_ITEM(value, x, y, label, attr, event) value = editCheckBox(value, x, y, label, attr, event)
#if defined(GVARS)
void drawGVarName(coord_t x, coord_t y, int8_t index, LcdFlags flags=0);
void drawGVarValue(coord_t x, coord_t y, uint8_t gvar, gvar_t value, LcdFlags flags=0);
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, uint8_t event);
#define GVAR_MENU_ITEM(x, y, v, min, max, lcdattr, editflags, event) editGVarFieldValue(x, y, v, min, max, lcdattr, editflags, event)
#define displayGVar(x, y, v, min, max) GVAR_MENU_ITEM(x, y, v, min, max, 0, 0, 0)
#else
#define GVAR_MENU_ITEM(x, y, v, min, max, lcdattr, editflags, event) editGVarFieldValue(x, y, v, min, max, lcdattr, event)
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t event);
#define displayGVar(x, y, v, min, max) lcdDrawNumber(x, y, v)
#endif
extern uint8_t s_curveChan;
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, uint8_t event, uint8_t attr);
extern uint8_t editNameCursorPos;
void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uint8_t active, uint8_t attr=ZCHAR);
void editSingleName(coord_t x, coord_t y, const pm_char *label, char *name, uint8_t size, uint8_t event, uint8_t active);
#if MENU_COLUMNS > 1
uint8_t editDelay(const coord_t x, const coord_t y, const uint8_t event, const uint8_t attr, const pm_char *str, uint8_t delay);
#define EDIT_DELAY(x, y, event, attr, str, delay) editDelay(x, y, event, attr, str, delay)
#else
uint8_t editDelay(const coord_t y, const uint8_t event, const uint8_t attr, const pm_char *str, uint8_t delay);
#define EDIT_DELAY(x, y, event, attr, str, delay) editDelay(y, event, attr, str, delay)
#endif
#define WARNING_TYPE_ASTERISK 0
#define WARNING_TYPE_CONFIRM 1
#define WARNING_TYPE_INPUT 2
void copySelection(char * dst, const char * src, uint8_t size);
extern const pm_char * warningText;
extern const pm_char * warningInfoText;
extern uint8_t warningInfoLength;
extern uint8_t warningResult;
extern uint8_t warningType;
#define COPY_MODE 1
#define MOVE_MODE 2
extern uint8_t s_copyMode;
extern int8_t s_copySrcRow;
extern int8_t s_copyTgtOfs;
extern uint8_t s_currIdx;
extern uint8_t s_maxLines;
extern uint8_t s_copySrcIdx;
extern uint8_t s_copySrcCh;
extern int8_t s_currCh;
uint8_t getExposCount();
void deleteExpo(uint8_t idx);
void insertExpo(uint8_t idx);
uint8_t getMixesCount();
void deleteMix(uint8_t idx);
void insertMix(uint8_t idx);
#define MENU_X 30
#define MENU_Y 16
#define MENU_W LCD_W-(2*MENU_X)
#define WARNING_LINE_LEN 32
#define WARNING_LINE_X 16
#define WARNING_LINE_Y 3*FH
void drawMessageBox(const char * title);
void displayPopup(const char * title);
void displayWarning(uint8_t event);
extern void (*popupFunc)(uint8_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) (warningText = s, warningInfoText = 0, popupFunc = displayWarning)
#define POPUP_CONFIRMATION(s) (warningText = s, warningType = WARNING_TYPE_CONFIRM, warningInfoText = 0, popupFunc = displayWarning)
#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)
#define NAVIGATION_MENUS
#define POPUP_MENU_ADD_ITEM(s) do { popupMenuOffsetType = MENU_OFFSET_INTERNAL; if (popupMenuNoItems < POPUP_MENU_MAX_LINES) popupMenuItems[popupMenuNoItems++] = s; } while (0)
#define POPUP_MENU_START(func) do { popupMenuHandler = (func); AUDIO_KEY_PRESS(); } while(0)
#define POPUP_MENU_MAX_LINES 12
#define MENU_MAX_DISPLAY_LINES 6
#define POPUP_MENU_ADD_SD_ITEM(s) POPUP_MENU_ADD_ITEM(s)
#define MENU_LINE_LENGTH (LEN_MODEL_NAME+12)
#define POPUP_MENU_ITEMS_FROM_BSS()
extern const char * popupMenuItems[POPUP_MENU_MAX_LINES];
extern uint16_t popupMenuNoItems;
extern uint16_t popupMenuOffset;
enum {
MENU_OFFSET_INTERNAL,
MENU_OFFSET_EXTERNAL
};
extern uint8_t popupMenuOffsetType;
const char * runPopupMenu(uint8_t event);
extern void (*popupMenuHandler)(const char *result);
#define STATUS_LINE_LENGTH 32
extern char statusLineMsg[STATUS_LINE_LENGTH];
void showStatusLine();
void drawStatusLine();
#define TEXT_FILENAME_MAXLEN 40
extern char s_text_file[TEXT_FILENAME_MAXLEN];
void menuTextView(uint8_t event);
void pushMenuTextView(const char *filename);
void pushModelNotes();
void menuChannelsView(uint8_t event);
#define LABEL(...) (uint8_t)-1
#if defined(PCBX9E) && !defined(SIMU)
#define KEY_UP KEY_MINUS
#define KEY_DOWN KEY_PLUS
#define KEY_RIGHT KEY_PLUS
#define KEY_LEFT KEY_MINUS
#define CURSOR_MOVED_LEFT(event) (EVT_KEY_MASK(event) == KEY_LEFT)
#define CURSOR_MOVED_RIGHT(event) (EVT_KEY_MASK(event) == KEY_RIGHT)
#else
#define KEY_UP KEY_PLUS
#define KEY_DOWN KEY_MINUS
#define KEY_RIGHT KEY_MINUS
#define KEY_LEFT KEY_PLUS
#define CURSOR_MOVED_LEFT(event) (EVT_KEY_MASK(event) == KEY_LEFT)
#define CURSOR_MOVED_RIGHT(event) (EVT_KEY_MASK(event) == KEY_RIGHT)
#endif
#define REPEAT_LAST_CURSOR_MOVE() { if (CURSOR_MOVED_LEFT(event) || CURSOR_MOVED_RIGHT(event)) putEvent(event); else menuHorizontalPosition = 0; }
#define MOVE_CURSOR_FROM_HERE() if (menuHorizontalPosition > 0) REPEAT_LAST_CURSOR_MOVE()
#define MENU_FIRST_LINE_EDIT (menuTab ? (MAXCOL((uint16_t)0) >= HIDDEN_ROW ? (MAXCOL((uint16_t)1) >= HIDDEN_ROW ? 2 : 1) : 0) : 0)
#define POS_HORZ_INIT(posVert) ((COLATTR(posVert) & NAVIGATION_LINE_BY_LINE) ? -1 : 0)
#define EDIT_MODE_INIT 0 // TODO enum
typedef int16_t (*FnFuncP) (int16_t x);
void drawFunction(FnFuncP fn, uint8_t offset=0);
void onSourceLongEnterPress(const char *result);
uint8_t switchToMix(uint8_t source);
#endif // _MENUS_H_ #endif // _MENUS_H_

View file

@ -94,7 +94,7 @@ void resetCustomCurveX(int8_t * points, int noPoints)
void displayPresetChoice(uint8_t event) void displayPresetChoice(uint8_t event)
{ {
displayWarning(event); runPopupWarning(event);
lcdDrawNumber(WARNING_LINE_X+FW*7, WARNING_LINE_Y, 45*warningInputValue/4, LEFT|INVERS); lcdDrawNumber(WARNING_LINE_X+FW*7, WARNING_LINE_Y, 45*warningInputValue/4, LEFT|INVERS);
lcdDrawChar(lcdLastPos, WARNING_LINE_Y, '@', INVERS); lcdDrawChar(lcdLastPos, WARNING_LINE_Y, '@', INVERS);
@ -149,11 +149,11 @@ void menuModelCurveOne(uint8_t event)
SIMPLE_SUBMENU(STR_MENUCURVES, 4 + 5+crv.points + (crv.type==CURVE_TYPE_CUSTOM ? 5+crv.points-2 : 0)); SIMPLE_SUBMENU(STR_MENUCURVES, 4 + 5+crv.points + (crv.type==CURVE_TYPE_CUSTOM ? 5+crv.points-2 : 0));
lcd_putsLeft(FH+1, STR_NAME); lcdDrawTextAlignedLeft(FH+1, STR_NAME);
editName(INDENT_WIDTH, 2*FH+1, crv.name, sizeof(crv.name), event, menuVerticalPosition==0); editName(INDENT_WIDTH, 2*FH+1, crv.name, sizeof(crv.name), event, menuVerticalPosition==0);
uint8_t attr = (menuVerticalPosition==1 ? (s_editMode>0 ? INVERS|BLINK : INVERS) : 0); uint8_t attr = (menuVerticalPosition==1 ? (s_editMode>0 ? INVERS|BLINK : INVERS) : 0);
lcd_putsLeft(3*FH+1, STR_TYPE); lcdDrawTextAlignedLeft(3*FH+1, STR_TYPE);
lcdDrawTextAtIndex(INDENT_WIDTH, 4*FH+1, STR_CURVE_TYPES, crv.type, attr); lcdDrawTextAtIndex(INDENT_WIDTH, 4*FH+1, STR_CURVE_TYPES, crv.type, attr);
if (attr) { if (attr) {
uint8_t newType = checkIncDecModelZero(event, crv.type, CURVE_TYPE_LAST); uint8_t newType = checkIncDecModelZero(event, crv.type, CURVE_TYPE_LAST);
@ -170,7 +170,7 @@ void menuModelCurveOne(uint8_t event)
} }
attr = (menuVerticalPosition==2 ? (s_editMode>0 ? INVERS|BLINK : INVERS) : 0); attr = (menuVerticalPosition==2 ? (s_editMode>0 ? INVERS|BLINK : INVERS) : 0);
lcd_putsLeft(5*FH+1, STR_COUNT); lcdDrawTextAlignedLeft(5*FH+1, STR_COUNT);
lcdDrawNumber(INDENT_WIDTH, 6*FH+1, 5+crv.points, LEFT|attr); lcdDrawNumber(INDENT_WIDTH, 6*FH+1, 5+crv.points, LEFT|attr);
lcdDrawText(lcdLastPos, 6*FH+1, STR_PTS, attr); lcdDrawText(lcdLastPos, 6*FH+1, STR_PTS, attr);
if (attr) { if (attr) {
@ -191,7 +191,7 @@ void menuModelCurveOne(uint8_t event)
} }
} }
lcd_putsLeft(7*FH+1, STR_SMOOTH); lcdDrawTextAlignedLeft(7*FH+1, STR_SMOOTH);
drawCheckBox(7 * FW, 7 * FH + 1, crv.smooth, menuVerticalPosition == 3 ? INVERS : 0); drawCheckBox(7 * FW, 7 * FH + 1, crv.smooth, menuVerticalPosition == 3 ? INVERS : 0);
if (menuVerticalPosition==3) crv.smooth = checkIncDecModel(event, crv.smooth, 0, 1); if (menuVerticalPosition==3) crv.smooth = checkIncDecModel(event, crv.smooth, 0, 1);
@ -291,7 +291,7 @@ void editCurveRef(coord_t x, coord_t y, CurveRef & curve, uint8_t event, uint8_t
void menuModelCurvesAll(uint8_t event) void menuModelCurvesAll(uint8_t event)
{ {
SIMPLE_MENU(STR_MENUCURVES, menuTabModel, e_CurvesAll, MAX_CURVES); SIMPLE_MENU(STR_MENUCURVES, menuTabModel, MENU_MODEL_CURVES, MAX_CURVES);
int sub = menuVerticalPosition; int sub = menuVerticalPosition;

View file

@ -64,7 +64,7 @@ void menuModelCustomScriptOne(uint8_t event)
LcdFlags attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0); LcdFlags attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
if (i == ITEM_MODEL_CUSTOMSCRIPT_FILE) { if (i == ITEM_MODEL_CUSTOMSCRIPT_FILE) {
lcd_putsLeft(y, STR_SCRIPT); lcdDrawTextAlignedLeft(y, STR_SCRIPT);
if (ZEXIST(sd.file)) if (ZEXIST(sd.file))
lcdDrawSizedText(SCRIPT_ONE_2ND_COLUMN_POS, y, sd.file, sizeof(sd.file), attr); lcdDrawSizedText(SCRIPT_ONE_2ND_COLUMN_POS, y, sd.file, sizeof(sd.file), attr);
else else
@ -80,11 +80,11 @@ void menuModelCustomScriptOne(uint8_t event)
} }
} }
else if (i == ITEM_MODEL_CUSTOMSCRIPT_NAME) { else if (i == ITEM_MODEL_CUSTOMSCRIPT_NAME) {
lcd_putsLeft(y, TR_NAME); lcdDrawTextAlignedLeft(y, TR_NAME);
editName(SCRIPT_ONE_2ND_COLUMN_POS, y, sd.name, sizeof(sd.name), event, attr); editName(SCRIPT_ONE_2ND_COLUMN_POS, y, sd.name, sizeof(sd.name), event, attr);
} }
else if (i == ITEM_MODEL_CUSTOMSCRIPT_PARAMS_LABEL) { else if (i == ITEM_MODEL_CUSTOMSCRIPT_PARAMS_LABEL) {
lcd_putsLeft(y, STR_INPUTS); lcdDrawTextAlignedLeft(y, STR_INPUTS);
} }
else if (i <= ITEM_MODEL_CUSTOMSCRIPT_PARAMS_LABEL+scriptInputsOutputs[s_currIdx].inputsCount) { else if (i <= ITEM_MODEL_CUSTOMSCRIPT_PARAMS_LABEL+scriptInputsOutputs[s_currIdx].inputsCount) {
int inputIdx = i-ITEM_MODEL_CUSTOMSCRIPT_PARAMS_LABEL-1; int inputIdx = i-ITEM_MODEL_CUSTOMSCRIPT_PARAMS_LABEL-1;
@ -121,7 +121,7 @@ void menuModelCustomScripts(uint8_t event)
lcdDrawNumber(19*FW, 0, luaGetMemUsed(), RIGHT); lcdDrawNumber(19*FW, 0, luaGetMemUsed(), RIGHT);
lcdDrawText(19*FW+1, 0, STR_BYTES); lcdDrawText(19*FW+1, 0, STR_BYTES);
MENU(STR_MENUCUSTOMSCRIPTS, menuTabModel, e_CustomScripts, MAX_SCRIPTS, { NAVIGATION_LINE_BY_LINE|3/*repeated*/ }); MENU(STR_MENUCUSTOMSCRIPTS, menuTabModel, MENU_MODEL_CUSTOM_SCRIPTS, MAX_SCRIPTS, { NAVIGATION_LINE_BY_LINE|3/*repeated*/ });
coord_t y; coord_t y;
int8_t sub = menuVerticalPosition; int8_t sub = menuVerticalPosition;

View file

@ -83,7 +83,7 @@ void onTelemetryScriptFileSelectionMenu(const char *result)
void menuModelDisplay(uint8_t event) void menuModelDisplay(uint8_t event)
{ {
MENU(STR_MENU_DISPLAY, menuTabModel, e_Display, ITEM_DISPLAY_MAX, { LABEL(TopBar), 0, 0, TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1), TELEMETRY_SCREEN_ROWS(2), TELEMETRY_SCREEN_ROWS(3) }); MENU(STR_MENU_DISPLAY, menuTabModel, MENU_MODEL_DISPLAY, ITEM_DISPLAY_MAX, { LABEL(TopBar), 0, 0, TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1), TELEMETRY_SCREEN_ROWS(2), TELEMETRY_SCREEN_ROWS(3) });
for (int i=0; i<NUM_BODY_LINES; i++) { for (int i=0; i<NUM_BODY_LINES; i++) {
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH; coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
@ -98,11 +98,11 @@ void menuModelDisplay(uint8_t event)
switch (k) { switch (k) {
case ITEM_DISPLAY_TOP_BAR_LABEL: case ITEM_DISPLAY_TOP_BAR_LABEL:
lcd_putsLeft(y, STR_TOP_BAR); lcdDrawTextAlignedLeft(y, STR_TOP_BAR);
break; break;
case ITEM_DISPLAY_TOP_BAR_VOLTAGE: case ITEM_DISPLAY_TOP_BAR_VOLTAGE:
lcd_putsLeft(y, STR_VOLTAGE); lcdDrawTextAlignedLeft(y, STR_VOLTAGE);
putsMixerSource(DISPLAY_COL2, y, g_model.frsky.voltsSource ? MIXSRC_FIRST_TELEM+3*(g_model.frsky.voltsSource-1) : 0, attr); putsMixerSource(DISPLAY_COL2, y, g_model.frsky.voltsSource ? MIXSRC_FIRST_TELEM+3*(g_model.frsky.voltsSource-1) : 0, attr);
if (attr) { if (attr) {
g_model.frsky.voltsSource = checkIncDec(event, g_model.frsky.voltsSource, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isVoltsSensor); g_model.frsky.voltsSource = checkIncDec(event, g_model.frsky.voltsSource, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isVoltsSensor);
@ -110,7 +110,7 @@ void menuModelDisplay(uint8_t event)
break; break;
case ITEM_DISPLAY_TOP_BAR_ALTITUDE: case ITEM_DISPLAY_TOP_BAR_ALTITUDE:
lcd_putsLeft(y, STR_ALTITUDE); lcdDrawTextAlignedLeft(y, STR_ALTITUDE);
putsMixerSource(DISPLAY_COL2, y, g_model.frsky.altitudeSource ? MIXSRC_FIRST_TELEM+3*(g_model.frsky.altitudeSource-1) : 0, attr); putsMixerSource(DISPLAY_COL2, y, g_model.frsky.altitudeSource ? MIXSRC_FIRST_TELEM+3*(g_model.frsky.altitudeSource-1) : 0, attr);
if (attr) { if (attr) {
g_model.frsky.altitudeSource = checkIncDec(event, g_model.frsky.altitudeSource, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isAltSensor); g_model.frsky.altitudeSource = checkIncDec(event, g_model.frsky.altitudeSource, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isAltSensor);

View file

@ -32,7 +32,7 @@ void displayFlightModes(coord_t x, coord_t y, FlightModesType value)
FlightModesType editFlightModes(coord_t x, coord_t y, uint8_t event, FlightModesType value, uint8_t attr) FlightModesType editFlightModes(coord_t x, coord_t y, uint8_t event, FlightModesType value, uint8_t attr)
{ {
lcd_putsColumnLeft(x, y, STR_FLMODE); drawFieldLabel(x, y, STR_FLMODE);
int posHorz = menuHorizontalPosition; int posHorz = menuHorizontalPosition;
@ -80,7 +80,7 @@ bool isTrimModeAvailable(int mode)
void menuModelFlightModesAll(uint8_t event) void menuModelFlightModesAll(uint8_t event)
{ {
MENU(STR_MENUFLIGHTPHASES, menuTabModel, e_FlightModesAll, MAX_FLIGHT_MODES+1, { NAVIGATION_LINE_BY_LINE|(ITEM_FLIGHT_MODES_LAST-1), 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, menuTabModel, MENU_MODEL_FLIGHT_MODES, MAX_FLIGHT_MODES+1, { NAVIGATION_LINE_BY_LINE|(ITEM_FLIGHT_MODES_LAST-1), 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 });
int8_t sub = menuVerticalPosition; int8_t sub = menuVerticalPosition;
@ -97,7 +97,7 @@ void menuModelFlightModesAll(uint8_t event)
if (k==MAX_FLIGHT_MODES) { if (k==MAX_FLIGHT_MODES) {
// last line available - add the "check trims" line // last line available - add the "check trims" line
lcd_putsLeft((LCD_LINES-1)*FH+1, STR_CHECKTRIMS); lcdDrawTextAlignedLeft((LCD_LINES-1)*FH+1, STR_CHECKTRIMS);
putsFlightMode(OFS_CHECKTRIMS, (LCD_LINES-1)*FH+1, mixerCurrentFlightMode+1); putsFlightMode(OFS_CHECKTRIMS, (LCD_LINES-1)*FH+1, mixerCurrentFlightMode+1);
if (sub==MAX_FLIGHT_MODES) { if (sub==MAX_FLIGHT_MODES) {
if (!trimsCheckTimer) { if (!trimsCheckTimer) {

View file

@ -149,7 +149,7 @@ void menuModelGVars(uint8_t event)
menuTitle = STR_MENUGLOBALVARS; menuTitle = STR_MENUGLOBALVARS;
} }
MENU_FLAGS(menuTitle, menuTabModel, e_GVars, after2seconds ? CHECK_FLAG_NO_SCREEN_INDEX : 0, MAX_GVARS, { GVARS_COLUMNS, GVARS_COLUMNS, GVARS_COLUMNS, GVARS_COLUMNS, GVARS_COLUMNS, GVARS_COLUMNS, GVARS_COLUMNS, GVARS_COLUMNS, GVARS_COLUMNS }); MENU_FLAGS(menuTitle, menuTabModel, MENU_MODEL_GVARS, after2seconds ? CHECK_FLAG_NO_SCREEN_INDEX : 0, MAX_GVARS, { GVARS_COLUMNS, GVARS_COLUMNS, GVARS_COLUMNS, GVARS_COLUMNS, GVARS_COLUMNS, GVARS_COLUMNS, GVARS_COLUMNS, GVARS_COLUMNS, GVARS_COLUMNS });
int sub = menuVerticalPosition; int sub = menuVerticalPosition;

View file

@ -36,7 +36,7 @@ enum menuModelHeliItems {
void menuModelHeli(uint8_t event) void menuModelHeli(uint8_t event)
{ {
SIMPLE_MENU(STR_MENUHELISETUP, menuTabModel, e_Heli, ITEM_HELI_MAX); SIMPLE_MENU(STR_MENUHELISETUP, menuTabModel, MENU_MODEL_HELI, ITEM_HELI_MAX);
int sub = menuVerticalPosition; int sub = menuVerticalPosition;
@ -52,13 +52,13 @@ void menuModelHeli(uint8_t event)
break; break;
case ITEM_HELI_SWASHRING: case ITEM_HELI_SWASHRING:
lcd_putsLeft(y, STR_SWASHRING); lcdDrawTextAlignedLeft(y, STR_SWASHRING);
lcdDrawNumber(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.value, LEFT|attr); lcdDrawNumber(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.value, LEFT|attr);
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.swashR.value, 100); if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.swashR.value, 100);
break; break;
case ITEM_HELI_ELE: case ITEM_HELI_ELE:
lcd_putsLeft(y, STR_ELEVATOR); lcdDrawTextAlignedLeft(y, STR_ELEVATOR);
putsMixerSource(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.elevatorSource, attr); putsMixerSource(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.elevatorSource, attr);
if (attr) CHECK_INCDEC_MODELSOURCE(event, g_model.swashR.elevatorSource, 0, MIXSRC_LAST_CH); if (attr) CHECK_INCDEC_MODELSOURCE(event, g_model.swashR.elevatorSource, 0, MIXSRC_LAST_CH);
break; break;
@ -70,7 +70,7 @@ void menuModelHeli(uint8_t event)
break; break;
case ITEM_HELI_AIL: case ITEM_HELI_AIL:
lcd_putsLeft(y, STR_AILERON); lcdDrawTextAlignedLeft(y, STR_AILERON);
putsMixerSource(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.aileronSource, attr); putsMixerSource(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.aileronSource, attr);
if (attr) CHECK_INCDEC_MODELSOURCE(event, g_model.swashR.aileronSource, 0, MIXSRC_LAST_CH); if (attr) CHECK_INCDEC_MODELSOURCE(event, g_model.swashR.aileronSource, 0, MIXSRC_LAST_CH);
break; break;
@ -82,7 +82,7 @@ void menuModelHeli(uint8_t event)
break; break;
case ITEM_HELI_COL: case ITEM_HELI_COL:
lcd_putsLeft(y, STR_COLLECTIVE); lcdDrawTextAlignedLeft(y, STR_COLLECTIVE);
putsMixerSource(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.collectiveSource, attr); putsMixerSource(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.collectiveSource, attr);
if (attr) CHECK_INCDEC_MODELSOURCE(event, g_model.swashR.collectiveSource, 0, MIXSRC_LAST_CH); if (attr) CHECK_INCDEC_MODELSOURCE(event, g_model.swashR.collectiveSource, 0, MIXSRC_LAST_CH);
break; break;

View file

@ -213,30 +213,30 @@ void menuModelExpoOne(uint8_t event)
break; break;
case EXPO_FIELD_SOURCE: case EXPO_FIELD_SOURCE:
lcd_putsLeft(y, NO_INDENT(STR_SOURCE)); lcdDrawTextAlignedLeft(y, NO_INDENT(STR_SOURCE));
putsMixerSource(EXPO_ONE_2ND_COLUMN, y, ed->srcRaw, STREXPANDED|attr); putsMixerSource(EXPO_ONE_2ND_COLUMN, y, ed->srcRaw, STREXPANDED|attr);
if (attr) ed->srcRaw = checkIncDec(event, ed->srcRaw, INPUTSRC_FIRST, INPUTSRC_LAST, EE_MODEL|INCDEC_SOURCE|NO_INCDEC_MARKS, isInputSourceAvailable); if (attr) ed->srcRaw = checkIncDec(event, ed->srcRaw, INPUTSRC_FIRST, INPUTSRC_LAST, EE_MODEL|INCDEC_SOURCE|NO_INCDEC_MARKS, isInputSourceAvailable);
break; break;
case EXPO_FIELD_SCALE: case EXPO_FIELD_SCALE:
lcd_putsLeft(y, STR_SCALE); lcdDrawTextAlignedLeft(y, STR_SCALE);
putsTelemetryChannelValue(EXPO_ONE_2ND_COLUMN, y, (ed->srcRaw - MIXSRC_FIRST_TELEM)/3, convertTelemValue(ed->srcRaw - MIXSRC_FIRST_TELEM + 1, ed->scale), LEFT|attr); putsTelemetryChannelValue(EXPO_ONE_2ND_COLUMN, y, (ed->srcRaw - MIXSRC_FIRST_TELEM)/3, convertTelemValue(ed->srcRaw - MIXSRC_FIRST_TELEM + 1, ed->scale), LEFT|attr);
if (attr) ed->scale = checkIncDec(event, ed->scale, 0, maxTelemValue(ed->srcRaw - MIXSRC_FIRST_TELEM + 1), EE_MODEL); if (attr) ed->scale = checkIncDec(event, ed->scale, 0, maxTelemValue(ed->srcRaw - MIXSRC_FIRST_TELEM + 1), EE_MODEL);
break; break;
case EXPO_FIELD_WEIGHT: case EXPO_FIELD_WEIGHT:
lcd_putsLeft(y, STR_WEIGHT); lcdDrawTextAlignedLeft(y, STR_WEIGHT);
ed->weight = GVAR_MENU_ITEM(EXPO_ONE_2ND_COLUMN, y, ed->weight, MIN_EXPO_WEIGHT, 100, LEFT|attr, 0, event); ed->weight = GVAR_MENU_ITEM(EXPO_ONE_2ND_COLUMN, y, ed->weight, MIN_EXPO_WEIGHT, 100, LEFT|attr, 0, event);
break; break;
case EXPO_FIELD_OFFSET: case EXPO_FIELD_OFFSET:
lcd_putsLeft(y, NO_INDENT(STR_OFFSET)); lcdDrawTextAlignedLeft(y, NO_INDENT(STR_OFFSET));
ed->offset = GVAR_MENU_ITEM(EXPO_ONE_2ND_COLUMN, y, ed->offset, -100, 100, LEFT|attr, 0, event); ed->offset = GVAR_MENU_ITEM(EXPO_ONE_2ND_COLUMN, y, ed->offset, -100, 100, LEFT|attr, 0, event);
break; break;
#if defined(CURVES) #if defined(CURVES)
case EXPO_FIELD_CURVE: case EXPO_FIELD_CURVE:
lcd_putsLeft(y, STR_CURVE); lcdDrawTextAlignedLeft(y, STR_CURVE);
editCurveRef(EXPO_ONE_2ND_COLUMN, y, ed->curve, event, attr); editCurveRef(EXPO_ONE_2ND_COLUMN, y, ed->curve, event, attr);
break; break;
#endif #endif
@ -258,7 +258,7 @@ void menuModelExpoOne(uint8_t event)
case EXPO_FIELD_TRIM: case EXPO_FIELD_TRIM:
uint8_t not_stick = (ed->srcRaw > MIXSRC_Ail); uint8_t not_stick = (ed->srcRaw > MIXSRC_Ail);
int8_t carryTrim = -ed->carryTrim; int8_t carryTrim = -ed->carryTrim;
lcd_putsLeft(y, STR_TRIM); lcdDrawTextAlignedLeft(y, STR_TRIM);
lcdDrawTextAtIndex(EXPO_ONE_2ND_COLUMN, y, STR_VMIXTRIMS, (not_stick && carryTrim == 0) ? 0 : carryTrim+1, menuHorizontalPosition==0 ? attr : 0); lcdDrawTextAtIndex(EXPO_ONE_2ND_COLUMN, y, STR_VMIXTRIMS, (not_stick && carryTrim == 0) ? 0 : carryTrim+1, menuHorizontalPosition==0 ? attr : 0);
if (attr) ed->carryTrim = -checkIncDecModel(event, carryTrim, not_stick ? TRIM_ON : -TRIM_OFF, -TRIM_LAST); if (attr) ed->carryTrim = -checkIncDecModel(event, carryTrim, not_stick ? TRIM_ON : -TRIM_OFF, -TRIM_LAST);
break; break;
@ -490,7 +490,7 @@ void menuModelExposAll(uint8_t event)
lcdDrawNumber(127, 2, calcRESXto1000(anas[index]), PREC1|TINSIZE|RIGHT); lcdDrawNumber(127, 2, calcRESXto1000(anas[index]), PREC1|TINSIZE|RIGHT);
} }
SIMPLE_MENU(STR_MENUINPUTS, menuTabModel, e_InputsAll, s_maxLines); SIMPLE_MENU(STR_MENUINPUTS, menuTabModel, MENU_MODEL_INPUTS, s_maxLines);
// Gauge // Gauge
if (!s_currCh) { if (!s_currCh) {

View file

@ -76,7 +76,7 @@ void menuModelLogicalSwitches(uint8_t event)
{ {
INCDEC_DECLARE_VARS(EE_MODEL); INCDEC_DECLARE_VARS(EE_MODEL);
MENU(STR_MENULOGICALSWITCHES, menuTabModel, e_LogicalSwitches, NUM_LOGICAL_SWITCH, { NAVIGATION_LINE_BY_LINE|LS_FIELD_LAST/*repeated...*/ }); MENU(STR_MENULOGICALSWITCHES, menuTabModel, MENU_MODEL_LOGICAL_SWITCHES, NUM_LOGICAL_SWITCH, { NAVIGATION_LINE_BY_LINE|LS_FIELD_LAST/*repeated...*/ });
int k = 0; int k = 0;
int sub = menuVerticalPosition; int sub = menuVerticalPosition;

View file

@ -234,19 +234,19 @@ void menuModelMixOne(uint8_t event)
break; break;
case MIX_FIELD_SOURCE: case MIX_FIELD_SOURCE:
lcd_putsLeft(y, NO_INDENT(STR_SOURCE)); lcdDrawTextAlignedLeft(y, NO_INDENT(STR_SOURCE));
putsMixerSource(MIXES_2ND_COLUMN, y, md2->srcRaw, STREXPANDED|attr); putsMixerSource(MIXES_2ND_COLUMN, y, md2->srcRaw, STREXPANDED|attr);
if (attr) CHECK_INCDEC_MODELSOURCE(event, md2->srcRaw, 1, MIXSRC_LAST); if (attr) CHECK_INCDEC_MODELSOURCE(event, md2->srcRaw, 1, MIXSRC_LAST);
break; break;
case MIX_FIELD_WEIGHT: case MIX_FIELD_WEIGHT:
lcd_putsLeft(y, STR_WEIGHT); lcdDrawTextAlignedLeft(y, STR_WEIGHT);
gvarWeightItem(MIXES_2ND_COLUMN, y, md2, attr|LEFT, event); gvarWeightItem(MIXES_2ND_COLUMN, y, md2, attr|LEFT, event);
break; break;
case MIX_FIELD_OFFSET: case MIX_FIELD_OFFSET:
{ {
lcd_putsLeft(y, NO_INDENT(STR_OFFSET)); lcdDrawTextAlignedLeft(y, NO_INDENT(STR_OFFSET));
u_int8int16_t offset; u_int8int16_t offset;
MD_OFFSET_TO_UNION(md2, offset); MD_OFFSET_TO_UNION(md2, offset);
offset.word = GVAR_MENU_ITEM(MIXES_2ND_COLUMN, y, offset.word, GV_RANGELARGE_OFFSET_NEG, GV_RANGELARGE_OFFSET, attr|LEFT, 0, event); offset.word = GVAR_MENU_ITEM(MIXES_2ND_COLUMN, y, offset.word, GV_RANGELARGE_OFFSET_NEG, GV_RANGELARGE_OFFSET, attr|LEFT, 0, event);
@ -256,14 +256,14 @@ void menuModelMixOne(uint8_t event)
} }
case MIX_FIELD_TRIM: case MIX_FIELD_TRIM:
lcd_putsLeft(y, STR_TRIM); lcdDrawTextAlignedLeft(y, STR_TRIM);
drawCheckBox(MIXES_2ND_COLUMN, y, !md2->carryTrim, attr); drawCheckBox(MIXES_2ND_COLUMN, y, !md2->carryTrim, attr);
if (attr) md2->carryTrim = !checkIncDecModel(event, !md2->carryTrim, 0, 1); if (attr) md2->carryTrim = !checkIncDecModel(event, !md2->carryTrim, 0, 1);
break; break;
#if defined(CURVES) #if defined(CURVES)
case MIX_FIELD_CURVE: case MIX_FIELD_CURVE:
lcd_putsLeft(y, STR_CURVE); lcdDrawTextAlignedLeft(y, STR_CURVE);
editCurveRef(MIXES_2ND_COLUMN, y, md2->curve, event, attr); editCurveRef(MIXES_2ND_COLUMN, y, md2->curve, event, attr);
break; break;
#endif #endif
@ -279,7 +279,7 @@ void menuModelMixOne(uint8_t event)
break; break;
case MIX_FIELD_WARNING: case MIX_FIELD_WARNING:
lcd_putsColumnLeft(MENU_COLUMN2_X+MIXES_2ND_COLUMN, y, STR_MIXWARNING); drawFieldLabel(MENU_COLUMN2_X+MIXES_2ND_COLUMN, y, STR_MIXWARNING);
if (md2->mixWarn) if (md2->mixWarn)
lcdDrawNumber(MENU_COLUMN2_X+MIXES_2ND_COLUMN, y, md2->mixWarn, attr|LEFT); lcdDrawNumber(MENU_COLUMN2_X+MIXES_2ND_COLUMN, y, md2->mixWarn, attr|LEFT);
else else
@ -515,7 +515,7 @@ void menuModelMixAll(uint8_t event)
lcdDrawNumber(127, 2, calcRESXto1000(ex_chans[index]), PREC1|TINSIZE|RIGHT); lcdDrawNumber(127, 2, calcRESXto1000(ex_chans[index]), PREC1|TINSIZE|RIGHT);
} }
SIMPLE_MENU(STR_MIXER, menuTabModel, e_MixAll, s_maxLines); SIMPLE_MENU(STR_MIXER, menuTabModel, MENU_MODEL_MIXES, s_maxLines);
// Gauge // Gauge
if (!s_currCh) { if (!s_currCh) {

View file

@ -110,7 +110,7 @@ void menuModelLimits(uint8_t event)
#endif #endif
} }
MENU(STR_MENULIMITS, menuTabModel, e_Limits, 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, 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, 0 }); MENU(STR_MENULIMITS, 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, 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, 0 });
if (sub<NUM_CHNOUT && menuHorizontalPosition>=0) { if (sub<NUM_CHNOUT && menuHorizontalPosition>=0) {
drawColumnHeader(STR_LIMITS_HEADERS, menuHorizontalPosition); drawColumnHeader(STR_LIMITS_HEADERS, menuHorizontalPosition);

View file

@ -128,7 +128,7 @@ void menuModelSelect(uint8_t event)
} }
} }
else if (s_copyMode && (s_copyTgtOfs || s_copySrcRow>=0)) { else if (s_copyMode && (s_copyTgtOfs || s_copySrcRow>=0)) {
displayPopup(s_copyMode==COPY_MODE ? STR_COPYINGMODEL : STR_MOVINGMODEL); showMessageBox(s_copyMode==COPY_MODE ? STR_COPYINGMODEL : STR_MOVINGMODEL);
storageCheck(true); // force writing of current model data before this is changed storageCheck(true); // force writing of current model data before this is changed
uint8_t cur = (MAX_MODELS + sub + s_copyTgtOfs) % MAX_MODELS; uint8_t cur = (MAX_MODELS + sub + s_copyTgtOfs) % MAX_MODELS;
@ -224,7 +224,7 @@ void menuModelSelect(uint8_t event)
lcdDrawText(19*FW + 3, 0, STR_BYTES); lcdDrawText(19*FW + 3, 0, STR_BYTES);
lcdDrawText(lcdLastPos + 3, 0, STR_FREE); lcdDrawText(lcdLastPos + 3, 0, STR_FREE);
drawScreenIndex(e_ModelSelect, DIM(menuTabModel), 0); drawScreenIndex(MENU_MODEL_SELECT, DIM(menuTabModel), 0);
lcdDrawFilledRect(0, 0, LCD_W, FH, SOLID, FILL_WHITE|GREY_DEFAULT); lcdDrawFilledRect(0, 0, LCD_W, FH, SOLID, FILL_WHITE|GREY_DEFAULT);
TITLE(STR_MENUMODELSEL); TITLE(STR_MENUMODELSEL);

View file

@ -170,7 +170,7 @@ void editTimerMode(int timerIdx, coord_t y, LcdFlags attr, uint8_t event)
void editTimerCountdown(int timerIdx, coord_t y, LcdFlags attr, uint8_t event) void editTimerCountdown(int timerIdx, coord_t y, LcdFlags attr, uint8_t event)
{ {
TimerData & timer = g_model.timers[timerIdx]; TimerData & timer = g_model.timers[timerIdx];
lcd_putsLeft(y, STR_BEEPCOUNTDOWN); lcdDrawTextAlignedLeft(y, STR_BEEPCOUNTDOWN);
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VBEEPCOUNTDOWN, timer.countdownBeep, (menuHorizontalPosition==0 ? attr : 0)); lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VBEEPCOUNTDOWN, timer.countdownBeep, (menuHorizontalPosition==0 ? attr : 0));
if (timer.countdownBeep != COUNTDOWN_SILENT) { if (timer.countdownBeep != COUNTDOWN_SILENT) {
lcdDrawNumber(MODEL_SETUP_3RD_COLUMN, y, TIMER_COUNTDOWN_START(timerIdx), (menuHorizontalPosition == 1 ? attr : 0) | LEFT); lcdDrawNumber(MODEL_SETUP_3RD_COLUMN, y, TIMER_COUNTDOWN_START(timerIdx), (menuHorizontalPosition == 1 ? attr : 0) | LEFT);
@ -293,7 +293,7 @@ void menuModelSetup(uint8_t event)
FAILSAFE_ROWS(EXTERNAL_MODULE), MULTIMODULE_MODULE_ROWS FAILSAFE_ROWS(EXTERNAL_MODULE), MULTIMODULE_MODULE_ROWS
LABEL(Trainer), 0, TRAINER_CHANNELS_ROWS(), IF_TRAINER_ON(2)}); LABEL(Trainer), 0, TRAINER_CHANNELS_ROWS(), IF_TRAINER_ON(2)});
#endif #endif
MENU_CHECK(STR_MENUSETUP, menuTabModel, e_ModelSetup, ITEM_MODEL_SETUP_MAX); MENU_CHECK(STR_MENUSETUP, menuTabModel, MENU_MODEL_SETUP, ITEM_MODEL_SETUP_MAX);
#if (defined(DSM2) || defined(PXX)) #if (defined(DSM2) || defined(PXX))
if (menuEvent) { if (menuEvent) {
@ -322,7 +322,7 @@ void menuModelSetup(uint8_t event)
break; break;
case ITEM_MODEL_BITMAP: case ITEM_MODEL_BITMAP:
lcd_putsLeft(y, STR_BITMAP); lcdDrawTextAlignedLeft(y, STR_BITMAP);
if (ZEXIST(g_model.header.bitmap)) if (ZEXIST(g_model.header.bitmap))
lcdDrawSizedText(MODEL_SETUP_2ND_COLUMN, y, g_model.header.bitmap, sizeof(g_model.header.bitmap), attr); lcdDrawSizedText(MODEL_SETUP_2ND_COLUMN, y, g_model.header.bitmap, sizeof(g_model.header.bitmap), attr);
else else
@ -404,7 +404,7 @@ void menuModelSetup(uint8_t event)
#if defined(PCBX9E) #if defined(PCBX9E)
case ITEM_MODEL_TOP_LCD_TIMER: case ITEM_MODEL_TOP_LCD_TIMER:
lcd_putsLeft(y, STR_TOPLCDTIMER); lcdDrawTextAlignedLeft(y, STR_TOPLCDTIMER);
drawStringWithIndex(MODEL_SETUP_2ND_COLUMN, y, STR_TIMER, g_model.toplcdTimer+1, attr); drawStringWithIndex(MODEL_SETUP_2ND_COLUMN, y, STR_TIMER, g_model.toplcdTimer+1, attr);
if (attr) { if (attr) {
g_model.toplcdTimer = checkIncDec(event, g_model.toplcdTimer, 0, TIMERS-1, EE_MODEL); g_model.toplcdTimer = checkIncDec(event, g_model.toplcdTimer, 0, TIMERS-1, EE_MODEL);
@ -441,7 +441,7 @@ void menuModelSetup(uint8_t event)
break; break;
case ITEM_MODEL_THROTTLE_LABEL: case ITEM_MODEL_THROTTLE_LABEL:
lcd_putsLeft(y, STR_THROTTLE_LABEL); lcdDrawTextAlignedLeft(y, STR_THROTTLE_LABEL);
break; break;
case ITEM_MODEL_THROTTLE_REVERSED: case ITEM_MODEL_THROTTLE_REVERSED:
@ -450,7 +450,7 @@ void menuModelSetup(uint8_t event)
case ITEM_MODEL_THROTTLE_TRACE: case ITEM_MODEL_THROTTLE_TRACE:
{ {
lcd_putsLeft(y, STR_TTRACE); lcdDrawTextAlignedLeft(y, STR_TTRACE);
if (attr) CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, g_model.thrTraceSrc, NUM_POTS+NUM_CHNOUT, isThrottleSourceAvailable); if (attr) CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, g_model.thrTraceSrc, NUM_POTS+NUM_CHNOUT, isThrottleSourceAvailable);
uint8_t idx = g_model.thrTraceSrc + MIXSRC_Thr; uint8_t idx = g_model.thrTraceSrc + MIXSRC_Thr;
if (idx > MIXSRC_Thr) if (idx > MIXSRC_Thr)
@ -466,7 +466,7 @@ void menuModelSetup(uint8_t event)
break; break;
case ITEM_MODEL_PREFLIGHT_LABEL: case ITEM_MODEL_PREFLIGHT_LABEL:
lcd_putsLeft(y, STR_PREFLIGHT); lcdDrawTextAlignedLeft(y, STR_PREFLIGHT);
break; break;
case ITEM_MODEL_CHECKLIST_DISPLAY: case ITEM_MODEL_CHECKLIST_DISPLAY:
@ -501,7 +501,7 @@ void menuModelSetup(uint8_t event)
break; break;
} }
#endif #endif
lcd_putsLeft(y, STR_SWITCHWARNING); lcdDrawTextAlignedLeft(y, STR_SWITCHWARNING);
swarnstate_t states = g_model.switchWarningState; swarnstate_t states = g_model.switchWarningState;
char c; char c;
if (attr) { if (attr) {
@ -564,7 +564,7 @@ void menuModelSetup(uint8_t event)
} }
#endif #endif
lcd_putsLeft(y, STR_POTWARNING); lcdDrawTextAlignedLeft(y, STR_POTWARNING);
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, PSTR("\004""OFF\0""Man\0""Auto"), g_model.potsWarnMode, (menuHorizontalPosition == 0) ? attr : 0); lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, PSTR("\004""OFF\0""Man\0""Auto"), g_model.potsWarnMode, (menuHorizontalPosition == 0) ? attr : 0);
if (attr && (menuHorizontalPosition == 0)) { if (attr && (menuHorizontalPosition == 0)) {
CHECK_INCDEC_MODELVAR(event, g_model.potsWarnMode, POTS_WARN_OFF, POTS_WARN_AUTO); CHECK_INCDEC_MODELVAR(event, g_model.potsWarnMode, POTS_WARN_OFF, POTS_WARN_AUTO);
@ -625,7 +625,7 @@ void menuModelSetup(uint8_t event)
case ITEM_MODEL_BEEP_CENTER: case ITEM_MODEL_BEEP_CENTER:
{ {
lcd_putsLeft(y, STR_BEEPCTR); lcdDrawTextAlignedLeft(y, STR_BEEPCTR);
coord_t x = MODEL_SETUP_2ND_COLUMN; coord_t x = MODEL_SETUP_2ND_COLUMN;
for (int i=0; i<NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS; i++) { for (int i=0; i<NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS; i++) {
if (i>=POT1 && i<POT1+NUM_XPOTS && !IS_POT_AVAILABLE(i)) { if (i>=POT1 && i<POT1+NUM_XPOTS && !IS_POT_AVAILABLE(i)) {
@ -648,18 +648,18 @@ void menuModelSetup(uint8_t event)
} }
case ITEM_MODEL_USE_GLOBAL_FUNCTIONS: case ITEM_MODEL_USE_GLOBAL_FUNCTIONS:
lcd_putsLeft(y, STR_USE_GLOBAL_FUNCS); lcdDrawTextAlignedLeft(y, STR_USE_GLOBAL_FUNCS);
drawCheckBox(MODEL_SETUP_2ND_COLUMN, y, !g_model.noGlobalFunctions, attr); drawCheckBox(MODEL_SETUP_2ND_COLUMN, y, !g_model.noGlobalFunctions, attr);
if (attr) g_model.noGlobalFunctions = !checkIncDecModel(event, !g_model.noGlobalFunctions, 0, 1); if (attr) g_model.noGlobalFunctions = !checkIncDecModel(event, !g_model.noGlobalFunctions, 0, 1);
break; break;
case ITEM_MODEL_INTERNAL_MODULE_LABEL: case ITEM_MODEL_INTERNAL_MODULE_LABEL:
lcd_putsLeft(y, TR_INTERNALRF); lcdDrawTextAlignedLeft(y, TR_INTERNALRF);
break; break;
#if defined(TARANIS_INTERNAL_PPM) #if defined(TARANIS_INTERNAL_PPM)
case ITEM_MODEL_INTERNAL_MODULE_MODE: case ITEM_MODEL_INTERNAL_MODULE_MODE:
lcd_putsLeft(y, STR_MODE); lcdDrawTextAlignedLeft(y, STR_MODE);
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_TARANIS_PROTOCOLS, g_model.moduleData[INTERNAL_MODULE].type, menuHorizontalPosition==0 ? attr : 0); lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_TARANIS_PROTOCOLS, g_model.moduleData[INTERNAL_MODULE].type, menuHorizontalPosition==0 ? attr : 0);
if (IS_MODULE_XJT(INTERNAL_MODULE)) if (IS_MODULE_XJT(INTERNAL_MODULE))
lcdDrawTextAtIndex(MODEL_SETUP_3RD_COLUMN, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[INTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 0); lcdDrawTextAtIndex(MODEL_SETUP_3RD_COLUMN, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[INTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 0);
@ -684,7 +684,7 @@ void menuModelSetup(uint8_t event)
break; break;
#else #else
case ITEM_MODEL_INTERNAL_MODULE_MODE: case ITEM_MODEL_INTERNAL_MODULE_MODE:
lcd_putsLeft(y, STR_MODE); lcdDrawTextAlignedLeft(y, STR_MODE);
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[0].rfProtocol, attr); lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[0].rfProtocol, attr);
if (attr) { if (attr) {
g_model.moduleData[INTERNAL_MODULE].rfProtocol = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].rfProtocol, RF_PROTO_OFF, RF_PROTO_LAST, EE_MODEL, isRfProtocolAvailable); g_model.moduleData[INTERNAL_MODULE].rfProtocol = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].rfProtocol, RF_PROTO_OFF, RF_PROTO_LAST, EE_MODEL, isRfProtocolAvailable);
@ -697,17 +697,17 @@ void menuModelSetup(uint8_t event)
break; break;
#endif #endif
case ITEM_MODEL_TRAINER_MODE: case ITEM_MODEL_TRAINER_MODE:
lcd_putsLeft(y, STR_MODE); lcdDrawTextAlignedLeft(y, STR_MODE);
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VTRAINERMODES, g_model.trainerMode, attr); lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VTRAINERMODES, g_model.trainerMode, attr);
if (attr) g_model.trainerMode = checkIncDec(event, g_model.trainerMode, 0, HAS_WIRELESS_TRAINER_HARDWARE() ? TRAINER_MODE_MASTER_BATTERY_COMPARTMENT : TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE, EE_MODEL, isTrainerModeAvailable); if (attr) g_model.trainerMode = checkIncDec(event, g_model.trainerMode, 0, HAS_WIRELESS_TRAINER_HARDWARE() ? TRAINER_MODE_MASTER_BATTERY_COMPARTMENT : TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE, EE_MODEL, isTrainerModeAvailable);
break; break;
case ITEM_MODEL_EXTERNAL_MODULE_LABEL: case ITEM_MODEL_EXTERNAL_MODULE_LABEL:
lcd_putsLeft(y, TR_EXTERNALRF); lcdDrawTextAlignedLeft(y, TR_EXTERNALRF);
break; break;
case ITEM_MODEL_EXTERNAL_MODULE_MODE: case ITEM_MODEL_EXTERNAL_MODULE_MODE:
lcd_putsLeft(y, STR_MODE); lcdDrawTextAlignedLeft(y, STR_MODE);
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_TARANIS_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].type, menuHorizontalPosition==0 ? attr : 0); lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_TARANIS_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].type, menuHorizontalPosition==0 ? attr : 0);
if (IS_MODULE_XJT(EXTERNAL_MODULE)) if (IS_MODULE_XJT(EXTERNAL_MODULE))
lcdDrawTextAtIndex(MODEL_SETUP_3RD_COLUMN, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[EXTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 0); lcdDrawTextAtIndex(MODEL_SETUP_3RD_COLUMN, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[EXTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 0);
@ -839,7 +839,7 @@ void menuModelSetup(uint8_t event)
break; break;
case ITEM_MODEL_TRAINER_LABEL: case ITEM_MODEL_TRAINER_LABEL:
lcd_putsLeft(y, STR_TRAINER); lcdDrawTextAlignedLeft(y, STR_TRAINER);
break; break;
case ITEM_MODEL_INTERNAL_MODULE_CHANNELS: case ITEM_MODEL_INTERNAL_MODULE_CHANNELS:
@ -848,7 +848,7 @@ void menuModelSetup(uint8_t event)
{ {
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k); uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
ModuleData & moduleData = g_model.moduleData[moduleIdx]; ModuleData & moduleData = g_model.moduleData[moduleIdx];
lcd_putsLeft(y, STR_CHANNELRANGE); lcdDrawTextAlignedLeft(y, STR_CHANNELRANGE);
if ((int8_t)PORT_CHANNELS_ROWS(moduleIdx) >= 0) { if ((int8_t)PORT_CHANNELS_ROWS(moduleIdx) >= 0) {
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, STR_CH, menuHorizontalPosition==0 ? attr : 0); lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, STR_CH, menuHorizontalPosition==0 ? attr : 0);
lcdDrawNumber(lcdLastPos, y, moduleData.channelsStart+1, LEFT | (menuHorizontalPosition==0 ? attr : 0)); lcdDrawNumber(lcdLastPos, y, moduleData.channelsStart+1, LEFT | (menuHorizontalPosition==0 ? attr : 0));
@ -884,7 +884,7 @@ void menuModelSetup(uint8_t event)
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k); uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
ModuleData & moduleData = g_model.moduleData[moduleIdx]; ModuleData & moduleData = g_model.moduleData[moduleIdx];
if (IS_MODULE_PPM(moduleIdx)) { if (IS_MODULE_PPM(moduleIdx)) {
lcd_putsLeft(y, STR_PPMFRAME); lcdDrawTextAlignedLeft(y, STR_PPMFRAME);
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, (int16_t)moduleData.ppm.frameLength*5 + 225, (menuHorizontalPosition<=0 ? attr : 0) | PREC1|LEFT); lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, (int16_t)moduleData.ppm.frameLength*5 + 225, (menuHorizontalPosition<=0 ? attr : 0) | PREC1|LEFT);
lcdDrawText(lcdLastPos, y, STR_MS); lcdDrawText(lcdLastPos, y, STR_MS);
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN+6*FW, y, (moduleData.ppm.delay*50)+300, (CURSOR_ON_LINE() || menuHorizontalPosition==1) ? attr : 0); lcdDrawNumber(MODEL_SETUP_2ND_COLUMN+6*FW, y, (moduleData.ppm.delay*50)+300, (CURSOR_ON_LINE() || menuHorizontalPosition==1) ? attr : 0);
@ -910,11 +910,11 @@ void menuModelSetup(uint8_t event)
coord_t xOffsetBind = MODEL_SETUP_BIND_OFS; coord_t xOffsetBind = MODEL_SETUP_BIND_OFS;
if (IS_MODULE_XJT(moduleIdx) && g_model.moduleData[moduleIdx].rfProtocol == RF_PROTO_D8) { if (IS_MODULE_XJT(moduleIdx) && g_model.moduleData[moduleIdx].rfProtocol == RF_PROTO_D8) {
xOffsetBind = 0; xOffsetBind = 0;
lcd_putsLeft(y, STR_RECEIVER); lcdDrawTextAlignedLeft(y, STR_RECEIVER);
if (attr) l_posHorz += 1; if (attr) l_posHorz += 1;
} }
else { else {
lcd_putsLeft(y, STR_RECEIVER_NUM); lcdDrawTextAlignedLeft(y, STR_RECEIVER_NUM);
} }
if (IS_MODULE_XJT(moduleIdx) || IS_MODULE_DSM2(moduleIdx) || IS_MODULE_MULTIMODULE(moduleIdx)) { if (IS_MODULE_XJT(moduleIdx) || IS_MODULE_DSM2(moduleIdx) || IS_MODULE_MULTIMODULE(moduleIdx)) {
if (xOffsetBind) lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, g_model.header.modelId[moduleIdx], (l_posHorz==0 ? attr : 0) | LEADING0|LEFT, 2); if (xOffsetBind) lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, g_model.header.modelId[moduleIdx], (l_posHorz==0 ? attr : 0) | LEADING0|LEFT, 2);
@ -953,7 +953,7 @@ void menuModelSetup(uint8_t event)
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k); uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
if (IS_MODULE_XJT(moduleIdx)) { if (IS_MODULE_XJT(moduleIdx)) {
ModuleData & moduleData = g_model.moduleData[moduleIdx]; ModuleData & moduleData = g_model.moduleData[moduleIdx];
lcd_putsLeft(y, STR_FAILSAFE); lcdDrawTextAlignedLeft(y, STR_FAILSAFE);
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VFAILSAFE, moduleData.failsafeMode, menuHorizontalPosition==0 ? attr : 0); lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VFAILSAFE, moduleData.failsafeMode, menuHorizontalPosition==0 ? attr : 0);
if (moduleData.failsafeMode == FAILSAFE_CUSTOM) lcdDrawText(MODEL_SETUP_2ND_COLUMN + MODEL_SETUP_SET_FAILSAFE_OFS, y, STR_SET, menuHorizontalPosition==1 ? attr : 0); if (moduleData.failsafeMode == FAILSAFE_CUSTOM) lcdDrawText(MODEL_SETUP_2ND_COLUMN + MODEL_SETUP_SET_FAILSAFE_OFS, y, STR_SET, menuHorizontalPosition==1 ? attr : 0);
if (attr) { if (attr) {
@ -984,16 +984,16 @@ void menuModelSetup(uint8_t event)
{ {
case MM_RF_PROTO_FRSKY: case MM_RF_PROTO_FRSKY:
case MM_RF_PROTO_SFHSS: case MM_RF_PROTO_SFHSS:
lcd_putsLeft(y, STR_MULTI_RFTUNE); lcdDrawTextAlignedLeft(y, STR_MULTI_RFTUNE);
break; break;
case MM_RF_PROTO_HUBSAN: case MM_RF_PROTO_HUBSAN:
lcd_putsLeft(y, STR_MULTI_VIDFREQ); lcdDrawTextAlignedLeft(y, STR_MULTI_VIDFREQ);
break; break;
case MM_RF_PROTO_DSM2: case MM_RF_PROTO_DSM2:
g_model.moduleData[moduleIdx].multi.optionValue = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_MULTI_DSMFRAME, STR_OPTIONS_DSM, g_model.moduleData[moduleIdx].multi.optionValue, 0, 12, attr, event); g_model.moduleData[moduleIdx].multi.optionValue = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_MULTI_DSMFRAME, STR_OPTIONS_DSM, g_model.moduleData[moduleIdx].multi.optionValue, 0, 12, attr, event);
break; break;
default: default:
lcd_putsLeft(y, STR_MULTI_OPTION); lcdDrawTextAlignedLeft(y, STR_MULTI_OPTION);
break; break;
} }
if (g_model.moduleData[moduleIdx].multi.rfProtocol != MM_RF_PROTO_DSM2) { if (g_model.moduleData[moduleIdx].multi.rfProtocol != MM_RF_PROTO_DSM2) {
@ -1019,7 +1019,7 @@ void menuModelSetup(uint8_t event)
#if defined(PXX) #if defined(PXX)
if (IS_RANGECHECK_ENABLE()) { if (IS_RANGECHECK_ENABLE()) {
displayPopup("RSSI: "); showMessageBox("RSSI: ");
lcdDrawNumber(16+4*FW, 5*FH, TELEMETRY_RSSI(), BOLD); lcdDrawNumber(16+4*FW, 5*FH, TELEMETRY_RSSI(), BOLD);
} }
#endif #endif

View file

@ -32,7 +32,7 @@ void onCustomFunctionsFileSelectionMenu(const char * result)
CustomFunctionData * cfn; CustomFunctionData * cfn;
uint8_t eeFlags; uint8_t eeFlags;
if (menuHandlers[menuLevel] == menuModelCustomFunctions) { if (menuHandlers[menuLevel] == menuModelSpecialFunctions) {
cfn = &g_model.customFn[sub]; cfn = &g_model.customFn[sub];
eeFlags = EE_MODEL; eeFlags = EE_MODEL;
} }
@ -72,7 +72,7 @@ void onCustomFunctionsMenu(const char * result)
CustomFunctionData * cfn; CustomFunctionData * cfn;
uint8_t eeFlags; uint8_t eeFlags;
if (menuHandlers[menuLevel] == menuModelCustomFunctions) { if (menuHandlers[menuLevel] == menuModelSpecialFunctions) {
cfn = &g_model.customFn[sub]; cfn = &g_model.customFn[sub];
eeFlags = EE_MODEL; eeFlags = EE_MODEL;
} }
@ -144,7 +144,7 @@ enum CustomFunctionsItems {
ITEM_CUSTOM_FUNCTIONS_LAST = ITEM_CUSTOM_FUNCTIONS_COUNT-1 ITEM_CUSTOM_FUNCTIONS_LAST = ITEM_CUSTOM_FUNCTIONS_COUNT-1
}; };
void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext) void menuSpecialFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext)
{ {
int sub = menuVerticalPosition; int sub = menuVerticalPosition;
uint8_t eeFlags = (functions == g_model.customFn) ? EE_MODEL : EE_GENERAL; uint8_t eeFlags = (functions == g_model.customFn) ? EE_MODEL : EE_GENERAL;
@ -421,8 +421,8 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
} }
} }
void menuModelCustomFunctions(uint8_t event) void menuModelSpecialFunctions(uint8_t event)
{ {
MENU(STR_MENUCUSTOMFUNC, menuTabModel, e_CustomFunctions, NUM_CFN, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ }); MENU(STR_MENUCUSTOMFUNC, menuTabModel, MENU_MODEL_SPECIAL_FUNCTIONS, NUM_CFN, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ });
return menuCustomFunctions(event, g_model.customFn, &modelFunctionsContext); return menuSpecialFunctions(event, g_model.customFn, &modelFunctionsContext);
} }

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
enum menuModelTelemetryItems { enum MenuModelTelemetryFrskyItems {
ITEM_TELEMETRY_PROTOCOL_TYPE, ITEM_TELEMETRY_PROTOCOL_TYPE,
ITEM_TELEMETRY_RSSI_LABEL, ITEM_TELEMETRY_RSSI_LABEL,
ITEM_TELEMETRY_RSSI_ALARM1, ITEM_TELEMETRY_RSSI_ALARM1,
@ -165,7 +165,7 @@ void menuModelSensor(uint8_t event)
case SENSOR_FIELD_ID: case SENSOR_FIELD_ID:
if (sensor->type == TELEM_TYPE_CUSTOM) { if (sensor->type == TELEM_TYPE_CUSTOM) {
lcd_putsLeft(y, STR_ID); lcdDrawTextAlignedLeft(y, STR_ID);
lcdDrawHexNumber(SENSOR_2ND_COLUMN, y, sensor->id, LEFT|(menuHorizontalPosition==0 ? attr : 0)); lcdDrawHexNumber(SENSOR_2ND_COLUMN, y, sensor->id, LEFT|(menuHorizontalPosition==0 ? attr : 0));
lcdDrawNumber(SENSOR_3RD_COLUMN, y, sensor->instance, LEFT|(menuHorizontalPosition==1 ? attr : 0)); lcdDrawNumber(SENSOR_3RD_COLUMN, y, sensor->instance, LEFT|(menuHorizontalPosition==1 ? attr : 0));
if (attr) { if (attr) {
@ -201,7 +201,7 @@ void menuModelSensor(uint8_t event)
break; break;
case SENSOR_FIELD_UNIT: case SENSOR_FIELD_UNIT:
lcd_putsLeft(y, STR_UNIT); lcdDrawTextAlignedLeft(y, STR_UNIT);
// TODO flash saving with selectMenuItem where I copied those 2 lines? // TODO flash saving with selectMenuItem where I copied those 2 lines?
lcdDrawTextAtIndex(SENSOR_2ND_COLUMN, y, STR_VTELEMUNIT, sensor->unit, attr); lcdDrawTextAtIndex(SENSOR_2ND_COLUMN, y, STR_VTELEMUNIT, sensor->unit, attr);
if (attr) { if (attr) {
@ -225,7 +225,7 @@ void menuModelSensor(uint8_t event)
case SENSOR_FIELD_PARAM1: case SENSOR_FIELD_PARAM1:
if (sensor->type == TELEM_TYPE_CALCULATED) { if (sensor->type == TELEM_TYPE_CALCULATED) {
if (sensor->formula == TELEM_FORMULA_CELL) { if (sensor->formula == TELEM_FORMULA_CELL) {
lcd_putsLeft(y, STR_CELLSENSOR); lcdDrawTextAlignedLeft(y, STR_CELLSENSOR);
putsMixerSource(SENSOR_2ND_COLUMN, y, sensor->cell.source ? MIXSRC_FIRST_TELEM+3*(sensor->cell.source-1) : 0, attr); putsMixerSource(SENSOR_2ND_COLUMN, y, sensor->cell.source ? MIXSRC_FIRST_TELEM+3*(sensor->cell.source-1) : 0, attr);
if (attr) { if (attr) {
sensor->cell.source = checkIncDec(event, sensor->cell.source, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isCellsSensor); sensor->cell.source = checkIncDec(event, sensor->cell.source, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isCellsSensor);
@ -233,7 +233,7 @@ void menuModelSensor(uint8_t event)
break; break;
} }
else if (sensor->formula == TELEM_FORMULA_DIST) { else if (sensor->formula == TELEM_FORMULA_DIST) {
lcd_putsLeft(y, STR_GPSSENSOR); lcdDrawTextAlignedLeft(y, STR_GPSSENSOR);
putsMixerSource(SENSOR_2ND_COLUMN, y, sensor->dist.gps ? MIXSRC_FIRST_TELEM+3*(sensor->dist.gps-1) : 0, attr); putsMixerSource(SENSOR_2ND_COLUMN, y, sensor->dist.gps ? MIXSRC_FIRST_TELEM+3*(sensor->dist.gps-1) : 0, attr);
if (attr) { if (attr) {
sensor->dist.gps = checkIncDec(event, sensor->dist.gps, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isGPSSensor); sensor->dist.gps = checkIncDec(event, sensor->dist.gps, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isGPSSensor);
@ -241,7 +241,7 @@ void menuModelSensor(uint8_t event)
break; break;
} }
else if (sensor->formula == TELEM_FORMULA_CONSUMPTION) { else if (sensor->formula == TELEM_FORMULA_CONSUMPTION) {
lcd_putsLeft(y, STR_CURRENTSENSOR); lcdDrawTextAlignedLeft(y, STR_CURRENTSENSOR);
putsMixerSource(SENSOR_2ND_COLUMN, y, sensor->consumption.source ? MIXSRC_FIRST_TELEM+3*(sensor->consumption.source-1) : 0, attr); putsMixerSource(SENSOR_2ND_COLUMN, y, sensor->consumption.source ? MIXSRC_FIRST_TELEM+3*(sensor->consumption.source-1) : 0, attr);
if (attr) { if (attr) {
sensor->consumption.source = checkIncDec(event, sensor->consumption.source, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isSensorAvailable); sensor->consumption.source = checkIncDec(event, sensor->consumption.source, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isSensorAvailable);
@ -249,7 +249,7 @@ void menuModelSensor(uint8_t event)
break; break;
} }
else if (sensor->formula == TELEM_FORMULA_TOTALIZE) { else if (sensor->formula == TELEM_FORMULA_TOTALIZE) {
lcd_putsLeft(y, NO_INDENT(STR_SOURCE)); lcdDrawTextAlignedLeft(y, NO_INDENT(STR_SOURCE));
putsMixerSource(SENSOR_2ND_COLUMN, y, sensor->consumption.source ? MIXSRC_FIRST_TELEM+3*(sensor->consumption.source-1) : 0, attr); putsMixerSource(SENSOR_2ND_COLUMN, y, sensor->consumption.source ? MIXSRC_FIRST_TELEM+3*(sensor->consumption.source-1) : 0, attr);
if (attr) { if (attr) {
sensor->consumption.source = checkIncDec(event, sensor->consumption.source, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isSensorAvailable); sensor->consumption.source = checkIncDec(event, sensor->consumption.source, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isSensorAvailable);
@ -259,13 +259,13 @@ void menuModelSensor(uint8_t event)
} }
else { else {
if (sensor->unit == UNIT_RPMS) { if (sensor->unit == UNIT_RPMS) {
lcd_putsLeft(y, NO_INDENT(STR_BLADES)); lcdDrawTextAlignedLeft(y, NO_INDENT(STR_BLADES));
if (attr) sensor->custom.ratio = checkIncDec(event, sensor->custom.ratio, 1, 30000, EE_MODEL|NO_INCDEC_MARKS|INCDEC_REP10); if (attr) sensor->custom.ratio = checkIncDec(event, sensor->custom.ratio, 1, 30000, EE_MODEL|NO_INCDEC_MARKS|INCDEC_REP10);
lcdDrawNumber(SENSOR_2ND_COLUMN, y, sensor->custom.ratio, LEFT|attr); lcdDrawNumber(SENSOR_2ND_COLUMN, y, sensor->custom.ratio, LEFT|attr);
break; break;
} }
else { else {
lcd_putsLeft(y, STR_RATIO); lcdDrawTextAlignedLeft(y, STR_RATIO);
if (attr) sensor->custom.ratio = checkIncDec(event, sensor->custom.ratio, 0, 30000, EE_MODEL|NO_INCDEC_MARKS|INCDEC_REP10); if (attr) sensor->custom.ratio = checkIncDec(event, sensor->custom.ratio, 0, 30000, EE_MODEL|NO_INCDEC_MARKS|INCDEC_REP10);
if (sensor->custom.ratio == 0) if (sensor->custom.ratio == 0)
lcdDrawChar(SENSOR_2ND_COLUMN, y, '-', attr); lcdDrawChar(SENSOR_2ND_COLUMN, y, '-', attr);
@ -283,7 +283,7 @@ void menuModelSensor(uint8_t event)
break; break;
} }
else if (sensor->formula == TELEM_FORMULA_DIST) { else if (sensor->formula == TELEM_FORMULA_DIST) {
lcd_putsLeft(y, STR_ALTSENSOR); lcdDrawTextAlignedLeft(y, STR_ALTSENSOR);
putsMixerSource(SENSOR_2ND_COLUMN, y, sensor->dist.alt ? MIXSRC_FIRST_TELEM+3*(sensor->dist.alt-1) : 0, attr); putsMixerSource(SENSOR_2ND_COLUMN, y, sensor->dist.alt ? MIXSRC_FIRST_TELEM+3*(sensor->dist.alt-1) : 0, attr);
if (attr) { if (attr) {
sensor->dist.alt = checkIncDec(event, sensor->dist.alt, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isAltSensor); sensor->dist.alt = checkIncDec(event, sensor->dist.alt, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isAltSensor);
@ -292,13 +292,13 @@ void menuModelSensor(uint8_t event)
} }
} }
else if (sensor->unit == UNIT_RPMS) { else if (sensor->unit == UNIT_RPMS) {
lcd_putsLeft(y, STR_MULTIPLIER); lcdDrawTextAlignedLeft(y, STR_MULTIPLIER);
if (attr) sensor->custom.offset = checkIncDec(event, sensor->custom.offset, 1, 30000, EE_MODEL|NO_INCDEC_MARKS|INCDEC_REP10); if (attr) sensor->custom.offset = checkIncDec(event, sensor->custom.offset, 1, 30000, EE_MODEL|NO_INCDEC_MARKS|INCDEC_REP10);
lcdDrawNumber(SENSOR_2ND_COLUMN, y, sensor->custom.offset, LEFT|attr); lcdDrawNumber(SENSOR_2ND_COLUMN, y, sensor->custom.offset, LEFT|attr);
break; break;
} }
else { else {
lcd_putsLeft(y, NO_INDENT(STR_OFFSET)); lcdDrawTextAlignedLeft(y, NO_INDENT(STR_OFFSET));
if (attr) sensor->custom.offset = checkIncDec(event, sensor->custom.offset, -30000, +30000, EE_MODEL|NO_INCDEC_MARKS|INCDEC_REP10); if (attr) sensor->custom.offset = checkIncDec(event, sensor->custom.offset, -30000, +30000, EE_MODEL|NO_INCDEC_MARKS|INCDEC_REP10);
if (sensor->prec > 0) attr |= (sensor->prec == 2 ? PREC2 : PREC1); if (sensor->prec > 0) attr |= (sensor->prec == 2 ? PREC2 : PREC1);
lcdDrawNumber(SENSOR_2ND_COLUMN, y, sensor->custom.offset, LEFT|attr); lcdDrawNumber(SENSOR_2ND_COLUMN, y, sensor->custom.offset, LEFT|attr);
@ -391,7 +391,7 @@ void onSensorMenu(const char *result)
} }
} }
void menuModelTelemetry(uint8_t event) void menuModelTelemetryFrsky(uint8_t event)
{ {
if (warningResult) { if (warningResult) {
warningResult = 0; warningResult = 0;
@ -400,7 +400,7 @@ void menuModelTelemetry(uint8_t event)
} }
} }
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX, { TELEMETRY_TYPE_ROWS RSSI_ROWS SENSORS_ROWS VARIO_ROWS }); MENU(STR_MENUTELEMETRY, 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++) { for (int i=0; i<NUM_BODY_LINES; i++) {
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH; coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
@ -463,13 +463,13 @@ void menuModelTelemetry(uint8_t event)
switch (k) { switch (k) {
case ITEM_TELEMETRY_PROTOCOL_TYPE: case ITEM_TELEMETRY_PROTOCOL_TYPE:
lcd_putsLeft(y, STR_TELEMETRY_TYPE); lcdDrawTextAlignedLeft(y, STR_TELEMETRY_TYPE);
lcdDrawTextAtIndex(TELEM_COL2, y, STR_TELEMETRY_PROTOCOLS, g_model.telemetryProtocol, attr); lcdDrawTextAtIndex(TELEM_COL2, y, STR_TELEMETRY_PROTOCOLS, g_model.telemetryProtocol, attr);
g_model.telemetryProtocol = checkIncDec(event, g_model.telemetryProtocol, PROTOCOL_TELEMETRY_FIRST, PROTOCOL_TELEMETRY_LAST, EE_MODEL, isTelemetryProtocolAvailable); g_model.telemetryProtocol = checkIncDec(event, g_model.telemetryProtocol, PROTOCOL_TELEMETRY_FIRST, PROTOCOL_TELEMETRY_LAST, EE_MODEL, isTelemetryProtocolAvailable);
break; break;
case ITEM_TELEMETRY_SENSORS_LABEL: case ITEM_TELEMETRY_SENSORS_LABEL:
lcd_putsLeft(y, STR_TELEMETRY_SENSORS); lcdDrawTextAlignedLeft(y, STR_TELEMETRY_SENSORS);
lcdDrawText(TELEM_COL2, y, STR_VALUE, 0); lcdDrawText(TELEM_COL2, y, STR_VALUE, 0);
if (!g_model.ignoreSensorIds && !IS_SPEKTRUM_PROTOCOL()) { if (!g_model.ignoreSensorIds && !IS_SPEKTRUM_PROTOCOL()) {
lcdDrawText(TELEM_COL3, y, STR_ID, 0); lcdDrawText(TELEM_COL3, y, STR_ID, 0);
@ -514,13 +514,13 @@ void menuModelTelemetry(uint8_t event)
break; break;
case ITEM_TELEMETRY_RSSI_LABEL: case ITEM_TELEMETRY_RSSI_LABEL:
lcd_putsLeft(y, PSTR("RSSI")); lcdDrawTextAlignedLeft(y, PSTR("RSSI"));
break; break;
case ITEM_TELEMETRY_RSSI_ALARM1: case ITEM_TELEMETRY_RSSI_ALARM1:
case ITEM_TELEMETRY_RSSI_ALARM2: { case ITEM_TELEMETRY_RSSI_ALARM2: {
uint8_t alarm = k-ITEM_TELEMETRY_RSSI_ALARM1; uint8_t alarm = k-ITEM_TELEMETRY_RSSI_ALARM1;
lcd_putsLeft(y, (alarm==0 ? STR_LOWALARM : STR_CRITICALALARM)); lcdDrawTextAlignedLeft(y, (alarm==0 ? STR_LOWALARM : STR_CRITICALALARM));
lcdDrawNumber(TELEM_COL2, y, getRssiAlarmValue(alarm), LEFT|attr, 3); lcdDrawNumber(TELEM_COL2, y, getRssiAlarmValue(alarm), LEFT|attr, 3);
if (attr && s_editMode>0) { if (attr && s_editMode>0) {
CHECK_INCDEC_MODELVAR(event, g_model.frsky.rssiAlarms[alarm].value, -30, 30); CHECK_INCDEC_MODELVAR(event, g_model.frsky.rssiAlarms[alarm].value, -30, 30);
@ -530,11 +530,11 @@ void menuModelTelemetry(uint8_t event)
#if defined(VARIO) #if defined(VARIO)
case ITEM_TELEMETRY_VARIO_LABEL: case ITEM_TELEMETRY_VARIO_LABEL:
lcd_putsLeft(y, STR_VARIO); lcdDrawTextAlignedLeft(y, STR_VARIO);
break; break;
case ITEM_TELEMETRY_VARIO_SOURCE: case ITEM_TELEMETRY_VARIO_SOURCE:
lcd_putsLeft(y, STR_SOURCE); lcdDrawTextAlignedLeft(y, STR_SOURCE);
putsMixerSource(TELEM_COL2, y, g_model.frsky.varioSource ? MIXSRC_FIRST_TELEM+3*(g_model.frsky.varioSource-1) : 0, attr); putsMixerSource(TELEM_COL2, y, g_model.frsky.varioSource ? MIXSRC_FIRST_TELEM+3*(g_model.frsky.varioSource-1) : 0, attr);
if (attr) { if (attr) {
g_model.frsky.varioSource = checkIncDec(event, g_model.frsky.varioSource, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isSensorAvailable); g_model.frsky.varioSource = checkIncDec(event, g_model.frsky.varioSource, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isSensorAvailable);
@ -542,7 +542,7 @@ void menuModelTelemetry(uint8_t event)
break; break;
case ITEM_TELEMETRY_VARIO_RANGE: case ITEM_TELEMETRY_VARIO_RANGE:
lcd_putsLeft(y, STR_RANGE); lcdDrawTextAlignedLeft(y, STR_RANGE);
lcdDrawNumber(TELEM_COL2, y, -10+g_model.frsky.varioMin, (menuHorizontalPosition==0 ? attr : 0)|LEFT); lcdDrawNumber(TELEM_COL2, y, -10+g_model.frsky.varioMin, (menuHorizontalPosition==0 ? attr : 0)|LEFT);
lcdDrawNumber(TELEM_COL2+7*FW, y, 10+g_model.frsky.varioMax, (menuHorizontalPosition==1 ? attr : 0)|LEFT); lcdDrawNumber(TELEM_COL2+7*FW, y, 10+g_model.frsky.varioMax, (menuHorizontalPosition==1 ? attr : 0)|LEFT);
if (attr && s_editMode>0) { if (attr && s_editMode>0) {
@ -558,7 +558,7 @@ void menuModelTelemetry(uint8_t event)
break; break;
case ITEM_TELEMETRY_VARIO_CENTER: case ITEM_TELEMETRY_VARIO_CENTER:
lcd_putsLeft(y, STR_CENTER); lcdDrawTextAlignedLeft(y, STR_CENTER);
lcdDrawNumber(TELEM_COL2, y, -5+g_model.frsky.varioCenterMin, (menuHorizontalPosition==0 ? attr : 0)|PREC1|LEFT); lcdDrawNumber(TELEM_COL2, y, -5+g_model.frsky.varioCenterMin, (menuHorizontalPosition==0 ? attr : 0)|PREC1|LEFT);
lcdDrawNumber(TELEM_COL2+7*FW, y, 5+g_model.frsky.varioCenterMax, (menuHorizontalPosition==1 ? attr : 0)|PREC1|LEFT); lcdDrawNumber(TELEM_COL2+7*FW, y, 5+g_model.frsky.varioCenterMax, (menuHorizontalPosition==1 ? attr : 0)|PREC1|LEFT);
lcdDrawTextAtIndex(TELEM_COL3, y, STR_VVARIOCENTER, g_model.frsky.varioCenterSilent, (menuHorizontalPosition==2 ? attr : 0)); lcdDrawTextAtIndex(TELEM_COL3, y, STR_VVARIOCENTER, g_model.frsky.varioCenterSilent, (menuHorizontalPosition==2 ? attr : 0));

View file

@ -334,7 +334,7 @@ void onLongMenuPress(const char *result)
tmr10ms_t menuEntryTime; tmr10ms_t menuEntryTime;
void check(const char * name, check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t rowcount, uint8_t flags) void check(const char * name, event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t rowcount, uint8_t flags)
{ {
vertpos_t l_posVert = menuVerticalPosition; vertpos_t l_posVert = menuVerticalPosition;
horzpos_t l_posHorz = menuHorizontalPosition; horzpos_t l_posHorz = menuHorizontalPosition;
@ -579,12 +579,12 @@ void check(const char * name, check_event_t event, uint8_t curr, const MenuHandl
} }
void check_simple(const char * name, check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, vertpos_t rowcount) void check_simple(const char * name, event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, vertpos_t rowcount)
{ {
check(name, event, curr, menuTab, menuTabSize, 0, 0, rowcount); check(name, event, curr, menuTab, menuTabSize, 0, 0, rowcount);
} }
void check_submenu_simple(const char * name, check_event_t event, uint8_t rowcount) void check_submenu_simple(const char * name, event_t event, uint8_t rowcount)
{ {
check_simple(name, event, 0, 0, 0, rowcount); check_simple(name, event, 0, 0, 0, rowcount);
} }

View file

@ -45,7 +45,7 @@ void drawMessageBox(const char * title)
// could be a place for a warningInfoText // could be a place for a warningInfoText
} }
void displayPopup(const char * title) void showMessageBox(const char * title)
{ {
drawMessageBox(title); drawMessageBox(title);
lcdRefresh(); lcdRefresh();
@ -83,7 +83,7 @@ void drawAlertBox(const char * title, const char * text, const char * action)
#undef MESSAGE_LCD_OFFSET #undef MESSAGE_LCD_OFFSET
} }
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); drawAlertBox(title, text, action);
AUDIO_ERROR_MESSAGE(sound); AUDIO_ERROR_MESSAGE(sound);
@ -92,7 +92,7 @@ void message(const pm_char * title, const pm_char * text, const char * action, u
clearKeyEvents(); clearKeyEvents();
} }
void displayWarning(uint8_t event) void runPopupWarning(uint8_t event)
{ {
warningResult = false; warningResult = false;
drawMessageBox(warningText); drawMessageBox(warningText);
@ -111,10 +111,11 @@ void displayWarning(uint8_t event)
warningType = WARNING_TYPE_ASTERISK; warningType = WARNING_TYPE_ASTERISK;
break; break;
default: default:
if (warningType != WARNING_TYPE_INPUT) break; if (warningType == WARNING_TYPE_INPUT) {
s_editMode = EDIT_MODIFY_FIELD; s_editMode = EDIT_MODIFY_FIELD;
warningInputValue = checkIncDec(event, warningInputValue, warningInputValueMin, warningInputValueMax); warningInputValue = checkIncDec(event, warningInputValue, warningInputValueMin, warningInputValueMax);
s_editMode = EDIT_SELECT_FIELD; s_editMode = EDIT_SELECT_FIELD;
}
break; break;
} }
} }

View file

@ -106,14 +106,14 @@ void menuCommonCalib(uint8_t event)
case CALIB_START: case CALIB_START:
// START CALIBRATION // START CALIBRATION
if (!READ_ONLY()) { if (!READ_ONLY()) {
lcd_putsLeft(MENU_HEADER_HEIGHT+2*FH, STR_MENUTOSTART); lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+2*FH, STR_MENUTOSTART);
} }
break; break;
case CALIB_SET_MIDPOINT: case CALIB_SET_MIDPOINT:
// SET MIDPOINT // SET MIDPOINT
lcdDrawText(0*FW, MENU_HEADER_HEIGHT+FH, STR_SETMIDPOINT, INVERS); lcdDrawText(0*FW, MENU_HEADER_HEIGHT+FH, STR_SETMIDPOINT, INVERS);
lcd_putsLeft(MENU_HEADER_HEIGHT+2*FH, STR_MENUWHENDONE); lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+2*FH, STR_MENUWHENDONE);
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) { for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) {
reusableBuffer.calib.loVals[i] = 15000; reusableBuffer.calib.loVals[i] = 15000;
@ -130,7 +130,7 @@ void menuCommonCalib(uint8_t event)
// MOVE STICKS/POTS // MOVE STICKS/POTS
STICK_SCROLL_DISABLE(); STICK_SCROLL_DISABLE();
lcdDrawText(0*FW, MENU_HEADER_HEIGHT+FH, STR_MOVESTICKSPOTS, INVERS); lcdDrawText(0*FW, MENU_HEADER_HEIGHT+FH, STR_MOVESTICKSPOTS, INVERS);
lcd_putsLeft(MENU_HEADER_HEIGHT+2*FH, STR_MENUWHENDONE); lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+2*FH, STR_MENUWHENDONE);
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) { for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) {
if (abs(reusableBuffer.calib.loVals[i]-reusableBuffer.calib.hiVals[i]) > 50) { if (abs(reusableBuffer.calib.loVals[i]-reusableBuffer.calib.hiVals[i]) > 50) {
@ -197,9 +197,9 @@ void menuCommonCalib(uint8_t event)
#endif #endif
} }
void menuGeneralCalib(uint8_t event) void menuRadioCalibration(uint8_t event)
{ {
check_simple(STR_MENUCALIBRATION, event, e_Calib, menuTabGeneral, DIM(menuTabGeneral), 0); check_simple(STR_MENUCALIBRATION, event, MENU_RADIO_CALIBRATION, menuTabGeneral, DIM(menuTabGeneral), 0);
menuCommonCalib(READ_ONLY() ? 0 : event); menuCommonCalib(READ_ONLY() ? 0 : event);
if (menuEvent) { if (menuEvent) {
calibrationState = CALIB_START; calibrationState = CALIB_START;

View file

@ -20,9 +20,9 @@
#include "opentx.h" #include "opentx.h"
void menuGeneralDiagAna(uint8_t event) void menuRadioDiagAnalogs(uint8_t event)
{ {
SIMPLE_MENU(STR_MENUANA, menuTabGeneral, e_Ana, 0); SIMPLE_MENU(STR_MENUANA, menuTabGeneral, MENU_RADIO_DIAG_ANALOGS, 0);
STICK_SCROLL_DISABLE(); STICK_SCROLL_DISABLE();
@ -42,6 +42,6 @@ void menuGeneralDiagAna(uint8_t event)
} }
// SWR // SWR
lcd_putsLeft(MENU_HEADER_HEIGHT+6*FH, "RAS"); lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+6*FH, "RAS");
lcdDrawNumber(10*FW-1, MENU_HEADER_HEIGHT+6*FH, telemetryData.swr.value, RIGHT); lcdDrawNumber(10*FW-1, MENU_HEADER_HEIGHT+6*FH, telemetryData.swr.value, RIGHT);
} }

View file

@ -26,9 +26,9 @@ void displayKeyState(uint8_t x, uint8_t y, EnumKeys key)
lcdDrawChar(x, y, t+'0', t ? INVERS : 0); lcdDrawChar(x, y, t+'0', t ? INVERS : 0);
} }
void menuGeneralDiagKeys(uint8_t event) void menuRadioDiagKeys(uint8_t event)
{ {
SIMPLE_MENU(STR_MENUDIAG, menuTabGeneral, e_Keys, 1); SIMPLE_MENU(STR_MENUDIAG, menuTabGeneral, MENU_RADIO_DIAG_KEYS, 1);
lcdDrawText(14*FW, MENU_HEADER_HEIGHT+2*FH, STR_VTRIM); lcdDrawText(14*FW, MENU_HEADER_HEIGHT+2*FH, STR_VTRIM);

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
enum menuGeneralHwItems { enum menuRadioHwItems {
ITEM_SETUP_HW_LABEL_STICKS, ITEM_SETUP_HW_LABEL_STICKS,
ITEM_SETUP_HW_STICK1, ITEM_SETUP_HW_STICK1,
ITEM_SETUP_HW_STICK2, ITEM_SETUP_HW_STICK2,
@ -81,9 +81,9 @@ enum menuGeneralHwItems {
#define SWITCH_TYPE_MAX(sw) ((MIXSRC_SF-MIXSRC_FIRST_SWITCH == sw || MIXSRC_SH-MIXSRC_FIRST_SWITCH == sw) ? SWITCH_2POS : SWITCH_3POS) #define SWITCH_TYPE_MAX(sw) ((MIXSRC_SF-MIXSRC_FIRST_SWITCH == sw || MIXSRC_SH-MIXSRC_FIRST_SWITCH == sw) ? SWITCH_2POS : SWITCH_3POS)
void menuGeneralHardware(uint8_t event) void menuRadioHardware(uint8_t event)
{ {
MENU(STR_HARDWARE, menuTabGeneral, e_Hardware, ITEM_SETUP_HW_MAX, { LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, BLUETOOTH_ROWS 0 }); MENU(STR_HARDWARE, menuTabGeneral, MENU_RADIO_HARDWARE, ITEM_SETUP_HW_MAX, { LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, BLUETOOTH_ROWS 0 });
uint8_t sub = menuVerticalPosition; uint8_t sub = menuVerticalPosition;
@ -97,7 +97,7 @@ void menuGeneralHardware(uint8_t event)
LcdFlags attr = (sub == k ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0); LcdFlags attr = (sub == k ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
switch (k) { switch (k) {
case ITEM_SETUP_HW_LABEL_STICKS: case ITEM_SETUP_HW_LABEL_STICKS:
lcd_putsLeft(y, STR_STICKS); lcdDrawTextAlignedLeft(y, STR_STICKS);
break; break;
case ITEM_SETUP_HW_STICK1: case ITEM_SETUP_HW_STICK1:
case ITEM_SETUP_HW_STICK2: case ITEM_SETUP_HW_STICK2:
@ -133,7 +133,7 @@ void menuGeneralHardware(uint8_t event)
} }
#endif #endif
case ITEM_SETUP_HW_LABEL_POTS: case ITEM_SETUP_HW_LABEL_POTS:
lcd_putsLeft(y, STR_POTS); lcdDrawTextAlignedLeft(y, STR_POTS);
break; break;
case ITEM_SETUP_HW_POT1: case ITEM_SETUP_HW_POT1:
case ITEM_SETUP_HW_POT2: case ITEM_SETUP_HW_POT2:
@ -159,7 +159,7 @@ void menuGeneralHardware(uint8_t event)
break; break;
} }
case ITEM_SETUP_HW_LABEL_SWITCHES: case ITEM_SETUP_HW_LABEL_SWITCHES:
lcd_putsLeft(y, STR_SWITCHES); lcdDrawTextAlignedLeft(y, STR_SWITCHES);
break; break;
case ITEM_SETUP_HW_SA: case ITEM_SETUP_HW_SA:
case ITEM_SETUP_HW_SB: case ITEM_SETUP_HW_SB:
@ -198,7 +198,7 @@ void menuGeneralHardware(uint8_t event)
} }
#if defined(PCBX9E) #if defined(PCBX9E)
case ITEM_SETUP_HW_BLUETOOTH: case ITEM_SETUP_HW_BLUETOOTH:
lcd_putsLeft(y, "Bluetooth"); lcdDrawTextAlignedLeft(y, "Bluetooth");
drawCheckBox(HW_SETTINGS_COLUMN, y, g_eeGeneral.bluetoothEnable, menuHorizontalPosition == 0 ? attr : 0); drawCheckBox(HW_SETTINGS_COLUMN, y, g_eeGeneral.bluetoothEnable, menuHorizontalPosition == 0 ? attr : 0);
if (attr && menuHorizontalPosition == 0) { if (attr && menuHorizontalPosition == 0) {
g_eeGeneral.bluetoothEnable = checkIncDecGen(event, g_eeGeneral.bluetoothEnable, 0, 1); g_eeGeneral.bluetoothEnable = checkIncDecGen(event, g_eeGeneral.bluetoothEnable, 0, 1);

View file

@ -25,18 +25,18 @@
#define IS_DIRECTORY(fname) ((bool)(!NODE_TYPE(fname))) #define IS_DIRECTORY(fname) ((bool)(!NODE_TYPE(fname)))
#define IS_FILE(fname) ((bool)(NODE_TYPE(fname))) #define IS_FILE(fname) ((bool)(NODE_TYPE(fname)))
void menuGeneralSdManagerInfo(evt_t event) void menuRadioSdManagerInfo(event_t event)
{ {
SIMPLE_SUBMENU(STR_SD_INFO_TITLE, 1); SIMPLE_SUBMENU(STR_SD_INFO_TITLE, 1);
lcd_putsLeft(2*FH, STR_SD_TYPE); lcdDrawTextAlignedLeft(2*FH, STR_SD_TYPE);
lcdDrawText(10*FW, 2*FH, SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD); lcdDrawText(10*FW, 2*FH, SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD);
lcd_putsLeft(3*FH, STR_SD_SIZE); lcdDrawTextAlignedLeft(3*FH, STR_SD_SIZE);
lcdDrawNumber(10*FW, 3*FH, sdGetSize(), LEFT); lcdDrawNumber(10*FW, 3*FH, sdGetSize(), LEFT);
lcdDrawChar(lcdLastPos, 3*FH, 'M'); lcdDrawChar(lcdLastPos, 3*FH, 'M');
lcd_putsLeft(4*FH, STR_SD_SECTORS); lcdDrawTextAlignedLeft(4*FH, STR_SD_SECTORS);
#if defined(SD_GET_FREE_BLOCKNR) #if defined(SD_GET_FREE_BLOCKNR)
lcdDrawNumber(10*FW, 4*FH, SD_GET_FREE_BLOCKNR()/1000, LEFT); lcdDrawNumber(10*FW, 4*FH, SD_GET_FREE_BLOCKNR()/1000, LEFT);
lcdDrawChar(lcdLastPos, 4*FH, '/'); lcdDrawChar(lcdLastPos, 4*FH, '/');
@ -46,7 +46,7 @@ void menuGeneralSdManagerInfo(evt_t event)
#endif #endif
lcdDrawChar(lcdLastPos, 4*FH, 'k'); lcdDrawChar(lcdLastPos, 4*FH, 'k');
lcd_putsLeft(5*FH, STR_SD_SPEED); lcdDrawTextAlignedLeft(5*FH, STR_SD_SPEED);
lcdDrawNumber(10*FW, 5*FH, SD_GET_SPEED()/1000, LEFT); lcdDrawNumber(10*FW, 5*FH, SD_GET_SPEED()/1000, LEFT);
lcdDrawText(lcdLastPos, 5*FH, "kb/s"); lcdDrawText(lcdLastPos, 5*FH, "kb/s");
} }
@ -147,7 +147,7 @@ void onSdManagerMenu(const char *result)
char *line = reusableBuffer.sdmanager.lines[index]; char *line = reusableBuffer.sdmanager.lines[index];
if (result == STR_SD_INFO) { if (result == STR_SD_INFO) {
pushMenu(menuGeneralSdManagerInfo); pushMenu(menuRadioSdManagerInfo);
} }
else if (result == STR_SD_FORMAT) { else if (result == STR_SD_FORMAT) {
POPUP_CONFIRMATION(STR_CONFIRM_FORMAT); POPUP_CONFIRMATION(STR_CONFIRM_FORMAT);
@ -227,11 +227,11 @@ void onSdManagerMenu(const char *result)
#endif #endif
} }
void menuGeneralSdManager(evt_t _event) void menuRadioSdManager(event_t _event)
{ {
if (warningResult) { if (warningResult) {
warningResult = 0; warningResult = 0;
displayPopup(STR_FORMATTING); showMessageBox(STR_FORMATTING);
closeLogs(); closeLogs();
audioQueue.stopSD(); audioQueue.stopSD();
if (f_mkfs(0, 1, 0) == FR_OK) { if (f_mkfs(0, 1, 0) == FR_OK) {
@ -245,8 +245,8 @@ void menuGeneralSdManager(evt_t _event)
int lastPos = menuVerticalPosition; int lastPos = menuVerticalPosition;
evt_t event = (EVT_KEY_MASK(_event) == KEY_ENTER ? 0 : _event); event_t event = (EVT_KEY_MASK(_event) == KEY_ENTER ? 0 : _event);
SIMPLE_MENU(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, menuTabGeneral, e_Sd, reusableBuffer.sdmanager.count); SIMPLE_MENU(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, menuTabGeneral, MENU_RADIO_SD_MANAGER, reusableBuffer.sdmanager.count);
int index = menuVerticalPosition-menuVerticalOffset; int index = menuVerticalPosition-menuVerticalOffset;

View file

@ -42,7 +42,7 @@ const pm_uchar sticks[] PROGMEM = {
#define CASE_SPLASH_PARAM(x) #define CASE_SPLASH_PARAM(x)
#endif #endif
enum menuGeneralSetupItems { enum menuRadioSetupItems {
CASE_RTCLOCK(ITEM_SETUP_DATE) CASE_RTCLOCK(ITEM_SETUP_DATE)
CASE_RTCLOCK(ITEM_SETUP_TIME) CASE_RTCLOCK(ITEM_SETUP_TIME)
ITEM_SETUP_BATTERY_CALIB, ITEM_SETUP_BATTERY_CALIB,
@ -93,7 +93,7 @@ enum menuGeneralSetupItems {
ITEM_SETUP_MAX ITEM_SETUP_MAX
}; };
void menuGeneralSetup(uint8_t event) void menuRadioSetup(uint8_t event)
{ {
#if defined(RTCLOCK) #if defined(RTCLOCK)
struct gtm t; struct gtm t;
@ -115,7 +115,7 @@ void menuGeneralSetup(uint8_t event)
} }
#endif #endif
MENU(STR_MENURADIOSETUP, menuTabGeneral, e_Setup, ITEM_SETUP_MAX, { 2, 2, 0, 1, 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) CASE_HAPTIC(LABEL(HAPTIC)) CASE_HAPTIC(0) CASE_HAPTIC(0) CASE_HAPTIC(0) 0, LABEL(ALARMS), 0, 0, 0, 0, IF_ROTARY_ENCODERS(0) LABEL(BACKLIGHT), 0, 0, 0, CASE_PCBX9E_PCBX9DP(0) CASE_PWM_BACKLIGHT(0) CASE_PWM_BACKLIGHT(0) 0, CASE_SPLASH_PARAM(0) CASE_GPS(LABEL(GPS)) CASE_GPS(0) CASE_GPS(0) CASE_GPS(0) CASE_PXX(0) 0, 0, IF_FAI_CHOICE(0) CASE_MAVLINK(0) 0, 0, LABEL(TX_MODE), 0, 1/*to force edit mode*/ }); MENU(STR_MENURADIOSETUP, menuTabGeneral, MENU_RADIO_SETUP, ITEM_SETUP_MAX, { 2, 2, 0, 1, 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) CASE_HAPTIC(LABEL(HAPTIC)) CASE_HAPTIC(0) CASE_HAPTIC(0) CASE_HAPTIC(0) 0, LABEL(ALARMS), 0, 0, 0, 0, IF_ROTARY_ENCODERS(0) LABEL(BACKLIGHT), 0, 0, 0, CASE_PCBX9E_PCBX9DP(0) CASE_PWM_BACKLIGHT(0) CASE_PWM_BACKLIGHT(0) 0, CASE_SPLASH_PARAM(0) CASE_GPS(LABEL(GPS)) CASE_GPS(0) CASE_GPS(0) CASE_GPS(0) CASE_PXX(0) 0, 0, IF_FAI_CHOICE(0) CASE_MAVLINK(0) 0, 0, LABEL(TX_MODE), 0, 1/*to force edit mode*/ });
if (event == EVT_ENTRY) { if (event == EVT_ENTRY) {
reusableBuffer.generalSettings.stickMode = g_eeGeneral.stickMode; reusableBuffer.generalSettings.stickMode = g_eeGeneral.stickMode;
@ -131,7 +131,7 @@ void menuGeneralSetup(uint8_t event)
switch(k) { switch(k) {
case ITEM_SETUP_DATE: case ITEM_SETUP_DATE:
lcd_putsLeft(y, STR_DATE); lcdDrawTextAlignedLeft(y, STR_DATE);
lcdDrawChar(RADIO_SETUP_DATE_COLUMN, y, '-'); lcdDrawChar(RADIO_SETUP_DATE_COLUMN+3*FW-2, y, '-'); lcdDrawChar(RADIO_SETUP_DATE_COLUMN, y, '-'); lcdDrawChar(RADIO_SETUP_DATE_COLUMN+3*FW-2, y, '-');
for (uint8_t j=0; j<3; j++) { for (uint8_t j=0; j<3; j++) {
uint8_t rowattr = (menuHorizontalPosition==j ? attr : 0); uint8_t rowattr = (menuHorizontalPosition==j ? attr : 0);
@ -163,7 +163,7 @@ void menuGeneralSetup(uint8_t event)
break; break;
case ITEM_SETUP_TIME: case ITEM_SETUP_TIME:
lcd_putsLeft(y, STR_TIME); lcdDrawTextAlignedLeft(y, STR_TIME);
lcdDrawChar(RADIO_SETUP_TIME_COLUMN+1, y, ':'); lcdDrawChar(RADIO_SETUP_TIME_COLUMN+3*FW-2, y, ':'); lcdDrawChar(RADIO_SETUP_TIME_COLUMN+1, y, ':'); lcdDrawChar(RADIO_SETUP_TIME_COLUMN+3*FW-2, y, ':');
for (uint8_t j=0; j<3; j++) { for (uint8_t j=0; j<3; j++) {
uint8_t rowattr = (menuHorizontalPosition==j ? attr : 0); uint8_t rowattr = (menuHorizontalPosition==j ? attr : 0);
@ -188,7 +188,7 @@ void menuGeneralSetup(uint8_t event)
break; break;
case ITEM_SETUP_BATTERY_CALIB: case ITEM_SETUP_BATTERY_CALIB:
lcd_putsLeft(y, STR_BATT_CALIB); lcdDrawTextAlignedLeft(y, STR_BATT_CALIB);
putsVolts(RADIO_SETUP_2ND_COLUMN, y, getBatteryVoltage(), attr | PREC2 | LEFT); putsVolts(RADIO_SETUP_2ND_COLUMN, y, getBatteryVoltage(), attr | PREC2 | LEFT);
if (attr && s_editMode > 0) { if (attr && s_editMode > 0) {
CHECK_INCDEC_GENVAR(event, g_eeGeneral.txVoltageCalibration, -127, 127); CHECK_INCDEC_GENVAR(event, g_eeGeneral.txVoltageCalibration, -127, 127);
@ -196,7 +196,7 @@ void menuGeneralSetup(uint8_t event)
break; break;
case ITEM_SETUP_BATTERY_RANGE: case ITEM_SETUP_BATTERY_RANGE:
lcd_putsLeft(y, STR_BATTERY_RANGE); lcdDrawTextAlignedLeft(y, STR_BATTERY_RANGE);
putsVolts(RADIO_SETUP_2ND_COLUMN, y, 90+g_eeGeneral.vBatMin, (menuHorizontalPosition==0 ? attr : 0)|LEFT|NO_UNIT); putsVolts(RADIO_SETUP_2ND_COLUMN, y, 90+g_eeGeneral.vBatMin, (menuHorizontalPosition==0 ? attr : 0)|LEFT|NO_UNIT);
lcdDrawChar(lcdLastPos, y, '-'); lcdDrawChar(lcdLastPos, y, '-');
putsVolts(lcdLastPos+FW, y, 120+g_eeGeneral.vBatMax, (menuHorizontalPosition>0 ? attr : 0)|LEFT|NO_UNIT); putsVolts(lcdLastPos+FW, y, 120+g_eeGeneral.vBatMax, (menuHorizontalPosition>0 ? attr : 0)|LEFT|NO_UNIT);
@ -210,7 +210,7 @@ void menuGeneralSetup(uint8_t event)
break; break;
case ITEM_SETUP_SOUND_LABEL: case ITEM_SETUP_SOUND_LABEL:
lcd_putsLeft(y, STR_SOUND_LABEL); lcdDrawTextAlignedLeft(y, STR_SOUND_LABEL);
break; break;
case ITEM_SETUP_BEEP_MODE: case ITEM_SETUP_BEEP_MODE:
@ -222,7 +222,7 @@ void menuGeneralSetup(uint8_t event)
case ITEM_SETUP_GENERAL_VOLUME: case ITEM_SETUP_GENERAL_VOLUME:
{ {
lcd_putsLeft(y, STR_SPEAKER_VOLUME); lcdDrawTextAlignedLeft(y, STR_SPEAKER_VOLUME);
uint8_t b = g_eeGeneral.speakerVolume+VOLUME_LEVEL_DEF; uint8_t b = g_eeGeneral.speakerVolume+VOLUME_LEVEL_DEF;
drawSlider(RADIO_SETUP_2ND_COLUMN, y, b, VOLUME_LEVEL_MAX, attr); drawSlider(RADIO_SETUP_2ND_COLUMN, y, b, VOLUME_LEVEL_MAX, attr);
if (attr) { if (attr) {
@ -251,7 +251,7 @@ void menuGeneralSetup(uint8_t event)
break; break;
case ITEM_SETUP_SPEAKER_PITCH: case ITEM_SETUP_SPEAKER_PITCH:
lcd_putsLeft( y, STR_SPKRPITCH); lcdDrawTextAlignedLeft( y, STR_SPKRPITCH);
lcdDrawChar(RADIO_SETUP_2ND_COLUMN, y, '+', attr); lcdDrawChar(RADIO_SETUP_2ND_COLUMN, y, '+', attr);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN+FW, y, g_eeGeneral.speakerPitch*15, attr|LEFT); lcdDrawNumber(RADIO_SETUP_2ND_COLUMN+FW, y, g_eeGeneral.speakerPitch*15, attr|LEFT);
lcdDrawText(lcdLastPos, y, "Hz", attr); lcdDrawText(lcdLastPos, y, "Hz", attr);
@ -262,7 +262,7 @@ void menuGeneralSetup(uint8_t event)
#if defined(VARIO) #if defined(VARIO)
case ITEM_SETUP_VARIO_LABEL: case ITEM_SETUP_VARIO_LABEL:
lcd_putsLeft(y, STR_VARIO); lcdDrawTextAlignedLeft(y, STR_VARIO);
break; break;
case ITEM_SETUP_VARIO_VOLUME: case ITEM_SETUP_VARIO_VOLUME:
@ -270,21 +270,21 @@ void menuGeneralSetup(uint8_t event)
break; break;
case ITEM_SETUP_VARIO_PITCH: case ITEM_SETUP_VARIO_PITCH:
lcd_putsLeft(y, STR_PITCH_AT_ZERO); lcdDrawTextAlignedLeft(y, STR_PITCH_AT_ZERO);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, VARIO_FREQUENCY_ZERO+(g_eeGeneral.varioPitch*10), attr|LEFT); lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, VARIO_FREQUENCY_ZERO+(g_eeGeneral.varioPitch*10), attr|LEFT);
lcdDrawText(lcdLastPos, y, "Hz", attr); lcdDrawText(lcdLastPos, y, "Hz", attr);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.varioPitch, -40, 40); if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.varioPitch, -40, 40);
break; break;
case ITEM_SETUP_VARIO_RANGE: case ITEM_SETUP_VARIO_RANGE:
lcd_putsLeft(y, STR_PITCH_AT_MAX); lcdDrawTextAlignedLeft(y, STR_PITCH_AT_MAX);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, VARIO_FREQUENCY_ZERO+(g_eeGeneral.varioPitch*10)+VARIO_FREQUENCY_RANGE+(g_eeGeneral.varioRange*10), attr|LEFT); lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, VARIO_FREQUENCY_ZERO+(g_eeGeneral.varioPitch*10)+VARIO_FREQUENCY_RANGE+(g_eeGeneral.varioRange*10), attr|LEFT);
lcdDrawText(lcdLastPos, y, "Hz", attr); lcdDrawText(lcdLastPos, y, "Hz", attr);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.varioRange, -80, 80); if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.varioRange, -80, 80);
break; break;
case ITEM_SETUP_VARIO_REPEAT: case ITEM_SETUP_VARIO_REPEAT:
lcd_putsLeft(y, STR_REPEAT_AT_ZERO); lcdDrawTextAlignedLeft(y, STR_REPEAT_AT_ZERO);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, VARIO_REPEAT_ZERO+(g_eeGeneral.varioRepeat*10), attr|LEFT); lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, VARIO_REPEAT_ZERO+(g_eeGeneral.varioRepeat*10), attr|LEFT);
lcdDrawText(lcdLastPos, y, STR_MS, attr); lcdDrawText(lcdLastPos, y, STR_MS, attr);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.varioRepeat, -30, 50); if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.varioRepeat, -30, 50);
@ -293,7 +293,7 @@ void menuGeneralSetup(uint8_t event)
#if defined(HAPTIC) #if defined(HAPTIC)
case ITEM_SETUP_HAPTIC_LABEL: case ITEM_SETUP_HAPTIC_LABEL:
lcd_putsLeft(y, STR_HAPTIC_LABEL); lcdDrawTextAlignedLeft(y, STR_HAPTIC_LABEL);
break; break;
case ITEM_SETUP_HAPTIC_MODE: case ITEM_SETUP_HAPTIC_MODE:
@ -310,7 +310,7 @@ void menuGeneralSetup(uint8_t event)
#endif #endif
case ITEM_SETUP_CONTRAST: case ITEM_SETUP_CONTRAST:
lcd_putsLeft(y, STR_CONTRAST); lcdDrawTextAlignedLeft(y, STR_CONTRAST);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.contrast, attr|LEFT); lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.contrast, attr|LEFT);
if (attr) { if (attr) {
CHECK_INCDEC_GENVAR(event, g_eeGeneral.contrast, CONTRAST_MIN, CONTRAST_MAX); CHECK_INCDEC_GENVAR(event, g_eeGeneral.contrast, CONTRAST_MIN, CONTRAST_MAX);
@ -319,11 +319,11 @@ void menuGeneralSetup(uint8_t event)
break; break;
case ITEM_SETUP_ALARMS_LABEL: case ITEM_SETUP_ALARMS_LABEL:
lcd_putsLeft(y, STR_ALARMS_LABEL); lcdDrawTextAlignedLeft(y, STR_ALARMS_LABEL);
break; break;
case ITEM_SETUP_BATTERY_WARNING: case ITEM_SETUP_BATTERY_WARNING:
lcd_putsLeft(y, STR_BATTERYWARNING); lcdDrawTextAlignedLeft(y, STR_BATTERYWARNING);
putsVolts(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.vBatWarn, attr|LEFT); putsVolts(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.vBatWarn, attr|LEFT);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatWarn, 40, 120); // 4-12V if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatWarn, 40, 120); // 4-12V
break; break;
@ -343,14 +343,14 @@ void menuGeneralSetup(uint8_t event)
} }
case ITEM_SETUP_INACTIVITY_ALARM: case ITEM_SETUP_INACTIVITY_ALARM:
lcd_putsLeft(y, STR_INACTIVITYALARM); lcdDrawTextAlignedLeft(y, STR_INACTIVITYALARM);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.inactivityTimer, attr|LEFT); lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.inactivityTimer, attr|LEFT);
lcdDrawChar(lcdLastPos, y, 'm'); lcdDrawChar(lcdLastPos, y, 'm');
if(attr) g_eeGeneral.inactivityTimer = checkIncDec(event, g_eeGeneral.inactivityTimer, 0, 250, EE_GENERAL); //0..250minutes if(attr) g_eeGeneral.inactivityTimer = checkIncDec(event, g_eeGeneral.inactivityTimer, 0, 250, EE_GENERAL); //0..250minutes
break; break;
case ITEM_SETUP_BACKLIGHT_LABEL: case ITEM_SETUP_BACKLIGHT_LABEL:
lcd_putsLeft(y, STR_BACKLIGHT_LABEL); lcdDrawTextAlignedLeft(y, STR_BACKLIGHT_LABEL);
break; break;
case ITEM_SETUP_BACKLIGHT_MODE: case ITEM_SETUP_BACKLIGHT_MODE:
@ -362,14 +362,14 @@ void menuGeneralSetup(uint8_t event)
break; break;
case ITEM_SETUP_BACKLIGHT_DELAY: case ITEM_SETUP_BACKLIGHT_DELAY:
lcd_putsLeft(y, STR_BLDELAY); lcdDrawTextAlignedLeft(y, STR_BLDELAY);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.lightAutoOff*5, attr|LEFT); lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.lightAutoOff*5, attr|LEFT);
lcdDrawChar(lcdLastPos, y, 's'); lcdDrawChar(lcdLastPos, y, 's');
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.lightAutoOff, 0, 600/5); if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.lightAutoOff, 0, 600/5);
break; break;
case ITEM_SETUP_BRIGHTNESS: case ITEM_SETUP_BRIGHTNESS:
lcd_putsLeft(y, STR_BRIGHTNESS); lcdDrawTextAlignedLeft(y, STR_BRIGHTNESS);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 100-g_eeGeneral.backlightBright, attr|LEFT) ; lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 100-g_eeGeneral.backlightBright, attr|LEFT) ;
if (attr) { if (attr) {
uint8_t b = 100 - g_eeGeneral.backlightBright; uint8_t b = 100 - g_eeGeneral.backlightBright;
@ -380,7 +380,7 @@ void menuGeneralSetup(uint8_t event)
#if defined(PCBX9DP) || defined(PCBX9E) #if defined(PCBX9DP) || defined(PCBX9E)
case ITEM_SETUP_BACKLIGHT_COLOR: case ITEM_SETUP_BACKLIGHT_COLOR:
lcd_putsLeft(y, STR_BLCOLOR); lcdDrawTextAlignedLeft(y, STR_BLCOLOR);
drawSlider(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.backlightColor, 20, attr); drawSlider(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.backlightColor, 20, attr);
if (attr) g_eeGeneral.backlightColor = checkIncDec(event, g_eeGeneral.backlightColor, 0, 20, EE_GENERAL | NO_INCDEC_MARKS); if (attr) g_eeGeneral.backlightColor = checkIncDec(event, g_eeGeneral.backlightColor, 0, 20, EE_GENERAL | NO_INCDEC_MARKS);
break; break;
@ -389,7 +389,7 @@ void menuGeneralSetup(uint8_t event)
#if defined(SPLASH) && !defined(FSPLASH) #if defined(SPLASH) && !defined(FSPLASH)
case ITEM_SETUP_DISABLE_SPLASH: case ITEM_SETUP_DISABLE_SPLASH:
{ {
lcd_putsLeft(y, STR_SPLASHSCREEN); lcdDrawTextAlignedLeft(y, STR_SPLASHSCREEN);
if (SPLASH_NEEDED()) { if (SPLASH_NEEDED()) {
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, SPLASH_TIMEOUT/100, attr|LEFT); lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, SPLASH_TIMEOUT/100, attr|LEFT);
lcdDrawChar(lcdLastPos, y, 's'); lcdDrawChar(lcdLastPos, y, 's');
@ -404,11 +404,11 @@ void menuGeneralSetup(uint8_t event)
#if defined(TELEMETRY_FRSKY) && defined(FRSKY_HUB) && defined(GPS) #if defined(TELEMETRY_FRSKY) && defined(FRSKY_HUB) && defined(GPS)
case ITEM_SETUP_LABEL_GPS: case ITEM_SETUP_LABEL_GPS:
lcd_putsLeft(y, STR_GPS); lcdDrawTextAlignedLeft(y, STR_GPS);
break; break;
case ITEM_SETUP_TIMEZONE: case ITEM_SETUP_TIMEZONE:
lcd_putsLeft(y, STR_TIMEZONE); lcdDrawTextAlignedLeft(y, STR_TIMEZONE);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.timezone, attr|LEFT); lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.timezone, attr|LEFT);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.timezone, -12, 12); if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.timezone, -12, 12);
break; break;
@ -429,7 +429,7 @@ void menuGeneralSetup(uint8_t event)
#endif #endif
case ITEM_SETUP_LANGUAGE: case ITEM_SETUP_LANGUAGE:
lcd_putsLeft(y, STR_VOICELANG); lcdDrawTextAlignedLeft(y, STR_VOICELANG);
lcdDrawText(RADIO_SETUP_2ND_COLUMN, y, currentLanguagePack->name, attr); lcdDrawText(RADIO_SETUP_2ND_COLUMN, y, currentLanguagePack->name, attr);
if (attr) { if (attr) {
currentLanguagePackIdx = checkIncDec(event, currentLanguagePackIdx, 0, DIM(languagePacks)-2, EE_GENERAL); currentLanguagePackIdx = checkIncDec(event, currentLanguagePackIdx, 0, DIM(languagePacks)-2, EE_GENERAL);
@ -463,14 +463,14 @@ void menuGeneralSetup(uint8_t event)
#endif #endif
case ITEM_SETUP_SWITCHES_DELAY: case ITEM_SETUP_SWITCHES_DELAY:
lcd_putsLeft(y, STR_SWITCHES_DELAY); lcdDrawTextAlignedLeft(y, STR_SWITCHES_DELAY);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 10*SWITCHES_DELAY(), attr|LEFT); lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 10*SWITCHES_DELAY(), attr|LEFT);
lcdDrawText(lcdLastPos, y, STR_MS, attr); lcdDrawText(lcdLastPos, y, STR_MS, attr);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.switchesDelay, -15, 100-15); if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.switchesDelay, -15, 100-15);
break; break;
case ITEM_SETUP_RX_CHANNEL_ORD: case ITEM_SETUP_RX_CHANNEL_ORD:
lcd_putsLeft(y, STR_RXCHANNELORD); // RAET->AETR lcdDrawTextAlignedLeft(y, STR_RXCHANNELORD); // RAET->AETR
for (uint8_t i=1; i<=4; i++) { for (uint8_t i=1; i<=4; i++) {
putsChnLetter(RADIO_SETUP_2ND_COLUMN - FW + i*FW, y, channel_order(i), attr); putsChnLetter(RADIO_SETUP_2ND_COLUMN - FW + i*FW, y, channel_order(i), attr);
} }
@ -478,7 +478,7 @@ void menuGeneralSetup(uint8_t event)
break; break;
case ITEM_SETUP_STICK_MODE_LABELS: case ITEM_SETUP_STICK_MODE_LABELS:
lcd_putsLeft(y, NO_INDENT(STR_MODE)); lcdDrawTextAlignedLeft(y, NO_INDENT(STR_MODE));
for (uint8_t i=0; i<4; i++) { for (uint8_t i=0; i<4; i++) {
lcd_img((6+4*i)*FW, y, sticks, i, 0); lcd_img((6+4*i)*FW, y, sticks, i, 0);
} }

View file

@ -22,12 +22,12 @@
#define TRAINER_CALIB_POS 12 #define TRAINER_CALIB_POS 12
void menuGeneralTrainer(uint8_t event) void menuRadioTrainer(uint8_t event)
{ {
uint8_t y; uint8_t y;
bool slave = SLAVE_MODE(); bool slave = SLAVE_MODE();
MENU(STR_MENUTRAINER, menuTabGeneral, e_Trainer, (slave ? 0 : 6), { 2, 2, 2, 2, 0/*, 0*/ }); MENU(STR_MENUTRAINER, menuTabGeneral, MENU_RADIO_TRAINER, (slave ? 0 : 6), { 2, 2, 2, 2, 0/*, 0*/ });
if (slave) { if (slave) {
lcdDrawText(7*FW, 4*FH, STR_SLAVE); lcdDrawText(7*FW, 4*FH, STR_SLAVE);
@ -73,7 +73,7 @@ void menuGeneralTrainer(uint8_t event)
} }
attr = (sub==5) ? blink : 0; attr = (sub==5) ? blink : 0;
lcd_putsLeft(MENU_HEADER_HEIGHT+1+5*FH, STR_MULTIPLIER); lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+1+5*FH, STR_MULTIPLIER);
lcdDrawNumber(LEN_MULTIPLIER*FW+3*FW, MENU_HEADER_HEIGHT+1+5*FH, g_eeGeneral.PPM_Multiplier+10, attr|PREC1|RIGHT); lcdDrawNumber(LEN_MULTIPLIER*FW+3*FW, MENU_HEADER_HEIGHT+1+5*FH, g_eeGeneral.PPM_Multiplier+10, attr|PREC1|RIGHT);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.PPM_Multiplier, -10, 40); if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.PPM_Multiplier, -10, 40);

View file

@ -65,11 +65,11 @@ void backupEeprom()
storageCheck(true); storageCheck(true);
} }
void menuGeneralVersion(uint8_t event) void menuRadioVersion(uint8_t event)
{ {
if (warningResult) { if (warningResult) {
warningResult = 0; warningResult = 0;
displayPopup(STR_STORAGE_FORMAT); showMessageBox(STR_STORAGE_FORMAT);
storageEraseAll(false); storageEraseAll(false);
#if !defined(SIMU) #if !defined(SIMU)
NVIC_SystemReset(); NVIC_SystemReset();
@ -82,14 +82,14 @@ void menuGeneralVersion(uint8_t event)
getCPUUniqueID(reusableBuffer.version.id); getCPUUniqueID(reusableBuffer.version.id);
} }
SIMPLE_MENU(STR_MENUVERSION, menuTabGeneral, e_Vers, 1); SIMPLE_MENU(STR_MENUVERSION, menuTabGeneral, MENU_RADIO_VERSION, 1);
lcd_putsLeft(MENU_HEADER_HEIGHT+1, vers_stamp); lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+1, vers_stamp);
lcd_putsLeft(MENU_HEADER_HEIGHT+4*FH+1, "UID\037\033:"); lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+4*FH+1, "UID\037\033:");
lcdDrawText(5*FW+3, MENU_HEADER_HEIGHT+4*FH+1, reusableBuffer.version.id); lcdDrawText(5*FW+3, MENU_HEADER_HEIGHT+4*FH+1, reusableBuffer.version.id);
lcd_putsLeft(MENU_HEADER_HEIGHT+5*FH+1, STR_EEBACKUP); lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+5*FH+1, STR_EEBACKUP);
lcd_putsLeft(MENU_HEADER_HEIGHT+6*FH+1, STR_FACTORYRESET); lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+6*FH+1, STR_FACTORYRESET);
lcdDrawFilledRect(0, MENU_HEADER_HEIGHT+5*FH, LCD_W, 2*FH+1, SOLID); lcdDrawFilledRect(0, MENU_HEADER_HEIGHT+5*FH, LCD_W, 2*FH+1, SOLID);
if (event == EVT_KEY_LONG(KEY_ENTER)) { if (event == EVT_KEY_LONG(KEY_ENTER)) {

View file

@ -411,12 +411,12 @@ void displaySwitch(coord_t x, coord_t y, int width, unsigned int index)
} }
const MenuItem MAIN_MENU[] = { const MenuItem MAIN_MENU[] = {
{ "RADIO SETTINGS", menuGeneralSetup }, { "RADIO SETTINGS", menuRadioSetup },
{ "MODEL SELECT", menuModelSelect }, { "MODEL SELECT", menuModelSelect },
{ "MODEL SETTINGS", menuModelSetup }, { "MODEL SETTINGS", menuModelSetup },
{ "CHECKLIST", menuModelNotes }, { "CHECKLIST", menuModelNotes },
{ "SD MANAGER", menuGeneralSdManager }, { "SD MANAGER", menuRadioSdManager },
{ "VERSION", menuGeneralVersion } { "VERSION", menuRadioVersion }
}; };
bool isMenuAvailable(int index) bool isMenuAvailable(int index)
@ -473,7 +473,7 @@ void menuMainView(uint8_t event)
break; break;
case EVT_KEY_LONG(KEY_MENU): case EVT_KEY_LONG(KEY_MENU):
pushMenu(menuGeneralSetup); pushMenu(menuRadioSetup);
killEvents(event); killEvents(event);
break; break;
#endif #endif
@ -489,7 +489,7 @@ void menuMainView(uint8_t event)
case EVT_KEY_LONG(KEY_PAGE): case EVT_KEY_LONG(KEY_PAGE):
if (!IS_FAI_ENABLED()) if (!IS_FAI_ENABLED())
chainMenu(menuTelemetryFrsky); chainMenu(menuViewTelemetryFrsky);
killEvents(event); killEvents(event);
break; break;

View file

@ -149,24 +149,24 @@ void menuStatisticsDebug(uint8_t event)
#endif #endif
} }
lcd_putsLeft(MENU_DEBUG_Y_FREE_RAM, "Free Mem"); lcdDrawTextAlignedLeft(MENU_DEBUG_Y_FREE_RAM, "Free Mem");
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_FREE_RAM, availableMemory(), LEFT); lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_FREE_RAM, availableMemory(), LEFT);
lcdDrawText(lcdLastPos, MENU_DEBUG_Y_FREE_RAM, "b"); lcdDrawText(lcdLastPos, MENU_DEBUG_Y_FREE_RAM, "b");
#if defined(LUA) #if defined(LUA)
lcd_putsLeft(MENU_DEBUG_Y_LUA, "Lua scripts"); lcdDrawTextAlignedLeft(MENU_DEBUG_Y_LUA, "Lua scripts");
lcdDrawText(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_LUA+1, "[Duration]", SMLSIZE); lcdDrawText(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_LUA+1, "[Duration]", SMLSIZE);
lcdDrawNumber(lcdLastPos, MENU_DEBUG_Y_LUA, 10*maxLuaDuration, LEFT); lcdDrawNumber(lcdLastPos, MENU_DEBUG_Y_LUA, 10*maxLuaDuration, LEFT);
lcdDrawText(lcdLastPos+2, MENU_DEBUG_Y_LUA+1, "[Interval]", SMLSIZE); lcdDrawText(lcdLastPos+2, MENU_DEBUG_Y_LUA+1, "[Interval]", SMLSIZE);
lcdDrawNumber(lcdLastPos, MENU_DEBUG_Y_LUA, 10*maxLuaInterval, LEFT); lcdDrawNumber(lcdLastPos, MENU_DEBUG_Y_LUA, 10*maxLuaInterval, LEFT);
#endif #endif
lcd_putsLeft(MENU_DEBUG_Y_MIXMAX, STR_TMIXMAXMS); lcdDrawTextAlignedLeft(MENU_DEBUG_Y_MIXMAX, STR_TMIXMAXMS);
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_MIXMAX, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT); lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_MIXMAX, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT);
lcdDrawText(lcdLastPos, MENU_DEBUG_Y_MIXMAX, "ms"); lcdDrawText(lcdLastPos, MENU_DEBUG_Y_MIXMAX, "ms");
#if !defined(SIMU) && defined(USB_SERIAL) #if !defined(SIMU) && defined(USB_SERIAL)
lcd_putsLeft(MENU_DEBUG_Y_USB, "Usb"); lcdDrawTextAlignedLeft(MENU_DEBUG_Y_USB, "Usb");
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_USB, charsWritten, LEFT); lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_USB, charsWritten, LEFT);
lcdDrawText(lcdLastPos, MENU_DEBUG_Y_USB, " "); lcdDrawText(lcdLastPos, MENU_DEBUG_Y_USB, " ");
lcdDrawNumber(lcdLastPos, MENU_DEBUG_Y_USB, APP_Rx_ptr_in, LEFT); lcdDrawNumber(lcdLastPos, MENU_DEBUG_Y_USB, APP_Rx_ptr_in, LEFT);
@ -174,7 +174,7 @@ void menuStatisticsDebug(uint8_t event)
lcdDrawNumber(lcdLastPos, MENU_DEBUG_Y_USB, usbWraps, LEFT); lcdDrawNumber(lcdLastPos, MENU_DEBUG_Y_USB, usbWraps, LEFT);
#endif #endif
lcd_putsLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB); lcdDrawTextAlignedLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB);
lcdDrawText(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+1, "[M]", SMLSIZE); lcdDrawText(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+1, "[M]", SMLSIZE);
lcdDrawNumber(lcdLastPos, MENU_DEBUG_Y_RTOS, menusStack.available(), LEFT); lcdDrawNumber(lcdLastPos, MENU_DEBUG_Y_RTOS, menusStack.available(), LEFT);
lcdDrawText(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[X]", SMLSIZE); lcdDrawText(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[X]", SMLSIZE);

View file

@ -204,7 +204,7 @@ enum NavigationDirection {
#define decrTelemetryScreen() direction = up #define decrTelemetryScreen() direction = up
#define incrTelemetryScreen() direction = down #define incrTelemetryScreen() direction = down
void menuTelemetryFrsky(uint8_t event) void menuViewTelemetryFrsky(uint8_t event)
{ {
enum NavigationDirection direction = none; enum NavigationDirection direction = none;

View file

@ -97,7 +97,7 @@ void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uin
void drawProgressBar(const char *label) void drawProgressBar(const char *label)
{ {
lcd_putsLeft(4*FH, label); lcdDrawTextAlignedLeft(4*FH, label);
lcdDrawRect(3, 6*FH+4, 204, 7); lcdDrawRect(3, 6*FH+4, 204, 7);
lcdRefresh(); lcdRefresh();
} }
@ -131,7 +131,7 @@ void title(const pm_char * s)
select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char *label, const pm_char *values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, uint8_t event) select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char *label, const pm_char *values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, uint8_t event)
{ {
lcd_putsColumnLeft(x, y, label); drawFieldLabel(x, y, label);
if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr); if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr);
if (attr) value = checkIncDec(event, value, min, max, (menuVerticalPositions[0] == 0) ? EE_MODEL : EE_GENERAL); if (attr) value = checkIncDec(event, value, min, max, (menuVerticalPositions[0] == 0) ? EE_MODEL : EE_GENERAL);
return value; return value;
@ -145,7 +145,7 @@ uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const pm_char *label,
swsrc_t switchMenuItem(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, uint8_t event) swsrc_t switchMenuItem(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, uint8_t event)
{ {
lcd_putsColumnLeft(x, y, STR_SWITCH); drawFieldLabel(x, y, STR_SWITCH);
putsSwitches(x, y, value, attr); putsSwitches(x, y, value, attr);
if (attr) CHECK_INCDEC_MODELSWITCH(event, value, SWSRC_FIRST_IN_MIXES, SWSRC_LAST_IN_MIXES, isSwitchAvailableInMixes); if (attr) CHECK_INCDEC_MODELSWITCH(event, value, SWSRC_FIRST_IN_MIXES, SWSRC_LAST_IN_MIXES, isSwitchAvailableInMixes);
return value; return value;

View file

@ -75,11 +75,13 @@
#if defined(FLIGHT_MODES) #if defined(FLIGHT_MODES)
void displayFlightModes(coord_t x, coord_t y, FlightModesType value, uint8_t attr); 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 #else
#define displayFlightModes(...) #define displayFlightModes(...)
#endif #endif
#define ALERT_SOUND_ARG , uint8_t sound
// Curve functions // Curve functions
coord_t getCurveYCoord(FnFuncP fn, int x, int width); coord_t getCurveYCoord(FnFuncP fn, int x, int width);
void drawFunction(FnFuncP fn, int offset); 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 Layout * customScreens[MAX_CUSTOM_SCREENS];
extern Topbar * topbar; 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_MAIN_VIEW_DISPLAYED() menuHandlers[0] == menuMainView
#define IS_TELEMETRY_VIEW_DISPLAYED() false #define IS_TELEMETRY_VIEW_DISPLAYED() false
#define IS_OTHER_VIEW_DISPLAYED() false #define IS_OTHER_VIEW_DISPLAYED() false

View file

@ -32,20 +32,20 @@ const MenuHandlerFunc menuTabModel[] = {
CASE_GVARS(menuModelGVars) CASE_GVARS(menuModelGVars)
#endif #endif
menuModelLogicalSwitches, menuModelLogicalSwitches,
menuModelCustomFunctions, menuModelSpecialFunctions,
#if defined(LUA_MODEL_SCRIPTS) #if defined(LUA_MODEL_SCRIPTS)
menuModelCustomScripts, menuModelCustomScripts,
#endif #endif
CASE_FRSKY(menuModelTelemetry) CASE_FRSKY(menuModelTelemetryFrsky)
CASE_MAVLINK(menuTelemetryMavlinkSetup) CASE_MAVLINK(menuModelTelemetryMavlink)
CASE_TEMPLATES(menuModelTemplates) CASE_TEMPLATES(menuModelTemplates)
}; };
extern uint8_t s_curveChan; 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); lcdDrawNumber(x+MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT);
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, delay, DELAY_MAX); if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, delay, DELAY_MAX);
@ -60,7 +60,7 @@ uint8_t s_copySrcCh;
uint8_t editNameCursorPos = 0; 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) { if (active && s_editMode <= 0) {
flags |= INVERS; flags |= INVERS;

View file

@ -21,16 +21,16 @@
#include "opentx.h" #include "opentx.h"
const MenuHandlerFunc menuTabGeneral[] = { const MenuHandlerFunc menuTabGeneral[] = {
menuGeneralSetup, menuRadioSetup,
menuGeneralSdManager, menuRadioSdManager,
menuGeneralCustomFunctions, menuRadioSpecialFunctions,
menuGeneralTrainer, menuRadioTrainer,
menuGeneralHardware, menuRadioHardware,
menuGeneralVersion, 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*/ }); MENU(STR_MENUSPECIALFUNCS, RADIO_ICONS, menuTabGeneral, MENU_RADIO_SPECIAL_FUNCTIONS, NUM_CFN, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ });
return menuCustomFunctions(event, g_eeGeneral.customFn, globalFunctionsContext); return menuSpecialFunctions(event, g_eeGeneral.customFn, globalFunctionsContext);
} }

View file

@ -21,7 +21,7 @@
#include "opentx.h" #include "opentx.h"
MenuHandlerFunc menuHandlers[5]; MenuHandlerFunc menuHandlers[5];
evt_t menuEvent = 0; event_t menuEvent = 0;
uint8_t menuVerticalPositions[4]; uint8_t menuVerticalPositions[4];
uint8_t menuLevel = 0; uint8_t menuLevel = 0;
@ -47,7 +47,7 @@ void pushMenu(MenuHandlerFunc newMenu)
killEvents(KEY_ENTER); killEvents(KEY_ENTER);
if (menuLevel == 0) { if (menuLevel == 0) {
if (newMenu == menuGeneralSetup) if (newMenu == menuRadioSetup)
menuVerticalPositions[0] = 1; menuVerticalPositions[0] = 1;
if (newMenu == menuModelSetup) if (newMenu == menuModelSetup)
menuVerticalPositions[0] = 0; menuVerticalPositions[0] = 0;
@ -66,7 +66,7 @@ void pushMenu(MenuHandlerFunc newMenu)
TRACE("pushMenu(%d, %p)", menuLevel, newMenu); TRACE("pushMenu(%d, %p)", menuLevel, newMenu);
} }
bool menuModelNotes(evt_t event) bool menuModelNotes(event_t event)
{ {
if (event == EVT_ENTRY) { if (event == EVT_ENTRY) {
strcpy(s_text_file, MODELS_PATH "/"); strcpy(s_text_file, MODELS_PATH "/");

View file

@ -24,13 +24,10 @@
#include "keys.h" #include "keys.h"
#define MENU_COLUMNS 2 #define MENU_COLUMNS 2
#define MENU_COLUMN2_X 280 #define MENU_COLUMN2_X 280
#define MIXES_2ND_COLUMN 140 #define MIXES_2ND_COLUMN 140
#define COLUMN_HEADER_X 150 #define COLUMN_HEADER_X 150
typedef evt_t & check_event_t;
extern uint8_t menuPageIndex; extern uint8_t menuPageIndex;
extern uint8_t menuPageCount; extern uint8_t menuPageCount;
extern uint16_t linesCount; extern uint16_t linesCount;
@ -44,12 +41,12 @@ extern uint8_t noHighlightCounter;
#define NO_HIGHLIGHT() (noHighlightCounter > 0) #define NO_HIGHLIGHT() (noHighlightCounter > 0)
#define START_NO_HIGHLIGHT() do { noHighlightCounter = 25; } while(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 MenuHandlerFunc menuHandlers[5];
extern uint8_t menuVerticalPositions[4]; extern uint8_t menuVerticalPositions[4];
extern uint8_t menuLevel; extern uint8_t menuLevel;
extern evt_t menuEvent; extern event_t menuEvent;
/// goto given Menu, but substitute current menu in menuStack /// goto given Menu, but substitute current menu in menuStack
void chainMenu(MenuHandlerFunc newMenu); void chainMenu(MenuHandlerFunc newMenu);
@ -104,21 +101,21 @@ enum MenuIcons {
}; };
enum EnumTabModel { enum EnumTabModel {
e_ModelSetup, MENU_MODEL_SETUP,
CASE_HELI(e_Heli) CASE_HELI(MENU_MODEL_HELI)
CASE_FLIGHT_MODES(e_FlightModesAll) CASE_FLIGHT_MODES(MENU_MODEL_FLIGHT_MODES)
e_InputsAll, MENU_MODEL_INPUTS,
e_MixAll, MENU_MODEL_MIXES,
e_Limits, MENU_MODEL_OUTPUTS,
CASE_CURVES(e_CurvesAll) CASE_CURVES(MENU_MODEL_CURVES)
CASE_GVARS(e_GVars) CASE_GVARS(MENU_MODEL_GVARS)
e_LogicalSwitches, MENU_MODEL_LOGICAL_SWITCHES,
e_CustomFunctions, MENU_MODEL_SPECIAL_FUNCTIONS,
#if defined(LUA_MODEL_SCRIPTS) #if defined(LUA_MODEL_SCRIPTS)
e_CustomScripts, MENU_MODEL_CUSTOM_SCRIPTS,
#endif #endif
CASE_FRSKY(e_Telemetry) CASE_FRSKY(MENU_MODEL_TELEMETRY_FRSKY)
e_TabModelPagesCount MENU_MODEL_PAGES_COUNT
}; };
const uint8_t RADIO_ICONS[] = { const uint8_t RADIO_ICONS[] = {
@ -168,44 +165,44 @@ const uint8_t MONITOR_ICONS[] = {
ICON_MONITOR_LOGICAL_SWITCHES ICON_MONITOR_LOGICAL_SWITCHES
}; };
bool menuModelSetup(evt_t event); bool menuModelSetup(event_t event);
bool menuModelHeli(evt_t event); bool menuModelHeli(event_t event);
bool menuModelFlightModesAll(evt_t event); bool menuModelFlightModesAll(event_t event);
bool menuModelExposAll(evt_t event); bool menuModelExposAll(event_t event);
bool menuModelMixAll(evt_t event); bool menuModelMixAll(event_t event);
bool menuModelLimits(evt_t event); bool menuModelLimits(event_t event);
bool menuModelCurvesAll(evt_t event); bool menuModelCurvesAll(event_t event);
bool menuModelCurveOne(evt_t event); bool menuModelCurveOne(event_t event);
bool menuModelGVars(evt_t event); bool menuModelGVars(event_t event);
bool menuModelLogicalSwitches(evt_t event); bool menuModelLogicalSwitches(event_t event);
bool menuModelCustomFunctions(evt_t event); bool menuModelSpecialFunctions(event_t event);
bool menuModelCustomScripts(evt_t event); bool menuModelCustomScripts(event_t event);
bool menuModelTelemetry(evt_t event); bool menuModelTelemetryFrsky(event_t event);
bool menuModelExpoOne(evt_t event); bool menuModelExpoOne(event_t event);
extern const MenuHandlerFunc menuTabModel[e_TabModelPagesCount]; extern const MenuHandlerFunc menuTabModel[MENU_MODEL_PAGES_COUNT];
enum EnumTabRadio { enum EnumTabRadio {
e_Setup, MENU_RADIO_SETUP,
e_Sd, MENU_RADIO_SD_MANAGER,
e_GeneralCustomFunctions, MENU_RADIO_SPECIAL_FUNCTIONS,
e_Trainer, MENU_RADIO_TRAINER,
e_Hardware, MENU_RADIO_HARDWARE,
e_Vers, MENU_RADIO_VERSION,
e_TabRadioPagesCount MENU_RADIO_PAGES_COUNT
}; };
bool menuGeneralSetup(evt_t event); bool menuRadioSetup(event_t event);
bool menuGeneralSdManager(evt_t event); bool menuRadioSdManager(event_t event);
bool menuGeneralCustomFunctions(evt_t event); bool menuRadioSpecialFunctions(event_t event);
bool menuGeneralTrainer(evt_t event); bool menuRadioTrainer(event_t event);
bool menuGeneralVersion(evt_t event); bool menuRadioVersion(event_t event);
bool menuGeneralHardware(evt_t event); bool menuRadioHardware(event_t event);
bool menuGeneralCalib(evt_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_StatsGraph,
e_StatsDebug, e_StatsDebug,
@ -215,10 +212,10 @@ enum EnumTabDiag
#endif #endif
}; };
bool menuStatsGraph(evt_t event); bool menuStatsGraph(event_t event);
bool menuStatsDebug(evt_t event); bool menuStatsDebug(event_t event);
bool menuStatsAnalogs(evt_t event); bool menuStatsAnalogs(event_t event);
bool menuStatsTraces(evt_t event); bool menuStatsTraces(event_t event);
static const MenuHandlerFunc menuTabStats[] PROGMEM = { static const MenuHandlerFunc menuTabStats[] PROGMEM = {
menuStatsGraph, 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; extern const MenuHandlerFunc menuTabScreensSetup[1+MAX_CUSTOM_SCREENS] PROGMEM;
bool menuFirstCalib(evt_t event); bool menuFirstCalib(event_t event);
bool menuMainView(evt_t event); bool menuMainView(event_t event);
bool menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunctionsContext & functionsContext); bool menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomFunctionsContext & functionsContext);
bool menuModelSelect(evt_t event); bool menuModelSelect(event_t event);
bool menuAboutView(evt_t event); bool menuAboutView(event_t event);
bool menuMainViewChannelsMonitor(evt_t event); bool menuMainViewChannelsMonitor(event_t event);
bool menuTextView(evt_t event); bool menuTextView(event_t event);
bool menuScreensTheme(evt_t event); bool menuScreensTheme(event_t event);
typedef uint16_t FlightModesType; typedef uint16_t FlightModesType;
@ -315,7 +312,7 @@ extern const CheckIncDecStops &stopsSwitch;
#define CATEGORY_END(val) \ #define CATEGORY_END(val) \
(val), (val+1) (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); 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 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) #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) \ #define CHECK_INCDEC_PARAM(event, var, min, max) \
checkIncDec(event, var, min, max, incdecFlag, isValueAvailable) checkIncDec(event, var, min, max, incdecFlag, isValueAvailable)
int8_t navigate(evt_t event, int count, int rows, int columns=1, bool loop=true); int8_t navigate(event_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(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_simple(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); bool check_submenu_simple(event_t event, uint8_t maxrow);
#define MENU_TAB(...) const uint8_t mstate_tab[] = __VA_ARGS__ #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; 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); 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, evt_t event); uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, LcdFlags attr, event_t event);
#if defined(GVARS) #if defined(GVARS)
#define GVAR_MENU_ITEM(x, y, v, min, max, lcdattr, editflags, event) editGVarFieldValue(x, y, v, min, max, lcdattr, editflags, event) #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 #endif
#if defined(GVARS) #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) #define displayGVar(x, y, v, min, max) GVAR_MENU_ITEM(x, y, v, min, max, 0, 0, 0)
#else #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) #define displayGVar(x, y, v, min, max) lcdDrawNumber(x, y, v)
#endif #endif
extern uint8_t editNameCursorPos; 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); 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, evt_t event, uint8_t attr); void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, uint8_t attr);
extern uint8_t s_curveChan; 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 copySelection(char * dst, const char * src, uint8_t size);
void displayPopup(const char * title); void showMessageBox(const char * title);
void displayWarning(evt_t event); void runPopupWarning(event_t event);
extern void (* popupFunc)(evt_t event); extern void (* popupFunc)(event_t event);
extern int16_t warningInputValue; extern int16_t warningInputValue;
extern int16_t warningInputValueMin; extern int16_t warningInputValueMin;
extern int16_t warningInputValueMax; extern int16_t warningInputValueMax;
extern uint8_t warningInfoFlags; extern uint8_t warningInfoFlags;
#define DISPLAY_WARNING (*popupFunc) #define DISPLAY_WARNING (*popupFunc)
#define POPUP_WARNING(s) (warningType = WARNING_TYPE_ASTERISK, warningText = s, 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 = displayWarning) #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 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 WARNING_INFO_FLAGS warningInfoFlags
#define SET_WARNING_INFO(info, len, flags) (warningInfoText = info, warningInfoLength = len, warningInfoFlags = flags) #define SET_WARNING_INFO(info, len, flags) (warningInfoText = info, warningInfoLength = len, warningInfoFlags = flags)
@ -503,7 +500,7 @@ enum {
MENU_OFFSET_EXTERNAL MENU_OFFSET_EXTERNAL
}; };
extern uint8_t popupMenuOffsetType; extern uint8_t popupMenuOffsetType;
const char * runPopupMenu(evt_t event); const char * runPopupMenu(event_t event);
extern void (*popupMenuHandler)(const char * result); extern void (*popupMenuHandler)(const char * result);
#define TEXT_FILENAME_MAXLEN 40 #define TEXT_FILENAME_MAXLEN 40

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, "@"); lcdDrawNumber(WARNING_LINE_X, WARNING_INFOLINE_Y-10, 45*warningInputValue/4, LEFT|INVERS, 0, NULL, "@");
if (warningResult) { if (warningResult) {
@ -140,7 +140,7 @@ enum MenuModelCurveOneItems {
ITEM_CURVE_COORDS2, ITEM_CURVE_COORDS2,
}; };
bool menuModelCurveOne(evt_t event) bool menuModelCurveOne(event_t event)
{ {
static uint8_t pointsOfs = 0; static uint8_t pointsOfs = 0;
CurveData & crv = g_model.curves[s_curveChan]; CurveData & crv = g_model.curves[s_curveChan];
@ -312,7 +312,7 @@ bool menuModelCurveOne(evt_t event)
return true; 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)); lcdDrawTextAtIndex(x, y, "\004DiffExpoFuncCstm", curve.type, (menuHorizontalPosition==0 ? attr : 0));
if (attr && menuHorizontalPosition==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_NAME_POS 60
#define CURVES_POINTS_POS 120 #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; int8_t sub = menuVerticalPosition;

View file

@ -47,7 +47,7 @@ enum menuModelCustomScriptItems {
#define SCRIPT_ONE_2ND_COLUMN_POS (120) #define SCRIPT_ONE_2ND_COLUMN_POS (120)
#define SCRIPT_ONE_3RD_COLUMN_POS (240) #define SCRIPT_ONE_3RD_COLUMN_POS (240)
bool menuModelCustomScriptOne(evt_t event) bool menuModelCustomScriptOne(event_t event)
{ {
ScriptData &sd = g_model.scriptsData[s_currIdx]; ScriptData &sd = g_model.scriptsData[s_currIdx];
@ -122,12 +122,12 @@ bool menuModelCustomScriptOne(evt_t event)
#define SCRIPTS_COLUMN_NAME 160 #define SCRIPTS_COLUMN_NAME 160
#define SCRIPTS_COLUMN_STATE 300 #define SCRIPTS_COLUMN_STATE 300
bool menuModelCustomScripts(evt_t event) bool menuModelCustomScripts(event_t event)
{ {
// lcdDrawNumber(19*FW, 0, luaGetMemUsed(), 0); // lcdDrawNumber(19*FW, 0, luaGetMemUsed(), 0);
// lcdDrawText(19*FW+1, 0, STR_BYTES); // 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; int8_t sub = menuVerticalPosition;

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); displayFlightModes(x, y, value, attr);
@ -76,9 +76,9 @@ bool isTrimModeAvailable(int mode)
#define FLIGHT_MODES_FADEIN_COLUMN 420 #define FLIGHT_MODES_FADEIN_COLUMN 420
#define FLIGHT_MODES_FADEOUT_COLUMN 460 #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) { if (menuVerticalPosition==0 && menuHorizontalPosition==ITEM_FLIGHT_MODES_SWITCH) {
menuHorizontalPosition += CURSOR_MOVED_LEFT(event) ? -1 : +1; menuHorizontalPosition += CURSOR_MOVED_LEFT(event) ? -1 : +1;

View file

@ -42,9 +42,9 @@ void onGVARSMenu(const char *result)
#define GVARS_FM_COLUMN(p) (160 + (p)*38) #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; int sub = menuVerticalPosition;

View file

@ -34,9 +34,9 @@ enum menuModelHeliItems {
#define MODEL_HELI_2ND_COLUMN (230) #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; int sub = menuVerticalPosition;

View file

@ -171,7 +171,7 @@ enum ExposFields {
#define CURVE_ROWS 1 #define CURVE_ROWS 1
bool menuModelExpoOne(evt_t event) bool menuModelExpoOne(event_t event)
{ {
ExpoData * ed = expoAddress(s_currIdx); 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; int sub = menuVerticalPosition;
@ -370,7 +370,7 @@ bool menuModelExposAll(evt_t event)
uint8_t chn = expoAddress(s_currIdx)->chn + 1; uint8_t chn = expoAddress(s_currIdx)->chn + 1;
int linesCount = getExposLinesCount(); 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) { switch (event) {
case EVT_ENTRY: case EVT_ENTRY:

View file

@ -72,11 +72,11 @@ void onLogicalSwitchesMenu(const char *result)
} }
} }
bool menuModelLogicalSwitches(evt_t event) bool menuModelLogicalSwitches(event_t event)
{ {
INCDEC_DECLARE_VARS(EE_MODEL); 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); LogicalSwitchData * cs = lswAddress(menuVerticalPosition);
uint8_t cstate = lswFamily(cs->func); uint8_t cstate = lswFamily(cs->func);

View file

@ -162,7 +162,7 @@ enum MixFields {
MIX_FIELD_COUNT 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; u_int8int16_t weight;
MD_WEIGHT_TO_UNION(md, 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); MD_UNION_TO_WEIGHT(weight, md);
} }
bool menuModelMixOne(evt_t event) bool menuModelMixOne(event_t event)
{ {
MixData * md2 = mixAddress(s_currIdx) ; 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); 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[] = { BitmapBuffer * mpx_mode[] = {
mixerSetupAddBitmap, mixerSetupAddBitmap,
@ -399,7 +399,7 @@ bool menuModelMixAll(evt_t event)
uint8_t chn = mixAddress(s_currIdx)->destCh + 1; uint8_t chn = mixAddress(s_currIdx)->destCh + 1;
int linesCount = getMixesLinesCount(); 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) { switch (event) {
case EVT_ENTRY: case EVT_ENTRY:

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, 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,

View file

@ -179,7 +179,7 @@ void initModelsList()
} }
} }
bool menuModelSelect(evt_t event) bool menuModelSelect(event_t event)
{ {
if (warningResult) { if (warningResult) {
warningResult = 0; warningResult = 0;

View file

@ -21,7 +21,7 @@
#include "opentx.h" #include "opentx.h"
uint8_t g_moduleIdx; uint8_t g_moduleIdx;
bool menuModelFailsafe(evt_t event); bool menuModelFailsafe(event_t event);
enum menuModelSetupItems { enum menuModelSetupItems {
ITEM_MODEL_NAME, 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]; TimerData & timer = g_model.timers[timerIdx];
if (attr && menuHorizontalPosition < 0) { 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]; TimerData & timer = g_model.timers[timerIdx];
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BEEPCOUNTDOWN); 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 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) #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; int l_posHorz = menuHorizontalPosition;
bool CURSOR_ON_CELL = (menuHorizontalPosition >= 0); 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; 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, { 0, 0, TIMERS_ROWS, 0, 1, 0, 0,
LABEL(Throttle), 0, 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, 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; return true;
} }
bool menuModelFailsafe(evt_t event) bool menuModelFailsafe(event_t event)
{ {
uint8_t ch = 0; uint8_t ch = 0;
uint8_t channelStart = g_model.moduleData[g_moduleIdx].channelsStart; uint8_t channelStart = g_model.moduleData[g_moduleIdx].channelsStart;

View file

@ -32,7 +32,7 @@ void onCustomFunctionsFileSelectionMenu(const char * result)
CustomFunctionData * cf; CustomFunctionData * cf;
uint8_t eeFlags; uint8_t eeFlags;
if (menuHandlers[menuLevel] == menuModelCustomFunctions) { if (menuHandlers[menuLevel] == menuModelSpecialFunctions) {
cf = &g_model.customFn[menuVerticalPosition]; cf = &g_model.customFn[menuVerticalPosition];
eeFlags = EE_MODEL; eeFlags = EE_MODEL;
} }
@ -71,7 +71,7 @@ void onCustomFunctionsMenu(const char *result)
CustomFunctionData * cfn; CustomFunctionData * cfn;
uint8_t eeFlags; uint8_t eeFlags;
if (menuHandlers[menuLevel] == menuModelCustomFunctions) { if (menuHandlers[menuLevel] == menuModelSpecialFunctions) {
cfn = &g_model.customFn[menuVerticalPosition]; cfn = &g_model.customFn[menuVerticalPosition];
eeFlags = EE_MODEL; eeFlags = EE_MODEL;
} }
@ -143,7 +143,7 @@ enum SpecialFunctionsItems {
ITEM_SPECIAL_FUNCTIONS_LAST = ITEM_SPECIAL_FUNCTIONS_COUNT-1 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; 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; 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*/ }); MENU(STR_MENUCUSTOMFUNC, MODEL_ICONS, menuTabModel, MENU_MODEL_SPECIAL_FUNCTIONS, NUM_CFN, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ });
return menuCustomFunctions(event, g_model.customFn, modelFunctionsContext); return menuSpecialFunctions(event, g_model.customFn, modelFunctionsContext);
} }

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
enum menuModelTelemetryItems { enum MenuModelTelemetryFrskyItems {
ITEM_TELEMETRY_PROTOCOL_TYPE, ITEM_TELEMETRY_PROTOCOL_TYPE,
ITEM_TELEMETRY_RSSI_LABEL, ITEM_TELEMETRY_RSSI_LABEL,
ITEM_TELEMETRY_RSSI_ALARM1, ITEM_TELEMETRY_RSSI_ALARM1,
@ -123,7 +123,7 @@ enum SensorFields {
#define SENSOR_FILTER_ROWS (sensor->isConfigurable() ? (uint8_t)0 : HIDDEN_ROW) #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) #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]; 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) { if (warningResult) {
warningResult = 0; 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++) { for (int i=0; i<NUM_BODY_LINES; i++) {
coord_t y = MENU_CONTENT_TOP + i*FH; coord_t y = MENU_CONTENT_TOP + i*FH;

View file

@ -106,7 +106,7 @@ void onSwitchLongEnterPress(const char *result)
checkIncDecSelection = SWSRC_INVERT; 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; int newval = val;
@ -298,7 +298,7 @@ uint8_t menuPageIndex;
uint8_t menuPageCount; uint8_t menuPageCount;
uint16_t linesCount; 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; 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; 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); uint8_t maxcol = MAXCOL(menuVerticalPosition);
@ -563,17 +563,17 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
return true; 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); 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); 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)) { if (CURSOR_MOVED_LEFT(event) || CURSOR_MOVED_RIGHT(event)) {
putEvent(event); putEvent(event);

View file

@ -29,7 +29,7 @@ uint8_t warningInfoFlags = ZCHAR;
int16_t warningInputValue; int16_t warningInputValue;
int16_t warningInputValueMin; int16_t warningInputValueMin;
int16_t warningInputValueMax; int16_t warningInputValueMax;
void (*popupFunc)(evt_t event) = NULL; void (*popupFunc)(event_t event) = NULL;
const char *popupMenuItems[POPUP_MENU_MAX_LINES]; const char *popupMenuItems[POPUP_MENU_MAX_LINES];
uint8_t s_menu_item = 0; uint8_t s_menu_item = 0;
uint16_t popupMenuNoItems = 0; uint16_t popupMenuNoItems = 0;
@ -37,7 +37,7 @@ uint16_t popupMenuOffset = 0;
uint8_t popupMenuOffsetType = MENU_OFFSET_INTERNAL; uint8_t popupMenuOffsetType = MENU_OFFSET_INTERNAL;
void (*popupMenuHandler)(const char * result); void (*popupMenuHandler)(const char * result);
void displayWarningBox() void runPopupWarningBox()
{ {
// theme->drawMessageBox("", "", "", MESSAGEBOX_TYPE_WARNING); // theme->drawMessageBox("", "", "", MESSAGEBOX_TYPE_WARNING);
// lcdDrawSolidFilledRect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, TEXT_BGCOLOR); // 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); 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); drawAlertBox(title, text, action);
AUDIO_ERROR_MESSAGE(sound); AUDIO_ERROR_MESSAGE(sound);
@ -67,14 +67,14 @@ void message(const pm_char * title, const pm_char * text, const char * action, u
clearKeyEvents(); clearKeyEvents();
} }
void displayPopup(const char * title) void showMessageBox(const char * title)
{ {
// displayMessageBox(); // displayMessageBox();
lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y, title, WARNING_LINE_LEN, DBLSIZE|WARNING_COLOR); lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y, title, WARNING_LINE_LEN, DBLSIZE|WARNING_COLOR);
lcdRefresh(); lcdRefresh();
} }
void displayWarning(evt_t event) void runPopupWarning(event_t event)
{ {
warningResult = false; 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; const char * result = NULL;

View file

@ -77,7 +77,7 @@ void drawMouse()
drawStick(STICK_LEFT_X, STICKS_Y+100, background, calibratedStick[11], calibratedStick[12]); 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); drawMenuTemplate(NULL, ICON_RADIO_CALIBRATION, NULL, OPTION_MENU_NO_FOOTER);
@ -227,7 +227,7 @@ bool menuCommonCalib(evt_t event)
return true; 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 (event == EVT_ENTRY || event == EVT_ENTRY_UP) TRACE("Menu %s displayed ...", STR_MENUCALIBRATION);
if (calibrationState == CALIB_FINISHED) { if (calibrationState == CALIB_FINISHED) {
@ -244,7 +244,7 @@ bool menuGeneralCalib(evt_t event)
return menuCommonCalib(READ_ONLY() ? 0 : 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) { if (event == EVT_KEY_BREAK(KEY_EXIT) || calibrationState == CALIB_FINISHED) {
calibrationState = CALIB_START; calibrationState = CALIB_START;

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
enum menuGeneralHwItems { enum menuRadioHwItems {
ITEM_SETUP_HW_CALIBRATION, ITEM_SETUP_HW_CALIBRATION,
ITEM_SETUP_HW_LABEL_STICKS, ITEM_SETUP_HW_LABEL_STICKS,
ITEM_SETUP_HW_STICK1, ITEM_SETUP_HW_STICK1,
@ -57,9 +57,9 @@ enum menuGeneralHwItems {
#define BLUETOOTH_ROWS 1, #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) #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; uint8_t sub = menuVerticalPosition;
@ -75,7 +75,7 @@ bool menuGeneralHardware(evt_t event)
case ITEM_SETUP_HW_CALIBRATION: case ITEM_SETUP_HW_CALIBRATION:
lcdDrawText(MENUS_MARGIN_LEFT, y, "Calibration", attr); lcdDrawText(MENUS_MARGIN_LEFT, y, "Calibration", attr);
if (attr && s_editMode>0) { if (attr && s_editMode>0) {
pushMenu(menuGeneralCalib); pushMenu(menuRadioCalibration);
} }
break; break;
case ITEM_SETUP_HW_LABEL_STICKS: case ITEM_SETUP_HW_LABEL_STICKS:

View file

@ -29,7 +29,7 @@
int currentBitmapIndex = 0; int currentBitmapIndex = 0;
BitmapBuffer * currentBitmap = NULL; BitmapBuffer * currentBitmap = NULL;
bool menuGeneralSdManagerInfo(evt_t event) bool menuRadioSdManagerInfo(event_t event)
{ {
SIMPLE_SUBMENU(STR_SD_INFO_TITLE, ICON_RADIO_SD_BROWSER, 1); 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]; char *line = reusableBuffer.sdmanager.lines[index];
if (result == STR_SD_INFO) { if (result == STR_SD_INFO) {
pushMenu(menuGeneralSdManagerInfo); pushMenu(menuRadioSdManagerInfo);
} }
else if (result == STR_SD_FORMAT) { else if (result == STR_SD_FORMAT) {
POPUP_CONFIRMATION(STR_CONFIRM_FORMAT); POPUP_CONFIRMATION(STR_CONFIRM_FORMAT);
@ -153,11 +153,11 @@ void onSdManagerMenu(const char * result)
#endif #endif
} }
bool menuGeneralSdManager(evt_t _event) bool menuRadioSdManager(event_t _event)
{ {
if (warningResult) { if (warningResult) {
warningResult = 0; warningResult = 0;
displayPopup(STR_FORMATTING); showMessageBox(STR_FORMATTING);
closeLogs(); closeLogs();
audioQueue.stopSD(); audioQueue.stopSD();
if (f_mkfs(0, 1, 0) == FR_OK) { 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); 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, e_Sd, reusableBuffer.sdmanager.count); 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; int index = menuVerticalPosition-menuVerticalOffset;

View file

@ -24,7 +24,7 @@
#define RADIO_SETUP_2ND_COLUMN 220 #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); drawHorizontalSlider(x, y, 100, value, min, max, 0, OPTION_SLIDER_DBL_COLOR|attr);
return selectMenuItem(x, y, NULL, value, min, max, attr, event); 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) #define CASE_SPLASH_PARAM(x)
#endif #endif
enum menuGeneralSetupItems { enum menuRadioSetupItems {
ITEM_SETUP_DATE, ITEM_SETUP_DATE,
ITEM_SETUP_TIME, ITEM_SETUP_TIME,
ITEM_SETUP_BATT_RANGE, ITEM_SETUP_BATT_RANGE,
@ -86,7 +86,7 @@ enum menuGeneralSetupItems {
ITEM_SETUP_MAX ITEM_SETUP_MAX
}; };
bool menuGeneralSetup(evt_t event) bool menuRadioSetup(event_t event)
{ {
#if defined(RTCLOCK) #if defined(RTCLOCK)
struct gtm t; struct gtm t;
@ -108,7 +108,7 @@ bool menuGeneralSetup(evt_t event)
} }
#endif #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, 2|NAVIGATION_LINE_BY_LINE, 2|NAVIGATION_LINE_BY_LINE, 1|NAVIGATION_LINE_BY_LINE,
LABEL(SOUND), 0, 0, 0, 0, 0, 0, 0, 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) CASE_VARIO(LABEL(VARIO)) CASE_VARIO(0) CASE_VARIO(0) CASE_VARIO(0) CASE_VARIO(0)

View file

@ -25,12 +25,12 @@
#define TRAINER_COLUMN_2 TRAINER_COLUMN_1+TRAINER_COLUMN_WIDTH #define TRAINER_COLUMN_2 TRAINER_COLUMN_1+TRAINER_COLUMN_WIDTH
#define TRAINER_COLUMN_3 TRAINER_COLUMN_2+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; uint8_t y;
bool slave = SLAVE_MODE(); 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) { if (slave) {
// TODO lcd_putsCenter(5*FH, STR_SLAVE, TEXT_COLOR); // TODO lcd_putsCenter(5*FH, STR_SLAVE, TEXT_COLOR);

View file

@ -20,11 +20,11 @@
#include "opentx.h" #include "opentx.h"
bool menuGeneralVersion(evt_t event) bool menuRadioVersion(event_t event)
{ {
DEBUG_TIMER_START(debugTimerVersion); DEBUG_TIMER_START(debugTimerVersion);
DEBUG_TIMER_START(debugTimerSimpleMenu); 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_STOP(debugTimerSimpleMenu);
DEBUG_TIMER_START(debugTimerDrawText); DEBUG_TIMER_START(debugTimerDrawText);

View file

@ -42,7 +42,7 @@ char fileSelection[LEN_ZONE_OPTION_STRING];
uint8_t fileSelectionDone; uint8_t fileSelectionDone;
int updateMainviewsMenu(); int updateMainviewsMenu();
bool menuScreenAdd(evt_t event); bool menuScreenAdd(event_t event);
void onScreenSetupMenu(const char * result); void onScreenSetupMenu(const char * result);
void onZoneOptionFileSelectionMenu(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); lcdDrawText(MENUS_MARGIN_LEFT, y, option->name);
@ -174,7 +174,7 @@ int getOptionsCount(const ZoneOption * options)
} }
template <class T> 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(); const ZoneOption * options = object->getOptions();
linesCount = getOptionsCount(options); linesCount = getOptionsCount(options);
@ -202,12 +202,12 @@ bool menuSettings(const char * title, const T * object, uint32_t i_flags, evt_t
return true; return true;
} }
bool menuWidgetSettings(evt_t event) bool menuWidgetSettings(event_t event)
{ {
return menuSettings<Widget>("Widget settings", currentWidget, EE_MODEL, 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 * previousWidget;
static Widget::PersistentData tempData; 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) { switch (event) {
case EVT_ENTRY: case EVT_ENTRY:
@ -351,7 +351,7 @@ bool menuWidgetsSetup(evt_t event)
} }
template <class T> 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; static uint8_t menuHorizontalOffset;
@ -416,7 +416,7 @@ enum menuScreensThemeItems {
ITEM_SCREEN_SETUP_THEME_OPTION1 = ITEM_SCREEN_SETUP_THEME+2 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); bool needsOffsetCheck = (menuVerticalPosition != 0 || menuHorizontalPosition < 0);
const ZoneOption * options = theme->getOptions(); const ZoneOption * options = theme->getOptions();
@ -486,7 +486,7 @@ enum MenuScreenSetupItems {
ITEM_SCREEN_SETUP_LAYOUT_OPTION1, ITEM_SCREEN_SETUP_LAYOUT_OPTION1,
}; };
bool menuScreenSetup(int index, evt_t event) bool menuScreenSetup(int index, event_t event)
{ {
if (customScreens[index] == NULL) { if (customScreens[index] == NULL) {
return menuScreenAdd(event); return menuScreenAdd(event);
@ -578,7 +578,7 @@ bool menuScreenSetup(int index, evt_t event)
} }
template<int N> template<int N>
bool menuCustomScreenSetup(evt_t event) bool menuCustomScreenSetup(event_t event)
{ {
return menuScreenSetup(N, event); return menuScreenSetup(N, event);
} }
@ -606,7 +606,7 @@ int updateMainviewsMenu()
return 1+MAX_CUSTOM_SCREENS; return 1+MAX_CUSTOM_SCREENS;
} }
bool menuScreenAdd(evt_t event) bool menuScreenAdd(event_t event)
{ {
menuPageCount = updateMainviewsMenu(); menuPageCount = updateMainviewsMenu();

View file

@ -38,7 +38,7 @@ enum AboutScreens {
#define ABOUT_X 62 #define ABOUT_X 62
#define ABOUT_INDENT 16 #define ABOUT_INDENT 16
bool menuAboutView(evt_t event) bool menuAboutView(event_t event)
{ {
static uint8_t screenIndex = 0; static uint8_t screenIndex = 0;
static uint8_t greyIndex = 0; static uint8_t greyIndex = 0;

View file

@ -30,11 +30,11 @@
#define Y_MIXBAR 28 #define Y_MIXBAR 28
#define LEG_COLORBOX 15 #define LEG_COLORBOX 15
bool menuChannelsMonitor(evt_t event, uint8_t page); bool menuChannelsMonitor(event_t event, uint8_t page);
bool menuLogicalSwitches(evt_t); bool menuLogicalSwitches(event_t);
template<int index> template<int index>
bool menuChannelsMonitor(evt_t event) bool menuChannelsMonitor(event_t event)
{ {
lastMonitorPage = e_MonChannelsFirst + index; lastMonitorPage = e_MonChannelsFirst + index;
MENU(STR_MONITOR_CHANNELS[index], MONITOR_ICONS, menuTabMonitors, lastMonitorPage, 0, { 0 }); 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); 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; uint8_t channel = 8 * page;
coord_t x, y = Y_OFFSET; coord_t x, y = Y_OFFSET;

View file

@ -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"; char lsString[] = "L64";
lcdColorTable[CUSTOM_COLOR_INDEX] = RGB(160, 160, 160); lcdColorTable[CUSTOM_COLOR_INDEX] = RGB(160, 160, 160);
@ -109,7 +109,7 @@ bool menuLogicalSwitchesMonitor(evt_t event)
return true; 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 }); MENU(STR_MONITOR_SWITCHES, MONITOR_ICONS, menuTabMonitors, e_MonLogicalSwitches, 1, { NUM_LOGICAL_SWITCH - 1 });
lastMonitorPage = e_MonLogicalSwitches; lastMonitorPage = e_MonLogicalSwitches;

View file

@ -128,7 +128,7 @@ int getMainViewsCount()
return MAX_CUSTOM_SCREENS; return MAX_CUSTOM_SCREENS;
} }
bool menuMainView(evt_t event) bool menuMainView(event_t event)
{ {
switch (event) { switch (event) {
case EVT_ENTRY: case EVT_ENTRY:
@ -202,7 +202,7 @@ bool menuMainView(evt_t event)
} }
#if 0 #if 0
bool menuMainViewChannelsMonitor(evt_t event) bool menuMainViewChannelsMonitor(event_t event)
{ {
switch (event) { switch (event) {
case EVT_KEY_BREAK(KEY_EXIT): case EVT_KEY_BREAK(KEY_EXIT):

Some files were not shown because too many files have changed in this diff Show more