diff --git a/companion/src/eeprominterface.h b/companion/src/eeprominterface.h index f91085ce0..0f9552bdf 100644 --- a/companion/src/eeprominterface.h +++ b/companion/src/eeprominterface.h @@ -58,7 +58,7 @@ #define IS_FLAMENCO(board) (board==BOARD_FLAMENCO) #define IS_STM32(board) (IS_TARANIS(board) || IS_HORUS(board) || IS_FLAMENCO(board)) #define IS_ARM(board) (IS_STM32(board) || IS_SKY9X(board)) -#define HAS_LARGE_LCD(board) (IS_TARANIS(board) && board != BOARD_X7D) +#define HAS_LARGE_LCD(board) (IS_HORUS(board) || (IS_TARANIS(board) && board != BOARD_X7D)) const uint8_t modn12x3[4][4]= { {1, 2, 3, 4}, diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index ae1e992bb..e1b0ec835 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -779,7 +779,7 @@ class FlightModeField: public TransformedField { public: FlightModeField(FlightModeData & phase, int index, BoardEnum board, unsigned int version): TransformedField(internalField), - internalField("Phase"), + internalField("FlightMode"), phase(phase), index(index), board(board), @@ -2986,7 +2986,9 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne eepromImportDebug() << QString("OpenTxModelData::OpenTxModelData(name: %1, board: %2, ver: %3, var: %4)").arg(name).arg(board).arg(version).arg(variant); - if (HAS_LARGE_LCD(board)) + if (board == BOARD_HORUS) + internalField.Append(new ZCharField<15>(modelData.name)); + else if (HAS_LARGE_LCD(board)) internalField.Append(new ZCharField<12>(modelData.name)); else internalField.Append(new ZCharField<10>(modelData.name)); diff --git a/companion/src/firmwares/opentx/opentxinterface.cpp b/companion/src/firmwares/opentx/opentxinterface.cpp index d8adccba6..c414b8e9b 100644 --- a/companion/src/firmwares/opentx/opentxinterface.cpp +++ b/companion/src/firmwares/opentx/opentxinterface.cpp @@ -200,9 +200,12 @@ bool OpenTxEepromInterface::loadModelVariant(unsigned int index, ModelData & mod bool OpenTxEepromInterface::loadModelFromByteArray(ModelData & model, const QByteArray & data) { - OpenTxModelData modelData(model, board, 218, 0); - modelData.Import(data); - modelData.Dump(); + // TODO check the 8 first bytes (fourcc + version + 'M' + size) + QByteArray raw = data.right(data.size() - 8); + OpenTxModelData modelData(model, board, 218, 0); // TODO board and 218 should be the version taken from the header + modelData.Import(raw); + modelData.Dump(); // Dumps the structure so that it's easy to check with firmware datastructs.h + model.used = true; return true; } diff --git a/companion/src/mdichild.cpp b/companion/src/mdichild.cpp index 9fb84e2e7..fc60f8cd2 100644 --- a/companion/src/mdichild.cpp +++ b/companion/src/mdichild.cpp @@ -387,19 +387,23 @@ bool MdiChild::loadOtxFile(const QString &fileName, bool resetCurrentFile) // info about all models QList models = storage.getModelsFileNames(); qDebug() << "We have" << models.size() << "models:"; +#if 0 foreach(QString filename, models) { QList::const_iterator i = storage.getModelIterator(filename); if (i != storage.models.end()) { qDebug() << "\tModel:" << i->filename << "size" << i->data.size(); } } - +#endif + for (QList::iterator i = storage.models.begin(); i != storage.models.end(); ++i) { GetEepromInterface()->loadModelFromByteArray(radioData.models[0], i->data); } + + ui->modelsList->refreshList(); // for test immediately save to another file - storage.write(fileName + "test.otx"); + // storage.write(fileName + "test.otx"); return true; }