mirror of
https://github.com/opentx/opentx.git
synced 2025-07-21 15:25:17 +03:00
EEPROM 'next' support. A lot of corrections.
This commit is contained in:
parent
0b387a2467
commit
cedddfe8d2
20 changed files with 419 additions and 434 deletions
|
@ -550,6 +550,7 @@ class ConversionField: public TransformedField {
|
|||
_field(0),
|
||||
table(table),
|
||||
shift(0),
|
||||
scale(1),
|
||||
min(INT_MIN),
|
||||
max(INT_MAX),
|
||||
exportFunc(NULL),
|
||||
|
@ -565,6 +566,7 @@ class ConversionField: public TransformedField {
|
|||
_field(0),
|
||||
table(table),
|
||||
shift(0),
|
||||
scale(0),
|
||||
min(INT_MIN),
|
||||
max(INT_MAX),
|
||||
exportFunc(NULL),
|
||||
|
@ -580,6 +582,7 @@ class ConversionField: public TransformedField {
|
|||
_field(0),
|
||||
table(NULL),
|
||||
shift(0),
|
||||
scale(0),
|
||||
min(INT_MIN),
|
||||
max(INT_MAX),
|
||||
exportFunc(exportFunc),
|
||||
|
@ -588,13 +591,14 @@ class ConversionField: public TransformedField {
|
|||
{
|
||||
}
|
||||
|
||||
ConversionField(int & field, int shift, int min=INT_MIN, int max=INT_MAX, const char *name = "Signed shifted"):
|
||||
ConversionField(int & field, int shift, int scale=0, int min=INT_MIN, int max=INT_MAX, const char *name = "Signed shifted"):
|
||||
TransformedField(internalField),
|
||||
internalField(_field, name),
|
||||
field(field),
|
||||
_field(0),
|
||||
table(NULL),
|
||||
shift(shift),
|
||||
scale(scale),
|
||||
min(min),
|
||||
max(max),
|
||||
exportFunc(NULL),
|
||||
|
@ -603,13 +607,14 @@ class ConversionField: public TransformedField {
|
|||
{
|
||||
}
|
||||
|
||||
ConversionField(unsigned int & field, int shift):
|
||||
ConversionField(unsigned int & field, int shift, int scale=0):
|
||||
TransformedField(internalField),
|
||||
internalField((unsigned int &)_field),
|
||||
field((int &)field),
|
||||
_field(0),
|
||||
table(NULL),
|
||||
shift(shift),
|
||||
scale(scale),
|
||||
min(INT_MIN),
|
||||
max(INT_MAX),
|
||||
exportFunc(NULL),
|
||||
|
@ -620,19 +625,25 @@ class ConversionField: public TransformedField {
|
|||
|
||||
virtual void beforeExport()
|
||||
{
|
||||
int val = field;
|
||||
|
||||
if (scale) {
|
||||
val /= scale;
|
||||
}
|
||||
|
||||
if (table) {
|
||||
if (table->exportValue(field, _field))
|
||||
if (table->exportValue(val, _field))
|
||||
return;
|
||||
if (!error.isEmpty())
|
||||
EEPROMWarnings += error + "\n";
|
||||
}
|
||||
else if (shift) {
|
||||
if (field < min) _field = min + shift;
|
||||
else if (field > max) _field = max + shift;
|
||||
else _field = field + shift;
|
||||
if (val < min) _field = min + shift;
|
||||
else if (val > max) _field = max + shift;
|
||||
else _field = val + shift;
|
||||
}
|
||||
else {
|
||||
_field = exportFunc(field);
|
||||
_field = exportFunc(val);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -648,6 +659,10 @@ class ConversionField: public TransformedField {
|
|||
else {
|
||||
field = importFunc(_field);
|
||||
}
|
||||
|
||||
if (scale) {
|
||||
field *= scale;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -656,6 +671,7 @@ class ConversionField: public TransformedField {
|
|||
int _field;
|
||||
ConversionTable * table;
|
||||
int shift;
|
||||
int scale;
|
||||
int min;
|
||||
int max;
|
||||
int (*exportFunc)(int);
|
||||
|
|
|
@ -417,9 +417,9 @@ QString CurveReference::toString()
|
|||
else {
|
||||
switch(type) {
|
||||
case CURVE_REF_DIFF:
|
||||
return QObject::tr("Diff(%1%%)").arg(getGVarString(value));
|
||||
return QObject::tr("Diff(%1)").arg(getGVarString(value));
|
||||
case CURVE_REF_EXPO:
|
||||
return QObject::tr("Expo(%1%%)").arg(getGVarString(value));
|
||||
return QObject::tr("Expo(%1)").arg(getGVarString(value));
|
||||
case CURVE_REF_FUNC:
|
||||
return QObject::tr("Function(%1)").arg(QString("x>0" "x<0" "|x|" "f>0" "f<0" "|f|").mid(3*(value-1), 3));
|
||||
default:
|
||||
|
|
|
@ -65,8 +65,8 @@ const uint8_t modn12x3[4][4]= {
|
|||
#define C9X_MAX_MODELS 60
|
||||
#define C9X_MAX_PHASES 9
|
||||
#define C9X_MAX_MIXERS 64
|
||||
#define C9X_MAX_EXPOS 32
|
||||
#define C9X_MAX_CURVES 16
|
||||
#define C9X_MAX_EXPOS 64
|
||||
#define C9X_MAX_CURVES 32
|
||||
#define C9X_MAX_POINTS 17
|
||||
#define C9X_MAX_GVARS 9
|
||||
#define C9X_MAX_ENCODERS 2
|
||||
|
@ -628,10 +628,7 @@ enum AssignFunc {
|
|||
FuncBackgroundMusic,
|
||||
FuncBackgroundMusicPause,
|
||||
FuncAdjustGV1,
|
||||
FuncAdjustGV2,
|
||||
FuncAdjustGV3,
|
||||
FuncAdjustGV4,
|
||||
FuncAdjustGV5,
|
||||
FuncAdjustGVLast = FuncAdjustGV1+C9X_MAX_GVARS-1,
|
||||
FuncCount
|
||||
};
|
||||
|
||||
|
@ -977,7 +974,6 @@ enum Capability {
|
|||
GvarsFlightPhases,
|
||||
GvarsHaveSources,
|
||||
GvarsAsSources,
|
||||
GvarsAsWeight,
|
||||
GvarsName,
|
||||
NoTelemetryProtocol,
|
||||
TelemetryCSFields,
|
||||
|
|
|
@ -283,7 +283,6 @@ int Er9xInterface::getCapability(const Capability capability)
|
|||
return 7;
|
||||
case GvarsHaveSources:
|
||||
case GvarsAsSources:
|
||||
case GvarsAsWeight:
|
||||
return 1;
|
||||
case GetThrSwitch:
|
||||
return DSW_THR;
|
||||
|
|
|
@ -319,7 +319,6 @@ int Ersky9xInterface::getCapability(const Capability capability)
|
|||
return 23;
|
||||
case GvarsHaveSources:
|
||||
case GvarsAsSources:
|
||||
case GvarsAsWeight:
|
||||
return 1;
|
||||
case TelemetryMaxMultiplier:
|
||||
return 2;
|
||||
|
|
|
@ -630,7 +630,7 @@ t_Open9xArmFuncSwData_v211::operator FuncSwData ()
|
|||
}
|
||||
else {
|
||||
c9x.param = value;
|
||||
if ((c9x.func == FuncPlayValue || c9x.func == FuncVolume || (c9x.func >= FuncAdjustGV1 && c9x.func <= FuncAdjustGV5)) && value > 7) {
|
||||
if ((c9x.func == FuncPlayValue || c9x.func == FuncVolume || (c9x.func >= FuncAdjustGV1 && c9x.func <= FuncAdjustGVLast)) && value > 7) {
|
||||
c9x.param++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -363,13 +363,34 @@ class SourceField: public ConversionField< UnsignedField<N> > {
|
|||
unsigned int _source;
|
||||
};
|
||||
|
||||
class CurveReferenceField: public StructField {
|
||||
class CurveReferenceField: public TransformedField {
|
||||
public:
|
||||
CurveReferenceField(CurveReference & curve, BoardEnum board, unsigned int version)
|
||||
CurveReferenceField(CurveReference & curve, BoardEnum board, unsigned int version):
|
||||
TransformedField(internalField),
|
||||
curve(curve),
|
||||
_curve_type(0)
|
||||
{
|
||||
Append(new UnsignedField<8>((unsigned int &)curve.type));
|
||||
Append(new SignedField<8>(curve.value));
|
||||
internalField.Append(new UnsignedField<8>(_curve_type));
|
||||
internalField.Append(new SignedField<8>(curve.value));
|
||||
}
|
||||
|
||||
virtual void beforeExport()
|
||||
{
|
||||
if (curve.value != 0)
|
||||
_curve_type = (unsigned int)curve.type;
|
||||
else
|
||||
_curve_type = 0;
|
||||
}
|
||||
|
||||
virtual void afterImport()
|
||||
{
|
||||
curve.type = (CurveReference::CurveRefType)_curve_type;
|
||||
}
|
||||
|
||||
protected:
|
||||
StructField internalField;
|
||||
CurveReference & curve;
|
||||
unsigned int _curve_type;
|
||||
};
|
||||
|
||||
class HeliField: public StructField {
|
||||
|
@ -804,13 +825,13 @@ class ExpoField: public TransformedField {
|
|||
if (IS_TARANIS(board) && version >= 216) {
|
||||
internalField.Append(new SourceField<8>(expo.srcRaw, board, version, 0));
|
||||
internalField.Append(new UnsignedField<16>(expo.scale));
|
||||
internalField.Append(new UnsignedField<8>(expo.chn));
|
||||
internalField.Append(new UnsignedField<8>(expo.chn, "Channel"));
|
||||
internalField.Append(new SwitchField<8>(expo.swtch, board, version));
|
||||
internalField.Append(new UnsignedField<16>(expo.phases));
|
||||
internalField.Append(new SignedField<8>(_weight));
|
||||
internalField.Append(new SignedField<8>(_weight, "Weight"));
|
||||
internalField.Append(new SignedField<8>(expo.carryTrim));
|
||||
internalField.Append(new ZCharField<8>(expo.name));
|
||||
internalField.Append(new SignedField<8>(expo.offset));
|
||||
internalField.Append(new SignedField<8>(expo.offset, "Offset"));
|
||||
internalField.Append(new CurveReferenceField(expo.curve, board, version));
|
||||
internalField.Append(new SpareBitsField<8>());
|
||||
}
|
||||
|
@ -903,8 +924,8 @@ class LimitField: public StructField {
|
|||
Append(new ConversionField< SignedField<16> >(limit.max, -1000));
|
||||
}
|
||||
else {
|
||||
Append(new ConversionField< SignedField<8> >(limit.min, +100));
|
||||
Append(new ConversionField< SignedField<8> >(limit.max, -100));
|
||||
Append(new ConversionField< SignedField<8> >(limit.min, +100, 10));
|
||||
Append(new ConversionField< SignedField<8> >(limit.max, -100, 10));
|
||||
}
|
||||
Append(new SignedField<8>(limit.ppmCenter));
|
||||
Append(new SignedField<14>(limit.offset));
|
||||
|
@ -1352,7 +1373,7 @@ class CustomFunctionField: public TransformedField {
|
|||
else if (fn.func == FuncPlayPrompt || fn.func == FuncBackgroundMusic) {
|
||||
memcpy(_arm_param, fn.paramarm, sizeof(_arm_param));
|
||||
}
|
||||
else if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGV5) {
|
||||
else if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) {
|
||||
unsigned int value;
|
||||
if (version >= 214) {
|
||||
_mode = fn.adjustMode;
|
||||
|
@ -1382,7 +1403,7 @@ class CustomFunctionField: public TransformedField {
|
|||
/* the default behavior */
|
||||
_param = fn.param;
|
||||
_union_param = (fn.enabled ? 1 : 0);
|
||||
if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGV5) {
|
||||
if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) {
|
||||
if (version >= 213) {
|
||||
_union_param += (fn.adjustMode << 1);
|
||||
if (fn.adjustMode == 1)
|
||||
|
@ -1435,7 +1456,7 @@ class CustomFunctionField: public TransformedField {
|
|||
else if (fn.func == FuncVolume) {
|
||||
sourcesConversionTable->importValue(value, (int &)fn.param);
|
||||
}
|
||||
else if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGV5) {
|
||||
else if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) {
|
||||
if (version >= 214) {
|
||||
fn.adjustMode = _mode;
|
||||
if (fn.adjustMode == 1)
|
||||
|
@ -1464,7 +1485,7 @@ class CustomFunctionField: public TransformedField {
|
|||
if (version >= 213) {
|
||||
fn.enabled = (_union_param & 0x01);
|
||||
}
|
||||
if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGV5) {
|
||||
if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) {
|
||||
if (version >= 213) {
|
||||
fn.adjustMode = ((_union_param >> 1) & 0x03);
|
||||
if (fn.adjustMode == 1)
|
||||
|
@ -1725,7 +1746,7 @@ class FrskyField: public StructField {
|
|||
Append(new SignedField<4>(frsky.varioMax));
|
||||
for (int i=0; i<2; i++) {
|
||||
Append(new ConversionField< UnsignedField<2> >(frsky.rssiAlarms[i].level, &rssiConversionTable[i], "RSSI level"));
|
||||
Append(new ConversionField< SignedField<6> >(frsky.rssiAlarms[i].value, -45+i*3, 0, 100, "RSSI value"));
|
||||
Append(new ConversionField< SignedField<6> >(frsky.rssiAlarms[i].value, -45+i*3, 0, 0, 100, "RSSI value"));
|
||||
}
|
||||
for (int i=0; i<2; i++) {
|
||||
Append(new FrskyScreenField(frsky.screens[i], board, version));
|
||||
|
@ -1949,6 +1970,7 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u
|
|||
void Open9xModelDataNew::beforeExport()
|
||||
{
|
||||
// qDebug() << QString("before export model") << modelData.name;
|
||||
|
||||
for (int module=0; module<3; module++) {
|
||||
if (modelData.moduleData[module].protocol >= PXX_XJT_X16 && modelData.moduleData[module].protocol <= PXX_XJT_LR12)
|
||||
subprotocols[module] = modelData.moduleData[module].protocol - PXX_XJT_X16;
|
||||
|
@ -2050,9 +2072,9 @@ Open9xGeneralDataNew::Open9xGeneralDataNew(GeneralSettings & generalData, BoardE
|
|||
internalField.Append(new UnsignedField<8>(generalData.speakerPitch));
|
||||
|
||||
if (IS_ARM(board))
|
||||
internalField.Append(new ConversionField< SignedField<8> >(generalData.speakerVolume, -12, 0, 23, "Volume"));
|
||||
internalField.Append(new ConversionField< SignedField<8> >(generalData.speakerVolume, -12, 0, 0, 23, "Volume"));
|
||||
else
|
||||
internalField.Append(new ConversionField< SignedField<8> >(generalData.speakerVolume, -7, 0, 7, "Volume"));
|
||||
internalField.Append(new ConversionField< SignedField<8> >(generalData.speakerVolume, -7, 0, 0, 7, "Volume"));
|
||||
|
||||
if (version >= 214 || (!IS_ARM(board) && version >= 213)) {
|
||||
internalField.Append(new SignedField<8>(generalData.vBatMin));
|
||||
|
|
|
@ -420,7 +420,6 @@ int Open9xInterface::getSize(ModelData &model)
|
|||
efile->EeFsCreate(tmp, EESIZE_RLC_MAX, board);
|
||||
|
||||
Open9xModelDataNew open9xModel(model, board, 255, GetCurrentFirmwareVariant());
|
||||
// open9xModel.Dump();
|
||||
|
||||
QByteArray eeprom;
|
||||
open9xModel.Export(eeprom);
|
||||
|
@ -502,7 +501,6 @@ int Open9xInterface::getCapability(const Capability capability)
|
|||
case GvarsName:
|
||||
return (IS_TARANIS(board) ? 10 : 6);
|
||||
case GvarsInCS:
|
||||
case GvarsAsWeight:
|
||||
case HasFAIMode:
|
||||
return 1;
|
||||
case GvarsAreNamed:
|
||||
|
|
|
@ -155,16 +155,8 @@ QString getFuncName(unsigned int val)
|
|||
return QObject::tr("Background Music");
|
||||
else if (val == FuncBackgroundMusicPause)
|
||||
return QObject::tr("Background Music Pause");
|
||||
else if (val == FuncAdjustGV1)
|
||||
return QObject::tr("Adjust GV1");
|
||||
else if (val == FuncAdjustGV2)
|
||||
return QObject::tr("Adjust GV2");
|
||||
else if (val == FuncAdjustGV3)
|
||||
return QObject::tr("Adjust GV3");
|
||||
else if (val == FuncAdjustGV4)
|
||||
return QObject::tr("Adjust GV4");
|
||||
else if (val == FuncAdjustGV5)
|
||||
return QObject::tr("Adjust GV5");
|
||||
else if (val >= FuncAdjustGV1 && val <= FuncAdjustGVLast)
|
||||
return QObject::tr("Adjust GV%1").arg(val-FuncAdjustGV1+1);
|
||||
else {
|
||||
return QString("???"); // Highlight unknown functions with output of question marks.(BTW should not happen that we do not know what a function is)
|
||||
}
|
||||
|
@ -424,7 +416,7 @@ void populateFuncParamCB(QComboBox *b, uint function, unsigned int value, unsign
|
|||
else if (function==FuncPlayValue) {
|
||||
populateSourceCB(b, RawSource(value), POPULATE_SOURCES|POPULATE_SWITCHES|POPULATE_GVARS|POPULATE_TRIMS|POPULATE_TELEMETRYEXT);
|
||||
}
|
||||
else if (function>=FuncAdjustGV1 && function<=FuncAdjustGV5 ) {
|
||||
else if (function>=FuncAdjustGV1 && function<=FuncAdjustGVLast) {
|
||||
switch (adjustmode) {
|
||||
case 1:
|
||||
populateSourceCB(b, RawSource(value), POPULATE_SOURCES|POPULATE_TRIMS|POPULATE_SWITCHES);
|
||||
|
@ -440,7 +432,6 @@ void populateFuncParamCB(QComboBox *b, uint function, unsigned int value, unsign
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
b->hide();
|
||||
}
|
||||
|
@ -482,11 +473,13 @@ void populatePhasesCB(QComboBox *b, int value)
|
|||
|
||||
void populateCurveReference(QComboBox *curveTypeCB, QCheckBox *curveGVarCB, QComboBox *curveValueCB, QSpinBox *curveValueSB, CurveReference & curve, unsigned int flags)
|
||||
{
|
||||
curveTypeCB->clear();
|
||||
if (curveTypeCB->count() == 0) {
|
||||
curveTypeCB->addItem(QObject::tr("Diff"));
|
||||
curveTypeCB->addItem(QObject::tr("Expo"));
|
||||
curveTypeCB->addItem(QObject::tr("Func"));
|
||||
curveTypeCB->addItem(QObject::tr("Curve"));
|
||||
}
|
||||
|
||||
curveTypeCB->setCurrentIndex(curve.type);
|
||||
|
||||
if (curve.type == CurveReference::CURVE_REF_DIFF || curve.type == CurveReference::CURVE_REF_EXPO) {
|
||||
|
@ -533,6 +526,31 @@ void populateCurveReference(QComboBox *curveTypeCB, QCheckBox *curveGVarCB, QCom
|
|||
}
|
||||
}
|
||||
|
||||
void retrieveCurveReference(QComboBox *curveTypeCB, QCheckBox *curveGVarCB, QComboBox *curveValueCB, QSpinBox *curveValueSB, CurveReference & curve, unsigned int flags)
|
||||
{
|
||||
switch (curveTypeCB->currentIndex()) {
|
||||
case 0:
|
||||
case 1:
|
||||
{
|
||||
int value;
|
||||
if (curveGVarCB->isChecked())
|
||||
value = curveValueCB->itemData(curveValueCB->currentIndex()).toInt();
|
||||
else
|
||||
value = curveValueSB->value();
|
||||
qDebug() << value;
|
||||
curve = CurveReference(curveTypeCB->currentIndex() == 0 ? CurveReference::CURVE_REF_DIFF : CurveReference::CURVE_REF_EXPO, value);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
curve = CurveReference(CurveReference::CURVE_REF_FUNC, curveValueCB->currentIndex());
|
||||
break;
|
||||
case 3:
|
||||
curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, curveValueCB->currentIndex() - GetEepromInterface()->getCapability(NumCurves));
|
||||
break;
|
||||
}
|
||||
populateCurveReference(curveTypeCB, curveGVarCB, curveValueCB, curveValueSB, curve, flags);
|
||||
}
|
||||
|
||||
void populateTrimUseCB(QComboBox *b, unsigned int phase)
|
||||
{
|
||||
b->addItem(QObject::tr("Own trim"));
|
||||
|
@ -1008,16 +1026,17 @@ QString getSignedStr(int value)
|
|||
|
||||
QString getGVarString(int16_t val, bool sign)
|
||||
{
|
||||
if (val >= -10000 && val <= 10000)
|
||||
if (val >= -10000 && val <= 10000) {
|
||||
if (sign)
|
||||
return QString("(%1%)").arg(getSignedStr(val));
|
||||
return QString("%1%").arg(getSignedStr(val));
|
||||
else
|
||||
return QString("(%1%)").arg(val);
|
||||
return QString("%1%").arg(val);
|
||||
}
|
||||
else {
|
||||
if (val<0)
|
||||
return QObject::tr("-GV%1").arg(-val-10000);
|
||||
else
|
||||
if (val<0) {
|
||||
return QObject::tr("(-GV%1)").arg(-val-10000);
|
||||
} else {
|
||||
return QObject::tr("(GV%1)").arg(val-10000);
|
||||
return QObject::tr("GV%1").arg(val-10000);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ void populatePhasesCB(QComboBox *b, int value);
|
|||
void populateTrimUseCB(QComboBox *b, unsigned int phase);
|
||||
void populateGvarUseCB(QComboBox *b, unsigned int phase);
|
||||
void populateCurveReference(QComboBox *curveTypeCB, QCheckBox *curveGVarCB, QComboBox *curveValueCB, QSpinBox *curveValueSB, CurveReference & curve, unsigned int flags);
|
||||
void retrieveCurveReference(QComboBox *curveTypeCB, QCheckBox *curveGVarCB, QComboBox *curveValueCB, QSpinBox *curveValueSB, CurveReference & curve, unsigned int flags);
|
||||
void populateCurvesCB(QComboBox *b, int value);
|
||||
void populateCustomScreenFieldCB(QComboBox *b, unsigned int value, bool last, int hubproto);
|
||||
void populateTimerSwitchCB(QComboBox *b, int value);
|
||||
|
|
|
@ -281,7 +281,8 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
|||
if (modified) model.funcSw[i].param = fswtchParam[i]->value()*10.0;
|
||||
fswtchParam[i]->setValue(model.funcSw[i].param/10.0);
|
||||
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM + CUSTOM_FUNCTION_ENABLE;
|
||||
} else if (index>=FuncAdjustGV1 && index<=FuncAdjustGV5) {
|
||||
}
|
||||
else if (index>=FuncAdjustGV1 && index<=FuncAdjustGVLast) {
|
||||
if (modified) model.funcSw[i].adjustMode = fswtchGVmode[i]->currentIndex();
|
||||
widgetsMask |= CUSTOM_FUNCTION_GV_MODE + CUSTOM_FUNCTION_ENABLE;
|
||||
if (model.funcSw[i].adjustMode==0) {
|
||||
|
|
|
@ -15,7 +15,6 @@ ExpoDialog::ExpoDialog(QWidget *parent, ExpoData *expoData, int stickMode) :
|
|||
setWindowTitle(tr("DEST -> %1").arg(getStickStr(ed->chn)));
|
||||
QRegExp rx(CHAR_FOR_NAMES_REGEX);
|
||||
|
||||
if (GetEepromInterface()->getCapability(GvarsAsWeight)) {
|
||||
int gvars=0;
|
||||
if (GetEepromInterface()->getCapability(HasVariants)) {
|
||||
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
|
||||
|
@ -24,28 +23,19 @@ ExpoDialog::ExpoDialog(QWidget *parent, ExpoData *expoData, int stickMode) :
|
|||
} else {
|
||||
gvars=1;
|
||||
}
|
||||
if (gvars==0) {
|
||||
ui->expoGV->setDisabled(true);
|
||||
ui->weightGV->setDisabled(true);
|
||||
ui->expoCurveGV->setDisabled(true);
|
||||
|
||||
/* TODO
|
||||
if (ed->expo>100) {
|
||||
ed->expo=0;
|
||||
if (gvars==0) {
|
||||
ui->weightGV->setDisabled(true);
|
||||
ui->curveGVarCB->hide();
|
||||
if ((ed->curve.type == CurveReference::CURVE_REF_EXPO || ed->curve.type == CurveReference::CURVE_REF_DIFF) && ed->curve.value > 100) {
|
||||
ed->curve.value = 0;
|
||||
}
|
||||
*/
|
||||
if (ed->weight>100 || ed->weight<-100) {
|
||||
ed->weight = 100;
|
||||
}
|
||||
/* TODO
|
||||
if (ed->curveParam>100 || ed->curveParam<-100) {
|
||||
ed->curveParam=0;
|
||||
}
|
||||
*/
|
||||
}
|
||||
// TODO populateGVCB(ui->expoCB, ed->expo);
|
||||
|
||||
populateGVCB(ui->weightCB, ed->weight);
|
||||
// TODO populateGVCB(ui->expoCurveCB, ed->curveParam);
|
||||
|
||||
ui->weightSB->setMinimum(0);
|
||||
ui->weightSB->setMaximum(100);
|
||||
|
@ -59,65 +49,13 @@ ExpoDialog::ExpoDialog(QWidget *parent, ExpoData *expoData, int stickMode) :
|
|||
ui->weightSB->show();
|
||||
ui->weightCB->hide();
|
||||
}
|
||||
/* TODO
|
||||
ui->expoSB->setMinimum(-100);
|
||||
ui->expoSB->setMaximum(100);
|
||||
if (ed->expo>100 || ed->expo<-100) {
|
||||
ui->expoGV->setChecked(true);
|
||||
ui->expoSB->hide();
|
||||
ui->expoCB->show();
|
||||
}
|
||||
else {
|
||||
ui->expoGV->setChecked(false);
|
||||
ui->expoSB->setValue(ed->expo);
|
||||
ui->expoSB->show();
|
||||
ui->expoCB->hide();
|
||||
}
|
||||
|
||||
ui->expoCurveSB->setMinimum(-100);
|
||||
ui->expoCurveSB->setMaximum(100);
|
||||
if (ed->curveParam>100 || ed->curveParam<-100) {
|
||||
ui->expoCurveGV->setChecked(true);
|
||||
ui->expoCurveSB->hide();
|
||||
ui->expoCurveCB->show();
|
||||
}
|
||||
else {
|
||||
ui->expoCurveGV->setChecked(false);
|
||||
ui->expoCurveSB->setValue(ed->curveParam);
|
||||
ui->expoCurveSB->show();
|
||||
ui->expoCurveCB->hide();
|
||||
}
|
||||
*/
|
||||
}
|
||||
else {
|
||||
// TODO ui->expoGV->hide();
|
||||
ui->weightGV->hide();
|
||||
// TODO ui->expoCurveGV->hide();
|
||||
// TODO ui->expoSB->setMinimum(-100);
|
||||
// TODO ui->expoSB->setMaximum(100);
|
||||
// TODO ui->expoSB->setValue(ed->expo);
|
||||
// TODO ui->expoCurveSB->setMinimum(-100);
|
||||
// TODO ui->expoCurveSB->setMaximum(100);
|
||||
// TODO ui->expoCurveSB->setValue(ed->curveParam);
|
||||
ui->weightSB->setMinimum(0);
|
||||
ui->weightSB->setMaximum(100);
|
||||
ui->weightSB->setValue(ed->weight);
|
||||
}
|
||||
|
||||
populateSwitchCB(ui->switchesCB,ed->swtch);
|
||||
/* if (ed->curveMode==0) {
|
||||
populateExpoCurvesCB(ui->curvesCB,0); // TODO capacity for er9x
|
||||
}
|
||||
else {
|
||||
populateExpoCurvesCB(ui->curvesCB,ed->curveParam); // TODO capacity for er9x
|
||||
}
|
||||
*/
|
||||
populateCurveReference(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve, 0);
|
||||
|
||||
ui->modeCB->setCurrentIndex(ed->mode-1);
|
||||
|
||||
ui->label_expo->hide();
|
||||
// TODO ui->expoCB->hide();
|
||||
// TODO ui->expoGV->hide();
|
||||
// TODO ui->expoSB->hide();
|
||||
|
||||
if (!GetEepromInterface()->getCapability(FlightPhases)) {
|
||||
ui->label_phases->hide();
|
||||
|
@ -138,6 +76,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ExpoData *expoData, int stickMode) :
|
|||
cb_fp[i]->hide();
|
||||
}
|
||||
}
|
||||
|
||||
int expolength=GetEepromInterface()->getCapability(HasExpoNames);
|
||||
if (!expolength) {
|
||||
ui->label_name->hide();
|
||||
|
@ -145,21 +84,25 @@ ExpoDialog::ExpoDialog(QWidget *parent, ExpoData *expoData, int stickMode) :
|
|||
} else {
|
||||
ui->expoName->setMaxLength(expolength);
|
||||
}
|
||||
|
||||
ui->expoName->setValidator(new QRegExpValidator(rx, this));
|
||||
ui->expoName->setText(ed->name);
|
||||
valuesChanged();
|
||||
|
||||
connect(ui->expoName,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
|
||||
connect(ui->expoCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
|
||||
connect(ui->expoSB,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
|
||||
connect(ui->expoCurveCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
|
||||
connect(ui->expoCurveSB,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
|
||||
|
||||
connect(ui->curveTypeCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
|
||||
connect(ui->curveGVarCB,SIGNAL(stateChanged(int)),this,SLOT(valuesChanged()));
|
||||
connect(ui->curveValueCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
|
||||
connect(ui->curveValueSB,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
|
||||
|
||||
connect(ui->weightCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
|
||||
connect(ui->weightSB,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
|
||||
connect(ui->switchesCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
|
||||
connect(ui->curvesCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
|
||||
connect(ui->modeCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
|
||||
connect(ui->expoGV,SIGNAL(stateChanged(int)),this,SLOT(widgetChanged()));
|
||||
connect(ui->expoCurveGV,SIGNAL(stateChanged(int)),this,SLOT(widgetChanged()));
|
||||
connect(ui->weightGV,SIGNAL(stateChanged(int)),this,SLOT(widgetChanged()));
|
||||
for (int i=0; i<9; i++) {
|
||||
connect(cb_fp[i],SIGNAL(toggled(bool)),this,SLOT(valuesChanged()));
|
||||
|
@ -186,7 +129,7 @@ void ExpoDialog::changeEvent(QEvent *e)
|
|||
|
||||
void ExpoDialog::widgetChanged()
|
||||
{
|
||||
if (GetEepromInterface()->getCapability(GvarsAsWeight)) {
|
||||
// TODO so many times duplicated :(
|
||||
int gvars=0;
|
||||
if (GetEepromInterface()->getCapability(HasVariants)) {
|
||||
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
|
||||
|
@ -195,7 +138,8 @@ void ExpoDialog::widgetChanged()
|
|||
} else {
|
||||
gvars=1;
|
||||
}
|
||||
if (gvars==1) {
|
||||
|
||||
/* TODO if (gvars==1) {
|
||||
if (ui->expoCurveGV->isChecked()) {
|
||||
ui->expoCurveCB->show();
|
||||
ui->expoCurveSB->hide();
|
||||
|
@ -210,39 +154,18 @@ void ExpoDialog::widgetChanged()
|
|||
ui->weightCB->hide();
|
||||
ui->weightSB->show();
|
||||
}
|
||||
}
|
||||
} */
|
||||
valuesChanged();
|
||||
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ExpoDialog::valuesChanged()
|
||||
{
|
||||
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
|
||||
if (ui->curvesCB->currentIndex()==0) {
|
||||
// TODO ed->curveMode = 0;
|
||||
ui->expoCurveGV->show();
|
||||
if (ui->expoCurveGV->isChecked()) {
|
||||
ui->expoCurveCB->show();
|
||||
ui->expoCurveSB->hide();
|
||||
// TODO ed->curveParam = ui->expoCurveCB->itemData(ui->expoCurveCB->currentIndex()).toInt();
|
||||
}
|
||||
else {
|
||||
ui->expoCurveCB->hide();
|
||||
ui->expoCurveSB->show();
|
||||
// TODO ed->curveParam = ui->expoCurveSB->value();
|
||||
}
|
||||
// TODO ed->expo = ed->curveParam;
|
||||
}
|
||||
else {
|
||||
// TODO ed->curveMode = 1;
|
||||
// TODO ed->curveParam = ui->curvesCB->currentIndex();
|
||||
// TODO ed->expo = 0;
|
||||
ui->expoCurveCB->hide();
|
||||
ui->expoCurveSB->hide();
|
||||
ui->expoCurveGV->hide();
|
||||
}
|
||||
|
||||
retrieveCurveReference(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve, 0);
|
||||
|
||||
if (ui->weightGV->isChecked()) {
|
||||
ed->weight = ui->weightCB->itemData(ui->weightCB->currentIndex()).toInt();
|
||||
} else {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>370</width>
|
||||
<height>289</height>
|
||||
<height>291</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -26,7 +26,7 @@
|
|||
<string/>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="companion9x.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
|
@ -308,14 +308,14 @@ If blank then the expo is considered to be "ON" all the time.</string>
|
|||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_curves">
|
||||
<property name="text">
|
||||
<string>Curve/Exponential</string>
|
||||
<string>Curve</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0,0,1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0,1,0">
|
||||
<item>
|
||||
<widget class="QComboBox" name="curvesCB">
|
||||
<widget class="QComboBox" name="curveTypeCB">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
|
@ -325,22 +325,22 @@ If blank then the expo is considered to be "ON" all the time.</string>
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="expoCurveGV">
|
||||
<widget class="QCheckBox" name="curveGVarCB">
|
||||
<property name="text">
|
||||
<string>GV</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="expoCurveSB"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="expoCurveCB">
|
||||
<widget class="QComboBox" name="curveValueCB">
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="curveValueSB"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
|
|
|
@ -82,7 +82,7 @@ void InputsPanel::update()
|
|||
default: str += " "; break;
|
||||
};
|
||||
|
||||
str += tr("Weight") + getGVarString(md->weight).rightJustified(6, ' ');
|
||||
str += tr("Weight(%1)").arg(getGVarString(md->weight));
|
||||
|
||||
QString curveStr = md->curve.toString();
|
||||
if (!curveStr.isEmpty()) {
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
MixerDialog::MixerDialog(QWidget *parent, MixData *mixdata, int stickMode) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::MixerDialog),
|
||||
md(mixdata)
|
||||
md(mixdata),
|
||||
lock(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QRegExp rx(CHAR_FOR_NAMES_REGEX);
|
||||
|
@ -22,7 +23,6 @@ MixerDialog::MixerDialog(QWidget *parent, MixData *mixdata, int stickMode) :
|
|||
|
||||
ui->sourceCB->removeItem(0);
|
||||
int limit=GetEepromInterface()->getCapability(OffsetWeight);
|
||||
if (GetEepromInterface()->getCapability(GvarsAsWeight)) {
|
||||
int gvars=0;
|
||||
if (GetEepromInterface()->getCapability(HasVariants)) {
|
||||
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
|
||||
|
@ -69,17 +69,6 @@ MixerDialog::MixerDialog(QWidget *parent, MixData *mixdata, int stickMode) :
|
|||
ui->offsetSB->show();
|
||||
ui->offsetCB->hide();
|
||||
}
|
||||
}
|
||||
else {
|
||||
ui->offsetGV->hide();
|
||||
ui->weightGV->hide();
|
||||
ui->offsetSB->setMinimum(-limit);
|
||||
ui->offsetSB->setMaximum(limit);
|
||||
ui->offsetSB->setValue(md->sOffset);
|
||||
ui->weightSB->setMinimum(-limit);
|
||||
ui->weightSB->setMaximum(limit);
|
||||
ui->weightSB->setValue(md->weight);
|
||||
}
|
||||
|
||||
populateCurveReference(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, md->curve, 0);
|
||||
|
||||
|
@ -197,38 +186,43 @@ void MixerDialog::changeEvent(QEvent *e)
|
|||
|
||||
void MixerDialog::widgetChanged()
|
||||
{
|
||||
if (GetEepromInterface()->getCapability(GvarsAsWeight)) {
|
||||
int gvars = 0;
|
||||
if (GetEepromInterface()->getCapability(HasVariants)) {
|
||||
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
|
||||
gvars = 1;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
gvars = 1;
|
||||
}
|
||||
|
||||
if (gvars == 1) {
|
||||
if (ui->weightGV->isChecked()) {
|
||||
ui->weightCB->show();
|
||||
ui->weightSB->hide();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->weightCB->hide();
|
||||
ui->weightSB->show();
|
||||
}
|
||||
if (ui->offsetGV->isChecked()) {
|
||||
ui->offsetCB->show();
|
||||
ui->offsetSB->hide();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->offsetCB->hide();
|
||||
ui->offsetSB->show();
|
||||
}
|
||||
}
|
||||
|
||||
valuesChanged();
|
||||
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||
}
|
||||
}
|
||||
|
||||
void MixerDialog::valuesChanged()
|
||||
{
|
||||
if (!lock) {
|
||||
lock = true;
|
||||
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
|
||||
md->srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt());
|
||||
if ((ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt()-65536)<4) {
|
||||
|
@ -256,13 +250,7 @@ void MixerDialog::valuesChanged()
|
|||
md->carryTrim = -(ui->trimCB->currentIndex()-1);
|
||||
md->noExpo = ui->MixDR_CB->checkState() ? 0 : 1;
|
||||
|
||||
// TODO md->curve = ui->curvesCB->currentIndex()-(numcurves)*GetEepromInterface()->getCapability(HasNegCurves);
|
||||
// TODO if (ui->differentialGV->isChecked()) {
|
||||
// TODO md->differential = ui->differentialCB->itemData(ui->differentialCB->currentIndex()).toInt();
|
||||
// TODO } else {
|
||||
// TODO md->differential = ui->differentialSB->value();
|
||||
// TODO }
|
||||
// populateCurveReference(QComboBox *curveTypeCB, QCheckBox *curveGVarCB, QComboBox *curveValueCB, QSpinBox *curveValueCB, CurveReference & curve, unsigned int flags)
|
||||
retrieveCurveReference(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, md->curve, 0);
|
||||
|
||||
md->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
|
||||
md->mixWarn = ui->warningCB->currentIndex();
|
||||
|
@ -286,6 +274,9 @@ void MixerDialog::valuesChanged()
|
|||
md->phases<<=1;
|
||||
}
|
||||
md->phases>>=1;
|
||||
|
||||
lock = false;
|
||||
}
|
||||
}
|
||||
|
||||
void MixerDialog::shrink() {
|
||||
|
|
|
@ -26,6 +26,7 @@ private slots:
|
|||
private:
|
||||
Ui::MixerDialog *ui;
|
||||
MixData *md;
|
||||
bool lock;
|
||||
};
|
||||
|
||||
#endif // MIXERDIALOG_H
|
||||
|
|
|
@ -104,8 +104,9 @@ void MixesPanel::update()
|
|||
default: str += " "; break;
|
||||
};
|
||||
|
||||
str += " " + getGVarString(md->weight, true).rightJustified(6, ' ');
|
||||
str += md->srcRaw.toString();
|
||||
str += " " + tr("Weight(%1)").arg(getGVarString(md->weight, true));
|
||||
|
||||
unsigned int fpCount = GetEepromInterface()->getCapability(FlightPhases);
|
||||
if (GetEepromInterface()->getCapability(FlightPhases)) {
|
||||
if(md->phases) {
|
||||
|
@ -149,16 +150,10 @@ void MixesPanel::update()
|
|||
} else if (md->carryTrim<0) {
|
||||
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString();
|
||||
}
|
||||
if(md->noExpo) {
|
||||
str += " " +tr("No DR/Expo");
|
||||
}
|
||||
|
||||
if (md->sOffset) str += " " + tr("Offset") + getGVarString(md->sOffset);
|
||||
|
||||
QString curveStr = md->curve.toString();
|
||||
if (!curveStr.isEmpty()) {
|
||||
str += " " + curveStr;
|
||||
}
|
||||
if (md->noExpo) str += " " + tr("No DR/Expo");
|
||||
if (md->sOffset) str += " " + tr("Offset(%1)").arg(getGVarString(md->sOffset));
|
||||
if (md->curve.value) str += " " + md->curve.toString();
|
||||
|
||||
int scale=GetEepromInterface()->getCapability(SlowScale);
|
||||
if (scale==0)
|
||||
|
|
|
@ -101,11 +101,14 @@ ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module
|
|||
moduleIdx(moduleIdx),
|
||||
ui(new Ui::Module)
|
||||
{
|
||||
lock = true;
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
QString label;
|
||||
if (moduleIdx < 0) {
|
||||
label = tr("Trainer Module");
|
||||
ui->trainerMode->setCurrentIndex(model.trainerMode);
|
||||
}
|
||||
else {
|
||||
ui->label_trainerMode->hide();
|
||||
|
@ -122,6 +125,7 @@ ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module
|
|||
for (int i=0; i<PROTO_LAST; i++) {
|
||||
if (GetEepromInterface()->isAvailable((Protocol)i, moduleIdx)) {
|
||||
ui->protocol->addItem(getProtocolStr(i), (QVariant)i);
|
||||
if (i == module.protocol) ui->protocol->setCurrentIndex(ui->protocol->count()-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,6 +147,8 @@ ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module
|
|||
connect(slider, SIGNAL(valueChanged(int)), this, SLOT(onFailsafeChannelChanged(int)));
|
||||
}
|
||||
}
|
||||
|
||||
lock = false;
|
||||
}
|
||||
|
||||
ModulePanel::~ModulePanel()
|
||||
|
@ -150,17 +156,20 @@ ModulePanel::~ModulePanel()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
#define MASK_CHANNELS_COUNT 1
|
||||
#define MASK_RX_NUMBER 2
|
||||
#define MASK_CHANNELS_RANGE 4
|
||||
#define MASK_PPM_FIELDS 8
|
||||
#define MASK_FAILSAFES 16
|
||||
#define MASK_PROTOCOL 1
|
||||
#define MASK_CHANNELS_COUNT 2
|
||||
#define MASK_RX_NUMBER 4
|
||||
#define MASK_CHANNELS_RANGE 8
|
||||
#define MASK_PPM_FIELDS 16
|
||||
#define MASK_FAILSAFES 32
|
||||
|
||||
void ModulePanel::update()
|
||||
{
|
||||
unsigned int mask = 0;
|
||||
Protocol protocol = (Protocol)module.protocol;
|
||||
|
||||
if (moduleIdx >= 0 || model.trainerMode != 0) {
|
||||
mask |= MASK_PROTOCOL;
|
||||
switch (protocol) {
|
||||
case OFF:
|
||||
break;
|
||||
|
@ -181,7 +190,12 @@ void ModulePanel::update()
|
|||
mask |= MASK_PPM_FIELDS | MASK_CHANNELS_RANGE| MASK_CHANNELS_COUNT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ui->label_protocol->setVisible(mask & MASK_PROTOCOL);
|
||||
ui->protocol->setVisible(mask & MASK_PROTOCOL);
|
||||
ui->label_rxNumber->setVisible(mask & MASK_PROTOCOL);
|
||||
ui->rxNumber->setVisible(mask & MASK_PROTOCOL);
|
||||
ui->rxNumber->setEnabled(mask & MASK_RX_NUMBER);
|
||||
ui->rxNumber->setValue(model.modelId);
|
||||
ui->label_channelsStart->setVisible(mask & MASK_CHANNELS_RANGE);
|
||||
|
@ -220,6 +234,15 @@ void ModulePanel::update()
|
|||
}
|
||||
}
|
||||
|
||||
void ModulePanel::on_trainerMode_currentIndexChanged(int index)
|
||||
{
|
||||
if (!lock) {
|
||||
model.trainerMode = index;
|
||||
update();
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void ModulePanel::on_protocol_currentIndexChanged(int index)
|
||||
{
|
||||
if (!lock) {
|
||||
|
@ -302,6 +325,8 @@ Setup::Setup(QWidget *parent, ModelData & model):
|
|||
ModelPanel(parent, model),
|
||||
ui(new Ui::Setup)
|
||||
{
|
||||
lock = true;
|
||||
|
||||
memset(modules, 0, sizeof(modules));
|
||||
|
||||
ui->setupUi(this);
|
||||
|
@ -325,13 +350,7 @@ Setup::Setup(QWidget *parent, ModelData & model):
|
|||
ui->modulesLayout->addWidget(modules[C9X_NUM_MODULES]);
|
||||
}
|
||||
|
||||
if (!GetEepromInterface()->getCapability(ModelImage)) {
|
||||
ui->image->hide();
|
||||
ui->modelImage_label->hide();
|
||||
ui->imagePreview->hide();
|
||||
}
|
||||
else {
|
||||
|
||||
if (GetEepromInterface()->getCapability(ModelImage)) {
|
||||
QStringList items;
|
||||
items.append("");
|
||||
QSettings settings("companion9x", "companion9x");
|
||||
|
@ -354,7 +373,6 @@ Setup::Setup(QWidget *parent, ModelData & model):
|
|||
items.append(model.bitmap);
|
||||
}
|
||||
items.sort();
|
||||
ui->image->clear();
|
||||
foreach ( QString file, items ) {
|
||||
ui->image->addItem(file);
|
||||
if (file == model.bitmap) {
|
||||
|
@ -375,6 +393,11 @@ Setup::Setup(QWidget *parent, ModelData & model):
|
|||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
ui->image->hide();
|
||||
ui->modelImage_label->hide();
|
||||
ui->imagePreview->hide();
|
||||
}
|
||||
|
||||
// Beep Center checkboxes
|
||||
int analogs = 4 + GetEepromInterface()->getCapability(Pots);
|
||||
|
|
|
@ -46,6 +46,7 @@ class ModulePanel : public ModelPanel
|
|||
virtual void update();
|
||||
|
||||
private slots:
|
||||
void on_trainerMode_currentIndexChanged(int index);
|
||||
void on_protocol_currentIndexChanged(int index);
|
||||
void on_ppmDelay_editingFinished();
|
||||
void on_channelsCount_editingFinished();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue