diff --git a/companion/src/eeprominterface.cpp b/companion/src/eeprominterface.cpp index 35e34cdee..92568c364 100644 --- a/companion/src/eeprominterface.cpp +++ b/companion/src/eeprominterface.cpp @@ -908,12 +908,12 @@ QString CustomFunctionData::paramToString(const ModelData * model) const } else if ((func>=FuncAdjustGV1) && (funcfunc = func; } diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index 4ee1eca38..4c2345f54 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -2115,12 +2115,17 @@ class ArmCustomFunctionField: public TransformedField { } } + static bool hasRepeatParam(const CustomFunctionData & fn) + { + return (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue || fn.func == FuncPlayHaptic); + } + virtual void beforeExport() { if (fn.swtch.type != SWITCH_TYPE_NONE) { _func = fn.func; - if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue || fn.func == FuncPlayHaptic || (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast)) + if (hasRepeatParam(fn)) _active = (version >= 216 ? fn.repeatParam : (fn.repeatParam/5)); else _active = (fn.enabled ? 1 : 0); @@ -2216,7 +2221,7 @@ class ArmCustomFunctionField: public TransformedField { { fn.func = (AssignFunc)_func; - if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue || fn.func == FuncPlayHaptic || (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast)) + if (hasRepeatParam(fn)) fn.repeatParam = (version >= 216 ? _active : (_active*5)); else fn.enabled = (_active & 0x01); diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index cdcadfe3f..b13eb8dc3 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -367,8 +367,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 | (IS_ARM(firmware->getBoard()) ? CUSTOM_FUNCTION_REPEAT : CUSTOM_FUNCTION_ENABLE); - if (cfn.adjustMode==0 || cfn.adjustMode==3) { + widgetsMask |= CUSTOM_FUNCTION_GV_MODE | CUSTOM_FUNCTION_ENABLE; + if (cfn.adjustMode==FUNC_ADJUST_GVAR_CONSTANT || cfn.adjustMode==FUNC_ADJUST_GVAR_INCDEC) { if (modified) cfn.param = fswtchParam[i]->value(); fswtchParam[i]->setDecimals(0); fswtchParam[i]->setSingleStep(1);