fix(cpn): model reference updates (#6769)

Co-authored-by: elecpower <elecpower@users.noreply.github.com>
This commit is contained in:
Neil Horne
2025-11-15 11:16:05 +10:00
committed by GitHub
co-authored by elecpower
parent a7db0e4592
commit 05ef9a5b9e
2 changed files with 20 additions and 6 deletions
+18 -6
View File
@@ -28,6 +28,7 @@
#include "helpers.h"
#include "adjustmentreference.h"
#include "compounditemmodels.h"
#include "sourcenumref.h"
#include <QMessageBox>
@@ -636,8 +637,8 @@ int ModelData::updateReference()
if (ed->srcRaw.isSet()) {
updateSwitchRef(ed->swtch);
updateCurveRef(ed->curve);
updateAdjustRef(ed->weight);
updateAdjustRef(ed->offset);
updateSourceNumRef(ed->weight);
updateSourceNumRef(ed->offset);
updateFlightModeFlags(ed->flightModes);
}
else {
@@ -660,8 +661,8 @@ int ModelData::updateReference()
if (md->srcRaw.isSet()) {
updateSwitchRef(md->swtch);
updateCurveRef(md->curve);
updateAdjustRef(md->weight);
updateAdjustRef(md->sOffset);
updateSourceNumRef(md->weight);
updateSourceNumRef(md->sOffset);
updateFlightModeFlags(md->flightModes);
}
else {
@@ -976,8 +977,8 @@ void ModelData::updateTypeValueRef(R & curRef, const T type, const int idxAdj, c
void ModelData::updateCurveRef(CurveReference & crv)
{
if (updRefInfo.type == REF_UPD_TYPE_GLOBAL_VARIABLE && (crv.type == CurveReference::CURVE_REF_DIFF || crv.type == CurveReference::CURVE_REF_EXPO))
updateAdjustRef(crv.value);
if (crv.type == CurveReference::CURVE_REF_DIFF || crv.type == CurveReference::CURVE_REF_EXPO)
updateSourceNumRef(crv.value);
else if (updRefInfo.type == REF_UPD_TYPE_CURVE && crv.type == CurveReference::CURVE_REF_CUSTOM)
updateTypeValueRef<CurveReference, CurveReference::CurveRefType>(crv, CurveReference::CURVE_REF_CUSTOM, 1);
}
@@ -2133,3 +2134,14 @@ bool ModelData::gvarInsertAllowed(const int index)
return ret;
}
void ModelData::updateSourceNumRef(int & value)
{
if (updRefInfo.type == REF_UPD_TYPE_CHANNEL ||
updRefInfo.type == REF_UPD_TYPE_GLOBAL_VARIABLE ||
updRefInfo.type == REF_UPD_TYPE_INPUT) {
SourceNumRef srcnum = SourceNumRef(value);
if (srcnum.isSource())
updateSourceIntRef(value);
}
}
+2
View File
@@ -43,6 +43,7 @@
class GeneralSettings;
class RadioDataConversionState;
class AbstractStaticItemModel;
class SourceNumRef;
constexpr char AIM_MODELDATA_TRAINERMODE[] {"modeldata.trainermode"};
constexpr char AIM_MODELDATA_FUNCSWITCHCONFIG[] {"modeldata.funcswitchconfig"};
@@ -430,4 +431,5 @@ class ModelData {
value = swtch.toValue();
}
void updateResetParam(CustomFunctionData * cfd);
void updateSourceNumRef(int & value);
};