Better fix for model backups import

This commit is contained in:
bsongis
2014-07-16 19:07:09 +02:00
parent 5da1e35efe
commit 7373ce2cae
4 changed files with 46 additions and 65 deletions
@@ -163,12 +163,13 @@ bool OpenTxEepromInterface::loadModelVariant(unsigned int index, ModelData &mode
}
else {
// load from SD Backup, size is stored in index
QByteArray eepromData((char *)data, index);
QByteArray modelData(sizeof(model), 0); // ModelData should be always bigger than the EEPROM struct
// memcpy(eepromData.data(), data, index);
// efile->openRd(FILE_MODEL(0));
int numbytes = efile->importRlc2(modelData, eepromData);
if (numbytes) {
QByteArray backupData((char *)data, index);
QByteArray modelData;
if (IS_SKY9X(board))
modelData = backupData;
else
importRlc(modelData, backupData);
if (modelData.size()) {
open9xModel.Import(modelData);
// open9xModel.Dump();
model.used = true;
@@ -176,8 +177,6 @@ bool OpenTxEepromInterface::loadModelVariant(unsigned int index, ModelData &mode
else {
model.clear();
}
// open9xModel.Import(eepromData);
// model.used = true;
}
return true;