[Companion] Horus support started
We only have the model name of the 1st model, but that's a good start ;)
This commit is contained in:
@@ -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},
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -387,19 +387,23 @@ bool MdiChild::loadOtxFile(const QString &fileName, bool resetCurrentFile)
|
||||
// info about all models
|
||||
QList<QString> models = storage.getModelsFileNames();
|
||||
qDebug() << "We have" << models.size() << "models:";
|
||||
#if 0
|
||||
foreach(QString filename, models) {
|
||||
QList<ModelFile>::const_iterator i = storage.getModelIterator(filename);
|
||||
if (i != storage.models.end()) {
|
||||
qDebug() << "\tModel:" << i->filename << "size" << i->data.size();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
for (QList<ModelFile>::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;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user