Companion gvar refactor for special functions to match radio (#5361)

This commit is contained in:
Neil Horne
2017-11-18 11:25:46 +01:00
committed by Bertrand Songis
parent 2631ad00bd
commit f7828ad4a3
+11 -6
View File
@@ -411,23 +411,28 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM; widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM;
} }
else if (func>=FuncAdjustGV1 && func<=FuncAdjustGVLast) { else if (func>=FuncAdjustGV1 && func<=FuncAdjustGVLast) {
int gvidx = func - FuncAdjustGV1;
if (modified) if (modified)
cfn.adjustMode = fswtchGVmode[i]->currentIndex(); cfn.adjustMode = fswtchGVmode[i]->currentIndex();
widgetsMask |= CUSTOM_FUNCTION_GV_MODE | CUSTOM_FUNCTION_ENABLE; widgetsMask |= CUSTOM_FUNCTION_GV_MODE | CUSTOM_FUNCTION_ENABLE;
if (cfn.adjustMode==FUNC_ADJUST_GVAR_CONSTANT || cfn.adjustMode==FUNC_ADJUST_GVAR_INCDEC) { if (cfn.adjustMode==FUNC_ADJUST_GVAR_CONSTANT || cfn.adjustMode==FUNC_ADJUST_GVAR_INCDEC) {
if (modified) if (modified)
cfn.param = fswtchParam[i]->value(); cfn.param = fswtchParam[i]->value() * model->gvarData[gvidx].multiplierSet();
fswtchParam[i]->setDecimals(0);
fswtchParam[i]->setSingleStep(1);
if (IS_ARM(getCurrentBoard())) { if (IS_ARM(getCurrentBoard())) {
fswtchParam[i]->setMinimum(-500); fswtchParam[i]->setDecimals(model->gvarData[gvidx].prec);
fswtchParam[i]->setMaximum(500); fswtchParam[i]->setSingleStep(model->gvarData[gvidx].multiplierGet());
fswtchParam[i]->setSuffix(model->gvarData[gvidx].unitToString());
fswtchParam[i]->setMinimum(model->gvarData[gvidx].getMinPrec());
fswtchParam[i]->setMaximum(model->gvarData[gvidx].getMaxPrec());
fswtchParam[i]->setValue(cfn.param * model->gvarData[gvidx].multiplierGet());
} }
else { else {
fswtchParam[i]->setDecimals(0);
fswtchParam[i]->setSingleStep(1);
fswtchParam[i]->setMinimum(-125); fswtchParam[i]->setMinimum(-125);
fswtchParam[i]->setMaximum(125); fswtchParam[i]->setMaximum(125);
fswtchParam[i]->setValue(cfn.param);
} }
fswtchParam[i]->setValue(cfn.param);
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM; widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM;
} }
else { else {