diff --git a/companion/src/eepromimportexport.h b/companion/src/eepromimportexport.h index 0d7ea49ece..6be4826e72 100644 --- a/companion/src/eepromimportexport.h +++ b/companion/src/eepromimportexport.h @@ -648,7 +648,7 @@ class ConversionField: public TransformedField { if (table->exportValue(_field, _field)) return; if (!error.isEmpty()) - EEPROMWarnings += error + "\n"; + EEPROMWarnings.push_back(error); } if (shift) { diff --git a/companion/src/eeprominterface.cpp b/companion/src/eeprominterface.cpp index 4cf29b34f0..b8798ef8be 100644 --- a/companion/src/eeprominterface.cpp +++ b/companion/src/eeprominterface.cpp @@ -12,7 +12,7 @@ #include "helpers.h" #include "wizarddata.h" -QString EEPROMWarnings; +std::list EEPROMWarnings; const char * switches9X[] = { "3POS", "THR", "RUD", "ELE", "AIL", "GEA", "TRN" }; const char * switchesX9D[] = { "SA", "SB", "SC", "SD", "SE", "SF", "SG", "SH" }; diff --git a/companion/src/eeprominterface.h b/companion/src/eeprominterface.h index 277fca225b..fd08c8df71 100644 --- a/companion/src/eeprominterface.h +++ b/companion/src/eeprominterface.h @@ -1198,7 +1198,7 @@ class EEPROMInterface }; -extern QString EEPROMWarnings; +extern std::list EEPROMWarnings; /* EEPROM string conversion functions */ void setEEPROMString(char *dst, const char *src, int size); diff --git a/companion/src/firmwares/opentx/open9xSky9xeeprom.cpp b/companion/src/firmwares/opentx/open9xSky9xeeprom.cpp index a7002e53c1..249c2b6cea 100644 --- a/companion/src/firmwares/opentx/open9xSky9xeeprom.cpp +++ b/companion/src/firmwares/opentx/open9xSky9xeeprom.cpp @@ -149,7 +149,7 @@ t_Open9xArmExpoData_v208::operator ExpoData () c9x.chn = chn; if (expo!=0 && curve!=0) { - EEPROMWarnings += ::QObject::tr("Simultaneous usage of expo and curves is no longer supported") + "\n"; + EEPROMWarnings.push_back(::QObject::tr("Simultaneous usage of expo and curves is no longer supported")); } else { if (curve == 0) { @@ -179,7 +179,7 @@ t_Open9xArmExpoData_v210::operator ExpoData () c9x.chn = chn; if (expo!=0 && curve!=0) { - EEPROMWarnings += ::QObject::tr("Simultaneous usage of expo and curves is no longer supported") + "\n"; + EEPROMWarnings.push_back(::QObject::tr("Simultaneous usage of expo and curves is no longer supported")); } else { if (curve == 0) { diff --git a/companion/src/firmwares/opentx/open9xStockeeprom.cpp b/companion/src/firmwares/opentx/open9xStockeeprom.cpp index 898743af12..0f26c96a6d 100644 --- a/companion/src/firmwares/opentx/open9xStockeeprom.cpp +++ b/companion/src/firmwares/opentx/open9xStockeeprom.cpp @@ -89,7 +89,7 @@ t_Open9xExpoData_v201::operator ExpoData () c9x.mode = mode; c9x.chn = chn; if (expo!=0 && curve!=0) { - EEPROMWarnings += ::QObject::tr("Simultaneous usage of expo and curves is no longer supported in OpenTX") + "\n"; + EEPROMWarnings.push_back(::QObject::tr("Simultaneous usage of expo and curves is no longer supported in OpenTX")); } else { if (curve == 0) { diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index abcf537215..cad02a119b 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -370,7 +370,8 @@ template class SwitchField: public ConversionField< SignedField > { public: SwitchField(RawSwitch & sw, BoardEnum board, unsigned int version, unsigned long flags=0): - ConversionField< SignedField >(_switch, SwitchesConversionTable::getInstance(board, version, flags), "Switch"), + ConversionField< SignedField >(_switch, SwitchesConversionTable::getInstance(board, version, flags), "Switch", + "Switch "+ sw.toString()+" cannot be exported on this board!"), sw(sw), _switch(0) { @@ -1257,14 +1258,14 @@ class CurvesField: public TransformedField { if (IS_TARANIS(board) && version >= 216) { offset += (curve->type == CurveData::CURVE_TYPE_CUSTOM ? curve->count * 2 - 2 : curve->count); if (offset > maxPoints) { - EEPROMWarnings += ::QObject::tr("OpenTX only accepts %1 points in all curves").arg(maxPoints) + "\n"; + EEPROMWarnings.push_back(::QObject::tr("OpenTX only accepts %1 points in all curves").arg(maxPoints)); break; } } else { offset += (curve->type == CurveData::CURVE_TYPE_CUSTOM ? curve->count * 2 - 2 : curve->count) - 5; if (offset > maxPoints - 5 * maxCurves) { - EEPROMWarnings += ::QObject::tr("OpenTx only accepts %1 points in all curves").arg(maxPoints) + "\n"; + EEPROMWarnings.push_back(::QObject::tr("OpenTx only accepts %1 points in all curves").arg(maxPoints)); break; } _curves[i] = offset; @@ -2430,7 +2431,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne if (IS_ARM(board)) internalField.Append(new UnsignedField<3>(modelData.telemetryProtocol)); else - internalField.Append(new ConversionField< UnsignedField<3> >((unsigned int &)modelData.moduleData[0].protocol, &protocolsConversionTable, "Protocol", ::QObject::tr("OpenTX doesn't accept this protocol"))); + internalField.Append(new ConversionField< UnsignedField<3> >((unsigned int &)modelData.moduleData[0].protocol, &protocolsConversionTable, "Protocol", ::QObject::tr("OpenTX doesn't accept this telemetry protocol"))); internalField.Append(new BoolField<1>(modelData.thrTrim)); @@ -2534,12 +2535,12 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne if (IS_TARANIS(board)) { modulesCount = 3; - internalField.Append(new ConversionField< SignedField<8> >(modelData.moduleData[1].protocol, &protocolsConversionTable, "Protocol", ::QObject::tr("OpenTX doesn't accept this protocol"))); + internalField.Append(new ConversionField< SignedField<8> >(modelData.moduleData[1].protocol, &protocolsConversionTable, "Protocol", ::QObject::tr("OpenTX doesn't accept this rado protocol"))); internalField.Append(new UnsignedField<8>(modelData.trainerMode)); } else if (IS_ARM(board) && version >= 216) { modulesCount = 3; - internalField.Append(new ConversionField< SignedField<8> >(modelData.moduleData[0].protocol, &protocolsConversionTable, "Protocol", ::QObject::tr("OpenTX doesn't accept this protocol"))); + internalField.Append(new ConversionField< SignedField<8> >(modelData.moduleData[0].protocol, &protocolsConversionTable, "Protocol", ::QObject::tr("OpenTX doesn't accept this radio protocol"))); } if (IS_ARM(board) && version >= 215) { diff --git a/companion/src/firmwares/opentx/opentxinterface.cpp b/companion/src/firmwares/opentx/opentxinterface.cpp index 707b1030a8..ff1fe846de 100644 --- a/companion/src/firmwares/opentx/opentxinterface.cpp +++ b/companion/src/firmwares/opentx/opentxinterface.cpp @@ -402,10 +402,21 @@ int OpenTxEepromInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t } } - if (!EEPROMWarnings.isEmpty()) + if (!EEPROMWarnings.empty()) { + QString msg; + int noErrorsToDisplay = std::min((int)EEPROMWarnings.size(),10); + for (int n = 0; n < noErrorsToDisplay; n++) { + msg += "-" + EEPROMWarnings.front() + "\n"; + EEPROMWarnings.pop_front(); + } + if (!EEPROMWarnings.empty()) { + msg = QObject::tr("(displaying only first 10 warnings)") + "\n" + msg; + } + EEPROMWarnings.clear(); QMessageBox::warning(NULL, QObject::tr("Warning"), - QObject::tr("EEPROM saved with these warnings:") + "\n- " + EEPROMWarnings.remove(EEPROMWarnings.length()-1, 1).replace("\n", "\n- ")); + QObject::tr("EEPROM saved with these warnings:") + "\n" + msg); + } return size; } diff --git a/companion/src/firmwares/th9x/th9xeeprom.cpp b/companion/src/firmwares/th9x/th9xeeprom.cpp index fa8947a91a..144c8bf4e8 100644 --- a/companion/src/firmwares/th9x/th9xeeprom.cpp +++ b/companion/src/firmwares/th9x/th9xeeprom.cpp @@ -197,7 +197,7 @@ int8_t t_Th9xLogicalSwitchData::fromSource(RawSource source) if (source.type == SOURCE_TYPE_STICK) v1 = 1+source.index; else if (source.type == SOURCE_TYPE_ROTARY_ENCODER) { - EEPROMWarnings += ::QObject::tr("th9x on this board doesn't have Rotary Encoders") + "\n"; + EEPROMWarnings.push_back(::QObject::tr("th9x on this board doesn't have Rotary Encoders")); v1 = 5+source.index; } else if (source.type == SOURCE_TYPE_MAX)