* Fix issue #4961

Fix yet another reference to HORUS_OR_TARANIS that should be IS_ARM
Also rename C9X function to export/import to be inline with the rest

* Another two IS_ARM/HORUS_TARANIS mixups

* Fix condition

* Simplify/fix two if statements

* Really fix if statement
This commit is contained in:
Arne Schwabe
2017-08-12 00:26:28 +02:00
committed by Bertrand Songis
parent b3e9d8d97d
commit 87295776ff
6 changed files with 28 additions and 32 deletions
+21 -23
View File
@@ -626,7 +626,7 @@ class SourceField: public ConversionField< UnsignedField<N> > {
};
int smallGvarToEEPROM(int gvar)
int smallGvarImport(int gvar)
{
if (gvar < -10000) {
gvar = 128 + gvar + 10000;
@@ -637,7 +637,7 @@ int smallGvarToEEPROM(int gvar)
return gvar;
}
int smallGvarToC9x(int gvar)
int smallGvarExport(int gvar)
{
if (gvar > 110) {
gvar = gvar - 128 - 10000;
@@ -764,7 +764,7 @@ class CurveReferenceField: public TransformedField {
{
if (curve.value != 0) {
_curve_type = (unsigned int)curve.type;
_curve_value = smallGvarToEEPROM(curve.value);
_curve_value = smallGvarImport(curve.value);
}
else {
_curve_type = 0;
@@ -775,7 +775,7 @@ class CurveReferenceField: public TransformedField {
virtual void afterImport()
{
curve.type = (CurveReference::CurveRefType)_curve_type;
curve.value = smallGvarToC9x(_curve_value);
curve.value = smallGvarExport(_curve_value);
qCDebug(eepromImport) << QString("imported CurveReference(%1)").arg(curve.toString());
}
@@ -1006,7 +1006,7 @@ class MixField: public TransformedField {
else
internalField.Append(new ZCharField<6>(this, mix.name));
}
else if (IS_TARANIS(board) && version >= 217) {
else if (IS_TARANIS(board) && version == 217) {
internalField.Append(new UnsignedField<8>(this, _destCh));
internalField.Append(new UnsignedField<9>(this, mix.flightModes));
internalField.Append(new UnsignedField<2>(this, (unsigned int &)mix.mltpx));
@@ -1023,7 +1023,7 @@ class MixField: public TransformedField {
internalField.Append(new UnsignedField<8>(this, mix.speedDown));
internalField.Append(new ZCharField<8>(this, mix.name));
}
else if (IS_ARM(board) && version >= 217) {
else if (IS_ARM(board) && version == 217) {
internalField.Append(new UnsignedField<5>(this, _destCh));
internalField.Append(new UnsignedField<3>(this, mix.mixWarn));
internalField.Append(new UnsignedField<9>(this, mix.flightModes));
@@ -1182,7 +1182,7 @@ class MixField: public TransformedField {
}
else if (mix.curve.type == CurveReference::CURVE_REF_DIFF) {
_curveMode = 0;
_curveParam = smallGvarToEEPROM(mix.curve.value);
_curveParam = smallGvarImport(mix.curve.value);
}
}
else {
@@ -1219,7 +1219,7 @@ class MixField: public TransformedField {
mix.destCh = _destCh + 1;
if (!IS_ARM(board) || (!IS_STM32(board) && version < 218) || version < 216) {
if (!_curveMode)
mix.curve = CurveReference(CurveReference::CURVE_REF_DIFF, smallGvarToC9x(_curveParam));
mix.curve = CurveReference(CurveReference::CURVE_REF_DIFF, smallGvarExport(_curveParam));
else if (_curveParam > 6)
mix.curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, _curveParam-6);
else if (_curveParam < 0)
@@ -1379,13 +1379,13 @@ class InputField: public TransformedField {
virtual void beforeExport()
{
_weight = smallGvarToEEPROM(expo.weight);
_weight = smallGvarImport(expo.weight);
if (IS_HORUS_OR_TARANIS(board) && version >= 216) {
_offset = smallGvarToEEPROM(expo.offset);
if ((IS_HORUS_OR_TARANIS(board) && version >= 216) || (IS_ARM(board) && version >= 218)) {
_offset = smallGvarImport(expo.offset);
}
if (!IS_TARANIS(board) || version < 216) {
if (!IS_ARM(board) || (!IS_TARANIS(board) && version < 218) || version < 216) {
if (expo.curve.type==CurveReference::CURVE_REF_FUNC && expo.curve.value) {
_curveMode = true;
_curveParam = expo.curve.value;
@@ -1396,33 +1396,31 @@ class InputField: public TransformedField {
}
else {
_curveMode = false;
_curveParam = smallGvarToEEPROM(expo.curve.value);
_curveParam = smallGvarImport(expo.curve.value);
}
}
}
virtual void afterImport()
{
if (IS_STM32(board)) {
if (version < 216) {
if (expo.mode) {
expo.srcRaw = RawSource(SOURCE_TYPE_STICK, expo.chn);
}
if (IS_STM32(board) && version < 216) {
if (expo.mode) {
expo.srcRaw = RawSource(SOURCE_TYPE_STICK, expo.chn);
}
}
else if (expo.mode) {
expo.srcRaw = RawSource(SOURCE_TYPE_STICK, expo.chn);
}
expo.weight = smallGvarToC9x(_weight);
expo.weight = smallGvarExport(_weight);
if (IS_STM32(board) && version >= 216) {
expo.offset = smallGvarToC9x(_offset);
if ((IS_STM32(board) && version >= 216) || (IS_ARM(board) && version >= 218)) {
expo.offset = smallGvarExport(_offset);
}
if (!IS_ARM(board) || (!IS_STM32(board) && version < 218) || version < 216) {
if (!IS_ARM(board) || (!IS_TARANIS(board) && version < 218) || version < 216) {
if (!_curveMode)
expo.curve = CurveReference(CurveReference::CURVE_REF_EXPO, smallGvarToC9x(_curveParam));
expo.curve = CurveReference(CurveReference::CURVE_REF_EXPO, smallGvarExport(_curveParam));
else if (_curveParam > 6)
expo.curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, _curveParam-6);
else
@@ -561,7 +561,7 @@ int OpenTxFirmware::getCapability(::Capability capability)
case ChannelsName:
return (IS_ARM(board) ? (HAS_LARGE_LCD(board) ? 6 : 4) : 0);
case HasCvNames:
return (IS_HORUS_OR_TARANIS(board) ? 1 : 0);
return (IS_ARM(board) ? 1 : 0);
case Telemetry:
if (IS_2560(board) || IS_ARM(board) || id.contains("frsky") || id.contains("telemetrez"))
return TM_HASTELEMETRY | TM_HASOFFSET | TM_HASWSHH;
+1 -1
View File
@@ -46,7 +46,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
setWindowTitle(tr("Edit %1").arg(RawSource(srcType, ed->chn).toString(&model, &generalSettings)));
QRegExp rx(CHAR_FOR_NAMES_REGEX);
if (IS_HORUS_OR_TARANIS(getCurrentBoard())) {
if (IS_ARM(getCurrentBoard())) {
gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, ed->weight, model, 100, -100, 100);
gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, ed->offset, model, 0, -100, 100);
}
+3 -3
View File
@@ -571,9 +571,9 @@ QString MultiModelPrinter::printTelemetry()
MultiColumns columns(modelPrinterMap.size());
columns.append("<table border='0' cellspacing='0' cellpadding='1' width='100%'>");
for (int i=0; i<2; i++) {
columns.append("<tr><td><b>" + QString(i == 0 ? tr("RSSI Alarms") : "") + "</b></td><td>");
if (IS_HORUS_OR_TARANIS(getCurrentBoard())) {
COMPARE(i == 0 ? tr("Low Alarm") : tr("Critical Alarm"));
columns.append("<tr><td><b>" + QString(i==0 ? tr("RSSI Alarms") : "") + "</b></td><td>");
if (IS_ARM(getCurrentBoard())) {
COMPARE(i==0 ? tr("Low Alarm") : tr("Critical Alarm"));
}
else {
COMPARE(getFrSkyAlarmType(model->rssiAlarms.level[i]));
+2 -2
View File
@@ -61,7 +61,7 @@ void WizMix::maxMixSwitch(char *name, MixData &mix, int channel, int sw, int wei
void WizMix::addMix(ModelData &model, Input input, int weight, int channel, int & mixIndex)
{
if (input != NO_INPUT) {
bool isHorusOrTaranis = IS_HORUS_OR_TARANIS(getCurrentBoard());
bool isHorusOrTaranis = IS_ARM(getCurrentBoard());
if (input >= RUDDER_INPUT && input <= AILERONS_INPUT) {
MixData & mix = model.mixData[mixIndex++];
mix.destCh = channel+1;
@@ -119,7 +119,7 @@ WizMix::operator ModelData()
// Add the Throttle Cut option
if( options[THROTTLE_CUT_OPTION] && throttleChannel >=0 ){
model.customFn[switchIndex].swtch.type = SWITCH_TYPE_SWITCH;
model.customFn[switchIndex].swtch.index = IS_HORUS_OR_TARANIS(getCurrentBoard()) ? SWITCH_SF0 : SWITCH_THR;
model.customFn[switchIndex].swtch.index = IS_ARM(getCurrentBoard()) ? SWITCH_SF0 : SWITCH_THR;
model.customFn[switchIndex].enabled = 1;
model.customFn[switchIndex].func = (AssignFunc)throttleChannel;
model.customFn[switchIndex].param = -100;
-2
View File
@@ -1067,8 +1067,6 @@ static inline void check_struct()
#endif
/* Difference between Taranis/Horus is LEN_EXPOMIX_NAME */
/* Sky9x does not have virtualinputs */
/* LEN_FUNCTION_NAME is the difference in CustomFunctionData */
#if defined(PCBX7)