Skip to content

Commit

Permalink
#3185 started with #2917 fix which should be ported to 'master' later
Browse files Browse the repository at this point in the history
  • Loading branch information
bsongis committed Jan 2, 2016
1 parent 8809a64 commit b9bb147
Show file tree
Hide file tree
Showing 23 changed files with 121 additions and 109 deletions.
4 changes: 2 additions & 2 deletions companion/src/firmwares/opentx/opentxeeprom.cpp
Expand Up @@ -2113,7 +2113,7 @@ class ArmCustomFunctionField: public TransformedField {
if (fn.swtch.type != SWITCH_TYPE_NONE) {
_func = fn.func;

if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue || fn.func == FuncPlayHaptic)
if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue || fn.func == FuncPlayHaptic || (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast))
_active = (version >= 216 ? fn.repeatParam : (fn.repeatParam/5));
else
_active = (fn.enabled ? 1 : 0);
Expand Down Expand Up @@ -2209,7 +2209,7 @@ class ArmCustomFunctionField: public TransformedField {
{
fn.func = (AssignFunc)_func;

if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue || fn.func == FuncPlayHaptic)
if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue || fn.func == FuncPlayHaptic || (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast))
fn.repeatParam = (version >= 216 ? _active : (_active*5));
else
fn.enabled = (_active & 0x01);
Expand Down
10 changes: 2 additions & 8 deletions companion/src/modeledit/customfunctions.cpp
Expand Up @@ -373,8 +373,8 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
}
else if (func>=FuncAdjustGV1 && func<=FuncAdjustGVLast) {
if (modified) cfn.adjustMode = fswtchGVmode[i]->currentIndex();
widgetsMask |= CUSTOM_FUNCTION_GV_MODE + CUSTOM_FUNCTION_ENABLE;
if (cfn.adjustMode==0) {
widgetsMask |= CUSTOM_FUNCTION_GV_MODE | (IS_ARM(firmware->getBoard()) ? CUSTOM_FUNCTION_REPEAT : CUSTOM_FUNCTION_ENABLE);
if (cfn.adjustMode==0 || cfn.adjustMode==3) {

This comment has been minimized.

Copy link
@bsongis

bsongis Jan 2, 2016

Author Member

constants

if (modified) cfn.param = fswtchParam[i]->value();
fswtchParam[i]->setDecimals(0);
fswtchParam[i]->setSingleStep(1);
Expand Down Expand Up @@ -677,12 +677,6 @@ void CustomFunctionsPanel::populateFuncParamCB(QComboBox *b, uint function, unsi
case 2:
populateSourceCB(b, RawSource(value), generalSettings, model, POPULATE_GVARS);
break;
case 3:
b->clear();
b->addItem("-1", 0);
b->addItem("+1", 1);
b->setCurrentIndex(value);
break;
}
}
else {
Expand Down
2 changes: 1 addition & 1 deletion radio/src/CMakeLists.txt
Expand Up @@ -132,7 +132,7 @@ elseif(PCB STREQUAL TARANIS)
set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} taranis_bitmaps)
add_definitions(-DPCBTARANIS)
add_definitions(-DAUDIO -DVOICE -DRTCLOCK)
add_definitions(-DDBLKEYS -DVIRTUALINPUTS -DLUAINPUTS -DXCURVES -DVARIO)
add_definitions(-DDBLKEYS -DVIRTUALINPUTS -DLUAINPUTS -DXCURVES -DVARIO -DBOLD_FONT)
set(SRC ${SRC} bmp.cpp)
set(GUI_SRC ${GUI_SRC} menu_general_diagkeys.cpp menu_general_diaganas.cpp menu_general_hardware.cpp view_channels.cpp view_telemetry.cpp view_text.cpp view_about.cpp)
set(TARGET_SRC ${TARGET_SRC} board_taranis.cpp rtc_driver.cpp)
Expand Down
Binary file modified radio/src/fonts/horus/font_dblsize.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified radio/src/fonts/horus/font_midsize.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified radio/src/fonts/horus/font_smlsize.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified radio/src/fonts/horus/font_stdsize.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified radio/src/fonts/horus/font_tinsize.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified radio/src/fonts/horus/font_xxlsize.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
81 changes: 49 additions & 32 deletions radio/src/functions.cpp
Expand Up @@ -27,7 +27,6 @@ CustomFunctionsContext modelFunctionsContext = { 0 };
CustomFunctionsContext globalFunctionsContext = { 0 };
#endif


#if defined(DEBUG)
/*
* This is a test function for debugging purpose, you may insert there your code and compile with the option DEBUG=YES
Expand Down Expand Up @@ -204,10 +203,8 @@ PLAY_FUNCTION(playValue, source_t idx)
}
#else
default:
{
PLAY_NUMBER(val, 0, 0);
break;
}
#endif
}
#endif
Expand All @@ -228,6 +225,27 @@ void playCustomFunctionFile(const CustomFunctionData *sd, uint8_t id)
}
#endif

#if defined(CPUARM)
bool isRepeatDelayElapsed(const CustomFunctionData * functions, CustomFunctionsContext & functionsContext, uint8_t index)
{
const CustomFunctionData * cfn = &functions[index];
tmr10ms_t tmr10ms = get_tmr10ms();
uint8_t repeatParam = CFN_PLAY_REPEAT(cfn);
if (!IS_SILENCE_PERIOD_ELAPSED() && repeatParam == CFN_PLAY_REPEAT_NOSTART) {
functionsContext.lastFunctionTime[index] = tmr10ms;
}
if (!functionsContext.lastFunctionTime[index] || (repeatParam && repeatParam!=CFN_PLAY_REPEAT_NOSTART && (signed)(tmr10ms-functionsContext.lastFunctionTime[index])>=100*repeatParam)) {
functionsContext.lastFunctionTime[index] = tmr10ms;
return true;
}
else {
return false;
}
}
#else
#define isRepeatDelayElapsed(...) true
#endif

#if defined(CPUARM)
#define VOLUME_HYSTERESIS 10 // how much must a input value change to actually be considered for new volume setting
getvalue_t requiredSpeakerVolumeRawLast = 1024 + 1; //initial value must be outside normal range
Expand Down Expand Up @@ -361,10 +379,8 @@ void evalFunctions()

#if defined(CPUARM)
case FUNC_SET_TIMER:
{
timerSet(CFN_TIMER_INDEX(cfn), CFN_PARAM(cfn));
break;
}
#endif

#if defined(CPUARM)
Expand Down Expand Up @@ -398,30 +414,37 @@ void evalFunctions()

#if defined(GVARS)
case FUNC_ADJUST_GVAR:
if (CFN_GVAR_MODE(cfn) == 0) {
SET_GVAR(CFN_GVAR_INDEX(cfn), CFN_PARAM(cfn), mixerCurrentFlightMode);
}
else if (CFN_GVAR_MODE(cfn) == 2) {
SET_GVAR(CFN_GVAR_INDEX(cfn), GVAR_VALUE(CFN_PARAM(cfn), mixerCurrentFlightMode), mixerCurrentFlightMode);
}
else if (CFN_GVAR_MODE(cfn) == 3) {
if (!(functionsContext.activeSwitches & switch_mask)) {
SET_GVAR(CFN_GVAR_INDEX(cfn), GVAR_VALUE(CFN_GVAR_INDEX(cfn), getGVarFlightPhase(mixerCurrentFlightMode, CFN_GVAR_INDEX(cfn))) + (CFN_PARAM(cfn) ? +1 : -1), mixerCurrentFlightMode);
if (isRepeatDelayElapsed(functions, functionsContext, i)) {
if (CFN_GVAR_MODE(cfn) == FUNC_ADJUST_GVAR_CONSTANT) {
SET_GVAR(CFN_GVAR_INDEX(cfn), CFN_PARAM(cfn), mixerCurrentFlightMode);
}
else if (CFN_GVAR_MODE(cfn) == FUNC_ADJUST_GVAR_GVAR) {
SET_GVAR(CFN_GVAR_INDEX(cfn), GVAR_VALUE(CFN_PARAM(cfn), mixerCurrentFlightMode), mixerCurrentFlightMode);
}
else if (CFN_GVAR_MODE(cfn) == FUNC_ADJUST_GVAR_INCDEC) {
#if defined(CPUARM)
int val_min = -CFN_GVAR_CST_MAX, val_max = +CFN_GVAR_CST_MAX;
SET_GVAR(CFN_GVAR_INDEX(cfn), limit(CFN_GVAR_CST_MIN, GVAR_VALUE(CFN_GVAR_INDEX(cfn), getGVarFlightPhase(mixerCurrentFlightMode, CFN_GVAR_INDEX(cfn))) + CFN_PARAM(cfn), CFN_GVAR_CST_MAX), mixerCurrentFlightMode);
#else
if (!(functionsContext.activeSwitches & switch_mask)) {
SET_GVAR(CFN_GVAR_INDEX(cfn), GVAR_VALUE(CFN_GVAR_INDEX(cfn), getGVarFlightPhase(mixerCurrentFlightMode, CFN_GVAR_INDEX(cfn))) + (CFN_PARAM(cfn) ? +1 : -1), mixerCurrentFlightMode);
}
#endif
}
else if (CFN_PARAM(cfn) >= MIXSRC_TrimRud && CFN_PARAM(cfn) <= MIXSRC_TrimAil) {
trimGvar[CFN_PARAM(cfn)-MIXSRC_TrimRud] = CFN_GVAR_INDEX(cfn);
}
}
else if (CFN_PARAM(cfn) >= MIXSRC_TrimRud && CFN_PARAM(cfn) <= MIXSRC_TrimAil) {
trimGvar[CFN_PARAM(cfn)-MIXSRC_TrimRud] = CFN_GVAR_INDEX(cfn);
}
#if defined(ROTARY_ENCODERS)
else if (CFN_PARAM(cfn) >= MIXSRC_REa && CFN_PARAM(cfn) < MIXSRC_TrimRud) {
int8_t scroll = rePreviousValues[CFN_PARAM(cfn)-MIXSRC_REa] - (g_rotenc[CFN_PARAM(cfn)-MIXSRC_REa] / ROTARY_ENCODER_GRANULARITY);
if (scroll) {
SET_GVAR(CFN_GVAR_INDEX(cfn), GVAR_VALUE(CFN_GVAR_INDEX(cfn), getGVarFlightPhase(mixerCurrentFlightMode, CFN_GVAR_INDEX(cfn))) + scroll, mixerCurrentFlightMode);
else if (CFN_PARAM(cfn) >= MIXSRC_REa && CFN_PARAM(cfn) < MIXSRC_TrimRud) {
int8_t scroll = rePreviousValues[CFN_PARAM(cfn)-MIXSRC_REa] - (g_rotenc[CFN_PARAM(cfn)-MIXSRC_REa] / ROTARY_ENCODER_GRANULARITY);
if (scroll) {
SET_GVAR(CFN_GVAR_INDEX(cfn), GVAR_VALUE(CFN_GVAR_INDEX(cfn), getGVarFlightPhase(mixerCurrentFlightMode, CFN_GVAR_INDEX(cfn))) + scroll, mixerCurrentFlightMode);
}
}
}
#endif
else {
SET_GVAR(CFN_GVAR_INDEX(cfn), calcRESXto100(getValue(CFN_PARAM(cfn))), mixerCurrentFlightMode);
else {
SET_GVAR(CFN_GVAR_INDEX(cfn), calcRESXto100(getValue(CFN_PARAM(cfn))), mixerCurrentFlightMode);
}
}
break;
#endif
Expand All @@ -447,14 +470,8 @@ void evalFunctions()
case FUNC_HAPTIC:
#endif
{
tmr10ms_t tmr10ms = get_tmr10ms();
uint8_t repeatParam = CFN_PLAY_REPEAT(cfn);
if (!IS_SILENCE_PERIOD_ELAPSED() && repeatParam == CFN_PLAY_REPEAT_NOSTART) {
functionsContext.lastFunctionTime[i] = tmr10ms;
}
if (!functionsContext.lastFunctionTime[i] || (repeatParam && repeatParam!=CFN_PLAY_REPEAT_NOSTART && (signed)(tmr10ms-functionsContext.lastFunctionTime[i])>=100*repeatParam)) {
if (isRepeatDelayElapsed(functions, functionsContext, i)) {
if (!IS_PLAYING(PLAY_INDEX)) {
functionsContext.lastFunctionTime[i] = tmr10ms;
if (CFN_FUNC(cfn) == FUNC_PLAY_SOUND) {
AUDIO_PLAY(AU_FRSKY_FIRST+CFN_PARAM(cfn));
}
Expand Down
2 changes: 1 addition & 1 deletion radio/src/gui/9x/menu_model_custom_functions.cpp
Expand Up @@ -341,7 +341,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu

case 4:
if (HAS_ENABLE_PARAM(func)) {
menu_lcd_onoff(MODEL_CUSTOM_FUNC_4TH_COLUMN_ONOFF, y, CFN_ACTIVE(cfn), attr);
drawCheckBox(MODEL_CUSTOM_FUNC_4TH_COLUMN_ONOFF, y, CFN_ACTIVE(cfn), attr);
#if defined(CPUARM)
if (active) CFN_ACTIVE(cfn) = checkIncDec(event, CFN_ACTIVE(cfn), 0, 1, eeFlags);
#else
Expand Down
2 changes: 1 addition & 1 deletion radio/src/gui/9x/menu_model_inputs_mixes.cpp
Expand Up @@ -530,7 +530,7 @@ void menuModelMixOne(uint8_t event)
if (attr && menuHorizontalPosition==0 && (not_stick || editMode>0)) md2->carryTrim = -checkIncDecModel(event, carryTrim, not_stick ? TRIM_ON : -TRIM_OFF, -TRIM_AIL);
if (!not_stick) {
lcdDrawText(COLUMN_X+MIXES_2ND_COLUMN, y, STR_DREX);
menu_lcd_onoff(COLUMN_X+MIXES_2ND_COLUMN+DREX_CHBOX_OFFSET, y, !md2->noExpo, menuHorizontalPosition==1 ? attr : 0);
drawCheckBox(COLUMN_X+MIXES_2ND_COLUMN+DREX_CHBOX_OFFSET, y, !md2->noExpo, menuHorizontalPosition==1 ? attr : 0);
if (attr && menuHorizontalPosition==1 && editMode>0) md2->noExpo = !checkIncDecModel(event, !md2->noExpo, 0, 1);
}
else if (attr) {
Expand Down
2 changes: 1 addition & 1 deletion radio/src/gui/9x/menu_model_setup.cpp
Expand Up @@ -465,7 +465,7 @@ void menuModelSetup(uint8_t event)
#if defined(CPUARM)
case ITEM_MODEL_USE_GLOBAL_FUNCTIONS:
lcd_putsLeft(y, STR_USE_GLOBAL_FUNCS);
menu_lcd_onoff(MODEL_SETUP_2ND_COLUMN, y, !g_model.noGlobalFunctions, attr);
drawCheckBox(MODEL_SETUP_2ND_COLUMN, y, !g_model.noGlobalFunctions, attr);
if (attr) g_model.noGlobalFunctions = !checkIncDecModel(event, !g_model.noGlobalFunctions, 0, 1);
break;
#endif
Expand Down
2 changes: 1 addition & 1 deletion radio/src/gui/9x/menus.h
Expand Up @@ -50,7 +50,7 @@ extern uint8_t noHighlightCounter;
#define NO_HIGHLIGHT() (noHighlightCounter > 0)
#define START_NO_HIGHLIGHT() do { noHighlightCounter = 25; } while(0)

void menu_lcd_onoff(coord_t x, coord_t y, uint8_t value, LcdFlags attr);
void drawCheckBox(coord_t x, coord_t y, uint8_t value, LcdFlags attr);

typedef void (* MenuHandlerFunc)(uint8_t event);

Expand Down
4 changes: 2 additions & 2 deletions radio/src/gui/9x/widgets.cpp
Expand Up @@ -32,7 +32,7 @@ void drawStick(coord_t centrex, int16_t xval, int16_t yval)
#undef MARKER_WIDTH
}

void menu_lcd_onoff(coord_t x, coord_t y, uint8_t value, LcdFlags attr)
void drawCheckBox(coord_t x, coord_t y, uint8_t value, LcdFlags attr)
{
#if defined(GRAPHICS)
if (value)
Expand Down Expand Up @@ -83,7 +83,7 @@ select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char *label, c
uint8_t onoffMenuItem(uint8_t value, coord_t x, coord_t y, const pm_char *label, LcdFlags attr, uint8_t event )
{
#if defined(GRAPHICS)
menu_lcd_onoff(x, y, value, attr);
drawCheckBox(x, y, value, attr);
return selectMenuItem(x, y, label, NULL, value, 0, 1, attr, event);
#else
return selectMenuItem(x, y, label, STR_OFFON, value, 0, 1, attr, event);
Expand Down
2 changes: 1 addition & 1 deletion radio/src/gui/taranis/menu_general_hardware.cpp
Expand Up @@ -198,7 +198,7 @@ void menuGeneralHardware(uint8_t event)
#if defined(REV9E)
case ITEM_SETUP_HW_BLUETOOTH:
lcd_putsLeft(y, "Bluetooth");
menu_lcd_onoff(HW_SETTINGS_COLUMN, y, g_eeGeneral.bluetoothEnable, menuHorizontalPosition == 0 ? attr : 0);
drawCheckBox(HW_SETTINGS_COLUMN, y, g_eeGeneral.bluetoothEnable, menuHorizontalPosition == 0 ? attr : 0);
if (attr && menuHorizontalPosition == 0) {
g_eeGeneral.bluetoothEnable = checkIncDecGen(event, g_eeGeneral.bluetoothEnable, 0, 1);
}
Expand Down
2 changes: 1 addition & 1 deletion radio/src/gui/taranis/menu_model_curves.cpp
Expand Up @@ -177,7 +177,7 @@ void menuModelCurveOne(uint8_t event)
}

lcd_putsLeft(7*FH+1, STR_SMOOTH);
menu_lcd_onoff(7*FW, 7*FH+1, crv.smooth, menuVerticalPosition==3 ? INVERS : 0);
drawCheckBox(7 * FW, 7 * FH + 1, crv.smooth, menuVerticalPosition == 3 ? INVERS : 0);
if (menuVerticalPosition==3) crv.smooth = checkIncDecModel(event, crv.smooth, 0, 1);

switch(event) {
Expand Down
37 changes: 21 additions & 16 deletions radio/src/gui/taranis/menu_model_custom_functions.cpp
Expand Up @@ -125,7 +125,7 @@ void onAdjustGvarSourceLongEnterPress(const char * result)
storageDirty(EE_MODEL);
}
else if (result == STR_INCDEC) {
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_INC;
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_INCDEC;
CFN_PARAM(cfn) = 0;
storageDirty(EE_MODEL);
}
Expand All @@ -134,6 +134,16 @@ void onAdjustGvarSourceLongEnterPress(const char * result)
}
}

enum CustomFunctionsItems {
ITEM_CUSTOM_FUNCTIONS_SWITCH,
ITEM_CUSTOM_FUNCTIONS_FUNCTION,
ITEM_CUSTOM_FUNCTIONS_PARAM1,
ITEM_CUSTOM_FUNCTIONS_PARAM2,
ITEM_CUSTOM_FUNCTIONS_REPEAT,
ITEM_CUSTOM_FUNCTIONS_COUNT,
ITEM_CUSTOM_FUNCTIONS_LAST = ITEM_CUSTOM_FUNCTIONS_COUNT-1
};

void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext)
{
int sub = menuVerticalPosition;
Expand Down Expand Up @@ -170,15 +180,15 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
uint8_t attr = ((sub==k && menuHorizontalPosition==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
uint8_t active = (attr && s_editMode>0);
switch (j) {
case 0:
case ITEM_CUSTOM_FUNCTIONS_SWITCH:
putsSwitches(MODEL_CUSTOM_FUNC_1ST_COLUMN, y, CFN_SWITCH(cfn), attr | ((functionsContext->activeSwitches & ((MASK_CFN_TYPE)1 << k)) ? BOLD : 0));
if (active || AUTOSWITCH_ENTER_LONG()) CHECK_INCDEC_SWITCH(event, CFN_SWITCH(cfn), SWSRC_FIRST, SWSRC_LAST, eeFlags, isSwitchAvailableInCustomFunctions);
if (func == FUNC_OVERRIDE_CHANNEL && functions != g_model.customFn) {
func = CFN_FUNC(cfn) = func+1;
}
break;

case 1:
case ITEM_CUSTOM_FUNCTIONS_FUNCTION:
if (CFN_SWITCH(cfn)) {
lcdDrawTextAtIndex(MODEL_CUSTOM_FUNC_2ND_COLUMN, y, STR_VFSWFUNC, func, attr);
if (active) {
Expand All @@ -187,14 +197,14 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
}
}
else {
j = 4; // skip other fields
j = ITEM_CUSTOM_FUNCTIONS_LAST; // skip other fields
if (sub==k && menuHorizontalPosition > 0) {
REPEAT_LAST_CURSOR_MOVE();
}
}
break;

case 2:
case ITEM_CUSTOM_FUNCTIONS_PARAM1:
{
int8_t maxParam = NUM_CHNOUT-1;
#if defined(OVERRIDE_CHANNEL_FUNCTION)
Expand All @@ -204,7 +214,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
else
#endif
if (func == FUNC_TRAINER) {
maxParam = 4;
maxParam = NUM_STICKS;
putsMixerSource(lcdNextPos, y, CFN_CH_INDEX(cfn)==0 ? 0 : MIXSRC_Rud+CFN_CH_INDEX(cfn)-1, attr);
}
#if defined(GVARS)
Expand All @@ -228,7 +238,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
break;
}

case 3:
case ITEM_CUSTOM_FUNCTIONS_PARAM2:
{
INCDEC_DECLARE_VARS(eeFlags);
int16_t val_displayed = CFN_PARAM(cfn);
Expand Down Expand Up @@ -335,7 +345,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
switch (CFN_GVAR_MODE(cfn)) {
case FUNC_ADJUST_GVAR_CONSTANT:
val_displayed = (int16_t)CFN_PARAM(cfn);
val_min = -CFN_GVAR_CST_MAX; val_max = +CFN_GVAR_CST_MAX;
val_min = CFN_GVAR_CST_MIN; val_max = CFN_GVAR_CST_MAX;
lcdDrawNumber(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT);
break;
case FUNC_ADJUST_GVAR_SOURCE:
Expand All @@ -351,17 +361,12 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
putsStrIdx(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, STR_GV, val_displayed+1, attr);
break;
default: // FUNC_ADJUST_GVAR_INC
#if 0 // TODO 2.2.X
val_min = -100; val_max = +100;
if (val_displayed < 0)
lcdDrawText(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, "-=", attr);
else
lcdDrawText(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, "+=", attr);
lcdDrawNumber(lcdNextPos, y, abs(val_displayed), attr|LEFT);
#endif
val_max = 1;
lcdDrawTextAtIndex(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, PSTR("\003-=1+=1"), val_displayed, attr);
break;
}
}
#endif
Expand All @@ -379,7 +384,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
POPUP_MENU_ADD_ITEM(STR_MIXSOURCE);
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_GVAR)
POPUP_MENU_ADD_ITEM(STR_GLOBALVAR);
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_INC)
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_INCDEC)
POPUP_MENU_ADD_ITEM(STR_INCDEC);
popupMenuHandler = onAdjustGvarSourceLongEnterPress;
s_editMode = EDIT_MODIFY_FIELD;
Expand All @@ -388,9 +393,9 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
break;
}

case 4:
case ITEM_CUSTOM_FUNCTIONS_REPEAT:
if (HAS_ENABLE_PARAM(func)) {
menu_lcd_onoff(MODEL_CUSTOM_FUNC_4TH_COLUMN_ONOFF, y, CFN_ACTIVE(cfn), attr);
drawCheckBox(MODEL_CUSTOM_FUNC_4TH_COLUMN_ONOFF, y, CFN_ACTIVE(cfn), attr);
if (active) CFN_ACTIVE(cfn) = checkIncDec(event, CFN_ACTIVE(cfn), 0, 1, eeFlags);
}
else if (HAS_REPEAT_PARAM(func)) {
Expand Down
2 changes: 1 addition & 1 deletion radio/src/gui/taranis/menu_model_inputs_mixes.cpp
Expand Up @@ -536,7 +536,7 @@ void menuModelMixOne(uint8_t event)

case MIX_FIELD_TRIM:
lcd_putsColumnLeft(COLUMN_X, y, STR_TRIM);
menu_lcd_onoff(COLUMN_X+MIXES_2ND_COLUMN, y, !md2->carryTrim, attr);
drawCheckBox(COLUMN_X + MIXES_2ND_COLUMN, y, !md2->carryTrim, attr);
if (attr) md2->carryTrim = !checkIncDecModel(event, !md2->carryTrim, 0, 1);
break;

Expand Down
2 changes: 1 addition & 1 deletion radio/src/gui/taranis/menu_model_setup.cpp
Expand Up @@ -602,7 +602,7 @@ void menuModelSetup(uint8_t event)

case ITEM_MODEL_USE_GLOBAL_FUNCTIONS:
lcd_putsLeft(y, STR_USE_GLOBAL_FUNCS);
menu_lcd_onoff(MODEL_SETUP_2ND_COLUMN, y, !g_model.noGlobalFunctions, attr);
drawCheckBox(MODEL_SETUP_2ND_COLUMN, y, !g_model.noGlobalFunctions, attr);
if (attr) g_model.noGlobalFunctions = !checkIncDecModel(event, !g_model.noGlobalFunctions, 0, 1);
break;

Expand Down

0 comments on commit b9bb147

Please sign in to comment.