1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-25 17:25:13 +03:00

Cosmetics again ...

This commit is contained in:
Bertrand Songis 2016-08-24 20:39:22 +02:00
parent a95f9b7dde
commit b69c2aa41c
48 changed files with 247 additions and 280 deletions

View file

@ -279,20 +279,19 @@ void title(const pm_char * s);
SIMPLE_MENU_NOTITLE(tab, menu, lines_count); \ SIMPLE_MENU_NOTITLE(tab, menu, lines_count); \
TITLE(title) TITLE(title)
#define SIMPLE_SUBMENU(title, lines_count) \ #define SIMPLE_SUBMENU(title, lines_count) \
SIMPLE_SUBMENU_NOTITLE(lines_count); \ SIMPLE_SUBMENU_NOTITLE(lines_count); \
TITLE(title) TITLE(title)
#if defined(CPUARM) #if defined(CPUARM)
typedef int select_menu_value_t; typedef int choice_t;
#else #else
typedef int8_t select_menu_value_t; typedef int8_t choice_t;
#endif #endif
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); choice_t editChoice(coord_t x, coord_t y, const pm_char * label, const pm_char *values, choice_t value, choice_t min, choice_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); uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const pm_char * label, LcdFlags attr, uint8_t event);
int8_t switchMenuItem(coord_t x, coord_t y, int8_t value, LcdFlags attr, uint8_t event); int8_t editSwitch(coord_t x, coord_t y, int8_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) #define ON_OFF_MENU_ITEM(value, x, y, label, attr, event) value = editCheckBox(value, x, y, label, attr, event)

View file

@ -1016,17 +1016,6 @@ void putsRotaryEncoderMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, Lcd
#endif #endif
#if defined(CPUARM) #if defined(CPUARM)
const pm_uint8_t bchunit_ar[] PROGMEM = {
UNIT_DIST, // Alt
UNIT_RAW, // Rpm
UNIT_PERCENT, // Fuel
UNIT_TEMPERATURE, // T1
UNIT_TEMPERATURE, // T2
UNIT_KTS, // Speed
UNIT_DIST, // Dist
UNIT_DIST, // GPS Alt
};
void drawValueWithUnit(coord_t x, coord_t y, lcdint_t val, uint8_t unit, LcdFlags att) void drawValueWithUnit(coord_t x, coord_t y, lcdint_t val, uint8_t unit, LcdFlags att)
{ {
// convertUnit(val, unit); // convertUnit(val, unit);

View file

@ -109,7 +109,7 @@ void menuModelDisplay(uint8_t event)
uint8_t screenIndex = TELEMETRY_CURRENT_SCREEN(k); uint8_t screenIndex = TELEMETRY_CURRENT_SCREEN(k);
drawStringWithIndex(0*FW, y, STR_SCREEN, screenIndex+1); drawStringWithIndex(0*FW, y, STR_SCREEN, screenIndex+1);
TelemetryScreenType oldScreenType = TELEMETRY_SCREEN_TYPE(screenIndex); TelemetryScreenType oldScreenType = TELEMETRY_SCREEN_TYPE(screenIndex);
TelemetryScreenType newScreenType = (TelemetryScreenType)selectMenuItem(DISPLAY_COL2, y, PSTR(""), STR_VTELEMSCREENTYPE, oldScreenType, 0, TELEMETRY_SCREEN_TYPE_MAX, (menuHorizontalPosition==0 ? attr : 0), event); TelemetryScreenType newScreenType = (TelemetryScreenType)editChoice(DISPLAY_COL2, y, PSTR(""), STR_VTELEMSCREENTYPE, oldScreenType, 0, TELEMETRY_SCREEN_TYPE_MAX, (menuHorizontalPosition==0 ? attr : 0), event);
if (newScreenType != oldScreenType) { if (newScreenType != oldScreenType) {
g_model.frsky.screensType = (g_model.frsky.screensType & (~(0x03 << (2*screenIndex)))) | (newScreenType << (2*screenIndex)); g_model.frsky.screensType = (g_model.frsky.screensType & (~(0x03 << (2*screenIndex)))) | (newScreenType << (2*screenIndex));
memset(&g_model.frsky.screens[screenIndex], 0, sizeof(g_model.frsky.screens[screenIndex])); memset(&g_model.frsky.screens[screenIndex], 0, sizeof(g_model.frsky.screens[screenIndex]));

View file

@ -125,7 +125,7 @@ void menuModelPhaseOne(uint8_t event)
break; break;
case ITEM_MODEL_PHASE_SWITCH: case ITEM_MODEL_PHASE_SWITCH:
fm->swtch = switchMenuItem(MIXES_2ND_COLUMN, y, fm->swtch, attr, event); fm->swtch = editSwitch(MIXES_2ND_COLUMN, y, fm->swtch, attr, event);
break; break;
case ITEM_MODEL_PHASE_TRIMS: case ITEM_MODEL_PHASE_TRIMS:

View file

@ -252,11 +252,11 @@ void menuModelExpoOne(uint8_t event)
#endif #endif
case EXPO_FIELD_SWITCH: case EXPO_FIELD_SWITCH:
ed->swtch = switchMenuItem(EXPO_ONE_2ND_COLUMN, y, ed->swtch, RIGHT | attr, event); ed->swtch = editSwitch(EXPO_ONE_2ND_COLUMN, y, ed->swtch, RIGHT | attr, event);
break; break;
case EXPO_FIELD_SIDE: case EXPO_FIELD_SIDE:
ed->mode = 4 - selectMenuItem(EXPO_ONE_2ND_COLUMN, y, STR_SIDE, STR_VSIDE, 4-ed->mode, 1, 3, RIGHT | attr, event); ed->mode = 4 - editChoice(EXPO_ONE_2ND_COLUMN, y, STR_SIDE, STR_VSIDE, 4-ed->mode, 1, 3, RIGHT | attr, event);
break; break;
case EXPO_FIELD_TRIM: case EXPO_FIELD_TRIM:

View file

@ -292,11 +292,11 @@ void menuModelExpoOne(uint8_t event)
#endif #endif
case EXPO_FIELD_SWITCH: case EXPO_FIELD_SWITCH:
ed->swtch = switchMenuItem(EXPO_ONE_2ND_COLUMN-3*FW, y, ed->swtch, attr, event); ed->swtch = editSwitch(EXPO_ONE_2ND_COLUMN-3*FW, y, ed->swtch, attr, event);
break; break;
case EXPO_FIELD_SIDE: case EXPO_FIELD_SIDE:
ed->mode = 4 - selectMenuItem(EXPO_ONE_2ND_COLUMN-3*FW, y, STR_SIDE, STR_VSIDE, 4-ed->mode, 1, 3, attr, event); ed->mode = 4 - editChoice(EXPO_ONE_2ND_COLUMN-3*FW, y, STR_SIDE, STR_VSIDE, 4-ed->mode, 1, 3, attr, event);
break; break;
} }
y += FH; y += FH;
@ -513,7 +513,7 @@ void menuModelMixOne(uint8_t event)
break; break;
#endif #endif
case MIX_FIELD_SWITCH: case MIX_FIELD_SWITCH:
md2->swtch = switchMenuItem(COLUMN_X+MIXES_2ND_COLUMN, y, md2->swtch, attr, event); md2->swtch = editSwitch(COLUMN_X+MIXES_2ND_COLUMN, y, md2->swtch, attr, event);
break; break;
case MIX_FIELD_WARNING: case MIX_FIELD_WARNING:
drawFieldLabel(COLUMN_X+MIXES_2ND_COLUMN, y, STR_MIXWARNING); drawFieldLabel(COLUMN_X+MIXES_2ND_COLUMN, y, STR_MIXWARNING);
@ -524,7 +524,7 @@ void menuModelMixOne(uint8_t event)
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, md2->mixWarn, 3); if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, md2->mixWarn, 3);
break; break;
case MIX_FIELD_MLTPX: case MIX_FIELD_MLTPX:
md2->mltpx = selectMenuItem(COLUMN_X+MIXES_2ND_COLUMN, y, STR_MULTPX, STR_VMLTPX, md2->mltpx, 0, 2, attr, event); md2->mltpx = editChoice(COLUMN_X+MIXES_2ND_COLUMN, y, STR_MULTPX, STR_VMLTPX, md2->mltpx, 0, 2, attr, event);
break; break;
case MIX_FIELD_DELAY_UP: case MIX_FIELD_DELAY_UP:
md2->delayUp = EDIT_DELAY(COLUMN_X, y, event, attr, STR_DELAYUP, md2->delayUp); md2->delayUp = EDIT_DELAY(COLUMN_X, y, event, attr, STR_DELAYUP, md2->delayUp);

View file

@ -269,7 +269,7 @@ void menuModelMixOne(uint8_t event)
#endif #endif
case MIX_FIELD_SWITCH: case MIX_FIELD_SWITCH:
md2->swtch = switchMenuItem(MIXES_2ND_COLUMN, y, md2->swtch, attr, event); md2->swtch = editSwitch(MIXES_2ND_COLUMN, y, md2->swtch, attr, event);
break; break;
case MIX_FIELD_WARNING: case MIX_FIELD_WARNING:
@ -282,7 +282,7 @@ void menuModelMixOne(uint8_t event)
break; break;
case MIX_FIELD_MLTPX: case MIX_FIELD_MLTPX:
md2->mltpx = selectMenuItem(MIXES_2ND_COLUMN, y, STR_MULTPX, STR_VMLTPX, md2->mltpx, 0, 2, attr, event); md2->mltpx = editChoice(MIXES_2ND_COLUMN, y, STR_MULTPX, STR_VMLTPX, md2->mltpx, 0, 2, attr, event);
break; break;
case MIX_FIELD_DELAY_UP: case MIX_FIELD_DELAY_UP:

View file

@ -329,7 +329,7 @@ void menuModelSetup(uint8_t event)
case ITEM_MODEL_TIMER3_COUNTDOWN_BEEP: case ITEM_MODEL_TIMER3_COUNTDOWN_BEEP:
{ {
TimerData * timer = &g_model.timers[k>=ITEM_MODEL_TIMER3 ? 2 : (k>=ITEM_MODEL_TIMER2 ? 1 : 0)]; TimerData * timer = &g_model.timers[k>=ITEM_MODEL_TIMER3 ? 2 : (k>=ITEM_MODEL_TIMER2 ? 1 : 0)];
timer->countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, timer->countdownBeep, COUNTDOWN_SILENT, COUNTDOWN_COUNT-1, attr, event); timer->countdownBeep = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, timer->countdownBeep, COUNTDOWN_SILENT, COUNTDOWN_COUNT-1, attr, event);
break; break;
} }
@ -338,7 +338,7 @@ void menuModelSetup(uint8_t event)
case ITEM_MODEL_TIMER3_PERSISTENT: case ITEM_MODEL_TIMER3_PERSISTENT:
{ {
TimerData * timer = &g_model.timers[k>=ITEM_MODEL_TIMER3 ? 2 : (k>=ITEM_MODEL_TIMER2 ? 1 : 0)]; TimerData * timer = &g_model.timers[k>=ITEM_MODEL_TIMER3 ? 2 : (k>=ITEM_MODEL_TIMER2 ? 1 : 0)];
timer->persistent = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_PERSISTENT, STR_VPERSISTENT, timer->persistent, 0, 2, attr, event); timer->persistent = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_PERSISTENT, STR_VPERSISTENT, timer->persistent, 0, 2, attr, event);
break; break;
} }
#else #else
@ -390,7 +390,7 @@ void menuModelSetup(uint8_t event)
case ITEM_MODEL_TIMER2_PERSISTENT: case ITEM_MODEL_TIMER2_PERSISTENT:
{ {
TimerData &timer = g_model.timers[k==ITEM_MODEL_TIMER2_PERSISTENT]; TimerData &timer = g_model.timers[k==ITEM_MODEL_TIMER2_PERSISTENT];
timer.persistent = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_PERSISTENT, STR_VPERSISTENT, timer.persistent, 0, 2, attr, event); timer.persistent = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_PERSISTENT, STR_VPERSISTENT, timer.persistent, 0, 2, attr, event);
break; break;
} }
#endif #endif
@ -422,12 +422,12 @@ void menuModelSetup(uint8_t event)
#if defined(CPUARM) #if defined(CPUARM)
case ITEM_MODEL_DISPLAY_TRIMS: case ITEM_MODEL_DISPLAY_TRIMS:
g_model.displayTrims = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_DISPLAY_TRIMS, STR_VDISPLAYTRIMS, g_model.displayTrims, 0, 2, attr, event); g_model.displayTrims = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_DISPLAY_TRIMS, STR_VDISPLAYTRIMS, g_model.displayTrims, 0, 2, attr, event);
break; break;
#endif #endif
case ITEM_MODEL_TRIM_INC: case ITEM_MODEL_TRIM_INC:
g_model.trimInc = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_TRIMINC, STR_VTRIMINC, g_model.trimInc, -2, 2, attr, event); g_model.trimInc = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_TRIMINC, STR_VTRIMINC, g_model.trimInc, -2, 2, attr, event);
break; break;
case ITEM_MODEL_THROTTLE_REVERSED: case ITEM_MODEL_THROTTLE_REVERSED:
@ -864,7 +864,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];
moduleData.ppm.outputType = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_OUTPUT_TYPE, STR_VOUTPUT_TYPE, moduleData.ppm.outputType, 0, 1, attr, event); moduleData.ppm.outputType = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_OUTPUT_TYPE, STR_VOUTPUT_TYPE, moduleData.ppm.outputType, 0, 1, attr, event);
break; break;
} }
#endif #endif
@ -918,7 +918,7 @@ void menuModelSetup(uint8_t event)
lcdDrawTextAlignedLeft(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 = editChoice(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:
lcdDrawTextAlignedLeft(y, STR_MULTI_OPTION); lcdDrawTextAlignedLeft(y, STR_MULTI_OPTION);

View file

@ -241,7 +241,7 @@ void menuModelSensor(uint8_t event)
break; break;
case SENSOR_FIELD_TYPE: case SENSOR_FIELD_TYPE:
sensor->type = selectMenuItem(SENSOR_2ND_COLUMN, y, NO_INDENT(STR_TYPE), STR_VSENSORTYPES, sensor->type, 0, 1, attr, event); sensor->type = editChoice(SENSOR_2ND_COLUMN, y, NO_INDENT(STR_TYPE), STR_VSENSORTYPES, sensor->type, 0, 1, attr, event);
if (attr && checkIncDec_Ret) { if (attr && checkIncDec_Ret) {
sensor->instance = 0; sensor->instance = 0;
if (sensor->type == TELEM_TYPE_CALCULATED) { if (sensor->type == TELEM_TYPE_CALCULATED) {
@ -270,7 +270,7 @@ void menuModelSensor(uint8_t event)
} }
} }
else { else {
sensor->formula = selectMenuItem(SENSOR_2ND_COLUMN, y, STR_FORMULA, STR_VFORMULAS, sensor->formula, 0, TELEM_FORMULA_LAST, attr, event); sensor->formula = editChoice(SENSOR_2ND_COLUMN, y, STR_FORMULA, STR_VFORMULAS, sensor->formula, 0, TELEM_FORMULA_LAST, attr, event);
if (attr && checkIncDec_Ret) { if (attr && checkIncDec_Ret) {
sensor->param = 0; sensor->param = 0;
if (sensor->formula == TELEM_FORMULA_CELL) { if (sensor->formula == TELEM_FORMULA_CELL) {
@ -291,7 +291,7 @@ void menuModelSensor(uint8_t event)
case SENSOR_FIELD_UNIT: case SENSOR_FIELD_UNIT:
lcdDrawTextAlignedLeft(y, "Unit"); lcdDrawTextAlignedLeft(y, "Unit");
// TODO flash saving with selectMenuItem where I copied those 2 lines? // TODO flash saving with editChoice 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) {
CHECK_INCDEC_MODELVAR_ZERO(event, sensor->unit, UNIT_MAX); CHECK_INCDEC_MODELVAR_ZERO(event, sensor->unit, UNIT_MAX);
@ -302,7 +302,7 @@ void menuModelSensor(uint8_t event)
break; break;
case SENSOR_FIELD_PRECISION: case SENSOR_FIELD_PRECISION:
sensor->prec = selectMenuItem(SENSOR_2ND_COLUMN, y, STR_PRECISION, STR_VPREC, sensor->prec, 0, 2, attr, event); sensor->prec = editChoice(SENSOR_2ND_COLUMN, y, STR_PRECISION, STR_VPREC, sensor->prec, 0, 2, attr, event);
if (attr && checkIncDec_Ret) { if (attr && checkIncDec_Ret) {
telemetryItems[s_currIdx].clear(); telemetryItems[s_currIdx].clear();
} }
@ -357,7 +357,7 @@ void menuModelSensor(uint8_t event)
case SENSOR_FIELD_PARAM2: case SENSOR_FIELD_PARAM2:
if (sensor->type == TELEM_TYPE_CALCULATED) { if (sensor->type == TELEM_TYPE_CALCULATED) {
if (sensor->formula == TELEM_FORMULA_CELL) { if (sensor->formula == TELEM_FORMULA_CELL) {
sensor->cell.index = selectMenuItem(SENSOR_2ND_COLUMN, y, STR_CELLINDEX, STR_VCELLINDEX, sensor->cell.index, 0, 8, attr, event); sensor->cell.index = editChoice(SENSOR_2ND_COLUMN, y, STR_CELLINDEX, STR_VCELLINDEX, sensor->cell.index, 0, 8, attr, event);
break; break;
} }
else if (sensor->formula == TELEM_FORMULA_DIST) { else if (sensor->formula == TELEM_FORMULA_DIST) {
@ -806,7 +806,7 @@ void menuModelTelemetryFrsky(uint8_t event)
drawStringWithIndex(0*FW, y, STR_SCREEN, screenIndex); drawStringWithIndex(0*FW, y, STR_SCREEN, screenIndex);
#if defined(GAUGES) #if defined(GAUGES)
bool screenType = g_model.frsky.screensType & screenIndex; bool screenType = g_model.frsky.screensType & screenIndex;
if (screenType != (bool)selectMenuItem(TELEM_SCRTYPE_COL, y, PSTR(""), STR_VTELEMSCREENTYPE, screenType, 0, 1, attr, event)) if (screenType != (bool)editChoice(TELEM_SCRTYPE_COL, y, PSTR(""), STR_VTELEMSCREENTYPE, screenType, 0, 1, attr, event))
g_model.frsky.screensType ^= screenIndex; g_model.frsky.screensType ^= screenIndex;
#endif #endif
break; break;

View file

@ -49,7 +49,7 @@ void menuRadioHardware(uint8_t event)
switch(k) { switch(k) {
case ITEM_RADIO_HARDWARE_OPTREX_DISPLAY: case ITEM_RADIO_HARDWARE_OPTREX_DISPLAY:
g_eeGeneral.optrexDisplay = selectMenuItem(GENERAL_HW_PARAM_OFS, y, STR_LCD, STR_VLCD, g_eeGeneral.optrexDisplay, 0, 1, attr, event); g_eeGeneral.optrexDisplay = editChoice(GENERAL_HW_PARAM_OFS, y, STR_LCD, STR_VLCD, g_eeGeneral.optrexDisplay, 0, 1, attr, event);
break; break;
case ITEM_RADIO_HARDWARE_STICKS_GAINS_LABELS: case ITEM_RADIO_HARDWARE_STICKS_GAINS_LABELS:
@ -78,13 +78,13 @@ void menuRadioHardware(uint8_t event)
#if defined(ROTARY_ENCODERS) #if defined(ROTARY_ENCODERS)
case ITEM_RADIO_HARDWARE_ROTARY_ENCODER: case ITEM_RADIO_HARDWARE_ROTARY_ENCODER:
g_eeGeneral.rotarySteps = selectMenuItem(GENERAL_HW_PARAM_OFS, y, PSTR("Rotary Encoder"), PSTR("\0062steps4steps"), g_eeGeneral.rotarySteps, 0, 1, attr, event); g_eeGeneral.rotarySteps = editChoice(GENERAL_HW_PARAM_OFS, y, PSTR("Rotary Encoder"), PSTR("\0062steps4steps"), g_eeGeneral.rotarySteps, 0, 1, attr, event);
break; break;
#endif #endif
#if defined(BLUETOOTH) #if defined(BLUETOOTH)
case ITEM_RADIO_HARDWARE_BT_BAUDRATE: case ITEM_RADIO_HARDWARE_BT_BAUDRATE:
g_eeGeneral.btBaudrate = selectMenuItem(GENERAL_HW_PARAM_OFS, y, STR_BAUDRATE, PSTR("\005115k 9600 19200"), g_eeGeneral.btBaudrate, 0, 2, attr, event); g_eeGeneral.btBaudrate = editChoice(GENERAL_HW_PARAM_OFS, y, STR_BAUDRATE, PSTR("\005115k 9600 19200"), g_eeGeneral.btBaudrate, 0, 2, attr, event);
if (attr && checkIncDec_Ret) { if (attr && checkIncDec_Ret) {
btInit(); btInit();
} }

View file

@ -34,16 +34,16 @@ const pm_uchar sticks[] PROGMEM = {
#define SLIDER_5POS(y, value, label, event, attr) { \ #define SLIDER_5POS(y, value, label, event, attr) { \
int8_t tmp = value; \ int8_t tmp = value; \
drawSlider(RADIO_SETUP_2ND_COLUMN, y, 2+tmp, 4, attr); \ drawSlider(RADIO_SETUP_2ND_COLUMN, y, 2+tmp, 4, attr); \
value = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, label, NULL, tmp, -2, +2, attr, event); \ value = editChoice(RADIO_SETUP_2ND_COLUMN, y, label, NULL, tmp, -2, +2, attr, event); \
} }
#elif defined(GRAPHICS) #elif defined(GRAPHICS)
#define SLIDER_5POS(y, value, label, event, attr) { \ #define SLIDER_5POS(y, value, label, event, attr) { \
int8_t tmp = value; \ int8_t tmp = value; \
display5posSlider(RADIO_SETUP_2ND_COLUMN, y, tmp, attr); \ display5posSlider(RADIO_SETUP_2ND_COLUMN, y, tmp, attr); \
value = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, label, NULL, tmp, -2, +2, attr, event); \ value = editChoice(RADIO_SETUP_2ND_COLUMN, y, label, NULL, tmp, -2, +2, attr, event); \
} }
#else #else
#define SLIDER_5POS(y, value, label, event, attr) value = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, label, STR_VBEEPLEN, value, -2, +2, attr, event) #define SLIDER_5POS(y, value, label, event, attr) value = editChoice(RADIO_SETUP_2ND_COLUMN, y, label, STR_VBEEPLEN, value, -2, +2, attr, event)
#endif #endif
#if defined(SPLASH) && !defined(FSPLASH) #if defined(SPLASH) && !defined(FSPLASH)
@ -234,7 +234,7 @@ void menuRadioSetup(uint8_t event)
#if defined(AUDIO) #if defined(AUDIO)
case ITEM_SETUP_BEEP_MODE: case ITEM_SETUP_BEEP_MODE:
g_eeGeneral.beepMode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_SPEAKER, STR_VBEEPMODE, g_eeGeneral.beepMode, -2, 1, attr, event); g_eeGeneral.beepMode = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_SPEAKER, STR_VBEEPMODE, g_eeGeneral.beepMode, -2, 1, attr, event);
#if defined(TELEMETRY_FRSKY) #if defined(TELEMETRY_FRSKY)
if (attr && checkIncDec_Ret) frskySendAlarms(); if (attr && checkIncDec_Ret) frskySendAlarms();
#endif #endif
@ -242,7 +242,7 @@ void menuRadioSetup(uint8_t event)
#if defined(BUZZER) // AUDIO + BUZZER #if defined(BUZZER) // AUDIO + BUZZER
case ITEM_SETUP_BUZZER_MODE: case ITEM_SETUP_BUZZER_MODE:
g_eeGeneral.buzzerMode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_BUZZER, STR_VBEEPMODE, g_eeGeneral.buzzerMode, -2, 1, attr, event); g_eeGeneral.buzzerMode = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_BUZZER, STR_VBEEPMODE, g_eeGeneral.buzzerMode, -2, 1, attr, event);
#if defined(TELEMETRY_FRSKY) #if defined(TELEMETRY_FRSKY)
if (attr && checkIncDec_Ret) frskySendAlarms(); if (attr && checkIncDec_Ret) frskySendAlarms();
#endif #endif
@ -250,7 +250,7 @@ void menuRadioSetup(uint8_t event)
#endif #endif
#elif defined(BUZZER) // BUZZER only #elif defined(BUZZER) // BUZZER only
case ITEM_SETUP_BUZZER_MODE: case ITEM_SETUP_BUZZER_MODE:
g_eeGeneral.beepMode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_SPEAKER, STR_VBEEPMODE, g_eeGeneral.beepMode, -2, 1, attr, event); g_eeGeneral.beepMode = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_SPEAKER, STR_VBEEPMODE, g_eeGeneral.beepMode, -2, 1, attr, event);
#if defined(TELEMETRY_FRSKY) #if defined(TELEMETRY_FRSKY)
if (attr && checkIncDec_Ret) frskySendAlarms(); if (attr && checkIncDec_Ret) frskySendAlarms();
#endif #endif
@ -341,7 +341,7 @@ void menuRadioSetup(uint8_t event)
break; break;
case ITEM_SETUP_HAPTIC_MODE: case ITEM_SETUP_HAPTIC_MODE:
g_eeGeneral.hapticMode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_MODE, STR_VBEEPMODE, g_eeGeneral.hapticMode, -2, 1, attr, event); g_eeGeneral.hapticMode = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_MODE, STR_VBEEPMODE, g_eeGeneral.hapticMode, -2, 1, attr, event);
break; break;
case ITEM_SETUP_HAPTIC_LENGTH: case ITEM_SETUP_HAPTIC_LENGTH:
@ -411,7 +411,7 @@ void menuRadioSetup(uint8_t event)
#if ROTARY_ENCODERS > 0 #if ROTARY_ENCODERS > 0
case ITEM_SETUP_RE_NAVIGATION: case ITEM_SETUP_RE_NAVIGATION:
g_eeGeneral.reNavigation = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_RENAVIG, STR_VRENAVIG, g_eeGeneral.reNavigation, 0, NUM_ROTARY_ENCODERS, attr, event); g_eeGeneral.reNavigation = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_RENAVIG, STR_VRENAVIG, g_eeGeneral.reNavigation, 0, NUM_ROTARY_ENCODERS, attr, event);
if (attr && checkIncDec_Ret) { if (attr && checkIncDec_Ret) {
g_rotenc[NAVIGATION_RE_IDX()] = 0; g_rotenc[NAVIGATION_RE_IDX()] = 0;
} }
@ -423,7 +423,7 @@ void menuRadioSetup(uint8_t event)
break; break;
case ITEM_SETUP_BACKLIGHT_MODE: case ITEM_SETUP_BACKLIGHT_MODE:
g_eeGeneral.backlightMode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_MODE, STR_VBLMODE, g_eeGeneral.backlightMode, e_backlight_mode_off, e_backlight_mode_on, attr, event); g_eeGeneral.backlightMode = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_MODE, STR_VBLMODE, g_eeGeneral.backlightMode, e_backlight_mode_off, e_backlight_mode_on, attr, event);
break; break;
case ITEM_SETUP_FLASH_BEEP: case ITEM_SETUP_FLASH_BEEP:
@ -480,13 +480,13 @@ void menuRadioSetup(uint8_t event)
break; break;
case ITEM_SETUP_GPSFORMAT: case ITEM_SETUP_GPSFORMAT:
g_eeGeneral.gpsFormat = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_GPSCOORD, STR_GPSFORMAT, g_eeGeneral.gpsFormat, 0, 1, attr, event); g_eeGeneral.gpsFormat = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_GPSCOORD, STR_GPSFORMAT, g_eeGeneral.gpsFormat, 0, 1, attr, event);
break; break;
#endif #endif
#if defined(PXX) #if defined(PXX)
case ITEM_SETUP_COUNTRYCODE: case ITEM_SETUP_COUNTRYCODE:
g_eeGeneral.countryCode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_COUNTRYCODE, STR_COUNTRYCODES, g_eeGeneral.countryCode, 0, 2, attr, event); g_eeGeneral.countryCode = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_COUNTRYCODE, STR_COUNTRYCODES, g_eeGeneral.countryCode, 0, 2, attr, event);
break; break;
#endif #endif
@ -504,7 +504,7 @@ void menuRadioSetup(uint8_t event)
break; break;
case ITEM_SETUP_IMPERIAL: case ITEM_SETUP_IMPERIAL:
g_eeGeneral.imperial = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_UNITSSYSTEM, STR_VUNITSSYSTEM, g_eeGeneral.imperial, 0, 1, attr, event); g_eeGeneral.imperial = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_UNITSSYSTEM, STR_VUNITSSYSTEM, g_eeGeneral.imperial, 0, 1, attr, event);
break; break;
#endif #endif
@ -522,7 +522,7 @@ void menuRadioSetup(uint8_t event)
#if defined(TELEMETRY_MAVLINK) #if defined(TELEMETRY_MAVLINK)
case ITEM_MAVLINK_BAUD: case ITEM_MAVLINK_BAUD:
g_eeGeneral.mavbaud = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_MAVLINK_BAUD_LABEL, STR_MAVLINK_BAUDS, g_eeGeneral.mavbaud, 0, 7, attr, event); g_eeGeneral.mavbaud = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_MAVLINK_BAUD_LABEL, STR_MAVLINK_BAUDS, g_eeGeneral.mavbaud, 0, 7, attr, event);
break; break;
#endif #endif

View file

@ -72,7 +72,7 @@ void title(const pm_char * s)
lcdDrawText(0, 0, s, INVERS); lcdDrawText(0, 0, s, INVERS);
} }
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) choice_t editChoice(coord_t x, coord_t y, const pm_char *label, const pm_char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, uint8_t event)
{ {
drawFieldLabel(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);
@ -84,13 +84,13 @@ uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const pm_char *label,
{ {
#if defined(GRAPHICS) #if defined(GRAPHICS)
drawCheckBox(x, y, value, attr); drawCheckBox(x, y, value, attr);
return selectMenuItem(x, y, label, NULL, value, 0, 1, attr, event); return editChoice(x, y, label, NULL, value, 0, 1, attr, event);
#else #else
return selectMenuItem(x, y, label, STR_OFFON, value, 0, 1, attr, event); return editChoice(x, y, label, STR_OFFON, value, 0, 1, attr, event);
#endif #endif
} }
int8_t switchMenuItem(coord_t x, coord_t y, int8_t value, LcdFlags attr, uint8_t event) int8_t editSwitch(coord_t x, coord_t y, int8_t value, LcdFlags attr, uint8_t event)
{ {
drawFieldLabel(x, y, STR_SWITCH); drawFieldLabel(x, y, STR_SWITCH);
drawSwitch(x, y, value, attr); drawSwitch(x, y, value, attr);

View file

@ -236,11 +236,11 @@ void title(const pm_char * s);
#define SIMPLE_SUBMENU(title, lines_count) \ #define SIMPLE_SUBMENU(title, lines_count) \
check_submenu_simple(title, event, lines_count) check_submenu_simple(title, event, lines_count)
typedef int select_menu_value_t; typedef int choice_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); choice_t editChoice(coord_t x, coord_t y, const pm_char *label, const pm_char *values, choice_t value, choice_t min, choice_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); 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); swsrc_t editSwitch(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) #define ON_OFF_MENU_ITEM(value, x, y, label, attr, event) value = editCheckBox(value, x, y, label, attr, event)

View file

@ -803,17 +803,6 @@ void drawTrimMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att
} }
} }
const pm_uint8_t bchunit_ar[] PROGMEM = {
UNIT_DIST, // Alt
UNIT_RAW, // Rpm
UNIT_PERCENT, // Fuel
UNIT_TEMPERATURE, // T1
UNIT_TEMPERATURE, // T2
UNIT_KTS, // Speed
UNIT_DIST, // Dist
UNIT_DIST, // GPS Alt
};
void drawValueWithUnit(coord_t x, coord_t y, int32_t val, uint8_t unit, LcdFlags att) void drawValueWithUnit(coord_t x, coord_t y, int32_t val, uint8_t unit, LcdFlags att)
{ {
// convertUnit(val, unit); // convertUnit(val, unit);

View file

@ -107,6 +107,7 @@ enum MenuModelIndexes {
void menuModelSelect(uint8_t event); void menuModelSelect(uint8_t event);
void menuModelSetup(uint8_t event); void menuModelSetup(uint8_t event);
void menuModelFailsafe(uint8_t event);
void menuModelHeli(uint8_t event); void menuModelHeli(uint8_t event);
void menuModelFlightModesAll(uint8_t event); void menuModelFlightModesAll(uint8_t event);
void menuModelExposAll(uint8_t event); void menuModelExposAll(uint8_t event);

View file

@ -125,7 +125,7 @@ void menuModelDisplay(uint8_t event)
uint8_t screenIndex = TELEMETRY_CURRENT_SCREEN(k); uint8_t screenIndex = TELEMETRY_CURRENT_SCREEN(k);
drawStringWithIndex(0*FW, y, STR_SCREEN, screenIndex+1); drawStringWithIndex(0*FW, y, STR_SCREEN, screenIndex+1);
TelemetryScreenType oldScreenType = TELEMETRY_SCREEN_TYPE(screenIndex); TelemetryScreenType oldScreenType = TELEMETRY_SCREEN_TYPE(screenIndex);
TelemetryScreenType newScreenType = (TelemetryScreenType)selectMenuItem(DISPLAY_COL2, y, PSTR(""), STR_VTELEMSCREENTYPE, oldScreenType, 0, TELEMETRY_SCREEN_TYPE_MAX, (menuHorizontalPosition==0 ? attr : 0), event); TelemetryScreenType newScreenType = (TelemetryScreenType)editChoice(DISPLAY_COL2, y, PSTR(""), STR_VTELEMSCREENTYPE, oldScreenType, 0, TELEMETRY_SCREEN_TYPE_MAX, (menuHorizontalPosition==0 ? attr : 0), event);
if (newScreenType != oldScreenType) { if (newScreenType != oldScreenType) {
g_model.frsky.screensType = (g_model.frsky.screensType & (~(0x03 << (2*screenIndex)))) | (newScreenType << (2*screenIndex)); g_model.frsky.screensType = (g_model.frsky.screensType & (~(0x03 << (2*screenIndex)))) | (newScreenType << (2*screenIndex));
memset(&g_model.frsky.screens[screenIndex], 0, sizeof(g_model.frsky.screens[screenIndex])); memset(&g_model.frsky.screens[screenIndex], 0, sizeof(g_model.frsky.screens[screenIndex]));

View file

@ -83,11 +83,11 @@ void menuModelGVarOne(uint8_t event)
break; break;
case GVAR_FIELD_UNIT: case GVAR_FIELD_UNIT:
gvar->unit = selectMenuItem(GVAR_2ND_COLUMN, y, STR_UNIT, "\001-%", gvar->unit, 0, 1, attr, event); gvar->unit = editChoice(GVAR_2ND_COLUMN, y, STR_UNIT, "\001-%", gvar->unit, 0, 1, attr, event);
break; break;
case GVAR_FIELD_PREC: case GVAR_FIELD_PREC:
gvar->prec = selectMenuItem(GVAR_2ND_COLUMN, y, STR_PRECISION, STR_VPREC, gvar->prec, 0, 1, attr, event); gvar->prec = editChoice(GVAR_2ND_COLUMN, y, STR_PRECISION, STR_VPREC, gvar->prec, 0, 1, attr, event);
break; break;
case GVAR_FIELD_MIN: case GVAR_FIELD_MIN:

View file

@ -249,11 +249,11 @@ void menuModelExpoOne(uint8_t event)
#endif #endif
case EXPO_FIELD_SWITCH: case EXPO_FIELD_SWITCH:
ed->swtch = switchMenuItem(EXPO_ONE_2ND_COLUMN, y, ed->swtch, attr, event); ed->swtch = editSwitch(EXPO_ONE_2ND_COLUMN, y, ed->swtch, attr, event);
break; break;
case EXPO_FIELD_SIDE: case EXPO_FIELD_SIDE:
ed->mode = 4 - selectMenuItem(EXPO_ONE_2ND_COLUMN, y, STR_SIDE, STR_VSIDE, 4-ed->mode, 1, 3, attr, event); ed->mode = 4 - editChoice(EXPO_ONE_2ND_COLUMN, y, STR_SIDE, STR_VSIDE, 4-ed->mode, 1, 3, attr, event);
break; break;
case EXPO_FIELD_TRIM: case EXPO_FIELD_TRIM:

View file

@ -276,7 +276,7 @@ void menuModelMixOne(uint8_t event)
#endif #endif
case MIX_FIELD_SWITCH: case MIX_FIELD_SWITCH:
md2->swtch = switchMenuItem(MENU_COLUMN2_X+MIXES_2ND_COLUMN, y, md2->swtch, attr, event); md2->swtch = editSwitch(MENU_COLUMN2_X+MIXES_2ND_COLUMN, y, md2->swtch, attr, event);
break; break;
case MIX_FIELD_WARNING: case MIX_FIELD_WARNING:
@ -289,7 +289,7 @@ void menuModelMixOne(uint8_t event)
break; break;
case MIX_FIELD_MLTPX: case MIX_FIELD_MLTPX:
md2->mltpx = selectMenuItem(MENU_COLUMN2_X+MIXES_2ND_COLUMN, y, STR_MULTPX, STR_VMLTPX, md2->mltpx, 0, 2, attr, event); md2->mltpx = editChoice(MENU_COLUMN2_X+MIXES_2ND_COLUMN, y, STR_MULTPX, STR_VMLTPX, md2->mltpx, 0, 2, attr, event);
break; break;
case MIX_FIELD_DELAY_UP: case MIX_FIELD_DELAY_UP:

View file

@ -21,7 +21,6 @@
#include "opentx.h" #include "opentx.h"
uint8_t g_moduleIdx; uint8_t g_moduleIdx;
void menuModelFailsafe(uint8_t event);
enum MenuModelSetupItems { enum MenuModelSetupItems {
ITEM_MODEL_NAME, ITEM_MODEL_NAME,
@ -355,7 +354,7 @@ void menuModelSetup(uint8_t event)
break; break;
case ITEM_MODEL_TIMER1_PERSISTENT: case ITEM_MODEL_TIMER1_PERSISTENT:
g_model.timers[0].persistent = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_PERSISTENT, STR_VPERSISTENT, g_model.timers[0].persistent, 0, 2, attr, event); g_model.timers[0].persistent = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_PERSISTENT, STR_VPERSISTENT, g_model.timers[0].persistent, 0, 2, attr, event);
break; break;
#if TIMERS > 1 #if TIMERS > 1
@ -376,7 +375,7 @@ void menuModelSetup(uint8_t event)
break; break;
case ITEM_MODEL_TIMER2_PERSISTENT: case ITEM_MODEL_TIMER2_PERSISTENT:
g_model.timers[1].persistent = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_PERSISTENT, STR_VPERSISTENT, g_model.timers[1].persistent, 0, 2, attr, event); g_model.timers[1].persistent = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_PERSISTENT, STR_VPERSISTENT, g_model.timers[1].persistent, 0, 2, attr, event);
break; break;
#endif #endif
@ -398,7 +397,7 @@ void menuModelSetup(uint8_t event)
break; break;
case ITEM_MODEL_TIMER3_PERSISTENT: case ITEM_MODEL_TIMER3_PERSISTENT:
g_model.timers[2].persistent = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_PERSISTENT, STR_VPERSISTENT, g_model.timers[2].persistent, 0, 2, attr, event); g_model.timers[2].persistent = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_PERSISTENT, STR_VPERSISTENT, g_model.timers[2].persistent, 0, 2, attr, event);
break; break;
#endif #endif
@ -433,11 +432,11 @@ void menuModelSetup(uint8_t event)
break; break;
case ITEM_MODEL_DISPLAY_TRIMS: case ITEM_MODEL_DISPLAY_TRIMS:
g_model.displayTrims = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_DISPLAY_TRIMS, STR_VDISPLAYTRIMS, g_model.displayTrims, 0, 2, attr, event); g_model.displayTrims = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_DISPLAY_TRIMS, STR_VDISPLAYTRIMS, g_model.displayTrims, 0, 2, attr, event);
break; break;
case ITEM_MODEL_TRIM_INC: case ITEM_MODEL_TRIM_INC:
g_model.trimInc = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_TRIMINC, STR_VTRIMINC, g_model.trimInc, -2, 2, attr, event); g_model.trimInc = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_TRIMINC, STR_VTRIMINC, g_model.trimInc, -2, 2, attr, event);
break; break;
case ITEM_MODEL_THROTTLE_LABEL: case ITEM_MODEL_THROTTLE_LABEL:
@ -990,7 +989,7 @@ void menuModelSetup(uint8_t event)
lcdDrawTextAlignedLeft(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 = editChoice(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:
lcdDrawTextAlignedLeft(y, STR_MULTI_OPTION); lcdDrawTextAlignedLeft(y, STR_MULTI_OPTION);

View file

@ -122,7 +122,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)
void menuModelSensor(uint8_t event) void menuModelSensor(event_t event)
{ {
TelemetrySensor * sensor = &g_model.telemetrySensors[s_currIdx]; TelemetrySensor * sensor = &g_model.telemetrySensors[s_currIdx];
@ -132,7 +132,7 @@ void menuModelSensor(uint8_t event)
SUBMENU(STR_MENUSENSOR, SENSOR_FIELD_MAX, { 0, 0, sensor->type == TELEM_TYPE_CALCULATED ? (uint8_t)0 : (uint8_t)1, SENSOR_UNIT_ROWS, SENSOR_PREC_ROWS, SENSOR_PARAM1_ROWS, SENSOR_PARAM2_ROWS, SENSOR_PARAM3_ROWS, SENSOR_PARAM4_ROWS, SENSOR_AUTOOFFSET_ROWS, SENSOR_ONLYPOS_ROWS, SENSOR_FILTER_ROWS, SENSOR_PERSISTENT_ROWS, 0 }); SUBMENU(STR_MENUSENSOR, SENSOR_FIELD_MAX, { 0, 0, sensor->type == TELEM_TYPE_CALCULATED ? (uint8_t)0 : (uint8_t)1, SENSOR_UNIT_ROWS, SENSOR_PREC_ROWS, SENSOR_PARAM1_ROWS, SENSOR_PARAM2_ROWS, SENSOR_PARAM3_ROWS, SENSOR_PARAM4_ROWS, SENSOR_AUTOOFFSET_ROWS, SENSOR_ONLYPOS_ROWS, SENSOR_FILTER_ROWS, SENSOR_PERSISTENT_ROWS, 0 });
for (int i=0; i<NUM_BODY_LINES; i++) { for (uint8_t 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;
int k = i + menuVerticalOffset; int k = i + menuVerticalOffset;
@ -152,7 +152,7 @@ void menuModelSensor(uint8_t event)
break; break;
case SENSOR_FIELD_TYPE: case SENSOR_FIELD_TYPE:
sensor->type = selectMenuItem(SENSOR_2ND_COLUMN, y, NO_INDENT(STR_TYPE), STR_VSENSORTYPES, sensor->type, 0, 1, attr, event); sensor->type = editChoice(SENSOR_2ND_COLUMN, y, NO_INDENT(STR_TYPE), STR_VSENSORTYPES, sensor->type, 0, 1, attr, event);
if (attr && checkIncDec_Ret) { if (attr && checkIncDec_Ret) {
sensor->instance = 0; sensor->instance = 0;
if (sensor->type == TELEM_TYPE_CALCULATED) { if (sensor->type == TELEM_TYPE_CALCULATED) {
@ -181,7 +181,7 @@ void menuModelSensor(uint8_t event)
} }
} }
else { else {
sensor->formula = selectMenuItem(SENSOR_2ND_COLUMN, y, STR_FORMULA, STR_VFORMULAS, sensor->formula, 0, TELEM_FORMULA_LAST, attr, event); sensor->formula = editChoice(SENSOR_2ND_COLUMN, y, STR_FORMULA, STR_VFORMULAS, sensor->formula, 0, TELEM_FORMULA_LAST, attr, event);
if (attr && checkIncDec_Ret) { if (attr && checkIncDec_Ret) {
sensor->param = 0; sensor->param = 0;
if (sensor->formula == TELEM_FORMULA_CELL) { if (sensor->formula == TELEM_FORMULA_CELL) {
@ -202,7 +202,7 @@ void menuModelSensor(uint8_t event)
case SENSOR_FIELD_UNIT: case SENSOR_FIELD_UNIT:
lcdDrawTextAlignedLeft(y, STR_UNIT); lcdDrawTextAlignedLeft(y, STR_UNIT);
// TODO flash saving with selectMenuItem where I copied those 2 lines? // TODO flash saving with editChoice 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) {
CHECK_INCDEC_MODELVAR_ZERO(event, sensor->unit, UNIT_MAX); CHECK_INCDEC_MODELVAR_ZERO(event, sensor->unit, UNIT_MAX);
@ -216,7 +216,7 @@ void menuModelSensor(uint8_t event)
break; break;
case SENSOR_FIELD_PRECISION: case SENSOR_FIELD_PRECISION:
sensor->prec = selectMenuItem(SENSOR_2ND_COLUMN, y, STR_PRECISION, STR_VPREC, sensor->prec, 0, 2, attr, event); sensor->prec = editChoice(SENSOR_2ND_COLUMN, y, STR_PRECISION, STR_VPREC, sensor->prec, 0, 2, attr, event);
if (attr && checkIncDec_Ret) { if (attr && checkIncDec_Ret) {
telemetryItems[s_currIdx].clear(); telemetryItems[s_currIdx].clear();
} }
@ -279,7 +279,7 @@ void menuModelSensor(uint8_t event)
case SENSOR_FIELD_PARAM2: case SENSOR_FIELD_PARAM2:
if (sensor->type == TELEM_TYPE_CALCULATED) { if (sensor->type == TELEM_TYPE_CALCULATED) {
if (sensor->formula == TELEM_FORMULA_CELL) { if (sensor->formula == TELEM_FORMULA_CELL) {
sensor->cell.index = selectMenuItem(SENSOR_2ND_COLUMN, y, STR_CELLINDEX, STR_VCELLINDEX, sensor->cell.index, 0, 8, attr, event); sensor->cell.index = editChoice(SENSOR_2ND_COLUMN, y, STR_CELLINDEX, STR_VCELLINDEX, sensor->cell.index, 0, 8, attr, event);
break; break;
} }
else if (sensor->formula == TELEM_FORMULA_DIST) { else if (sensor->formula == TELEM_FORMULA_DIST) {
@ -358,7 +358,7 @@ void menuModelSensor(uint8_t event)
void onSensorMenu(const char *result) void onSensorMenu(const char *result)
{ {
int index = menuVerticalPosition - ITEM_TELEMETRY_SENSOR1; uint8_t index = menuVerticalPosition - ITEM_TELEMETRY_SENSOR1;
if (index < MAX_TELEMETRY_SENSORS) { if (index < MAX_TELEMETRY_SENSORS) {
if (result == STR_EDIT) { if (result == STR_EDIT) {
@ -391,7 +391,7 @@ void onSensorMenu(const char *result)
} }
} }
void menuModelTelemetryFrsky(uint8_t event) void menuModelTelemetryFrsky(event_t event)
{ {
if (warningResult) { if (warningResult) {
warningResult = 0; warningResult = 0;
@ -402,7 +402,7 @@ void menuModelTelemetryFrsky(uint8_t event)
MENU(STR_MENUTELEMETRY, menuTabModel, MENU_MODEL_TELEMETRY_FRSKY, 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 (uint8_t 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;
int k = i + menuVerticalOffset; int k = i + menuVerticalOffset;
for (int j=0; j<=k; j++) { for (int j=0; j<=k; j++) {

View file

@ -126,7 +126,7 @@ void menuRadioHardware(uint8_t event)
else else
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0); lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
uint8_t potType = (g_eeGeneral.slidersConfig & mask) >> idx; uint8_t potType = (g_eeGeneral.slidersConfig & mask) >> idx;
potType = selectMenuItem(HW_SETTINGS_COLUMN+5*FW, y, "", STR_SLIDERTYPES, potType, SLIDER_NONE, SLIDER_WITH_DETENT, menuHorizontalPosition == 1 ? attr : 0, event); potType = editChoice(HW_SETTINGS_COLUMN+5*FW, y, "", STR_SLIDERTYPES, potType, SLIDER_NONE, SLIDER_WITH_DETENT, menuHorizontalPosition == 1 ? attr : 0, event);
g_eeGeneral.slidersConfig &= ~mask; g_eeGeneral.slidersConfig &= ~mask;
g_eeGeneral.slidersConfig |= (potType << idx); g_eeGeneral.slidersConfig |= (potType << idx);
break; break;
@ -153,7 +153,7 @@ void menuRadioHardware(uint8_t event)
else else
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0); lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
uint8_t potType = (g_eeGeneral.potsConfig & mask) >> shift; uint8_t potType = (g_eeGeneral.potsConfig & mask) >> shift;
potType = selectMenuItem(HW_SETTINGS_COLUMN+5*FW, y, "", STR_POTTYPES, potType, POT_NONE, POT_WITHOUT_DETENT, menuHorizontalPosition == 1 ? attr : 0, event); potType = editChoice(HW_SETTINGS_COLUMN+5*FW, y, "", STR_POTTYPES, potType, POT_NONE, POT_WITHOUT_DETENT, menuHorizontalPosition == 1 ? attr : 0, event);
g_eeGeneral.potsConfig &= ~mask; g_eeGeneral.potsConfig &= ~mask;
g_eeGeneral.potsConfig |= (potType << shift); g_eeGeneral.potsConfig |= (potType << shift);
break; break;
@ -189,7 +189,7 @@ void menuRadioHardware(uint8_t event)
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.switchNames[index], LEN_SWITCH_NAME, event, menuHorizontalPosition == 0 ? attr : 0); editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.switchNames[index], LEN_SWITCH_NAME, event, menuHorizontalPosition == 0 ? attr : 0);
else else
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0); lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
config = selectMenuItem(HW_SETTINGS_COLUMN+5*FW, y, "", STR_SWTYPES, config, SWITCH_NONE, SWITCH_TYPE_MAX(index), menuHorizontalPosition == 1 ? attr : 0, event); config = editChoice(HW_SETTINGS_COLUMN+5*FW, y, "", STR_SWTYPES, config, SWITCH_NONE, SWITCH_TYPE_MAX(index), menuHorizontalPosition == 1 ? attr : 0, event);
if (attr && checkIncDec_Ret) { if (attr && checkIncDec_Ret) {
swconfig_t mask = (swconfig_t)0x03 << (2*index); swconfig_t mask = (swconfig_t)0x03 << (2*index);
g_eeGeneral.switchConfig = (g_eeGeneral.switchConfig & ~mask) | ((swconfig_t(config) & 0x03) << (2*index)); g_eeGeneral.switchConfig = (g_eeGeneral.switchConfig & ~mask) | ((swconfig_t(config) & 0x03) << (2*index));
@ -207,7 +207,7 @@ void menuRadioHardware(uint8_t event)
break; break;
#endif #endif
case ITEM_RADIO_HARDWARE_UART3_MODE: case ITEM_RADIO_HARDWARE_UART3_MODE:
g_eeGeneral.serial2Mode = selectMenuItem(HW_SETTINGS_COLUMN, y, STR_UART3MODE, STR_UART3MODES, g_eeGeneral.serial2Mode, 0, UART_MODE_MAX, attr, event); g_eeGeneral.serial2Mode = editChoice(HW_SETTINGS_COLUMN, y, STR_UART3MODE, STR_UART3MODES, g_eeGeneral.serial2Mode, 0, UART_MODE_MAX, attr, event);
if (attr && checkIncDec_Ret) { if (attr && checkIncDec_Ret) {
serial2Init(g_eeGeneral.serial2Mode, MODEL_TELEMETRY_PROTOCOL()); serial2Init(g_eeGeneral.serial2Mode, MODEL_TELEMETRY_PROTOCOL());
} }

View file

@ -33,7 +33,7 @@ const pm_uchar sticks[] PROGMEM = {
#define SLIDER_5POS(y, value, label, event, attr) { \ #define SLIDER_5POS(y, value, label, event, attr) { \
int8_t tmp = value; \ int8_t tmp = value; \
drawSlider(RADIO_SETUP_2ND_COLUMN, y, 2+tmp, 4, attr); \ drawSlider(RADIO_SETUP_2ND_COLUMN, y, 2+tmp, 4, attr); \
value = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, label, NULL, tmp, -2, +2, attr, event); \ value = editChoice(RADIO_SETUP_2ND_COLUMN, y, label, NULL, tmp, -2, +2, attr, event); \
} }
#if defined(SPLASH) && !defined(FSPLASH) #if defined(SPLASH) && !defined(FSPLASH)
@ -215,7 +215,7 @@ void menuRadioSetup(uint8_t event)
break; break;
case ITEM_SETUP_BEEP_MODE: case ITEM_SETUP_BEEP_MODE:
g_eeGeneral.beepMode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_SPEAKER, STR_VBEEPMODE, g_eeGeneral.beepMode, -2, 1, attr, event); g_eeGeneral.beepMode = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_SPEAKER, STR_VBEEPMODE, g_eeGeneral.beepMode, -2, 1, attr, event);
#if defined(TELEMETRY_FRSKY) #if defined(TELEMETRY_FRSKY)
if (attr && checkIncDec_Ret) frskySendAlarms(); if (attr && checkIncDec_Ret) frskySendAlarms();
#endif #endif
@ -298,7 +298,7 @@ void menuRadioSetup(uint8_t event)
break; break;
case ITEM_SETUP_HAPTIC_MODE: case ITEM_SETUP_HAPTIC_MODE:
g_eeGeneral.hapticMode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_MODE, STR_VBEEPMODE, g_eeGeneral.hapticMode, -2, 1, attr, event); g_eeGeneral.hapticMode = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_MODE, STR_VBEEPMODE, g_eeGeneral.hapticMode, -2, 1, attr, event);
break; break;
case ITEM_SETUP_HAPTIC_LENGTH: case ITEM_SETUP_HAPTIC_LENGTH:
@ -355,7 +355,7 @@ void menuRadioSetup(uint8_t event)
break; break;
case ITEM_SETUP_BACKLIGHT_MODE: case ITEM_SETUP_BACKLIGHT_MODE:
g_eeGeneral.backlightMode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_MODE, STR_VBLMODE, g_eeGeneral.backlightMode, e_backlight_mode_off, e_backlight_mode_on, attr, event); g_eeGeneral.backlightMode = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_MODE, STR_VBLMODE, g_eeGeneral.backlightMode, e_backlight_mode_off, e_backlight_mode_on, attr, event);
break; break;
case ITEM_SETUP_FLASH_BEEP: case ITEM_SETUP_FLASH_BEEP:
@ -419,13 +419,13 @@ void menuRadioSetup(uint8_t event)
break; break;
case ITEM_SETUP_GPSFORMAT: case ITEM_SETUP_GPSFORMAT:
g_eeGeneral.gpsFormat = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_GPSCOORD, STR_GPSFORMAT, g_eeGeneral.gpsFormat, 0, 1, attr, event); g_eeGeneral.gpsFormat = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_GPSCOORD, STR_GPSFORMAT, g_eeGeneral.gpsFormat, 0, 1, attr, event);
break; break;
#endif #endif
#if defined(PXX) #if defined(PXX)
case ITEM_SETUP_COUNTRYCODE: case ITEM_SETUP_COUNTRYCODE:
g_eeGeneral.countryCode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_COUNTRYCODE, STR_COUNTRYCODES, g_eeGeneral.countryCode, 0, 2, attr, event); g_eeGeneral.countryCode = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_COUNTRYCODE, STR_COUNTRYCODES, g_eeGeneral.countryCode, 0, 2, attr, event);
break; break;
#endif #endif
@ -442,7 +442,7 @@ void menuRadioSetup(uint8_t event)
break; break;
case ITEM_SETUP_IMPERIAL: case ITEM_SETUP_IMPERIAL:
g_eeGeneral.imperial = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_UNITSSYSTEM, STR_VUNITSSYSTEM, g_eeGeneral.imperial, 0, 1, attr, event); g_eeGeneral.imperial = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_UNITSSYSTEM, STR_VUNITSSYSTEM, g_eeGeneral.imperial, 0, 1, attr, event);
break; break;
#if defined(FAI_CHOICE) #if defined(FAI_CHOICE)
@ -459,7 +459,7 @@ void menuRadioSetup(uint8_t event)
#if defined(TELEMETRY_MAVLINK) #if defined(TELEMETRY_MAVLINK)
case ITEM_MAVLINK_BAUD: case ITEM_MAVLINK_BAUD:
g_eeGeneral.mavbaud = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_MAVLINK_BAUD_LABEL, STR_MAVLINK_BAUDS, g_eeGeneral.mavbaud, 0, 7, attr, event); g_eeGeneral.mavbaud = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_MAVLINK_BAUD_LABEL, STR_MAVLINK_BAUDS, g_eeGeneral.mavbaud, 0, 7, attr, event);
break; break;
#endif #endif

View file

@ -129,7 +129,7 @@ void title(const pm_char * s)
lcdDrawText(0, 0, s, INVERS); lcdDrawText(0, 0, s, INVERS);
} }
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) choice_t editChoice(coord_t x, coord_t y, const pm_char *label, const pm_char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, uint8_t event)
{ {
drawFieldLabel(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);
@ -140,10 +140,10 @@ select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char *label, c
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const pm_char *label, 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 )
{ {
drawCheckBox(x, y, value, attr); drawCheckBox(x, y, value, attr);
return selectMenuItem(x, y, label, NULL, value, 0, 1, attr, event); return editChoice(x, y, label, NULL, value, 0, 1, attr, event);
} }
swsrc_t switchMenuItem(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, uint8_t event) swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, uint8_t event)
{ {
drawFieldLabel(x, y, STR_SWITCH); drawFieldLabel(x, y, STR_SWITCH);
drawSwitch(x, y, value, attr); drawSwitch(x, y, value, attr);

View file

@ -28,6 +28,7 @@
#include "bitmaps.h" #include "bitmaps.h"
#include "theme.h" #include "theme.h"
#define MENU_TOOLTIPS
#define MENU_HEADER_HEIGHT 45 #define MENU_HEADER_HEIGHT 45
#define MENU_TITLE_TOP 48 #define MENU_TITLE_TOP 48
#define MENU_TITLE_HEIGHT 21 #define MENU_TITLE_HEIGHT 21

View file

@ -294,30 +294,6 @@ void drawTrimMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att
} }
} }
const pm_uint8_t bchunit_ar[] PROGMEM = {
UNIT_DIST, // Alt
UNIT_RAW, // Rpm
UNIT_PERCENT, // Fuel
UNIT_TEMPERATURE, // T1
UNIT_TEMPERATURE, // T2
UNIT_KTS, // Speed
UNIT_DIST, // Dist
UNIT_DIST, // GPS Alt
};
void drawValueWithUnit(coord_t x, coord_t y, int32_t val, uint8_t unit, LcdFlags att)
{
// convertUnit(val, unit);
if (!(att & NO_UNIT) && unit != UNIT_RAW) {
char unitStr[8];
strAppend(unitStr, STR_VTELEMUNIT+1+unit*STR_VTELEMUNIT[0], STR_VTELEMUNIT[0]);
lcdDrawNumber(x, y, val, att, 0, NULL, unitStr);
}
else {
lcdDrawNumber(x, y, val, att);
}
}
void drawDate(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags att) void drawDate(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags att)
{ {
// TODO // TODO

View file

@ -129,7 +129,6 @@ inline void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, uint8_t le
void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags mode=0); void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags mode=0);
void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags flags=0, uint8_t len=0, const char * prefix=NULL, const char * suffix=NULL); void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags flags=0, uint8_t len=0, const char * prefix=NULL, const char * suffix=NULL);
void drawStringWithIndex(coord_t x, coord_t y, const pm_char *str, int idx, LcdFlags att=0, const char *prefix="");
void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att); void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att);
void putsStickName(coord_t x, coord_t y, uint8_t idx, LcdFlags att=0); void putsStickName(coord_t x, coord_t y, uint8_t idx, LcdFlags att=0);
void drawSwitch(coord_t x, coord_t y, swsrc_t swtch, LcdFlags flags=0); void drawSwitch(coord_t x, coord_t y, swsrc_t swtch, LcdFlags flags=0);

View file

@ -167,6 +167,7 @@ const uint8_t MONITOR_ICONS[] = {
}; };
bool menuModelSetup(event_t event); bool menuModelSetup(event_t event);
bool menuModelFailsafe(event_t event);
bool menuModelHeli(event_t event); bool menuModelHeli(event_t event);
bool menuModelFlightModesAll(event_t event); bool menuModelFlightModesAll(event_t event);
bool menuModelExposAll(event_t event); bool menuModelExposAll(event_t event);
@ -400,11 +401,6 @@ bool check_submenu_simple(event_t event, uint8_t maxrow);
if (!check_submenu_simple(event, lines_count)) return false; \ if (!check_submenu_simple(event, lines_count)) return false; \
drawMenuTemplate(title, icon, NULL, options) drawMenuTemplate(title, icon, NULL, options)
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, event_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)
#else #else

View file

@ -159,7 +159,7 @@ bool menuModelCurveOne(event_t event)
pointsOfs = 0; pointsOfs = 0;
break; break;
case EVT_KEY_LONG(KEY_ENTER): case EVT_KEY_LONG(KEY_ENTER):
if (menuVerticalPosition > ITEM_CURVE_POINTS) { if (menuVerticalPosition > ITEM_CURVE_NAME) {
killEvents(event); killEvents(event);
POPUP_MENU_ADD_ITEM(STR_CURVE_PRESET); POPUP_MENU_ADD_ITEM(STR_CURVE_PRESET);
POPUP_MENU_ADD_ITEM(STR_MIRROR); POPUP_MENU_ADD_ITEM(STR_MIRROR);
@ -290,12 +290,11 @@ bool menuModelCurvesAll(event_t event)
{ {
SIMPLE_MENU(STR_MENUCURVES, MODEL_ICONS, menuTabModel, MENU_MODEL_CURVES, MAX_CURVES); SIMPLE_MENU(STR_MENUCURVES, MODEL_ICONS, menuTabModel, MENU_MODEL_CURVES, MAX_CURVES);
int8_t sub = menuVerticalPosition; s_curveChan = menuVerticalPosition;
switch (event) { switch (event) {
case EVT_KEY_BREAK(KEY_ENTER): case EVT_KEY_BREAK(KEY_ENTER):
if (!READ_ONLY()) { if (!READ_ONLY()) {
s_curveChan = sub;
pushMenu(menuModelCurveOne); pushMenu(menuModelCurveOne);
} }
break; break;
@ -304,7 +303,7 @@ bool menuModelCurvesAll(event_t event)
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;
uint8_t k = i + menuVerticalOffset; uint8_t k = i + menuVerticalOffset;
LcdFlags attr = (sub == k ? INVERS : 0); LcdFlags attr = (menuVerticalPosition == k ? INVERS : 0);
{ {
drawStringWithIndex(MENUS_MARGIN_LEFT, y, STR_CV, k+1, attr); drawStringWithIndex(MENUS_MARGIN_LEFT, y, STR_CV, k+1, attr);
CurveData & crv = g_model.curves[k]; CurveData & crv = g_model.curves[k];
@ -313,10 +312,7 @@ bool menuModelCurvesAll(event_t event)
} }
} }
if (sub >= 0) { drawCurve(CURVE_CENTER_X, CURVE_CENTER_Y+10, 80);
s_curveChan = sub;
drawCurve(CURVE_CENTER_X, CURVE_CENTER_Y+10, 80);
}
return true; return true;
} }

View file

@ -121,11 +121,11 @@ bool menuModelFlightModesAll(event_t event)
return true; return true;
} }
FlightModeData *p = flightModeAddress(k); FlightModeData * p = flightModeAddress(k);
drawFlightMode(MENUS_MARGIN_LEFT, y, k+1, (getFlightMode()==k ? BOLD : 0) | ((menuVerticalPosition==k && menuHorizontalPosition<0) ? INVERS : 0)); drawFlightMode(MENUS_MARGIN_LEFT, y, k+1, (getFlightMode()==k ? BOLD : 0) | ((menuVerticalPosition==k && menuHorizontalPosition<0) ? INVERS : 0));
for (int j=0; j<ITEM_FLIGHT_MODES_COUNT; j++) { for (uint8_t j=0; j<ITEM_FLIGHT_MODES_COUNT; j++) {
LcdFlags attr = ((menuVerticalPosition==k && menuHorizontalPosition==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0); LcdFlags attr = ((menuVerticalPosition==k && menuHorizontalPosition==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
LcdFlags active = (attr && s_editMode>0) ; LcdFlags active = (attr && s_editMode>0) ;
switch (j) { switch (j) {

View file

@ -219,7 +219,7 @@ bool menuModelExpoOne(event_t event)
drawCurveCoord(CURVE_CENTER_X-CURVE_SIDE_WIDTH-37, top, texty); drawCurveCoord(CURVE_CENTER_X-CURVE_SIDE_WIDTH-37, top, texty);
} }
for (int i=0; i<NUM_BODY_LINES+1; i++) { for (uint8_t i=0; i<NUM_BODY_LINES+1; i++) {
LcdFlags attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0); LcdFlags attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
switch (i) { switch (i) {
case EXPO_FIELD_INPUT_NAME: case EXPO_FIELD_INPUT_NAME:
@ -244,7 +244,7 @@ bool menuModelExpoOne(event_t event)
menuHorizontalPosition = 0; menuHorizontalPosition = 0;
} }
break; break;
case EXPO_FIELD_SCALE: case EXPO_FIELD_SCALE:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_SCALE); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_SCALE);
drawSensorCustomValue(EXPO_ONE_2ND_COLUMN, y, (ed->srcRaw - MIXSRC_FIRST_TELEM)/3, convertTelemValue(ed->srcRaw - MIXSRC_FIRST_TELEM + 1, ed->scale), LEFT|attr); drawSensorCustomValue(EXPO_ONE_2ND_COLUMN, y, (ed->srcRaw - MIXSRC_FIRST_TELEM)/3, convertTelemValue(ed->srcRaw - MIXSRC_FIRST_TELEM + 1, ed->scale), LEFT|attr);
@ -277,12 +277,12 @@ bool menuModelExpoOne(event_t event)
case EXPO_FIELD_SWITCH: case EXPO_FIELD_SWITCH:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_SWITCH); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_SWITCH);
ed->swtch = switchMenuItem(EXPO_ONE_2ND_COLUMN, y, ed->swtch, attr, event); ed->swtch = editSwitch(EXPO_ONE_2ND_COLUMN, y, ed->swtch, attr, event);
break; break;
case EXPO_FIELD_SIDE: case EXPO_FIELD_SIDE:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_SIDE); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_SIDE);
ed->mode = 4 - selectMenuItem(EXPO_ONE_2ND_COLUMN, y, STR_VSIDE, 4-ed->mode, 1, 3, attr, event); ed->mode = 4 - editChoice(EXPO_ONE_2ND_COLUMN, y, STR_VSIDE, 4-ed->mode, 1, 3, attr, event);
break; break;
case EXPO_FIELD_TRIM: case EXPO_FIELD_TRIM:

View file

@ -85,9 +85,11 @@ bool menuModelLogicalSwitches(event_t event)
REPEAT_LAST_CURSOR_MOVE(LS_FIELD_LAST, false); REPEAT_LAST_CURSOR_MOVE(LS_FIELD_LAST, false);
} }
#if defined(MENU_TOOLTIPS)
if (menuVerticalPosition>= 0 && menuHorizontalPosition>=0) { if (menuVerticalPosition>= 0 && menuHorizontalPosition>=0) {
drawColumnHeader(STR_LSW_HEADERS, STR_LSW_DESCRIPTIONS, menuHorizontalPosition); drawColumnHeader(STR_LSW_HEADERS, STR_LSW_DESCRIPTIONS, menuHorizontalPosition);
} }
#endif
if (menuHorizontalPosition<0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) { if (menuHorizontalPosition<0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
killEvents(event); killEvents(event);

View file

@ -239,11 +239,11 @@ bool menuModelMixOne(event_t event)
#endif #endif
case MIX_FIELD_SWITCH: case MIX_FIELD_SWITCH:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_SWITCH); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_SWITCH);
md2->swtch = switchMenuItem(MIXES_2ND_COLUMN, y, md2->swtch, attr, event); md2->swtch = editSwitch(MIXES_2ND_COLUMN, y, md2->swtch, attr, event);
break; break;
case MIX_FIELD_MLTPX: case MIX_FIELD_MLTPX:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_MULTPX); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_MULTPX);
md2->mltpx = selectMenuItem(MIXES_2ND_COLUMN, y, STR_VMLTPX, md2->mltpx, 0, 2, attr, event); md2->mltpx = editChoice(MIXES_2ND_COLUMN, y, STR_VMLTPX, md2->mltpx, 0, 2, attr, event);
break; break;
case MIX_FIELD_DELAY_UP: case MIX_FIELD_DELAY_UP:
lcdDrawText(MENU_COLUMN2_X+MENUS_MARGIN_LEFT, y, STR_DELAYUP); lcdDrawText(MENU_COLUMN2_X+MENUS_MARGIN_LEFT, y, STR_DELAYUP);
@ -381,14 +381,14 @@ void displayMixStatus(uint8_t channel)
bool menuModelMixAll(event_t event) bool menuModelMixAll(event_t event)
{ {
BitmapBuffer * mpx_mode[] = { static const BitmapBuffer * mpx_mode[] = {
mixerSetupAddBitmap, mixerSetupAddBitmap,
mixerSetupMultiBitmap, mixerSetupMultiBitmap,
mixerSetupReplaceBitmap mixerSetupReplaceBitmap
}; };
int sub = menuVerticalPosition; uint8_t sub = menuVerticalPosition;
if (s_editMode > 0) { if (s_editMode > 0) {
s_editMode = 0; s_editMode = 0;
@ -465,7 +465,7 @@ bool menuModelMixAll(event_t event)
s_copyMode = 0; s_copyMode = 0;
return true; return true;
} }
else if (menuVerticalPosition >= 0) { else {
event = 0; event = 0;
s_copyMode = 0; s_copyMode = 0;
POPUP_MENU_ADD_ITEM(STR_EDIT); POPUP_MENU_ADD_ITEM(STR_EDIT);
@ -543,7 +543,9 @@ bool menuModelMixAll(event_t event)
if (cur-menuVerticalOffset >= 0 && cur-menuVerticalOffset < NUM_BODY_LINES) { if (cur-menuVerticalOffset >= 0 && cur-menuVerticalOffset < NUM_BODY_LINES) {
LcdFlags attr = ((s_copyMode || sub != cur) ? 0 : INVERS); LcdFlags attr = ((s_copyMode || sub != cur) ? 0 : INVERS);
if (mixCnt > 0) lcd->drawBitmap(10, y, mpx_mode[md->mltpx]); if (mixCnt > 0) {
lcd->drawBitmap(10, y, mpx_mode[md->mltpx]);
}
drawSource(MIX_LINE_SRC_POS, y, md->srcRaw); drawSource(MIX_LINE_SRC_POS, y, md->srcRaw);

View file

@ -21,7 +21,6 @@
#include "opentx.h" #include "opentx.h"
uint8_t g_moduleIdx; uint8_t g_moduleIdx;
bool menuModelFailsafe(event_t event);
enum MenuModelSetupItems { enum MenuModelSetupItems {
ITEM_MODEL_NAME, ITEM_MODEL_NAME,
@ -89,7 +88,7 @@ enum MenuModelSetupItems {
#define MODEL_SETUP_RANGE_OFS 80 #define MODEL_SETUP_RANGE_OFS 80
#define MODEL_SETUP_SET_FAILSAFE_OFS 100 #define MODEL_SETUP_SET_FAILSAFE_OFS 100
void onModelSetupBitmapMenu(const char *result) void onModelSetupBitmapMenu(const char * result)
{ {
if (result == STR_UPDATE_LIST) { if (result == STR_UPDATE_LIST) {
if (!sdListFiles(BITMAPS_PATH, BITMAPS_EXT, sizeof(g_model.header.bitmap), NULL)) { if (!sdListFiles(BITMAPS_PATH, BITMAPS_EXT, sizeof(g_model.header.bitmap), NULL)) {
@ -255,9 +254,9 @@ bool menuModelSetup(event_t event)
int sub = menuVerticalPosition; int sub = menuVerticalPosition;
for (int i=0; i<NUM_BODY_LINES; ++i) { for (uint8_t i=0; i<NUM_BODY_LINES; ++i) {
coord_t y = MENU_CONTENT_TOP + i*FH; coord_t y = MENU_CONTENT_TOP + i*FH;
int k = i + menuVerticalOffset; uint8_t k = i + menuVerticalOffset;
for (int j=0; j<=k; j++) { for (int j=0; j<=k; j++) {
if (mstate_tab[j] == HIDDEN_ROW) if (mstate_tab[j] == HIDDEN_ROW)
k++; k++;
@ -309,7 +308,7 @@ bool menuModelSetup(event_t event)
case ITEM_MODEL_TIMER1_PERSISTENT: case ITEM_MODEL_TIMER1_PERSISTENT:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_PERSISTENT); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_PERSISTENT);
g_model.timers[0].persistent = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_VPERSISTENT, g_model.timers[0].persistent, 0, 2, attr, event); g_model.timers[0].persistent = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_VPERSISTENT, g_model.timers[0].persistent, 0, 2, attr, event);
break; break;
#if TIMERS > 1 #if TIMERS > 1
@ -333,10 +332,10 @@ bool menuModelSetup(event_t event)
case ITEM_MODEL_TIMER2_PERSISTENT: case ITEM_MODEL_TIMER2_PERSISTENT:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_PERSISTENT); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_PERSISTENT);
g_model.timers[1].persistent = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_VPERSISTENT, g_model.timers[1].persistent, 0, 2, attr, event); g_model.timers[1].persistent = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_VPERSISTENT, g_model.timers[1].persistent, 0, 2, attr, event);
break; break;
#endif #endif
#if TIMERS > 2 #if TIMERS > 2
case ITEM_MODEL_TIMER3: case ITEM_MODEL_TIMER3:
editTimerMode(2, y, attr, event); editTimerMode(2, y, attr, event);
@ -358,7 +357,7 @@ bool menuModelSetup(event_t event)
case ITEM_MODEL_TIMER3_PERSISTENT: case ITEM_MODEL_TIMER3_PERSISTENT:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_PERSISTENT); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_PERSISTENT);
g_model.timers[2].persistent = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_VPERSISTENT, g_model.timers[2].persistent, 0, 2, attr, event); g_model.timers[2].persistent = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_VPERSISTENT, g_model.timers[2].persistent, 0, 2, attr, event);
break; break;
#endif #endif
@ -386,12 +385,12 @@ bool menuModelSetup(event_t event)
case ITEM_MODEL_DISPLAY_TRIMS: case ITEM_MODEL_DISPLAY_TRIMS:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_DISPLAY_TRIMS); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_DISPLAY_TRIMS);
g_model.displayTrims = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, "\006No\0 ChangeYes", g_model.displayTrims, 0, 2, attr, event); g_model.displayTrims = editChoice(MODEL_SETUP_2ND_COLUMN, y, "\006No\0 ChangeYes", g_model.displayTrims, 0, 2, attr, event);
break; break;
case ITEM_MODEL_TRIM_INC: case ITEM_MODEL_TRIM_INC:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_TRIMINC); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_TRIMINC);
g_model.trimInc = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_VTRIMINC, g_model.trimInc, -2, 2, attr, event); g_model.trimInc = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_VTRIMINC, g_model.trimInc, -2, 2, attr, event);
break; break;
case ITEM_MODEL_THROTTLE_LABEL: case ITEM_MODEL_THROTTLE_LABEL:
@ -568,7 +567,7 @@ bool menuModelSetup(event_t event)
case ITEM_MODEL_INTERNAL_MODULE_ANTENNA: case ITEM_MODEL_INTERNAL_MODULE_ANTENNA:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_ANTENNASELECTION); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_ANTENNASELECTION);
newAntennaSel = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_VANTENNATYPES, g_model.moduleData[INTERNAL_MODULE].ppm.pulsePol, 0, 1, attr, event); newAntennaSel = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_VANTENNATYPES, g_model.moduleData[INTERNAL_MODULE].ppm.pulsePol, 0, 1, attr, event);
if (newAntennaSel != g_model.moduleData[INTERNAL_MODULE].ppm.pulsePol && newAntennaSel == XJT_EXTERNAL_ANTENNA) { if (newAntennaSel != g_model.moduleData[INTERNAL_MODULE].ppm.pulsePol && newAntennaSel == XJT_EXTERNAL_ANTENNA) {
POPUP_CONFIRMATION(STR_ANTENNACONFIRM1); POPUP_CONFIRMATION(STR_ANTENNACONFIRM1);
const char * w = STR_ANTENNACONFIRM2; const char * w = STR_ANTENNACONFIRM2;
@ -581,7 +580,7 @@ bool menuModelSetup(event_t event)
case ITEM_MODEL_TRAINER_MODE: case ITEM_MODEL_TRAINER_MODE:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_MODE); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_MODE);
g_model.trainerMode = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_VTRAINERMODES, g_model.trainerMode, 0, HAS_WIRELESS_TRAINER_HARDWARE() ? TRAINER_MODE_MASTER_BATTERY_COMPARTMENT : TRAINER_MODE_SLAVE, attr, event); g_model.trainerMode = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_VTRAINERMODES, g_model.trainerMode, 0, HAS_WIRELESS_TRAINER_HARDWARE() ? TRAINER_MODE_MASTER_BATTERY_COMPARTMENT : TRAINER_MODE_SLAVE, attr, event);
break; break;
case ITEM_MODEL_EXTERNAL_MODULE_LABEL: case ITEM_MODEL_EXTERNAL_MODULE_LABEL:
@ -590,7 +589,7 @@ bool menuModelSetup(event_t event)
case ITEM_MODEL_EXTERNAL_MODULE_MODE: case ITEM_MODEL_EXTERNAL_MODULE_MODE:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_MODE); lcdDrawText(MENUS_MARGIN_LEFT, 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));
else if (IS_MODULE_DSM2(EXTERNAL_MODULE)) else if (IS_MODULE_DSM2(EXTERNAL_MODULE))
@ -856,7 +855,7 @@ bool menuModelSetup(event_t event)
break; break;
case MM_RF_PROTO_DSM2: case MM_RF_PROTO_DSM2:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_MULTI_DSMFRAME); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_MULTI_DSMFRAME);
g_model.moduleData[moduleIdx].multi.optionValue = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_OPTIONS_DSM, g_model.moduleData[moduleIdx].multi.optionValue, 0, 12, attr, event); g_model.moduleData[moduleIdx].multi.optionValue = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_OPTIONS_DSM, g_model.moduleData[moduleIdx].multi.optionValue, 0, 12, attr, event);
break; break;
default: default:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_MULTI_OPTION); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_MULTI_OPTION);

View file

@ -131,7 +131,7 @@ bool menuModelSensor(event_t event)
lcdDrawNumber(lcdNextPos, 3, s_currIdx+1, MENU_TITLE_COLOR|LEFT); lcdDrawNumber(lcdNextPos, 3, s_currIdx+1, MENU_TITLE_COLOR|LEFT);
drawSensorCustomValue(50, 3+FH, s_currIdx, getValue(MIXSRC_FIRST_TELEM+3*s_currIdx), MENU_TITLE_COLOR|LEFT); drawSensorCustomValue(50, 3+FH, s_currIdx, getValue(MIXSRC_FIRST_TELEM+3*s_currIdx), MENU_TITLE_COLOR|LEFT);
for (unsigned int i=0; i<NUM_BODY_LINES+1; i++) { for (uint8_t i=0; i<NUM_BODY_LINES+1; i++) {
coord_t y = MENU_CONTENT_TOP - FH - 2 + i*FH; coord_t y = MENU_CONTENT_TOP - FH - 2 + i*FH;
int k = i + menuVerticalOffset; int k = i + menuVerticalOffset;
@ -153,7 +153,7 @@ bool menuModelSensor(event_t event)
case SENSOR_FIELD_TYPE: case SENSOR_FIELD_TYPE:
lcdDrawText(MENUS_MARGIN_LEFT, y, NO_INDENT(STR_TYPE)); lcdDrawText(MENUS_MARGIN_LEFT, y, NO_INDENT(STR_TYPE));
sensor->type = selectMenuItem(SENSOR_2ND_COLUMN, y, STR_VSENSORTYPES, sensor->type, 0, 1, attr, event); sensor->type = editChoice(SENSOR_2ND_COLUMN, y, STR_VSENSORTYPES, sensor->type, 0, 1, attr, event);
if (attr && checkIncDec_Ret) { if (attr && checkIncDec_Ret) {
sensor->instance = 0; sensor->instance = 0;
if (sensor->type == TELEM_TYPE_CALCULATED) { if (sensor->type == TELEM_TYPE_CALCULATED) {
@ -183,7 +183,7 @@ bool menuModelSensor(event_t event)
} }
else { else {
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_FORMULA); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_FORMULA);
sensor->formula = selectMenuItem(SENSOR_2ND_COLUMN, y, STR_VFORMULAS, sensor->formula, 0, TELEM_FORMULA_LAST, attr, event); sensor->formula = editChoice(SENSOR_2ND_COLUMN, y, STR_VFORMULAS, sensor->formula, 0, TELEM_FORMULA_LAST, attr, event);
if (attr && checkIncDec_Ret) { if (attr && checkIncDec_Ret) {
sensor->param = 0; sensor->param = 0;
if (sensor->formula == TELEM_FORMULA_CELL) { if (sensor->formula == TELEM_FORMULA_CELL) {
@ -204,7 +204,7 @@ bool menuModelSensor(event_t event)
case SENSOR_FIELD_UNIT: case SENSOR_FIELD_UNIT:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_UNIT); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_UNIT);
// TODO flash saving with selectMenuItem where I copied those 2 lines? // TODO flash saving with editChoice 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) {
CHECK_INCDEC_MODELVAR_ZERO(event, sensor->unit, UNIT_MAX); CHECK_INCDEC_MODELVAR_ZERO(event, sensor->unit, UNIT_MAX);
@ -219,7 +219,7 @@ bool menuModelSensor(event_t event)
case SENSOR_FIELD_PRECISION: case SENSOR_FIELD_PRECISION:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_PRECISION); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_PRECISION);
sensor->prec = selectMenuItem(SENSOR_2ND_COLUMN, y, STR_VPREC, sensor->prec, 0, 2, attr, event); sensor->prec = editChoice(SENSOR_2ND_COLUMN, y, STR_VPREC, sensor->prec, 0, 2, attr, event);
if (attr && checkIncDec_Ret) { if (attr && checkIncDec_Ret) {
telemetryItems[s_currIdx].clear(); telemetryItems[s_currIdx].clear();
} }
@ -247,7 +247,7 @@ bool menuModelSensor(event_t event)
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_CURRENTSENSOR); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_CURRENTSENSOR);
drawSource(SENSOR_2ND_COLUMN, y, sensor->consumption.source ? MIXSRC_FIRST_TELEM+3*(sensor->consumption.source-1) : 0, attr); drawSource(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_TELEMETRY_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isTelemetryFieldAvailable); sensor->consumption.source = checkIncDec(event, sensor->consumption.source, 0, MAX_TELEMETRY_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isSensorAvailable);
} }
break; break;
} }
@ -255,7 +255,7 @@ bool menuModelSensor(event_t event)
lcdDrawText(MENUS_MARGIN_LEFT, y, NO_INDENT(STR_SOURCE)); lcdDrawText(MENUS_MARGIN_LEFT, y, NO_INDENT(STR_SOURCE));
drawSource(SENSOR_2ND_COLUMN, y, sensor->consumption.source ? MIXSRC_FIRST_TELEM+3*(sensor->consumption.source-1) : 0, attr); drawSource(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_TELEMETRY_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isTelemetryFieldComparisonAvailable); sensor->consumption.source = checkIncDec(event, sensor->consumption.source, 0, MAX_TELEMETRY_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isSensorAvailable);
} }
break; break;
} }
@ -283,7 +283,7 @@ bool menuModelSensor(event_t event)
if (sensor->type == TELEM_TYPE_CALCULATED) { if (sensor->type == TELEM_TYPE_CALCULATED) {
if (sensor->formula == TELEM_FORMULA_CELL) { if (sensor->formula == TELEM_FORMULA_CELL) {
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_CELLINDEX); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_CELLINDEX);
sensor->cell.index = selectMenuItem(SENSOR_2ND_COLUMN, y, STR_VCELLINDEX, sensor->cell.index, 0, 8, attr, event); sensor->cell.index = editChoice(SENSOR_2ND_COLUMN, y, STR_VCELLINDEX, sensor->cell.index, 0, 8, attr, event);
break; break;
} }
else if (sensor->formula == TELEM_FORMULA_DIST) { else if (sensor->formula == TELEM_FORMULA_DIST) {
@ -348,6 +348,9 @@ bool menuModelSensor(event_t event)
case SENSOR_FIELD_PERSISTENT: case SENSOR_FIELD_PERSISTENT:
lcdDrawText(MENUS_MARGIN_LEFT, y, NO_INDENT(STR_PERSISTENT)); lcdDrawText(MENUS_MARGIN_LEFT, y, NO_INDENT(STR_PERSISTENT));
sensor->persistent = editCheckBox(sensor->persistent, SENSOR_2ND_COLUMN, y, attr, event); sensor->persistent = editCheckBox(sensor->persistent, SENSOR_2ND_COLUMN, y, attr, event);
if (checkIncDec_Ret && !sensor->persistent) {
sensor->persistentValue = 0;
}
break; break;
case SENSOR_FIELD_LOGS: case SENSOR_FIELD_LOGS:
@ -359,13 +362,12 @@ bool menuModelSensor(event_t event)
break; break;
} }
} }
return true; return true;
} }
void onSensorMenu(const char *result) void onSensorMenu(const char * result)
{ {
int index = menuVerticalPosition - ITEM_TELEMETRY_SENSOR1; uint8_t index = menuVerticalPosition - ITEM_TELEMETRY_SENSOR1;
if (index < MAX_TELEMETRY_SENSORS) { if (index < MAX_TELEMETRY_SENSORS) {
if (result == STR_EDIT) { if (result == STR_EDIT) {
@ -409,7 +411,7 @@ bool menuModelTelemetryFrsky(event_t event)
MENU(STR_MENUTELEMETRY, MODEL_ICONS, menuTabModel, MENU_MODEL_TELEMETRY_FRSKY, 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 (uint8_t i=0; i<NUM_BODY_LINES; i++) {
coord_t y = MENU_CONTENT_TOP + i*FH; coord_t y = MENU_CONTENT_TOP + i*FH;
int k = i + menuVerticalOffset; int k = i + menuVerticalOffset;
for (int j=0; j<=k; j++) { for (int j=0; j<=k; j++) {
@ -583,6 +585,5 @@ bool menuModelTelemetryFrsky(event_t event)
#endif #endif
} }
} }
return true; return true;
} }

View file

@ -107,7 +107,7 @@ bool menuRadioHardware(event_t event)
else else
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0); lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
uint8_t potType = (g_eeGeneral.slidersConfig & mask) >> idx; uint8_t potType = (g_eeGeneral.slidersConfig & mask) >> idx;
potType = selectMenuItem(HW_SETTINGS_COLUMN+50, y, STR_SLIDERTYPES, potType, SLIDER_NONE, SLIDER_WITH_DETENT, menuHorizontalPosition == 1 ? attr : 0, event); potType = editChoice(HW_SETTINGS_COLUMN+50, y, STR_SLIDERTYPES, potType, SLIDER_NONE, SLIDER_WITH_DETENT, menuHorizontalPosition == 1 ? attr : 0, event);
g_eeGeneral.slidersConfig &= ~mask; g_eeGeneral.slidersConfig &= ~mask;
g_eeGeneral.slidersConfig |= (potType << idx); g_eeGeneral.slidersConfig |= (potType << idx);
break; break;
@ -128,7 +128,7 @@ bool menuRadioHardware(event_t event)
else else
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0); lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
uint8_t potType = (g_eeGeneral.potsConfig & mask) >> shift; uint8_t potType = (g_eeGeneral.potsConfig & mask) >> shift;
potType = selectMenuItem(HW_SETTINGS_COLUMN+50, y, STR_POTTYPES, potType, POT_NONE, POT_WITHOUT_DETENT, menuHorizontalPosition == 1 ? attr : 0, event); potType = editChoice(HW_SETTINGS_COLUMN+50, y, STR_POTTYPES, potType, POT_NONE, POT_WITHOUT_DETENT, menuHorizontalPosition == 1 ? attr : 0, event);
g_eeGeneral.potsConfig &= ~mask; g_eeGeneral.potsConfig &= ~mask;
g_eeGeneral.potsConfig |= (potType << shift); g_eeGeneral.potsConfig |= (potType << shift);
break; break;
@ -152,7 +152,7 @@ bool menuRadioHardware(event_t event)
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.switchNames[index], LEN_SWITCH_NAME, event, menuHorizontalPosition == 0 ? attr : 0); editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.switchNames[index], LEN_SWITCH_NAME, event, menuHorizontalPosition == 0 ? attr : 0);
else else
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0); lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
config = selectMenuItem(HW_SETTINGS_COLUMN+50, y, STR_SWTYPES, config, SWITCH_NONE, SWITCH_TYPE_MAX(index), menuHorizontalPosition == 1 ? attr : 0, event); config = editChoice(HW_SETTINGS_COLUMN+50, y, STR_SWTYPES, config, SWITCH_NONE, SWITCH_TYPE_MAX(index), menuHorizontalPosition == 1 ? attr : 0, event);
if (attr && checkIncDec_Ret) { if (attr && checkIncDec_Ret) {
swconfig_t mask = (swconfig_t)0x03 << (2*index); swconfig_t mask = (swconfig_t)0x03 << (2*index);
g_eeGeneral.switchConfig = (g_eeGeneral.switchConfig & ~mask) | ((swconfig_t(config) & 0x03) << (2*index)); g_eeGeneral.switchConfig = (g_eeGeneral.switchConfig & ~mask) | ((swconfig_t(config) & 0x03) << (2*index));
@ -171,7 +171,7 @@ bool menuRadioHardware(event_t event)
#if 0 #if 0
case ITEM_RADIO_HARDWARE_UART3_MODE: case ITEM_RADIO_HARDWARE_UART3_MODE:
g_eeGeneral.serial2Mode = selectMenuItem(HW_SETTINGS_COLUMN, y, STR_UART3MODE, STR_UART3MODES, g_eeGeneral.serial2Mode, 0, UART_MODE_MAX, attr, event); g_eeGeneral.serial2Mode = editChoice(HW_SETTINGS_COLUMN, y, STR_UART3MODE, STR_UART3MODES, g_eeGeneral.serial2Mode, 0, UART_MODE_MAX, attr, event);
if (attr && checkIncDec_Ret) { if (attr && checkIncDec_Ret) {
serial2Init(g_eeGeneral.serial2Mode, MODEL_TELEMETRY_PROTOCOL()); serial2Init(g_eeGeneral.serial2Mode, MODEL_TELEMETRY_PROTOCOL());
} }

View file

@ -181,6 +181,7 @@ bool menuRadioSdManager(event_t _event)
break; break;
#if 0 #if 0
// TODO: Implement it
case EVT_KEY_LONG(KEY_MENU): case EVT_KEY_LONG(KEY_MENU):
if (!READ_ONLY() && s_editMode == 0) { if (!READ_ONLY() && s_editMode == 0) {
killEvents(_event); killEvents(_event);
@ -196,13 +197,7 @@ bool menuRadioSdManager(event_t _event)
break; break;
case EVT_KEY_BREAK(KEY_ENTER): case EVT_KEY_BREAK(KEY_ENTER):
if (menuVerticalPosition < 0) { if (s_editMode > 0) {
if (reusableBuffer.sdmanager.count > 0) {
menuVerticalPosition = 0;
}
break;
}
else if (s_editMode > 0) {
break; break;
} }
else { else {
@ -342,7 +337,7 @@ bool menuRadioSdManager(event_t _event)
reusableBuffer.sdmanager.offset = menuVerticalOffset; reusableBuffer.sdmanager.offset = menuVerticalOffset;
for (int i=0; i<NUM_BODY_LINES; i++) { for (uint8_t i=0; i<NUM_BODY_LINES; i++) {
coord_t y = MENU_CONTENT_TOP + i*FH; coord_t y = MENU_CONTENT_TOP + i*FH;
LcdFlags attr = (index == i ? INVERS : 0); LcdFlags attr = (index == i ? INVERS : 0);
if (reusableBuffer.sdmanager.lines[i][0]) { if (reusableBuffer.sdmanager.lines[i][0]) {

View file

@ -27,10 +27,10 @@
int8_t editSlider(coord_t x, coord_t y, event_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 editChoice(x, y, NULL, value, min, max, attr, event);
} }
#define SLIDER_5POS(y, val, event, attr) val = editSlider(RADIO_SETUP_2ND_COLUMN, y, event, val, -2, +2, attr) #define SLIDER_5POS(val) val = editSlider(RADIO_SETUP_2ND_COLUMN, y, event, val, -2, +2, attr)
#if defined(SPLASH) && !defined(FSPLASH) #if defined(SPLASH) && !defined(FSPLASH)
#define CASE_SPLASH_PARAM(x) x, #define CASE_SPLASH_PARAM(x) x,
@ -115,7 +115,8 @@ bool menuRadioSetup(event_t event)
CASE_HAPTIC(LABEL(HAPTIC)) CASE_HAPTIC(0) CASE_HAPTIC(0) CASE_HAPTIC(0) CASE_HAPTIC(LABEL(HAPTIC)) CASE_HAPTIC(0) CASE_HAPTIC(0) CASE_HAPTIC(0)
LABEL(ALARMS), 0, 0, 0, LABEL(ALARMS), 0, 0, 0,
LABEL(BACKLIGHT), 0, 0, 0, 0, 0, LABEL(BACKLIGHT), 0, 0, 0, 0, 0,
CASE_GPS(LABEL(GPS)) CASE_GPS(0) CASE_GPS(0) CASE_PXX(0) 0, 0, 0, 0, 0, 0, 1/*to force edit mode*/ }); CASE_GPS(LABEL(GPS)) CASE_GPS(0) CASE_GPS(0)
CASE_PXX(0) 0, 0, 0, 0, 0, 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;
@ -225,7 +226,7 @@ bool menuRadioSetup(event_t event)
case ITEM_SETUP_BEEP_MODE: case ITEM_SETUP_BEEP_MODE:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_SPEAKER); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_SPEAKER);
g_eeGeneral.beepMode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_VBEEPMODE, g_eeGeneral.beepMode, -2, 1, attr, event); g_eeGeneral.beepMode = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_VBEEPMODE, g_eeGeneral.beepMode, -2, 1, attr, event);
#if defined(TELEMETRY_FRSKY) #if defined(TELEMETRY_FRSKY)
if (attr && checkIncDec_Ret) frskySendAlarms(); if (attr && checkIncDec_Ret) frskySendAlarms();
#endif #endif
@ -240,10 +241,12 @@ bool menuRadioSetup(event_t event)
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BEEP_VOLUME); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BEEP_VOLUME);
g_eeGeneral.beepVolume = editSlider(RADIO_SETUP_2ND_COLUMN, y, event, g_eeGeneral.beepVolume, -2, +2, attr); g_eeGeneral.beepVolume = editSlider(RADIO_SETUP_2ND_COLUMN, y, event, g_eeGeneral.beepVolume, -2, +2, attr);
break; break;
case ITEM_SETUP_WAV_VOLUME: case ITEM_SETUP_WAV_VOLUME:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_WAV_VOLUME); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_WAV_VOLUME);
g_eeGeneral.wavVolume = editSlider(RADIO_SETUP_2ND_COLUMN, y, event, g_eeGeneral.wavVolume, -2, +2, attr); g_eeGeneral.wavVolume = editSlider(RADIO_SETUP_2ND_COLUMN, y, event, g_eeGeneral.wavVolume, -2, +2, attr);
break; break;
case ITEM_SETUP_BACKGROUND_VOLUME: case ITEM_SETUP_BACKGROUND_VOLUME:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BG_VOLUME); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BG_VOLUME);
g_eeGeneral.backgroundVolume = editSlider(RADIO_SETUP_2ND_COLUMN, y, event, g_eeGeneral.backgroundVolume, -2, +2, attr); g_eeGeneral.backgroundVolume = editSlider(RADIO_SETUP_2ND_COLUMN, y, event, g_eeGeneral.backgroundVolume, -2, +2, attr);
@ -251,7 +254,7 @@ bool menuRadioSetup(event_t event)
case ITEM_SETUP_BEEP_LENGTH: case ITEM_SETUP_BEEP_LENGTH:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BEEP_LENGTH); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BEEP_LENGTH);
SLIDER_5POS(y, g_eeGeneral.beepLength, event, attr); SLIDER_5POS(g_eeGeneral.beepLength);
break; break;
case ITEM_SETUP_SPEAKER_PITCH: case ITEM_SETUP_SPEAKER_PITCH:
@ -294,17 +297,17 @@ bool menuRadioSetup(event_t event)
case ITEM_SETUP_HAPTIC_MODE: case ITEM_SETUP_HAPTIC_MODE:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_MODE); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_MODE);
g_eeGeneral.hapticMode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_VBEEPMODE, g_eeGeneral.hapticMode, -2, 1, attr, event); g_eeGeneral.hapticMode = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_VBEEPMODE, g_eeGeneral.hapticMode, -2, 1, attr, event);
break; break;
case ITEM_SETUP_HAPTIC_LENGTH: case ITEM_SETUP_HAPTIC_LENGTH:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_LENGTH); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_LENGTH);
SLIDER_5POS(y, g_eeGeneral.hapticLength, event, attr); SLIDER_5POS(g_eeGeneral.hapticLength);
break; break;
case ITEM_SETUP_HAPTIC_STRENGTH: case ITEM_SETUP_HAPTIC_STRENGTH:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_HAPTICSTRENGTH); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_HAPTICSTRENGTH);
SLIDER_5POS(y, g_eeGeneral.hapticStrength, event, attr); SLIDER_5POS(g_eeGeneral.hapticStrength);
break; break;
#endif #endif
@ -347,22 +350,6 @@ bool menuRadioSetup(event_t event)
break; break;
} }
#if defined(PCBSKY9X)
case ITEM_SETUP_CAPACITY_WARNING:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_CAPAWARNING);
drawValueWithUnit(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.mAhWarn*50, UNIT_MAH, attr|LEFT) ;
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.mAhWarn, 0, 100);
break;
#endif
#if defined(PCBSKY9X)
case ITEM_SETUP_TEMPERATURE_WARNING:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_TEMPWARNING);
drawValueWithUnit(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
break;
#endif
case ITEM_SETUP_INACTIVITY_ALARM: case ITEM_SETUP_INACTIVITY_ALARM:
lcdDrawText(MENUS_MARGIN_LEFT, y,STR_INACTIVITYALARM); lcdDrawText(MENUS_MARGIN_LEFT, y,STR_INACTIVITYALARM);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.inactivityTimer, attr|LEFT, 0, NULL, "m"); lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.inactivityTimer, attr|LEFT, 0, NULL, "m");
@ -375,7 +362,7 @@ bool menuRadioSetup(event_t event)
case ITEM_SETUP_BACKLIGHT_MODE: case ITEM_SETUP_BACKLIGHT_MODE:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_MODE); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_MODE);
g_eeGeneral.backlightMode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_VBLMODE, g_eeGeneral.backlightMode, e_backlight_mode_off, e_backlight_mode_on, attr, event); g_eeGeneral.backlightMode = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_VBLMODE, g_eeGeneral.backlightMode, e_backlight_mode_off, e_backlight_mode_on, attr, event);
break; break;
case ITEM_SETUP_FLASH_BEEP: case ITEM_SETUP_FLASH_BEEP:
@ -432,12 +419,12 @@ bool menuRadioSetup(event_t event)
case ITEM_SETUP_GPSFORMAT: case ITEM_SETUP_GPSFORMAT:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_GPSCOORD); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_GPSCOORD);
g_eeGeneral.gpsFormat = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_GPSFORMAT, g_eeGeneral.gpsFormat, 0, 1, attr, event); g_eeGeneral.gpsFormat = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_GPSFORMAT, g_eeGeneral.gpsFormat, 0, 1, attr, event);
break; break;
case ITEM_SETUP_COUNTRYCODE: case ITEM_SETUP_COUNTRYCODE:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_COUNTRYCODE); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_COUNTRYCODE);
g_eeGeneral.countryCode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_COUNTRYCODES, g_eeGeneral.countryCode, 0, 2, attr, event); g_eeGeneral.countryCode = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_COUNTRYCODES, g_eeGeneral.countryCode, 0, 2, attr, event);
break; break;
case ITEM_SETUP_LANGUAGE: case ITEM_SETUP_LANGUAGE:
@ -454,7 +441,7 @@ bool menuRadioSetup(event_t event)
case ITEM_SETUP_IMPERIAL: case ITEM_SETUP_IMPERIAL:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_UNITSSYSTEM); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_UNITSSYSTEM);
g_eeGeneral.imperial = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_VUNITSSYSTEM, g_eeGeneral.imperial, 0, 1, attr, event); g_eeGeneral.imperial = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_VUNITSSYSTEM, g_eeGeneral.imperial, 0, 1, attr, event);
break; break;
#if 0 #if 0
@ -473,7 +460,7 @@ bool menuRadioSetup(event_t event)
#if defined(TELEMETRY_MAVLINK) #if defined(TELEMETRY_MAVLINK)
case ITEM_MAVLINK_BAUD: case ITEM_MAVLINK_BAUD:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_MAVLINK_BAUD_LABEL); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_MAVLINK_BAUD_LABEL);
g_eeGeneral.mavbaud = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_MAVLINK_BAUDS, g_eeGeneral.mavbaud, 0, 7, attr, event); g_eeGeneral.mavbaud = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_MAVLINK_BAUDS, g_eeGeneral.mavbaud, 0, 7, attr, event);
break; break;
#endif #endif

View file

@ -22,25 +22,36 @@
bool menuRadioVersion(event_t event) bool menuRadioVersion(event_t event)
{ {
DEBUG_TIMER_START(debugTimerVersion); #if 0
DEBUG_TIMER_START(debugTimerSimpleMenu); if (warningResult) {
SIMPLE_MENU(STR_MENUVERSION, RADIO_ICONS, menuTabGeneral, MENU_RADIO_VERSION, 0); warningResult = 0;
DEBUG_TIMER_STOP(debugTimerSimpleMenu); showMessageBox(STR_STORAGE_FORMAT);
storageEraseAll(false);
NVIC_SystemReset();
}
#endif
if (event == EVT_ENTRY) {
getCPUUniqueID(reusableBuffer.version.id);
}
SIMPLE_MENU(STR_MENUVERSION, RADIO_ICONS, menuTabGeneral, MENU_RADIO_VERSION, 0);
DEBUG_TIMER_START(debugTimerDrawText);
DEBUG_TIMER_START(debugTimerDrawText1);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + FH, vers_stamp); lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + FH, vers_stamp);
DEBUG_TIMER_STOP(debugTimerDrawText1);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 2*FH, date_stamp); lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 2*FH, date_stamp);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 3*FH, time_stamp); lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 3*FH, time_stamp);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 4*FH, eeprom_stamp); lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 4*FH, eeprom_stamp);
DEBUG_TIMER_STOP(debugTimerDrawText); lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 5*FH, "UID:");
lcdDrawText(48, MENU_HEADER_HEIGHT+1+5*FH, reusableBuffer.version.id);
#if 0
if (event == EVT_KEY_LONG(KEY_ENTER)) {
killEvents(event);
// POPUP_MENU_ADD_ITEM(STR_EEBACKUP);
POPUP_MENU_ADD_ITEM(STR_FACTORYRESET);
POPUP_MENU_START(onVersionMenu);
}
#endif
// TODO EEPROM erase + backup
// lcdDrawTextAlignedCenter(MENU_HEADER_HEIGHT+6*FH, STR_EEBACKUP);
// if (event == EVT_KEY_LONG(KEY_ENTER)) {
// eepromBackup();
// }
DEBUG_TIMER_STOP(debugTimerVersion);
return true; return true;
} }

View file

@ -176,26 +176,6 @@ void drawMenuTemplate(const char * title, uint8_t icon, const uint8_t * icons, u
} }
} }
select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char * values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, event_t event)
{
if (attr & (~RIGHT)) value = checkIncDec(event, value, min, max, (menuVerticalPositions[0] == 0) ? EE_MODEL : EE_GENERAL);
if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr);
return value;
}
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, LcdFlags attr, event_t event)
{
drawCheckBox(x, y, value, attr);
return selectMenuItem(x, y, NULL, value, 0, 1, attr, event);
}
swsrc_t switchMenuItem(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, event_t event)
{
if (attr) CHECK_INCDEC_MODELSWITCH(event, value, SWSRC_FIRST_IN_MIXES, SWSRC_LAST_IN_MIXES, isSwitchAvailableInMixes);
drawSwitch(x, y, value, attr);
return value;
}
void drawTrimSquare(coord_t x, coord_t y) void drawTrimSquare(coord_t x, coord_t y)
{ {
lcdDrawSolidFilledRect(x-2, y, 15, 15, TRIM_BGCOLOR); lcdDrawSolidFilledRect(x-2, y, 15, 15, TRIM_BGCOLOR);

View file

@ -60,9 +60,6 @@ void drawHorizontalSlider(coord_t x, coord_t y, int len, int val, int min, int m
void drawSlider(coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options); void drawSlider(coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options);
#define drawStatusLine(...) #define drawStatusLine(...)
select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char * values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, event_t event);
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, LcdFlags attr, event_t event);
swsrc_t switchMenuItem(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, event_t event);
#if defined(GVARS) #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, event_t event); int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, event_t event);
#else #else

View file

@ -42,8 +42,13 @@ if(ARCH STREQUAL ARM)
endif() endif()
if(PCB STREQUAL FLAMENCO OR PCB STREQUAL HORUS) if(PCB STREQUAL FLAMENCO OR PCB STREQUAL HORUS)
if(HELI)
set(HELI_SRC gui/common/colorlcd/model_heli.cpp)
endif()
set(SRC set(SRC
${SRC} ${SRC}
gui/common/colorlcd/widgets.cpp gui/common/colorlcd/widgets.cpp
${HELI_SRC}
) )
endif() endif()

View file

@ -2,7 +2,7 @@
* Copyright (C) OpenTX * Copyright (C) OpenTX
* *
* Based on code named * Based on code named
* th9x - http://code.google.com/p/th9x * th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x * er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x * gruvin9x - http://code.google.com/p/gruvin9x
* *
@ -49,7 +49,7 @@ bool menuModelHeli(event_t event)
switch (k) { switch (k) {
case ITEM_HELI_SWASHTYPE: case ITEM_HELI_SWASHTYPE:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_SWASHTYPE); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_SWASHTYPE);
g_model.swashR.type = selectMenuItem(MODEL_HELI_2ND_COLUMN, y, STR_VSWASHTYPE, g_model.swashR.type, 0, SWASH_TYPE_MAX, attr, event); g_model.swashR.type = editChoice(MODEL_HELI_2ND_COLUMN, y, STR_VSWASHTYPE, g_model.swashR.type, 0, SWASH_TYPE_MAX, attr, event);
break; break;
case ITEM_HELI_SWASHRING: case ITEM_HELI_SWASHRING:

View file

@ -23,6 +23,44 @@
void drawStringWithIndex(coord_t x, coord_t y, const char * str, int idx, LcdFlags flags, const char * prefix) void drawStringWithIndex(coord_t x, coord_t y, const char * str, int idx, LcdFlags flags, const char * prefix)
{ {
char s[64]; char s[64];
strAppendUnsigned(strAppend(strAppend(s, prefix), str), abs(idx)); char * tmp = (prefix ? strAppend(s, prefix) : s);
tmp = strAppend(tmp, str);
tmp = strAppendUnsigned(tmp, abs(idx));
lcdDrawText(x, y, s, flags); lcdDrawText(x, y, s, flags);
} }
void drawValueWithUnit(coord_t x, coord_t y, int32_t val, uint8_t unit, LcdFlags att)
{
// convertUnit(val, unit);
if (!(att & NO_UNIT) && unit != UNIT_RAW) {
char unitStr[8];
strAppend(unitStr, STR_VTELEMUNIT+1+unit*STR_VTELEMUNIT[0], STR_VTELEMUNIT[0]);
lcdDrawNumber(x, y, val, att, 0, NULL, unitStr);
}
else {
lcdDrawNumber(x, y, val, att);
}
}
int editChoice(coord_t x, coord_t y, const char * values, int value, int min, int max, LcdFlags attr, event_t event)
{
if (attr & INVERS) value = checkIncDec(event, value, min, max, (menuVerticalPositions[0] == 0) ? EE_MODEL : EE_GENERAL);
if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr);
return value;
}
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, LcdFlags attr, event_t event )
{
value = editChoice(x, y, NULL, value, 0, 1, attr, event);
drawCheckBox(x, y, value, attr);
return value;
}
swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, event_t event)
{
if (attr & INVERS) CHECK_INCDEC_MODELSWITCH(event, value, SWSRC_FIRST_IN_MIXES, SWSRC_LAST_IN_MIXES, isSwitchAvailableInMixes);
drawSwitch(x, y, value, attr);
return value;
}

View file

@ -64,7 +64,7 @@ void menuModelHeli(uint8_t event)
switch (k) { switch (k) {
case ITEM_HELI_SWASHTYPE: case ITEM_HELI_SWASHTYPE:
g_model.swashR.type = selectMenuItem(MODEL_HELI_2ND_COLUMN, y, STR_SWASHTYPE, STR_VSWASHTYPE, g_model.swashR.type, 0, SWASH_TYPE_MAX, attr, event); g_model.swashR.type = editChoice(MODEL_HELI_2ND_COLUMN, y, STR_SWASHTYPE, STR_VSWASHTYPE, g_model.swashR.type, 0, SWASH_TYPE_MAX, attr, event);
break; break;
case ITEM_HELI_SWASHRING: case ITEM_HELI_SWASHRING:
@ -111,20 +111,20 @@ void menuModelHeli(uint8_t event)
break; break;
#else #else
case ITEM_HELI_COLLECTIVE: case ITEM_HELI_COLLECTIVE:
g_model.swashR.collectiveSource = selectMenuItem(MODEL_HELI_2ND_COLUMN, y, STR_COLLECTIVE, NULL, g_model.swashR.collectiveSource, 0, MIXSRC_LAST_CH, attr, event); g_model.swashR.collectiveSource = editChoice(MODEL_HELI_2ND_COLUMN, y, STR_COLLECTIVE, NULL, g_model.swashR.collectiveSource, 0, MIXSRC_LAST_CH, attr, event);
drawSource(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.collectiveSource, attr); drawSource(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.collectiveSource, attr);
break; break;
case ITEM_HELI_ELEDIRECTION: case ITEM_HELI_ELEDIRECTION:
g_model.swashR.invertELE = selectMenuItem(MODEL_HELI_2ND_COLUMN, y, STR_ELEDIRECTION, STR_MMMINV, g_model.swashR.invertELE, 0, 1, attr, event); g_model.swashR.invertELE = editChoice(MODEL_HELI_2ND_COLUMN, y, STR_ELEDIRECTION, STR_MMMINV, g_model.swashR.invertELE, 0, 1, attr, event);
break; break;
case ITEM_HELI_AILDIRECTION: case ITEM_HELI_AILDIRECTION:
g_model.swashR.invertAIL = selectMenuItem(MODEL_HELI_2ND_COLUMN, y, STR_AILDIRECTION, STR_MMMINV, g_model.swashR.invertAIL, 0, 1, attr, event); g_model.swashR.invertAIL = editChoice(MODEL_HELI_2ND_COLUMN, y, STR_AILDIRECTION, STR_MMMINV, g_model.swashR.invertAIL, 0, 1, attr, event);
break; break;
case ITEM_HELI_COLDIRECTION: case ITEM_HELI_COLDIRECTION:
g_model.swashR.invertCOL = selectMenuItem(MODEL_HELI_2ND_COLUMN, y, STR_COLDIRECTION, STR_MMMINV, g_model.swashR.invertCOL, 0, 1, attr, event); g_model.swashR.invertCOL = editChoice(MODEL_HELI_2ND_COLUMN, y, STR_COLDIRECTION, STR_MMMINV, g_model.swashR.invertCOL, 0, 1, attr, event);
break; break;
#endif #endif
} }

View file

@ -22,6 +22,7 @@
#define _GUI_COMMON_H_ #define _GUI_COMMON_H_
#include "lcd.h" #include "lcd.h"
#include "keys.h"
#if defined(CPUARM) #if defined(CPUARM)
typedef bool (*IsValueAvailable)(int); typedef bool (*IsValueAvailable)(int);
@ -79,6 +80,7 @@ void drawFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
#if defined(CPUARM) #if defined(CPUARM)
#include "telemetry/telemetry_sensors.h" #include "telemetry/telemetry_sensors.h"
void drawValueWithUnit(coord_t x, coord_t y, int32_t val, uint8_t unit, LcdFlags flags);
void drawCurveRef(coord_t x, coord_t y, CurveRef & curve, LcdFlags flags=0); void drawCurveRef(coord_t x, coord_t y, CurveRef & curve, LcdFlags flags=0);
void drawDate(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags flags=0); void drawDate(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags flags=0);
void drawGPSPosition(coord_t x, coord_t y, int32_t longitude, int32_t latitude, LcdFlags flags=0); void drawGPSPosition(coord_t x, coord_t y, int32_t longitude, int32_t latitude, LcdFlags flags=0);
@ -90,4 +92,11 @@ void drawSourceValue(coord_t x, coord_t y, source_t channel, LcdFlags flags=0);
void drawCurve(coord_t offset=0); void drawCurve(coord_t offset=0);
#if defined(COLORLCD)
void drawStringWithIndex(coord_t x, coord_t y, const char * str, int idx, LcdFlags flags=0, const char * prefix=NULL);
int editChoice(coord_t x, coord_t y, const char * values, int value, int min, int max, LcdFlags flags, event_t event);
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, LcdFlags flags, event_t event);
swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags flags, event_t event);
#endif
#endif // _GUI_COMMON_H_ #endif // _GUI_COMMON_H_

View file

@ -1635,7 +1635,6 @@ void varioWakeup();
#endif #endif
#if defined(CPUARM) #if defined(CPUARM)
void drawValueWithUnit(coord_t x, coord_t y, int32_t val, uint8_t unit, LcdFlags att);
#elif defined(TELEMETRY_FRSKY) #elif defined(TELEMETRY_FRSKY)
FORCEINLINE void convertUnit(getvalue_t & val, uint8_t & unit) FORCEINLINE void convertUnit(getvalue_t & val, uint8_t & unit)
{ {

View file

@ -45,9 +45,6 @@ set(GUI_SRC
${WIDGETS_SRC} ${WIDGETS_SRC}
) )
set(SRC ${SRC} gps.cpp) set(SRC ${SRC} gps.cpp)
if(HELI)
set(GUI_SRC ${GUI_SRC} model_heli.cpp)
endif()
if(DISK_CACHE) if(DISK_CACHE)
set(SRC ${SRC} disk_cache.cpp) set(SRC ${SRC} disk_cache.cpp)
add_definitions(-DDISK_CACHE) add_definitions(-DDISK_CACHE)