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