1
0
Fork 0
mirror of https://github.com/EdgeTX/edgetx.git synced 2025-07-24 00:35:14 +03:00

[Companion] Fixes

This commit is contained in:
Bertrand Songis 2017-01-18 15:25:27 +01:00
parent 38c7f1c7d3
commit 1924d28be3
34 changed files with 297 additions and 325 deletions

View file

@ -143,7 +143,7 @@ void AppPreferencesDialog::initSettings()
ui->backLightColor->setCurrentIndex(g.backLight()); ui->backLightColor->setCurrentIndex(g.backLight());
ui->volumeGain->setValue(g.profile[g.id()].volumeGain() / 10.0); ui->volumeGain->setValue(g.profile[g.id()].volumeGain() / 10.0);
if (IS_TARANIS(GetCurrentFirmware()->getBoard())) { if (IS_TARANIS(getCurrentBoard())) {
ui->backLightColor->setEnabled(false); ui->backLightColor->setEnabled(false);
} }
@ -230,7 +230,7 @@ void AppPreferencesDialog::initSettings()
} }
ui->lblGeneralSettings->setText(hwSettings); ui->lblGeneralSettings->setText(hwSettings);
Firmware * current_firmware = GetCurrentFirmware(); Firmware * current_firmware = getCurrentFirmware();
foreach(Firmware * firmware, firmwares) { foreach(Firmware * firmware, firmwares) {
ui->downloadVerCB->addItem(firmware->getName(), firmware->getId()); ui->downloadVerCB->addItem(firmware->getName(), firmware->getId());
@ -358,7 +358,7 @@ bool AppPreferencesDialog::displayImage(const QString & fileName)
return false; return false;
ui->imageLabel->setPixmap(makePixMap(image)); ui->imageLabel->setPixmap(makePixMap(image));
ui->imageLabel->setFixedSize(GetCurrentFirmware()->getCapability(LcdWidth), GetCurrentFirmware()->getCapability(LcdHeight)); ui->imageLabel->setFixedSize(getCurrentFirmware()->getCapability(LcdWidth), getCurrentFirmware()->getCapability(LcdHeight));
return true; return true;
} }
@ -427,7 +427,7 @@ Firmware * AppPreferencesDialog::getFirmwareVariant()
id += QString("-") + ui->langCombo->currentText(); id += QString("-") + ui->langCombo->currentText();
} }
return GetFirmware(id); return getFirmware(id);
} }
} }

View file

@ -40,8 +40,8 @@ burnConfigDialog::burnConfigDialog(QWidget *parent) :
getSettings(); getSettings();
populateProgrammers(); populateProgrammers();
EEPROMInterface *eepromInterface = GetEepromInterface(); BoardEnum board = getCurrentBoard();
if (IS_STM32(eepromInterface->getBoard())) { if (IS_STM32(board)) {
setWindowTitle(tr("DFU-UTIL Configuration")); setWindowTitle(tr("DFU-UTIL Configuration"));
ui->avrArgs->hide(); ui->avrArgs->hide();
ui->avrdude_location->hide(); ui->avrdude_location->hide();
@ -60,7 +60,7 @@ burnConfigDialog::burnConfigDialog(QWidget *parent) :
ui->samba_port->hide(); ui->samba_port->hide();
ui->sb_browse->hide(); ui->sb_browse->hide();
} }
else if (IS_SKY9X(eepromInterface->getBoard())) { else if (IS_SKY9X(board)) {
setWindowTitle(tr("SAM-BA Configuration")); setWindowTitle(tr("SAM-BA Configuration"));
ui->avrArgs->hide(); ui->avrArgs->hide();
ui->avrdude_location->hide(); ui->avrdude_location->hide();
@ -97,7 +97,7 @@ burnConfigDialog::burnConfigDialog(QWidget *parent) :
ui->dfuArgs->hide(); ui->dfuArgs->hide();
QTimer::singleShot(0, this, SLOT(shrink())); QTimer::singleShot(0, this, SLOT(shrink()));
connect(this,SIGNAL(accepted()),this,SLOT(putSettings())); connect(this, SIGNAL(accepted()), this, SLOT(putSettings()));
} }
burnConfigDialog::~burnConfigDialog() burnConfigDialog::~burnConfigDialog()
@ -328,13 +328,13 @@ void burnConfigDialog::on_pushButton_4_clicked()
void burnConfigDialog::on_advCtrChkB_toggled(bool checked) void burnConfigDialog::on_advCtrChkB_toggled(bool checked)
{ {
EEPROMInterface *eepromInterface = GetEepromInterface(); BoardEnum board = getCurrentBoard();
if (checked) { if (checked) {
if (IS_STM32(eepromInterface->getBoard())) { if (IS_STM32(board)) {
ui->label_dfu2->show(); ui->label_dfu2->show();
ui->dfuArgs->show(); ui->dfuArgs->show();
} }
else if (IS_SKY9X(eepromInterface->getBoard())) { else if (IS_SKY9X(board)) {
ui->label_sb2->show(); ui->label_sb2->show();
ui->arm_mcu->show(); ui->arm_mcu->show();
} }
@ -347,11 +347,11 @@ void burnConfigDialog::on_advCtrChkB_toggled(bool checked)
} }
} }
else { else {
if (IS_STM32(eepromInterface->getBoard())) { if (IS_STM32(board)) {
ui->label_dfu2->hide(); ui->label_dfu2->hide();
ui->dfuArgs->hide(); ui->dfuArgs->hide();
} }
else if (IS_SKY9X(eepromInterface->getBoard())) { else if (IS_SKY9X(board)) {
ui->label_sb2->hide(); ui->label_sb2->hide();
ui->arm_mcu->hide(); ui->arm_mcu->hide();
} }
@ -366,7 +366,7 @@ void burnConfigDialog::on_advCtrChkB_toggled(bool checked)
void burnConfigDialog::shrink() void burnConfigDialog::shrink()
{ {
resize(0,0); resize(0, 0);
} }

View file

@ -103,7 +103,6 @@ int main(int argc, char *argv[])
#endif #endif
registerStorageFactories(); registerStorageFactories();
registerEEpromInterfaces();
registerOpenTxFirmwares(); registerOpenTxFirmwares();
registerSimulators(); registerSimulators();
@ -118,7 +117,7 @@ int main(int argc, char *argv[])
QPixmap pixmap = QPixmap(splashScreen); QPixmap pixmap = QPixmap(splashScreen);
QSplashScreen *splash = new QSplashScreen(pixmap); QSplashScreen *splash = new QSplashScreen(pixmap);
current_firmware_variant = GetFirmware(g.profile[g.id()].fwType()); current_firmware_variant = getFirmware(g.profile[g.id()].fwType());
MainWindow *mainWin = new MainWindow(); MainWindow *mainWin = new MainWindow();
if (g.showSplash()) { if (g.showSplash()) {

View file

@ -247,7 +247,7 @@ QString SensorData::unitString() const
bool RawSource::isTimeBased() const bool RawSource::isTimeBased() const
{ {
if (IS_ARM(GetCurrentFirmware()->getBoard())) if (IS_ARM(getCurrentBoard()))
return (type == SOURCE_TYPE_SPECIAL && index > 0); return (type == SOURCE_TYPE_SPECIAL && index > 0);
else else
return (type==SOURCE_TYPE_TELEMETRY && (index==TELEMETRY_SOURCE_TX_TIME || index==TELEMETRY_SOURCE_TIMER1 || index==TELEMETRY_SOURCE_TIMER2 || index==TELEMETRY_SOURCE_TIMER3)); return (type==SOURCE_TYPE_TELEMETRY && (index==TELEMETRY_SOURCE_TX_TIME || index==TELEMETRY_SOURCE_TIMER1 || index==TELEMETRY_SOURCE_TIMER2 || index==TELEMETRY_SOURCE_TIMER3));
@ -255,7 +255,7 @@ bool RawSource::isTimeBased() const
float RawSourceRange::getValue(int value) float RawSourceRange::getValue(int value)
{ {
if (IS_ARM(GetCurrentFirmware()->getBoard())) if (IS_ARM(getCurrentBoard()))
return float(value) * step; return float(value) * step;
else else
return min + float(value) * step; return min + float(value) * step;
@ -265,7 +265,7 @@ RawSourceRange RawSource::getRange(const ModelData * model, const GeneralSetting
{ {
RawSourceRange result; RawSourceRange result;
Firmware * firmware = GetCurrentFirmware(); Firmware * firmware = getCurrentFirmware();
int board = firmware->getBoard(); int board = firmware->getBoard();
bool singleprec = (flags & RANGE_SINGLE_PRECISION); bool singleprec = (flags & RANGE_SINGLE_PRECISION);
@ -567,7 +567,7 @@ QString RawSource::toString(const ModelData * model) const
case SOURCE_TYPE_LUA_OUTPUT: case SOURCE_TYPE_LUA_OUTPUT:
return QObject::tr("LUA%1%2").arg(index/16+1).arg(QChar('a'+index%16)); return QObject::tr("LUA%1%2").arg(index/16+1).arg(QChar('a'+index%16));
case SOURCE_TYPE_STICK: case SOURCE_TYPE_STICK:
return GetCurrentFirmware()->getAnalogInputName(index); return getCurrentFirmware()->getAnalogInputName(index);
case SOURCE_TYPE_TRIM: case SOURCE_TYPE_TRIM:
return CHECK_IN_ARRAY(trims, index); return CHECK_IN_ARRAY(trims, index);
case SOURCE_TYPE_ROTARY_ENCODER: case SOURCE_TYPE_ROTARY_ENCODER:
@ -575,7 +575,7 @@ QString RawSource::toString(const ModelData * model) const
case SOURCE_TYPE_MAX: case SOURCE_TYPE_MAX:
return QObject::tr("MAX"); return QObject::tr("MAX");
case SOURCE_TYPE_SWITCH: case SOURCE_TYPE_SWITCH:
return GetCurrentFirmware()->getSwitch(index).name; return getCurrentFirmware()->getSwitch(index).name;
case SOURCE_TYPE_CUSTOM_SWITCH: case SOURCE_TYPE_CUSTOM_SWITCH:
return QObject::tr("L%1").arg(index+1); return QObject::tr("L%1").arg(index+1);
case SOURCE_TYPE_CYC: case SOURCE_TYPE_CYC:
@ -587,7 +587,7 @@ QString RawSource::toString(const ModelData * model) const
case SOURCE_TYPE_SPECIAL: case SOURCE_TYPE_SPECIAL:
return CHECK_IN_ARRAY(special, index); return CHECK_IN_ARRAY(special, index);
case SOURCE_TYPE_TELEMETRY: case SOURCE_TYPE_TELEMETRY:
if (IS_ARM(GetEepromInterface()->getBoard())) { if (IS_ARM(getCurrentBoard())) {
div_t qr = div(index, 3); div_t qr = div(index, 3);
QString result = QString(model ? model->sensorData[qr.quot].label : QString("[T%1]").arg(qr.quot+1)); QString result = QString(model ? model->sensorData[qr.quot].label : QString("[T%1]").arg(qr.quot+1));
if (qr.rem) result += qr.rem == 1 ? "-" : "+"; if (qr.rem) result += qr.rem == 1 ? "-" : "+";
@ -607,14 +607,14 @@ bool RawSource::isPot() const
{ {
return (type == SOURCE_TYPE_STICK && return (type == SOURCE_TYPE_STICK &&
index >= CPN_MAX_STICKS && index >= CPN_MAX_STICKS &&
index < CPN_MAX_STICKS+GetCurrentFirmware()->getCapability(Pots)); index < CPN_MAX_STICKS+getCurrentFirmware()->getCapability(Pots));
} }
bool RawSource::isSlider() const bool RawSource::isSlider() const
{ {
return (type == SOURCE_TYPE_STICK && return (type == SOURCE_TYPE_STICK &&
index >= CPN_MAX_STICKS+GetCurrentFirmware()->getCapability(Pots) && index >= CPN_MAX_STICKS+getCurrentFirmware()->getCapability(Pots) &&
index < CPN_MAX_STICKS+GetCurrentFirmware()->getCapability(Pots)+GetCurrentFirmware()->getCapability(Sliders)); index < CPN_MAX_STICKS+getCurrentFirmware()->getCapability(Pots)+getCurrentFirmware()->getCapability(Sliders));
} }
QString RawSwitch::toString() const QString RawSwitch::toString() const
@ -655,12 +655,12 @@ QString RawSwitch::toString() const
return QString("!") + RawSwitch(type, -index).toString(); return QString("!") + RawSwitch(type, -index).toString();
} }
else { else {
BoardEnum board = GetEepromInterface()->getBoard(); BoardEnum board = getCurrentBoard();
switch(type) { switch(type) {
case SWITCH_TYPE_SWITCH: case SWITCH_TYPE_SWITCH:
if (IS_HORUS_OR_TARANIS(board)) { if (IS_HORUS_OR_TARANIS(board)) {
div_t qr = div(index-1, 3); div_t qr = div(index-1, 3);
Firmware::Switch sw = GetCurrentFirmware()->getSwitch(qr.quot); Firmware::Switch sw = getCurrentFirmware()->getSwitch(qr.quot);
const char * positions[] = { ARROW_UP, "-", ARROW_DOWN }; const char * positions[] = { ARROW_UP, "-", ARROW_DOWN };
return QString(sw.name) + QString(positions[qr.rem]); return QString(sw.name) + QString(positions[qr.rem]);
} }
@ -791,7 +791,7 @@ QString LogicalSwitchData::funcToString() const
void CustomFunctionData::clear() void CustomFunctionData::clear()
{ {
memset(this, 0, sizeof(CustomFunctionData)); memset(this, 0, sizeof(CustomFunctionData));
if (!GetCurrentFirmware()->getCapability(SafetyChannelCustomFunction)) { if (!getCurrentFirmware()->getCapability(SafetyChannelCustomFunction)) {
func = FuncTrainer; func = FuncTrainer;
} }
} }
@ -864,8 +864,8 @@ QString CustomFunctionData::funcToString() const
void CustomFunctionData::populateResetParams(const ModelData * model, QComboBox * b, unsigned int value = 0) void CustomFunctionData::populateResetParams(const ModelData * model, QComboBox * b, unsigned int value = 0)
{ {
int val = 0; int val = 0;
Firmware * firmware = GetCurrentFirmware(); Firmware * firmware = getCurrentFirmware();
BoardEnum board = GetEepromInterface()->getBoard(); BoardEnum board = firmware->getBoard();
b->addItem(QObject::tr("Timer1"), val++); b->addItem(QObject::tr("Timer1"), val++);
b->addItem(QObject::tr("Timer2"), val++); b->addItem(QObject::tr("Timer2"), val++);
@ -946,7 +946,7 @@ QString CustomFunctionData::paramToString(const ModelData * model) const
return item.toString(model); return item.toString(model);
} }
else if ((func==FuncPlayPrompt) || (func==FuncPlayBoth)) { else if ((func==FuncPlayPrompt) || (func==FuncPlayBoth)) {
if ( GetCurrentFirmware()->getCapability(VoicesAsNumbers)) { if ( getCurrentFirmware()->getCapability(VoicesAsNumbers)) {
return QString("%1").arg(param); return QString("%1").arg(param);
} }
else { else {
@ -977,7 +977,7 @@ QString CustomFunctionData::repeatToString() const
return ""; return "";
} }
else { else {
unsigned int step = IS_ARM(GetEepromInterface()->getBoard()) ? 1 : 10; unsigned int step = IS_ARM(getCurrentBoard()) ? 1 : 10;
return QObject::tr("repeat(%1s)").arg(step*repeatParam); return QObject::tr("repeat(%1s)").arg(step*repeatParam);
} }
} }
@ -1070,13 +1070,13 @@ bool GeneralSettings::switchSourceAllowedTaranis(int index) const
bool GeneralSettings::isPotAvailable(int index) const bool GeneralSettings::isPotAvailable(int index) const
{ {
if (index<0 || index>GetCurrentFirmware()->getCapability(Pots)) return false; if (index<0 || index>getCurrentFirmware()->getCapability(Pots)) return false;
return potConfig[index] != POT_NONE; return potConfig[index] != POT_NONE;
} }
bool GeneralSettings::isSliderAvailable(int index) const bool GeneralSettings::isSliderAvailable(int index) const
{ {
if (index<0 || index>GetCurrentFirmware()->getCapability(Sliders)) return false; if (index<0 || index>getCurrentFirmware()->getCapability(Sliders)) return false;
return sliderConfig[index] != SLIDER_NONE; return sliderConfig[index] != SLIDER_NONE;
} }
@ -1093,11 +1093,13 @@ GeneralSettings::GeneralSettings()
calibSpanPos[i] = 0x180; calibSpanPos[i] = 0x180;
} }
for (int i=0; i<GetCurrentFirmware()->getCapability(FactoryInstalledSwitches); i++) { Firmware * firmware = getCurrentFirmware();
switchConfig[i] = GetCurrentFirmware()->getSwitch(i).type; BoardEnum board = firmware->getBoard();
for (int i=0; i<firmware->getCapability(FactoryInstalledSwitches); i++) {
switchConfig[i] = firmware->getSwitch(i).type;
} }
BoardEnum board = GetEepromInterface()->getBoard();
if (IS_HORUS(board)) { if (IS_HORUS(board)) {
potConfig[0] = POT_WITH_DETENT; potConfig[0] = POT_WITH_DETENT;
potConfig[1] = POT_MULTIPOS_SWITCH; potConfig[1] = POT_MULTIPOS_SWITCH;
@ -1136,7 +1138,7 @@ GeneralSettings::GeneralSettings()
stickMode = g.profile[g.id()].defaultMode(); stickMode = g.profile[g.id()].defaultMode();
QString t_calib = g.profile[g.id()].stickPotCalib(); QString t_calib = g.profile[g.id()].stickPotCalib();
int potsnum = GetCurrentFirmware()->getCapability(Pots); int potsnum = getCurrentFirmware()->getCapability(Pots);
if (!t_calib.isEmpty()) { if (!t_calib.isEmpty()) {
QString t_trainercalib=g.profile[g.id()].trainerCalib(); QString t_trainercalib=g.profile[g.id()].trainerCalib();
int8_t t_txVoltageCalibration=(int8_t)g.profile[g.id()].txVoltageCalibration(); int8_t t_txVoltageCalibration=(int8_t)g.profile[g.id()].txVoltageCalibration();
@ -1290,7 +1292,7 @@ RawSourceRange FrSkyChannelData::getRange() const
void FrSkyScreenData::clear() void FrSkyScreenData::clear()
{ {
memset(this, 0, sizeof(FrSkyScreenData)); memset(this, 0, sizeof(FrSkyScreenData));
if (!IS_ARM(GetCurrentFirmware()->getBoard())) { if (!IS_ARM(getCurrentBoard())) {
type = TELEMETRY_SCREEN_NUMBERS; type = TELEMETRY_SCREEN_NUMBERS;
} }
} }
@ -1421,7 +1423,7 @@ void ModelData::clearInputs()
expoData[i].clear(); expoData[i].clear();
//clear all input names //clear all input names
if (GetCurrentFirmware()->getCapability(VirtualInputs)) { if (getCurrentFirmware()->getCapability(VirtualInputs)) {
for (int i=0; i<CPN_MAX_INPUTS; i++) { for (int i=0; i<CPN_MAX_INPUTS; i++) {
inputNames[i][0] = 0; inputNames[i][0] = 0;
} }
@ -1436,7 +1438,7 @@ void ModelData::clearMixes()
RadioData::RadioData() RadioData::RadioData()
{ {
models.resize(GetCurrentFirmware()->getCapability(Models)); models.resize(getCurrentFirmware()->getCapability(Models));
} }
void ModelData::clear() void ModelData::clear()
@ -1448,7 +1450,7 @@ void ModelData::clear()
moduleData[0].ppm.delay = 300; moduleData[0].ppm.delay = 300;
moduleData[1].ppm.delay = 300; moduleData[1].ppm.delay = 300;
moduleData[2].ppm.delay = 300; moduleData[2].ppm.delay = 300;
int board = GetEepromInterface()->getBoard(); int board = getCurrentBoard();
if (IS_HORUS_OR_TARANIS(board)) { if (IS_HORUS_OR_TARANIS(board)) {
moduleData[0].protocol = PULSES_PXX_XJT_X16; moduleData[0].protocol = PULSES_PXX_XJT_X16;
moduleData[1].protocol = PULSES_OFF; moduleData[1].protocol = PULSES_OFF;
@ -1519,7 +1521,7 @@ QString removeAccents(const QString & str)
void ModelData::setDefaultInputs(const GeneralSettings & settings) void ModelData::setDefaultInputs(const GeneralSettings & settings)
{ {
BoardEnum board = GetEepromInterface()->getBoard(); BoardEnum board = getCurrentBoard();
if (IS_ARM(board)) { if (IS_ARM(board)) {
for (int i=0; i<CPN_MAX_STICKS; i++) { for (int i=0; i<CPN_MAX_STICKS; i++) {
ExpoData * expo = &expoData[i]; ExpoData * expo = &expoData[i];
@ -1534,7 +1536,7 @@ void ModelData::setDefaultInputs(const GeneralSettings & settings)
void ModelData::setDefaultMixes(const GeneralSettings & settings) void ModelData::setDefaultMixes(const GeneralSettings & settings)
{ {
BoardEnum board = GetEepromInterface()->getBoard(); BoardEnum board = getCurrentBoard();
if (IS_ARM(board)) { if (IS_ARM(board)) {
setDefaultInputs(settings); setDefaultInputs(settings);
} }
@ -1658,20 +1660,13 @@ ModelData ModelData::removeGlobalVars()
int ModelData::getChannelsMax(bool forceExtendedLimits) const int ModelData::getChannelsMax(bool forceExtendedLimits) const
{ {
if (forceExtendedLimits || extendedLimits) if (forceExtendedLimits || extendedLimits)
return IS_TARANIS(GetCurrentFirmware()->getBoard()) ? 150 : 125; return IS_TARANIS(getCurrentBoard()) ? 150 : 125;
else else
return 100; return 100;
} }
QList<EEPROMInterface *> eepromInterfaces; QList<EEPROMInterface *> eepromInterfaces;
void registerEEpromInterfaces()
{
registerOpenTxEEpromInterfaces();
// eepromInterfaces.push_back(new Ersky9xInterface());
// eepromInterfaces.push_back(new Er9xInterface());
}
void unregisterEEpromInterfaces() void unregisterEEpromInterfaces()
{ {
foreach(EEPROMInterface * intf, eepromInterfaces) { foreach(EEPROMInterface * intf, eepromInterfaces) {
@ -1795,7 +1790,7 @@ const int Firmware::getFlashSize()
} }
} }
Firmware * GetFirmware(const QString & id) Firmware * getFirmware(const QString & id)
{ {
foreach(Firmware * firmware, firmwares) { foreach(Firmware * firmware, firmwares) {
Firmware * result = firmware->getFirmwareVariant(id); Firmware * result = firmware->getFirmwareVariant(id);
@ -1849,17 +1844,18 @@ void Firmware::addOptions(Option options[])
this->opts.push_back(opts); this->opts.push_back(opts);
} }
SimulatorInterface *GetCurrentFirmwareSimulator() SimulatorInterface * getCurrentSimulator()
{ {
QString firmwareId = GetCurrentFirmware()->getId(); QString firmwareId = getCurrentFirmware()->getId();
SimulatorFactory *factory = getSimulatorFactory(firmwareId); SimulatorFactory * factory = getSimulatorFactory(firmwareId);
if (factory) if (factory)
return factory->create(); return factory->create();
else else
return NULL; return NULL;
} }
unsigned int getNumSubtypes(MultiModuleRFProtocols type) { unsigned int getNumSubtypes(MultiModuleRFProtocols type)
{
switch (type) { switch (type) {
case MM_RF_PROTO_HISKY: case MM_RF_PROTO_HISKY:
case MM_RF_PROTO_SYMAX: case MM_RF_PROTO_SYMAX:

View file

@ -288,42 +288,35 @@ struct Option {
class Firmware { class Firmware {
public: public:
Firmware(const QString & id, const QString & name, const BoardEnum board, EEPROMInterface * eepromInterface): Firmware(const QString & id, const QString & name, BoardEnum board):
id(id), id(id),
name(name), name(name),
board(board), board(board),
eepromInterface(eepromInterface),
variantBase(0), variantBase(0),
base(NULL) base(NULL),
eepromInterface(NULL)
{ {
} }
Firmware(Firmware * base, const QString & id, const QString & name, const BoardEnum board, EEPROMInterface * eepromInterface): Firmware(Firmware * base, const QString & id, const QString & name, BoardEnum board):
id(id), id(id),
name(name), name(name),
board(board), board(board),
eepromInterface(eepromInterface),
variantBase(0), variantBase(0),
base(base) base(base),
eepromInterface(NULL)
{ {
} }
virtual ~Firmware() virtual ~Firmware()
{ {
delete eepromInterface;
} }
inline const Firmware * getFirmwareBase() const inline const Firmware * getFirmwareBase() const
{ {
return base ? base : this; return base ? base : this;
} }
// TODO needed?
inline void setVariantBase(unsigned int variant)
{
variantBase = variant;
}
virtual Firmware * getFirmwareVariant(const QString & id) { return NULL; } virtual Firmware * getFirmwareVariant(const QString & id) { return NULL; }
unsigned int getVariantNumber(); unsigned int getVariantNumber();
@ -336,37 +329,37 @@ class Firmware {
virtual void addOptions(Option options[]); virtual void addOptions(Option options[]);
inline int saveEEPROM(uint8_t * eeprom, RadioData & radioData, uint8_t version=0, uint32_t variant=0)
{
return eepromInterface->save(eeprom, radioData, version, variant);
}
virtual QString getStampUrl() = 0; virtual QString getStampUrl() = 0;
virtual QString getReleaseNotesUrl() = 0; virtual QString getReleaseNotesUrl() = 0;
virtual QString getFirmwareUrl() = 0; virtual QString getFirmwareUrl() = 0;
inline BoardEnum getBoard() const BoardEnum getBoard() const
{ {
return board; return board;
} }
void setEEpromInterface(EEPROMInterface * interface)
{
eepromInterface = interface;
}
EEPROMInterface * getEEpromInterface()
{
return eepromInterface;
}
inline QString getName() const QString getName() const
{ {
return name; return name;
} }
inline QString getId() const QString getId() const
{ {
return id; return id;
} }
inline EEPROMInterface * getEepromInterface()
{
return eepromInterface;
}
virtual int getCapability(Capability) = 0; virtual int getCapability(Capability) = 0;
struct Switch { struct Switch {
@ -380,8 +373,6 @@ class Firmware {
virtual QTime getMaxTimerStart() = 0; virtual QTime getMaxTimerStart() = 0;
virtual bool isTelemetrySourceAvailable(int source) = 0;
virtual int isAvailable(PulsesProtocol proto, int port=0) = 0; virtual int isAvailable(PulsesProtocol proto, int port=0) = 0;
const int getFlashSize(); const int getFlashSize();
@ -395,9 +386,9 @@ class Firmware {
QString id; QString id;
QString name; QString name;
BoardEnum board; BoardEnum board;
EEPROMInterface * eepromInterface;
unsigned int variantBase; unsigned int variantBase;
Firmware * base; Firmware * base;
EEPROMInterface * eepromInterface;
private: private:
Firmware(); Firmware();
@ -408,18 +399,23 @@ extern QList<Firmware *> firmwares;
extern Firmware * default_firmware_variant; extern Firmware * default_firmware_variant;
extern Firmware * current_firmware_variant; extern Firmware * current_firmware_variant;
Firmware * GetFirmware(const QString & id); Firmware * getFirmware(const QString & id);
inline Firmware * GetCurrentFirmware() inline Firmware * getCurrentFirmware()
{ {
return current_firmware_variant; return current_firmware_variant;
} }
SimulatorInterface *getCurrentFirmwareSimulator(); SimulatorInterface * getCurrentSimulator();
inline EEPROMInterface * GetEepromInterface() inline EEPROMInterface * getCurrentEEpromInterface()
{ {
return GetCurrentFirmware()->getEepromInterface(); return getCurrentFirmware()->getEEpromInterface();
}
inline BoardEnum getCurrentBoard()
{
return getCurrentFirmware()->getBoard();
} }
inline int divRoundClosest(const int n, const int d) inline int divRoundClosest(const int n, const int d)
@ -429,8 +425,6 @@ inline int divRoundClosest(const int n, const int d)
#define CHECK_IN_ARRAY(T, index) ((unsigned int)index < (unsigned int)(sizeof(T)/sizeof(T[0])) ? T[(unsigned int)index] : "???") #define CHECK_IN_ARRAY(T, index) ((unsigned int)index < (unsigned int)(sizeof(T)/sizeof(T[0])) ? T[(unsigned int)index] : "???")
SimulatorInterface * GetCurrentFirmwareSimulator();
extern QList<EEPROMInterface *> eepromInterfaces; extern QList<EEPROMInterface *> eepromInterfaces;
bool loadFile(RadioData & radioData, const QString & filename); bool loadFile(RadioData & radioData, const QString & filename);

View file

@ -3468,7 +3468,7 @@ void OpenTxModelData::afterImport()
break; break;
} }
} }
strncpy(modelData.inputNames[i], GetCurrentFirmware()->getAnalogInputName(i).toLatin1().constData(), sizeof(modelData.inputNames[i])-1); strncpy(modelData.inputNames[i], getCurrentFirmware()->getAnalogInputName(i).toLatin1().constData(), sizeof(modelData.inputNames[i])-1);
} }
} }

View file

@ -45,9 +45,10 @@ size_t SizeOfArray(T(&)[N])
return N; return N;
} }
OpenTxEepromInterface::OpenTxEepromInterface(BoardEnum board): OpenTxEepromInterface::OpenTxEepromInterface(OpenTxFirmware * firmware):
EEPROMInterface(board), EEPROMInterface(firmware->getBoard()),
efile(new RleFile()) efile(new RleFile()),
firmware(firmware)
{ {
} }
@ -215,28 +216,6 @@ bool OpenTxEepromInterface::saveModel(unsigned int index, ModelData &model, uint
return (sz == eeprom.size()); return (sz == eeprom.size());
} }
QList<OpenTxEepromInterface *> opentxEEpromInterfaces;
void registerOpenTxEEpromInterface(BoardEnum board)
{
OpenTxEepromInterface * interface = new OpenTxEepromInterface(board);
opentxEEpromInterfaces.push_back(interface);
eepromInterfaces.push_back(interface);
}
void registerOpenTxEEpromInterfaces()
{
registerOpenTxEEpromInterface(BOARD_STOCK);
registerOpenTxEEpromInterface(BOARD_M128);
registerOpenTxEEpromInterface(BOARD_GRUVIN9X);
registerOpenTxEEpromInterface(BOARD_SKY9X);
registerOpenTxEEpromInterface(BOARD_9XRPRO);
registerOpenTxEEpromInterface(BOARD_TARANIS_X9D);
registerOpenTxEEpromInterface(BOARD_TARANIS_X9DP);
registerOpenTxEEpromInterface(BOARD_TARANIS_X9E);
registerOpenTxEEpromInterface(BOARD_TARANIS_X7);
registerOpenTxEEpromInterface(BOARD_HORUS);
}
unsigned long OpenTxEepromInterface::load(RadioData &radioData, const uint8_t * eeprom, int size) unsigned long OpenTxEepromInterface::load(RadioData &radioData, const uint8_t * eeprom, int size)
{ {
std::cout << "trying " << getName() << " import..."; std::cout << "trying " << getName() << " import...";
@ -304,10 +283,16 @@ unsigned long OpenTxEepromInterface::load(RadioData &radioData, const uint8_t *
} }
std::cout << " variant " << radioData.generalSettings.variant; std::cout << " variant " << radioData.generalSettings.variant;
for (int i = 0; i < GetCurrentFirmware()->getCapability(Models); i++) { if (getCurrentFirmware()->getCapability(Models) == 0) {
radioData.models.resize(firmware->getCapability(Models));
}
for (int i = 0; i < firmware->getCapability(Models); i++) {
if (!loadModelFromRLE(radioData.models[i], efile, i, version, radioData.generalSettings.variant)) { if (!loadModelFromRLE(radioData.models[i], efile, i, version, radioData.generalSettings.variant)) {
std::cout << " ko\n"; std::cout << " ko\n";
errors.set(UNKNOWN_ERROR); errors.set(UNKNOWN_ERROR);
if (getCurrentFirmware()->getCapability(Models) == 0) {
radioData.models.resize(i);
}
return errors.to_ulong(); return errors.to_ulong();
} }
} }
@ -358,7 +343,7 @@ int OpenTxEepromInterface::save(uint8_t * eeprom, const RadioData & radioData, u
return 0; return 0;
} }
for (int i = 0; i < GetCurrentFirmware()->getCapability(Models); i++) { for (int i = 0; i < getCurrentFirmware()->getCapability(Models); i++) {
if (!radioData.models[i].isEmpty()) { if (!radioData.models[i].isEmpty()) {
result = saveModel<OpenTxModelData>(i, (ModelData &)radioData.models[i], version, variant); result = saveModel<OpenTxModelData>(i, (ModelData &)radioData.models[i], version, variant);
if (!result) { if (!result) {
@ -397,7 +382,7 @@ int OpenTxEepromInterface::getSize(const ModelData &model)
QByteArray tmp(EESIZE_MAX, 0); QByteArray tmp(EESIZE_MAX, 0);
efile->EeFsCreate((uint8_t *) tmp.data(), EESIZE_MAX, board, 255/*version max*/); efile->EeFsCreate((uint8_t *) tmp.data(), EESIZE_MAX, board, 255/*version max*/);
OpenTxModelData open9xModel((ModelData &) model, board, 255/*version max*/, GetCurrentFirmware()->getVariantNumber()); OpenTxModelData open9xModel((ModelData &) model, board, 255/*version max*/, getCurrentFirmware()->getVariantNumber());
QByteArray eeprom; QByteArray eeprom;
open9xModel.Export(eeprom); open9xModel.Export(eeprom);
@ -416,7 +401,7 @@ int OpenTxEepromInterface::getSize(const GeneralSettings &settings)
QByteArray tmp(EESIZE_MAX, 0); QByteArray tmp(EESIZE_MAX, 0);
efile->EeFsCreate((uint8_t *) tmp.data(), EESIZE_MAX, board, 255); efile->EeFsCreate((uint8_t *) tmp.data(), EESIZE_MAX, board, 255);
OpenTxGeneralData open9xGeneral((GeneralSettings &) settings, board, 255, GetCurrentFirmware()->getVariantNumber()); OpenTxGeneralData open9xGeneral((GeneralSettings &) settings, board, 255, getCurrentFirmware()->getVariantNumber());
// open9xGeneral.Dump(); // open9xGeneral.Dump();
QByteArray eeprom; QByteArray eeprom;
@ -886,17 +871,6 @@ QTime OpenTxFirmware::getMaxTimerStart()
return QTime(0, 59, 59); return QTime(0, 59, 59);
} }
bool OpenTxFirmware::isTelemetrySourceAvailable(int source)
{
if (IS_TARANIS(board) && (source == TELEMETRY_SOURCE_RSSI_TX))
return false;
if (source == TELEMETRY_SOURCE_DTE)
return false;
return true;
}
int OpenTxFirmware::isAvailable(PulsesProtocol proto, int port) int OpenTxFirmware::isAvailable(PulsesProtocol proto, int port)
{ {
if (IS_HORUS_OR_TARANIS(board)) { if (IS_HORUS_OR_TARANIS(board)) {
@ -1269,6 +1243,17 @@ void addOpenTxLcdOptions(OpenTxFirmware * firmware)
firmware->addOptions(lcd_options); firmware->addOptions(lcd_options);
} }
QList<OpenTxEepromInterface *> opentxEEpromInterfaces;
void registerOpenTxFirmware(OpenTxFirmware * firmware)
{
OpenTxEepromInterface * eepromInterface = new OpenTxEepromInterface(firmware);
firmware->setEEpromInterface(eepromInterface);
opentxEEpromInterfaces.push_back(eepromInterface);
eepromInterfaces.push_back(eepromInterface);
firmwares.push_back(firmware);
}
void registerOpenTxFirmwares() void registerOpenTxFirmwares()
{ {
OpenTxFirmware * firmware; OpenTxFirmware * firmware;
@ -1296,31 +1281,31 @@ void registerOpenTxFirmwares()
/* FrSky Taranis X9D+ board */ /* FrSky Taranis X9D+ board */
firmware = new OpenTxFirmware("opentx-x9d+", QObject::tr("FrSky Taranis X9D+"), BOARD_TARANIS_X9DP); firmware = new OpenTxFirmware("opentx-x9d+", QObject::tr("FrSky Taranis X9D+"), BOARD_TARANIS_X9DP);
addOpenTxTaranisOptions(firmware); addOpenTxTaranisOptions(firmware);
firmwares.push_back(firmware); registerOpenTxFirmware(firmware);
/* FrSky Taranis X9D board */ /* FrSky Taranis X9D board */
firmware = new OpenTxFirmware("opentx-x9d", QObject::tr("FrSky Taranis X9D"), BOARD_TARANIS_X9D); firmware = new OpenTxFirmware("opentx-x9d", QObject::tr("FrSky Taranis X9D"), BOARD_TARANIS_X9D);
firmware->addOption("haptic", QObject::tr("Haptic module installed")); firmware->addOption("haptic", QObject::tr("Haptic module installed"));
addOpenTxTaranisOptions(firmware); addOpenTxTaranisOptions(firmware);
firmwares.push_back(firmware); registerOpenTxFirmware(firmware);
/* FrSky Taranis X9E board */ /* FrSky Taranis X9E board */
firmware = new OpenTxFirmware("opentx-x9e", QObject::tr("FrSky Taranis X9E"), BOARD_TARANIS_X9E); firmware = new OpenTxFirmware("opentx-x9e", QObject::tr("FrSky Taranis X9E"), BOARD_TARANIS_X9E);
firmware->addOption("shutdownconfirm", QObject::tr("Confirmation before radio shutdown")); firmware->addOption("shutdownconfirm", QObject::tr("Confirmation before radio shutdown"));
firmware->addOption("horussticks", QObject::tr("Horus gimbals installed (Hall sensors)")); firmware->addOption("horussticks", QObject::tr("Horus gimbals installed (Hall sensors)"));
addOpenTxTaranisOptions(firmware); addOpenTxTaranisOptions(firmware);
firmwares.push_back(firmware); registerOpenTxFirmware(firmware);
/* FrSky X7 board */ /* FrSky X7 board */
firmware = new OpenTxFirmware("opentx-x7", QObject::tr("FrSky Taranis X7"), BOARD_TARANIS_X7); firmware = new OpenTxFirmware("opentx-x7", QObject::tr("FrSky Taranis X7"), BOARD_TARANIS_X7);
addOpenTxTaranisOptions(firmware); addOpenTxTaranisOptions(firmware);
firmwares.push_back(firmware); registerOpenTxFirmware(firmware);
/* FrSky Horus board */ /* FrSky Horus board */
firmware = new OpenTxFirmware("opentx-horus", QObject::tr("FrSky Horus"), BOARD_HORUS); firmware = new OpenTxFirmware("opentx-horus", QObject::tr("FrSky Horus"), BOARD_HORUS);
addOpenTxFrskyOptions(firmware); addOpenTxFrskyOptions(firmware);
firmware->addOption("pcbdev", QObject::tr("Use ONLY with first DEV pcb version")); firmware->addOption("pcbdev", QObject::tr("Use ONLY with first DEV pcb version"));
firmwares.push_back(firmware); registerOpenTxFirmware(firmware);
/* 9XR-Pro */ /* 9XR-Pro */
firmware = new OpenTxFirmware("opentx-9xrpro", QObject::tr("Turnigy 9XR-PRO"), BOARD_9XRPRO); firmware = new OpenTxFirmware("opentx-9xrpro", QObject::tr("Turnigy 9XR-PRO"), BOARD_9XRPRO);
@ -1340,7 +1325,7 @@ void registerOpenTxFirmwares()
firmware->addOption("bluetooth", QObject::tr("Bluetooth interface")); firmware->addOption("bluetooth", QObject::tr("Bluetooth interface"));
firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font")); firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
addOpenTxCommonOptions(firmware); addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware); registerOpenTxFirmware(firmware);
/* 9XR board with M128 chip */ /* 9XR board with M128 chip */
firmware = new OpenTxFirmware("opentx-9xr128", QObject::tr("Turnigy 9XR with m128 chip"), BOARD_M128); firmware = new OpenTxFirmware("opentx-9xr128", QObject::tr("Turnigy 9XR with m128 chip"), BOARD_M128);
@ -1369,7 +1354,7 @@ void registerOpenTxFirmwares()
firmware->addOption("imperial", QObject::tr("Imperial units")); firmware->addOption("imperial", QObject::tr("Imperial units"));
firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font")); firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
addOpenTxCommonOptions(firmware); addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware); registerOpenTxFirmware(firmware);
/* 9XR board */ /* 9XR board */
firmware = new OpenTxFirmware("opentx-9xr", QObject::tr("Turnigy 9XR"), BOARD_STOCK); firmware = new OpenTxFirmware("opentx-9xr", QObject::tr("Turnigy 9XR"), BOARD_STOCK);
@ -1403,7 +1388,7 @@ void registerOpenTxFirmwares()
firmware->addOption("stickrev", QObject::tr("Add support for reversing stick inputs (e.g. needed for FrSky gimbals)")); firmware->addOption("stickrev", QObject::tr("Add support for reversing stick inputs (e.g. needed for FrSky gimbals)"));
firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font")); firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
addOpenTxCommonOptions(firmware); addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware); registerOpenTxFirmware(firmware);
/* 9x board */ /* 9x board */
firmware = new OpenTxFirmware("opentx-9x", QObject::tr("9X with stock board"), BOARD_STOCK); firmware = new OpenTxFirmware("opentx-9x", QObject::tr("9X with stock board"), BOARD_STOCK);
@ -1440,7 +1425,7 @@ void registerOpenTxFirmwares()
firmware->addOption("stickrev", QObject::tr("Add support for reversing stick inputs (e.g. needed for FrSky gimbals)")); firmware->addOption("stickrev", QObject::tr("Add support for reversing stick inputs (e.g. needed for FrSky gimbals)"));
firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font")); firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
addOpenTxCommonOptions(firmware); addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware); registerOpenTxFirmware(firmware);
/* 9x board with M128 chip */ /* 9x board with M128 chip */
firmware = new OpenTxFirmware("opentx-9x128", QObject::tr("9X with stock board and m128 chip"), BOARD_M128); firmware = new OpenTxFirmware("opentx-9x128", QObject::tr("9X with stock board and m128 chip"), BOARD_M128);
@ -1471,7 +1456,7 @@ void registerOpenTxFirmwares()
firmware->addOption("imperial", QObject::tr("Imperial units")); firmware->addOption("imperial", QObject::tr("Imperial units"));
firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font")); firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
addOpenTxCommonOptions(firmware); addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware); registerOpenTxFirmware(firmware);
/* ar9x board */ /* ar9x board */
firmware = new OpenTxFirmware("opentx-ar9x", QObject::tr("9X with AR9X board"), BOARD_AR9X); firmware = new OpenTxFirmware("opentx-ar9x", QObject::tr("9X with AR9X board"), BOARD_AR9X);
@ -1494,7 +1479,7 @@ void registerOpenTxFirmwares()
// firmware->addOption("rtc", QObject::tr("Optional RTC added")); // firmware->addOption("rtc", QObject::tr("Optional RTC added"));
// firmware->addOption("volume", QObject::tr("i2c volume control added")); // firmware->addOption("volume", QObject::tr("i2c volume control added"));
addOpenTxCommonOptions(firmware); addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware); registerOpenTxFirmware(firmware);
/* Sky9x board */ /* Sky9x board */
firmware = new OpenTxFirmware("opentx-sky9x", QObject::tr("9X with Sky9x board"), BOARD_SKY9X); firmware = new OpenTxFirmware("opentx-sky9x", QObject::tr("9X with Sky9x board"), BOARD_SKY9X);
@ -1515,7 +1500,7 @@ void registerOpenTxFirmwares()
firmware->addOption("bluetooth", QObject::tr("Bluetooth interface")); firmware->addOption("bluetooth", QObject::tr("Bluetooth interface"));
firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font")); firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
addOpenTxCommonOptions(firmware); addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware); registerOpenTxFirmware(firmware);
/* Gruvin9x board */ /* Gruvin9x board */
firmware = new OpenTxFirmware("opentx-gruvin9x", QObject::tr("9X with Gruvin9x board"), BOARD_GRUVIN9X); firmware = new OpenTxFirmware("opentx-gruvin9x", QObject::tr("9X with Gruvin9x board"), BOARD_GRUVIN9X);
@ -1541,7 +1526,7 @@ void registerOpenTxFirmwares()
firmware->addOption("imperial", QObject::tr("Imperial units")); firmware->addOption("imperial", QObject::tr("Imperial units"));
firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font")); firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
addOpenTxCommonOptions(firmware); addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware); registerOpenTxFirmware(firmware);
/* MEGA2560 board */ /* MEGA2560 board */
firmware = new OpenTxFirmware("opentx-mega2560", QObject::tr("DIY MEGA2560 radio"), BOARD_MEGA2560); firmware = new OpenTxFirmware("opentx-mega2560", QObject::tr("DIY MEGA2560 radio"), BOARD_MEGA2560);
@ -1572,17 +1557,17 @@ void registerOpenTxFirmwares()
firmware->addOption("imperial", QObject::tr("Imperial units")); firmware->addOption("imperial", QObject::tr("Imperial units"));
firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font")); firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
addOpenTxCommonOptions(firmware); addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware); registerOpenTxFirmware(firmware);
default_firmware_variant = GetFirmware("opentx-x9d+"); default_firmware_variant = getFirmware("opentx-x9d+");
current_firmware_variant = default_firmware_variant; current_firmware_variant = default_firmware_variant;
} }
void unregisterOpenTxFirmwares() void unregisterOpenTxFirmwares()
{ {
foreach (Firmware * f, firmwares) { foreach (Firmware * f, firmwares) {
delete f; delete f;
} }
} }
template <class T, class M> template <class T, class M>
@ -1599,7 +1584,7 @@ bool loadFromByteArray(T & dest, const QByteArray & data)
template <class T, class M> template <class T, class M>
bool saveToByteArray(const T & dest, QByteArray & data) bool saveToByteArray(const T & dest, QByteArray & data)
{ {
BoardEnum board = GetCurrentFirmware()->getBoard(); BoardEnum board = getCurrentBoard();
foreach(OpenTxEepromInterface * eepromInterface, opentxEEpromInterfaces) { foreach(OpenTxEepromInterface * eepromInterface, opentxEEpromInterfaces) {
if (eepromInterface->getBoard() == board) { if (eepromInterface->getBoard() == board) {
return eepromInterface->saveToByteArray<T, M>(dest, data); return eepromInterface->saveToByteArray<T, M>(dest, data);

View file

@ -24,12 +24,13 @@
#include "eeprominterface.h" #include "eeprominterface.h"
class RleFile; class RleFile;
class OpenTxFirmware;
class OpenTxEepromInterface : public EEPROMInterface class OpenTxEepromInterface : public EEPROMInterface
{ {
public: public:
OpenTxEepromInterface(BoardEnum board); OpenTxEepromInterface(OpenTxFirmware * firmware);
virtual ~OpenTxEepromInterface(); virtual ~OpenTxEepromInterface();
@ -78,6 +79,8 @@ class OpenTxEepromInterface : public EEPROMInterface
uint32_t getFourCC(); uint32_t getFourCC();
RleFile * efile; RleFile * efile;
OpenTxFirmware * firmware;
}; };
@ -85,12 +88,13 @@ class OpenTxFirmware: public Firmware
{ {
public: public:
OpenTxFirmware(const QString & id, OpenTxFirmware * parent): OpenTxFirmware(const QString & id, OpenTxFirmware * parent):
Firmware(parent, id, parent->getName(), parent->getBoard(), parent->eepromInterface) Firmware(parent, id, parent->getName(), parent->getBoard())
{ {
setEEpromInterface(parent->getEEpromInterface());
} }
OpenTxFirmware(const QString & id, const QString & name, const BoardEnum board): OpenTxFirmware(const QString & id, const QString & name, const BoardEnum board):
Firmware(id, name, board, new OpenTxEepromInterface(board)) Firmware(id, name, board)
{ {
addLanguage("en"); addLanguage("en");
addLanguage("cz"); addLanguage("cz");
@ -133,8 +137,6 @@ class OpenTxFirmware: public Firmware
virtual QTime getMaxTimerStart(); virtual QTime getMaxTimerStart();
virtual bool isTelemetrySourceAvailable(int source);
virtual int isAvailable(PulsesProtocol proto, int port=0); virtual int isAvailable(PulsesProtocol proto, int port=0);
protected: protected:
@ -145,7 +147,6 @@ class OpenTxFirmware: public Firmware
void registerOpenTxFirmwares(); void registerOpenTxFirmwares();
void unregisterOpenTxFirmwares(); void unregisterOpenTxFirmwares();
void registerOpenTxEEpromInterfaces();
extern QList<OpenTxEepromInterface *> opentxEEpromInterfaces; extern QList<OpenTxEepromInterface *> opentxEEpromInterfaces;

View file

@ -123,7 +123,7 @@ bool FlashEEpromDialog::patchCalibration()
{ {
QString calib = g.profile[g.id()].stickPotCalib(); QString calib = g.profile[g.id()].stickPotCalib();
QString trainercalib = g.profile[g.id()].trainerCalib(); QString trainercalib = g.profile[g.id()].trainerCalib();
int potsnum = GetCurrentFirmware()->getCapability(Pots); int potsnum = getCurrentFirmware()->getCapability(Pots);
int8_t txVoltageCalibration = (int8_t) g.profile[g.id()].txVoltageCalibration(); int8_t txVoltageCalibration = (int8_t) g.profile[g.id()].txVoltageCalibration();
int8_t txCurrentCalibration = (int8_t) g.profile[g.id()].txCurrentCalibration(); int8_t txCurrentCalibration = (int8_t) g.profile[g.id()].txCurrentCalibration();
int8_t PPM_Multiplier = (int8_t) g.profile[g.id()].ppmMultiplier(); int8_t PPM_Multiplier = (int8_t) g.profile[g.id()].ppmMultiplier();
@ -223,8 +223,8 @@ void FlashEEpromDialog::on_burnButton_clicked()
if (patch) { if (patch) {
QString filename = generateProcessUniqueTempFileName("temp.bin"); QString filename = generateProcessUniqueTempFileName("temp.bin");
QFile file(filename); QFile file(filename);
uint8_t *eeprom = (uint8_t*)malloc(getEEpromSize(GetCurrentFirmware()->getBoard())); uint8_t *eeprom = (uint8_t*)malloc(getEEpromSize(getCurrentBoard()));
int eeprom_size = GetEepromInterface()->save(eeprom, *radioData, 0, GetCurrentFirmware()->getVariantNumber()); int eeprom_size = getCurrentEEpromInterface()->save(eeprom, *radioData, 0, getCurrentFirmware()->getVariantNumber());
if (!eeprom_size) { if (!eeprom_size) {
QMessageBox::warning(this, tr("Error"), tr("Cannot write file %1:\n%2.").arg(filename).arg(file.errorString())); QMessageBox::warning(this, tr("Error"), tr("Cannot write file %1:\n%2.").arg(filename).arg(file.errorString()));
return; return;

View file

@ -54,7 +54,7 @@ fwName(g.profile[g.id()].fwName())
ui->useProfileSplash->setDisabled(true); ui->useProfileSplash->setDisabled(true);
} }
if (IS_STM32(GetEepromInterface()->getBoard())) { if (IS_STM32(getCurrentBoard())) {
// No backup on Taranis ... could be done if in massstorage // No backup on Taranis ... could be done if in massstorage
ui->backupEEprom->hide(); ui->backupEEprom->hide();
ui->backupEEprom->setCheckState(Qt::Unchecked); ui->backupEEprom->setCheckState(Qt::Unchecked);

View file

@ -35,7 +35,7 @@ FirmwarePreferencesDialog::FirmwarePreferencesDialog(QWidget *parent) :
setWindowIcon(CompanionIcon("fwpreferences.png")); setWindowIcon(CompanionIcon("fwpreferences.png"));
initSettings(); initSettings();
foreach(const char *lang, GetCurrentFirmware()->getFirmwareBase()->ttslanguages) { foreach(const char *lang, getCurrentFirmware()->getFirmwareBase()->ttslanguages) {
ui->voiceCombo->addItem(lang); ui->voiceCombo->addItem(lang);
if (current_firmware_variant->getId().contains(QString("-tts%1").arg(lang))) if (current_firmware_variant->getId().contains(QString("-tts%1").arg(lang)))
ui->voiceCombo->setCurrentIndex(ui->voiceCombo->count() - 1); ui->voiceCombo->setCurrentIndex(ui->voiceCombo->count() - 1);

View file

@ -44,7 +44,7 @@ CalibrationPanel::CalibrationPanel(QWidget * parent, GeneralSettings & generalSe
headerLabels << QObject::tr("Negative span") << QObject::tr("Mid value") << QObject::tr("Positive span"); headerLabels << QObject::tr("Negative span") << QObject::tr("Mid value") << QObject::tr("Positive span");
tableWidget->setHorizontalHeaderLabels(headerLabels); tableWidget->setHorizontalHeaderLabels(headerLabels);
int rows = CPN_MAX_STICKS + GetCurrentFirmware()->getCapability(Pots) + GetCurrentFirmware()->getCapability(Sliders); int rows = CPN_MAX_STICKS + getCurrentFirmware()->getCapability(Pots) + getCurrentFirmware()->getCapability(Sliders);
tableWidget->setRowCount(rows); tableWidget->setRowCount(rows);
for(int i = 0; i < rows; ++i) { for(int i = 0; i < rows; ++i) {

View file

@ -101,8 +101,8 @@ void GeneralEdit::on_calretrieve_PB_clicked()
{ {
int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt(); int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt();
QString calib=g.profile[profile_id].stickPotCalib(); QString calib=g.profile[profile_id].stickPotCalib();
int potsnum=GetCurrentFirmware()->getCapability(Pots)+GetCurrentFirmware()->getCapability(Sliders); int potsnum=getCurrentFirmware()->getCapability(Pots)+getCurrentFirmware()->getCapability(Sliders);
int numSwPots=GetCurrentFirmware()->getCapability(Switches)+GetCurrentFirmware()->getCapability(Pots)+GetCurrentFirmware()->getCapability(Sliders); int numSwPots=getCurrentFirmware()->getCapability(Switches)+getCurrentFirmware()->getCapability(Pots)+getCurrentFirmware()->getCapability(Sliders);
if (calib.isEmpty()) { if (calib.isEmpty()) {
return; return;
} }
@ -144,7 +144,7 @@ void GeneralEdit::on_calretrieve_PB_clicked()
generalSettings.txCurrentCalibration=txCurrentCalibration; generalSettings.txCurrentCalibration=txCurrentCalibration;
generalSettings.txVoltageCalibration=txVoltageCalibration; generalSettings.txVoltageCalibration=txVoltageCalibration;
generalSettings.vBatWarn=vBatWarn; generalSettings.vBatWarn=vBatWarn;
if (GetCurrentFirmware()->getCapability(HasBatMeterRange)) { if (getCurrentFirmware()->getCapability(HasBatMeterRange)) {
generalSettings.vBatMin = (int8_t) g.profile[profile_id].vBatMin(); generalSettings.vBatMin = (int8_t) g.profile[profile_id].vBatMin();
generalSettings.vBatMax = (int8_t) g.profile[profile_id].vBatMax(); generalSettings.vBatMax = (int8_t) g.profile[profile_id].vBatMax();
} }
@ -162,7 +162,7 @@ void GeneralEdit::on_calretrieve_PB_clicked()
qba = controlNames.mid(3*i,3).toLatin1(); qba = controlNames.mid(3*i,3).toLatin1();
strcpy(generalSettings.stickName[i], qba.data()); strcpy(generalSettings.stickName[i], qba.data());
} }
for (int i=0; i<(GetCurrentFirmware()->getCapability(Switches)); i++) { for (int i=0; i<(getCurrentFirmware()->getCapability(Switches)); i++) {
Byte=hwtypes.mid(i,1); Byte=hwtypes.mid(i,1);
byte16=(int16_t)Byte.toInt(&ok,16); byte16=(int16_t)Byte.toInt(&ok,16);
qba=controlNames.mid(3*(i+CPN_MAX_STICKS),3).toLatin1(); qba=controlNames.mid(3*(i+CPN_MAX_STICKS),3).toLatin1();
@ -171,8 +171,8 @@ void GeneralEdit::on_calretrieve_PB_clicked()
strcpy(generalSettings.switchName[i], qba.data()); strcpy(generalSettings.switchName[i], qba.data());
} }
} }
offset = GetCurrentFirmware()->getCapability(Switches); offset = getCurrentFirmware()->getCapability(Switches);
for (int i=0; i<(GetCurrentFirmware()->getCapability(Pots)); i++) { for (int i=0; i<(getCurrentFirmware()->getCapability(Pots)); i++) {
Byte=hwtypes.mid(i+offset,1); Byte=hwtypes.mid(i+offset,1);
byte16=(int16_t)Byte.toInt(&ok,16); byte16=(int16_t)Byte.toInt(&ok,16);
qba=controlNames.mid(3*(i+CPN_MAX_STICKS+offset),3).toLatin1(); qba=controlNames.mid(3*(i+CPN_MAX_STICKS+offset),3).toLatin1();
@ -181,8 +181,8 @@ void GeneralEdit::on_calretrieve_PB_clicked()
strcpy(generalSettings.potName[i], qba.data()); strcpy(generalSettings.potName[i], qba.data());
} }
} }
offset += GetCurrentFirmware()->getCapability(Pots); offset += getCurrentFirmware()->getCapability(Pots);
for (int i=0; i<(GetCurrentFirmware()->getCapability(Sliders)); i++) { for (int i=0; i<(getCurrentFirmware()->getCapability(Sliders)); i++) {
Byte=hwtypes.mid(i+offset,1); Byte=hwtypes.mid(i+offset,1);
byte16=(int16_t)Byte.toInt(&ok,16); byte16=(int16_t)Byte.toInt(&ok,16);
qba=controlNames.mid(3*(i+CPN_MAX_STICKS+offset),3).toLatin1(); qba=controlNames.mid(3*(i+CPN_MAX_STICKS+offset),3).toLatin1();
@ -245,7 +245,7 @@ void GeneralEdit::on_calstore_PB_clicked()
int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt(); int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt();
QString name=g.profile[profile_id].name(); QString name=g.profile[profile_id].name();
int potsnum=GetCurrentFirmware()->getCapability(Pots)+GetCurrentFirmware()->getCapability(Sliders); int potsnum=getCurrentFirmware()->getCapability(Pots)+getCurrentFirmware()->getCapability(Sliders);
if (name.isEmpty()) { if (name.isEmpty()) {
ui->calstore_PB->setDisabled(true); ui->calstore_PB->setDisabled(true);
return; return;
@ -279,15 +279,15 @@ void GeneralEdit::on_calstore_PB_clicked()
for (int i=0; i<CPN_MAX_STICKS; i++) { for (int i=0; i<CPN_MAX_STICKS; i++) {
controlNames.append(QString("%1").arg(generalSettings.stickName[i], -3)); controlNames.append(QString("%1").arg(generalSettings.stickName[i], -3));
} }
for (int i=0; i<(GetCurrentFirmware()->getCapability(Switches)); i++) { for (int i=0; i<(getCurrentFirmware()->getCapability(Switches)); i++) {
hwtypes.append(QString("%1").arg((uint16_t)generalSettings.switchConfig[i], 1)); hwtypes.append(QString("%1").arg((uint16_t)generalSettings.switchConfig[i], 1));
controlNames.append(QString("%1").arg(generalSettings.switchName[i], -3)); controlNames.append(QString("%1").arg(generalSettings.switchName[i], -3));
} }
for (int i=0; i<(GetCurrentFirmware()->getCapability(Pots)); i++) { for (int i=0; i<(getCurrentFirmware()->getCapability(Pots)); i++) {
hwtypes.append(QString("%1").arg((uint16_t)generalSettings.potConfig[i], 1)); hwtypes.append(QString("%1").arg((uint16_t)generalSettings.potConfig[i], 1));
controlNames.append(QString("%1").arg(generalSettings.potName[i], -3)); controlNames.append(QString("%1").arg(generalSettings.potName[i], -3));
} }
for (int i=0; i<(GetCurrentFirmware()->getCapability(Sliders)); i++) { for (int i=0; i<(getCurrentFirmware()->getCapability(Sliders)); i++) {
hwtypes.append(QString("%1").arg((uint16_t)generalSettings.sliderConfig[i], 1)); hwtypes.append(QString("%1").arg((uint16_t)generalSettings.sliderConfig[i], 1));
controlNames.append(QString("%1").arg(generalSettings.sliderName[i], -3)); controlNames.append(QString("%1").arg(generalSettings.sliderName[i], -3));
} }
@ -296,7 +296,7 @@ void GeneralEdit::on_calstore_PB_clicked()
g.profile[profile_id].txVoltageCalibration( generalSettings.txVoltageCalibration ); g.profile[profile_id].txVoltageCalibration( generalSettings.txVoltageCalibration );
g.profile[profile_id].txCurrentCalibration( generalSettings.txCurrentCalibration ); g.profile[profile_id].txCurrentCalibration( generalSettings.txCurrentCalibration );
g.profile[profile_id].vBatWarn( generalSettings.vBatWarn ); g.profile[profile_id].vBatWarn( generalSettings.vBatWarn );
if (GetCurrentFirmware()->getCapability(HasBatMeterRange)) { if (getCurrentFirmware()->getCapability(HasBatMeterRange)) {
g.profile[profile_id].vBatMin( generalSettings.vBatMin ); g.profile[profile_id].vBatMin( generalSettings.vBatMin );
g.profile[profile_id].vBatMax( generalSettings.vBatMax ); g.profile[profile_id].vBatMax( generalSettings.vBatMax );
} }

View file

@ -207,7 +207,7 @@ ui(new Ui::GeneralSetup)
ui->memwarnChkB->setChecked(!generalSettings.disableMemoryWarning); //Default is zero=checked ui->memwarnChkB->setChecked(!generalSettings.disableMemoryWarning); //Default is zero=checked
ui->alarmwarnChkB->setChecked(!generalSettings.disableAlarmWarning);//Default is zero=checked ui->alarmwarnChkB->setChecked(!generalSettings.disableAlarmWarning);//Default is zero=checked
if (IS_TARANIS(GetEepromInterface()->getBoard())) { if (IS_TARANIS(firmware->getBoard())) {
ui->splashScreenChkB->hide(); ui->splashScreenChkB->hide();
ui->splashScreenDuration->setCurrentIndex(3-generalSettings.splashDuration); ui->splashScreenDuration->setCurrentIndex(3-generalSettings.splashDuration);
} }
@ -261,7 +261,7 @@ ui(new Ui::GeneralSetup)
} }
ui->blAlarm_ChkB->setChecked(generalSettings.flashBeep); ui->blAlarm_ChkB->setChecked(generalSettings.flashBeep);
if (!GetCurrentFirmware()->getCapability(HasBatMeterRange)) { if (!firmware->getCapability(HasBatMeterRange)) {
ui->batMeterRangeLabel->hide(); ui->batMeterRangeLabel->hide();
ui->HasBatMeterMinRangeLabel->hide(); ui->HasBatMeterMinRangeLabel->hide();
ui->HasBatMeterMaxRangeLabel->hide(); ui->HasBatMeterMaxRangeLabel->hide();
@ -365,7 +365,7 @@ void GeneralSetupPanel::setValues()
ui->beeperCB->setCurrentIndex(generalSettings.beeperMode+2); ui->beeperCB->setCurrentIndex(generalSettings.beeperMode+2);
ui->channelorderCB->setCurrentIndex(generalSettings.templateSetup); ui->channelorderCB->setCurrentIndex(generalSettings.templateSetup);
ui->stickmodeCB->setCurrentIndex(generalSettings.stickMode); ui->stickmodeCB->setCurrentIndex(generalSettings.stickMode);
if (GetCurrentFirmware()->getCapability(Haptic)) { if (firmware->getCapability(Haptic)) {
ui->hapticLengthCB->setCurrentIndex(generalSettings.hapticLength+2); ui->hapticLengthCB->setCurrentIndex(generalSettings.hapticLength+2);
} }
else { else {
@ -380,7 +380,7 @@ void GeneralSetupPanel::setValues()
ui->hapticStrength->setValue(generalSettings.hapticStrength); ui->hapticStrength->setValue(generalSettings.hapticStrength);
ui->hapticmodeCB->setCurrentIndex(generalSettings.hapticMode+2); ui->hapticmodeCB->setCurrentIndex(generalSettings.hapticMode+2);
if (GetCurrentFirmware()->getCapability(HasBatMeterRange)) { if (firmware->getCapability(HasBatMeterRange)) {
ui->vBatMinDSB->setValue((double)(generalSettings.vBatMin + 90) / 10); ui->vBatMinDSB->setValue((double)(generalSettings.vBatMin + 90) / 10);
ui->vBatMaxDSB->setValue((double)(generalSettings.vBatMax + 120) / 10); ui->vBatMaxDSB->setValue((double)(generalSettings.vBatMax + 120) / 10);
} }

View file

@ -115,7 +115,7 @@ void getFileComboBoxValue(QComboBox * b, char * dest, int length)
void populatePhasesCB(QComboBox *b, int value) void populatePhasesCB(QComboBox *b, int value)
{ {
for (int i=-GetCurrentFirmware()->getCapability(FlightModes); i<=GetCurrentFirmware()->getCapability(FlightModes); i++) { for (int i=-getCurrentFirmware()->getCapability(FlightModes); i<=getCurrentFirmware()->getCapability(FlightModes); i++) {
if (i < 0) if (i < 0)
b->addItem(QObject::tr("!Flight mode %1").arg(-i-1), i); b->addItem(QObject::tr("!Flight mode %1").arg(-i-1), i);
else if (i > 0) else if (i > 0)
@ -123,7 +123,7 @@ void populatePhasesCB(QComboBox *b, int value)
else else
b->addItem(QObject::tr("----"), 0); b->addItem(QObject::tr("----"), 0);
} }
b->setCurrentIndex(value + GetCurrentFirmware()->getCapability(FlightModes)); b->setCurrentIndex(value + getCurrentFirmware()->getCapability(FlightModes));
} }
GVarGroup::GVarGroup(QCheckBox * weightGV, QAbstractSpinBox * weightSB, QComboBox * weightCB, int & weight, const ModelData & model, const int deflt, const int mini, const int maxi, const double step, bool allowGvars, ModelPanel * panel): GVarGroup::GVarGroup(QCheckBox * weightGV, QAbstractSpinBox * weightSB, QComboBox * weightCB, int & weight, const ModelData & model, const int deflt, const int mini, const int maxi, const double step, bool allowGvars, ModelPanel * panel):
@ -138,7 +138,7 @@ GVarGroup::GVarGroup(QCheckBox * weightGV, QAbstractSpinBox * weightSB, QComboBo
lock(true), lock(true),
panel(panel) panel(panel)
{ {
if (allowGvars && GetCurrentFirmware()->getCapability(Gvars)) { if (allowGvars && getCurrentFirmware()->getCapability(Gvars)) {
populateGVCB(*weightCB, weight, model); populateGVCB(*weightCB, weight, model);
connect(weightGV, SIGNAL(stateChanged(int)), this, SLOT(gvarCBChanged(int))); connect(weightGV, SIGNAL(stateChanged(int)), this, SLOT(gvarCBChanged(int)));
connect(weightCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged())); connect(weightCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
@ -242,7 +242,7 @@ void CurveGroup::update()
curveTypeCB->setCurrentIndex(found); curveTypeCB->setCurrentIndex(found);
if (curve.type == CurveReference::CURVE_REF_DIFF || curve.type == CurveReference::CURVE_REF_EXPO) { if (curve.type == CurveReference::CURVE_REF_DIFF || curve.type == CurveReference::CURVE_REF_EXPO) {
curveGVarCB->setVisible(GetCurrentFirmware()->getCapability(Gvars)); curveGVarCB->setVisible(getCurrentFirmware()->getCapability(Gvars));
if (curve.value > 100 || curve.value < -100) { if (curve.value > 100 || curve.value < -100) {
curveGVarCB->setChecked(true); curveGVarCB->setChecked(true);
if (lastType != CurveReference::CURVE_REF_DIFF && lastType != CurveReference::CURVE_REF_EXPO) { if (lastType != CurveReference::CURVE_REF_DIFF && lastType != CurveReference::CURVE_REF_EXPO) {
@ -278,7 +278,7 @@ void CurveGroup::update()
break; break;
case CurveReference::CURVE_REF_CUSTOM: case CurveReference::CURVE_REF_CUSTOM:
{ {
int numcurves = GetCurrentFirmware()->getCapability(NumCurves); int numcurves = getCurrentFirmware()->getCapability(NumCurves);
if (lastType != curve.type) { if (lastType != curve.type) {
lastType = curve.type; lastType = curve.type;
curveValueCB->clear(); curveValueCB->clear();
@ -367,7 +367,7 @@ void CurveGroup::valuesChanged()
void populateGvarUseCB(QComboBox *b, unsigned int phase) void populateGvarUseCB(QComboBox *b, unsigned int phase)
{ {
b->addItem(QObject::tr("Own value")); b->addItem(QObject::tr("Own value"));
for (int i=0; i<GetCurrentFirmware()->getCapability(FlightModes); i++) { for (int i=0; i<getCurrentFirmware()->getCapability(FlightModes); i++) {
if (i != (int)phase) { if (i != (int)phase) {
b->addItem(QObject::tr("Flight mode %1 value").arg(i)); b->addItem(QObject::tr("Flight mode %1 value").arg(i));
} }
@ -376,7 +376,7 @@ void populateGvarUseCB(QComboBox *b, unsigned int phase)
void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettings & generalSettings, SwitchContext context) void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettings & generalSettings, SwitchContext context)
{ {
BoardEnum board = GetCurrentFirmware()->getBoard(); BoardEnum board = getCurrentBoard();
RawSwitch item; RawSwitch item;
b->clear(); b->clear();
@ -384,7 +384,7 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
if (context != MixesContext && context != GlobalFunctionsContext) { if (context != MixesContext && context != GlobalFunctionsContext) {
// !FMx // !FMx
if (IS_ARM(board)) { if (IS_ARM(board)) {
for (int i=-GetCurrentFirmware()->getCapability(FlightModes); i<0; i++) { for (int i=-getCurrentFirmware()->getCapability(FlightModes); i<0; i++) {
item = RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i); item = RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1); if (item == value) b->setCurrentIndex(b->count()-1);
@ -393,14 +393,14 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
} }
if (context != GlobalFunctionsContext) { if (context != GlobalFunctionsContext) {
for (int i=-GetCurrentFirmware()->getCapability(LogicalSwitches); i<0; i++) { for (int i=-getCurrentFirmware()->getCapability(LogicalSwitches); i<0; i++) {
item = RawSwitch(SWITCH_TYPE_VIRTUAL, i); item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1); if (item == value) b->setCurrentIndex(b->count()-1);
} }
} }
for (int i=-GetCurrentFirmware()->getCapability(RotaryEncoders); i<0; i++) { for (int i=-getCurrentFirmware()->getCapability(RotaryEncoders); i<0; i++) {
item = RawSwitch(SWITCH_TYPE_ROTARY_ENCODER, i); item = RawSwitch(SWITCH_TYPE_ROTARY_ENCODER, i);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1); if (item == value) b->setCurrentIndex(b->count()-1);
@ -412,17 +412,17 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
if (item == value) b->setCurrentIndex(b->count()-1); if (item == value) b->setCurrentIndex(b->count()-1);
} }
for (int i=GetCurrentFirmware()->getCapability(MultiposPots)-1; i>=0; i--) { for (int i=getCurrentFirmware()->getCapability(MultiposPots)-1; i>=0; i--) {
if (generalSettings.potConfig[i] == GeneralSettings::POT_MULTIPOS_SWITCH) { if (generalSettings.potConfig[i] == GeneralSettings::POT_MULTIPOS_SWITCH) {
for (int j=-GetCurrentFirmware()->getCapability(MultiposPotsPositions); j<0; j++) { for (int j=-getCurrentFirmware()->getCapability(MultiposPotsPositions); j<0; j++) {
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, -i*GetCurrentFirmware()->getCapability(MultiposPotsPositions)+j); item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, -i*getCurrentFirmware()->getCapability(MultiposPotsPositions)+j);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1); if (item == value) b->setCurrentIndex(b->count()-1);
} }
} }
} }
for (int i=-GetCurrentFirmware()->getCapability(SwitchesPositions); i<0; i++) { for (int i=-getCurrentFirmware()->getCapability(SwitchesPositions); i<0; i++) {
item = RawSwitch(SWITCH_TYPE_SWITCH, i); item = RawSwitch(SWITCH_TYPE_SWITCH, i);
if (IS_HORUS_OR_TARANIS(board) && !generalSettings.switchPositionAllowedTaranis(i)) { if (IS_HORUS_OR_TARANIS(board) && !generalSettings.switchPositionAllowedTaranis(i)) {
continue; continue;
@ -444,7 +444,7 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
if (item == value) b->setCurrentIndex(b->count()-1); if (item == value) b->setCurrentIndex(b->count()-1);
} }
for (int i=1; i<=GetCurrentFirmware()->getCapability(SwitchesPositions); i++) { for (int i=1; i<=getCurrentFirmware()->getCapability(SwitchesPositions); i++) {
item = RawSwitch(SWITCH_TYPE_SWITCH, i); item = RawSwitch(SWITCH_TYPE_SWITCH, i);
if (IS_HORUS_OR_TARANIS(board) && !generalSettings.switchPositionAllowedTaranis(i)) { if (IS_HORUS_OR_TARANIS(board) && !generalSettings.switchPositionAllowedTaranis(i)) {
continue; continue;
@ -453,10 +453,10 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
if (item == value) b->setCurrentIndex(b->count()-1); if (item == value) b->setCurrentIndex(b->count()-1);
} }
for (int i=0; i<GetCurrentFirmware()->getCapability(MultiposPots); i++) { for (int i=0; i<getCurrentFirmware()->getCapability(MultiposPots); i++) {
if (generalSettings.potConfig[i] == GeneralSettings::POT_MULTIPOS_SWITCH) { if (generalSettings.potConfig[i] == GeneralSettings::POT_MULTIPOS_SWITCH) {
for (int j=1; j<=GetCurrentFirmware()->getCapability(MultiposPotsPositions); j++) { for (int j=1; j<=getCurrentFirmware()->getCapability(MultiposPotsPositions); j++) {
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i*GetCurrentFirmware()->getCapability(MultiposPotsPositions)+j); item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i*getCurrentFirmware()->getCapability(MultiposPotsPositions)+j);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1); if (item == value) b->setCurrentIndex(b->count()-1);
} }
@ -469,14 +469,14 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
if (item == value) b->setCurrentIndex(b->count()-1); if (item == value) b->setCurrentIndex(b->count()-1);
} }
for (int i=1; i<=GetCurrentFirmware()->getCapability(RotaryEncoders); i++) { for (int i=1; i<=getCurrentFirmware()->getCapability(RotaryEncoders); i++) {
item = RawSwitch(SWITCH_TYPE_ROTARY_ENCODER, i); item = RawSwitch(SWITCH_TYPE_ROTARY_ENCODER, i);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1); if (item == value) b->setCurrentIndex(b->count()-1);
} }
if (context != GlobalFunctionsContext) { if (context != GlobalFunctionsContext) {
for (int i=1; i<=GetCurrentFirmware()->getCapability(LogicalSwitches); i++) { for (int i=1; i<=getCurrentFirmware()->getCapability(LogicalSwitches); i++) {
item = RawSwitch(SWITCH_TYPE_VIRTUAL, i); item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1); if (item == value) b->setCurrentIndex(b->count()-1);
@ -497,7 +497,7 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
// FMx // FMx
if (context != MixesContext && context != GlobalFunctionsContext) { if (context != MixesContext && context != GlobalFunctionsContext) {
if (IS_ARM(board)) { if (IS_ARM(board)) {
for (int i=1; i<=GetCurrentFirmware()->getCapability(FlightModes); i++) { for (int i=1; i<=getCurrentFirmware()->getCapability(FlightModes); i++) {
item = RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i); item = RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1); if (item == value) b->setCurrentIndex(b->count()-1);
@ -514,7 +514,7 @@ void populateGVCB(QComboBox & b, int value, const ModelData & model)
b.clear(); b.clear();
int count = GetCurrentFirmware()->getCapability(Gvars); int count = getCurrentFirmware()->getCapability(Gvars);
for (int i=-count; i<=-1; i++) { for (int i=-count; i<=-1; i++) {
int16_t gval = (int16_t)(-10000+i); int16_t gval = (int16_t)(-10000+i);
if (strlen(model.gvars_names[-i-1]) > 0) if (strlen(model.gvars_names[-i-1]) > 0)
@ -546,7 +546,7 @@ void populateGVCB(QComboBox & b, int value, const ModelData & model)
void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSettings generalSettings, const ModelData * model, unsigned int flags) void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSettings generalSettings, const ModelData * model, unsigned int flags)
{ {
BoardEnum board = GetCurrentFirmware()->getBoard(); BoardEnum board = getCurrentBoard();
RawSource item; RawSource item;
b->clear(); b->clear();
@ -558,8 +558,8 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
} }
if (flags & POPULATE_SCRIPT_OUTPUTS) { if (flags & POPULATE_SCRIPT_OUTPUTS) {
for (int i=0; i<GetCurrentFirmware()->getCapability(LuaScripts); i++) { for (int i=0; i<getCurrentFirmware()->getCapability(LuaScripts); i++) {
for (int j=0; j<GetCurrentFirmware()->getCapability(LuaOutputsPerScript); j++) { for (int j=0; j<getCurrentFirmware()->getCapability(LuaOutputsPerScript); j++) {
item = RawSource(SOURCE_TYPE_LUA_OUTPUT, i*16+j); item = RawSource(SOURCE_TYPE_LUA_OUTPUT, i*16+j);
b->addItem(item.toString(model), item.toValue()); b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1); if (item == source) b->setCurrentIndex(b->count()-1);
@ -568,7 +568,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
} }
if (model && (flags & POPULATE_VIRTUAL_INPUTS)) { if (model && (flags & POPULATE_VIRTUAL_INPUTS)) {
int virtualInputs = GetCurrentFirmware()->getCapability(VirtualInputs); int virtualInputs = getCurrentFirmware()->getCapability(VirtualInputs);
for (int i=0; i<virtualInputs; i++) { for (int i=0; i<virtualInputs; i++) {
if (model->isInputValid(i)) { if (model->isInputValid(i)) {
item = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i); item = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i);
@ -579,15 +579,15 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
} }
if (flags & POPULATE_SOURCES) { if (flags & POPULATE_SOURCES) {
for (int i=0; i<CPN_MAX_STICKS+GetCurrentFirmware()->getCapability(Pots)+GetCurrentFirmware()->getCapability(Sliders); i++) { for (int i=0; i<CPN_MAX_STICKS+getCurrentFirmware()->getCapability(Pots)+getCurrentFirmware()->getCapability(Sliders); i++) {
item = RawSource(SOURCE_TYPE_STICK, i); item = RawSource(SOURCE_TYPE_STICK, i);
// skip unavailable pots and sliders // skip unavailable pots and sliders
if (item.isPot() && !generalSettings.isPotAvailable(i-CPN_MAX_STICKS)) continue; if (item.isPot() && !generalSettings.isPotAvailable(i-CPN_MAX_STICKS)) continue;
if (item.isSlider() && !generalSettings.isSliderAvailable(i-CPN_MAX_STICKS-GetCurrentFirmware()->getCapability(Pots))) continue; if (item.isSlider() && !generalSettings.isSliderAvailable(i-CPN_MAX_STICKS-getCurrentFirmware()->getCapability(Pots))) continue;
b->addItem(item.toString(model), item.toValue()); b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1); if (item == source) b->setCurrentIndex(b->count()-1);
} }
for (int i=0; i<GetCurrentFirmware()->getCapability(RotaryEncoders); i++) { for (int i=0; i<getCurrentFirmware()->getCapability(RotaryEncoders); i++) {
item = RawSource(SOURCE_TYPE_ROTARY_ENCODER, i); item = RawSource(SOURCE_TYPE_ROTARY_ENCODER, i);
b->addItem(item.toString(model), item.toValue()); b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1); if (item == source) b->setCurrentIndex(b->count()-1);
@ -609,7 +609,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
} }
if (flags & POPULATE_SWITCHES) { if (flags & POPULATE_SWITCHES) {
for (int i=0; i<GetCurrentFirmware()->getCapability(Switches); i++) { for (int i=0; i<getCurrentFirmware()->getCapability(Switches); i++) {
item = RawSource(SOURCE_TYPE_SWITCH, i); item = RawSource(SOURCE_TYPE_SWITCH, i);
b->addItem(item.toString(model), item.toValue()); b->addItem(item.toString(model), item.toValue());
if (IS_HORUS_OR_TARANIS(board) && !generalSettings.switchSourceAllowedTaranis(i)) { if (IS_HORUS_OR_TARANIS(board) && !generalSettings.switchSourceAllowedTaranis(i)) {
@ -620,7 +620,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
if (item == source) b->setCurrentIndex(b->count()-1); if (item == source) b->setCurrentIndex(b->count()-1);
} }
for (int i=0; i<GetCurrentFirmware()->getCapability(LogicalSwitches); i++) { for (int i=0; i<getCurrentFirmware()->getCapability(LogicalSwitches); i++) {
item = RawSource(SOURCE_TYPE_CUSTOM_SWITCH, i); item = RawSource(SOURCE_TYPE_CUSTOM_SWITCH, i);
b->addItem(item.toString(model), item.toValue()); b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1); if (item == source) b->setCurrentIndex(b->count()-1);
@ -634,13 +634,13 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
if (item == source) b->setCurrentIndex(b->count()-1); if (item == source) b->setCurrentIndex(b->count()-1);
} }
for (int i=0; i<GetCurrentFirmware()->getCapability(TrainerInputs); i++) { for (int i=0; i<getCurrentFirmware()->getCapability(TrainerInputs); i++) {
item = RawSource(SOURCE_TYPE_PPM, i); item = RawSource(SOURCE_TYPE_PPM, i);
b->addItem(item.toString(model), item.toValue()); b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1); if (item == source) b->setCurrentIndex(b->count()-1);
} }
for (int i=0; i<GetCurrentFirmware()->getCapability(Outputs); i++) { for (int i=0; i<getCurrentFirmware()->getCapability(Outputs); i++) {
item = RawSource(SOURCE_TYPE_CH, i); item = RawSource(SOURCE_TYPE_CH, i);
b->addItem(item.toString(model), item.toValue()); b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1); if (item == source) b->setCurrentIndex(b->count()-1);
@ -648,7 +648,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
} }
if (flags & POPULATE_TELEMETRY) { if (flags & POPULATE_TELEMETRY) {
if (IS_ARM(GetCurrentFirmware()->getBoard())) { if (IS_ARM(getCurrentBoard())) {
for (int i=0; i<5; ++i) { for (int i=0; i<5; ++i) {
item = RawSource(SOURCE_TYPE_SPECIAL, i); item = RawSource(SOURCE_TYPE_SPECIAL, i);
b->addItem(item.toString(model), item.toValue()); b->addItem(item.toString(model), item.toValue());
@ -667,9 +667,9 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
} }
else { else {
for (int i=0; i<(flags & POPULATE_TELEMETRYEXT ? TELEMETRY_SOURCES_STATUS_COUNT : TELEMETRY_SOURCES_COUNT); i++) { for (int i=0; i<(flags & POPULATE_TELEMETRYEXT ? TELEMETRY_SOURCES_STATUS_COUNT : TELEMETRY_SOURCES_COUNT); i++) {
if (i==TELEMETRY_SOURCE_TX_TIME && !GetCurrentFirmware()->getCapability(RtcTime)) if (i==TELEMETRY_SOURCE_TX_TIME && !getCurrentFirmware()->getCapability(RtcTime))
continue; continue;
if (i==TELEMETRY_SOURCE_SWR && !GetCurrentFirmware()->getCapability(SportTelemetry)) if (i==TELEMETRY_SOURCE_SWR && !getCurrentFirmware()->getCapability(SportTelemetry))
continue; continue;
if (i==TELEMETRY_SOURCE_TIMER3 && !IS_ARM(board)) if (i==TELEMETRY_SOURCE_TIMER3 && !IS_ARM(board))
continue; continue;
@ -681,7 +681,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
} }
if (flags & POPULATE_GVARS) { if (flags & POPULATE_GVARS) {
for (int i=0; i<GetCurrentFirmware()->getCapability(Gvars); i++) { for (int i=0; i<getCurrentFirmware()->getCapability(Gvars); i++) {
item = RawSource(SOURCE_TYPE_GVAR, i); item = RawSource(SOURCE_TYPE_GVAR, i);
b->addItem(item.toString(model), item.toValue()); b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1); if (item == source) b->setCurrentIndex(b->count()-1);
@ -752,7 +752,7 @@ QString getFrSkyProtocol(int protocol)
{ {
switch(protocol) { switch(protocol) {
case 2: case 2:
if ((GetCurrentFirmware()->getCapability(Telemetry) & TM_HASWSHH)) if ((getCurrentFirmware()->getCapability(Telemetry) & TM_HASWSHH))
return QObject::tr("Winged Shadow How High"); return QObject::tr("Winged Shadow How High");
else else
return QObject::tr("Winged Shadow How High (not supported)"); return QObject::tr("Winged Shadow How High (not supported)");
@ -814,8 +814,8 @@ CompanionIcon::CompanionIcon(const QString &baseimage)
void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx) void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
{ {
QString settingsPath; QString settingsPath;
Firmware * firmware = GetCurrentFirmware(); Firmware * firmware = getCurrentFirmware();
SimulatorInterface * simulator = GetCurrentFirmwareSimulator(); SimulatorInterface * simulator = getCurrentSimulator();
if (simulator) { if (simulator) {
#if defined(WIN32) && defined(WIN_USE_CONSOLE_STDIO) #if defined(WIN32) && defined(WIN_USE_CONSOLE_STDIO)
AllocConsole(); AllocConsole();
@ -833,7 +833,7 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
if (radioData.generalSettings.stickMode & 1) { if (radioData.generalSettings.stickMode & 1) {
flags |= SIMULATOR_FLAGS_STICK_MODE_LEFT; flags |= SIMULATOR_FLAGS_STICK_MODE_LEFT;
} }
BoardEnum board = GetCurrentFirmware()->getBoard(); BoardEnum board = getCurrentBoard();
SimulatorDialog * dialog; SimulatorDialog * dialog;
if (board == BOARD_HORUS) { if (board == BOARD_HORUS) {
@ -850,12 +850,12 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
else if (board == BOARD_FLAMENCO) { else if (board == BOARD_FLAMENCO) {
dialog = new SimulatorDialogFlamenco(parent, simulator, flags); dialog = new SimulatorDialogFlamenco(parent, simulator, flags);
QByteArray eeprom(getEEpromSize(board), 0); QByteArray eeprom(getEEpromSize(board), 0);
firmware->saveEEPROM((uint8_t *)eeprom.data(), *simuData); firmware->getEEpromInterface()->save((uint8_t *)eeprom.data(), *simuData);
simulator->setSdPath(g.profile[g.id()].sdPath(), ""); simulator->setSdPath(g.profile[g.id()].sdPath(), "");
dialog->start(eeprom); dialog->start(eeprom);
} }
else if (board == BOARD_TARANIS_X9D || board == BOARD_TARANIS_X9DP || board == BOARD_TARANIS_X9E) { else if (board == BOARD_TARANIS_X9D || board == BOARD_TARANIS_X9DP || board == BOARD_TARANIS_X9E) {
for (int i=0; i<GetCurrentFirmware()->getCapability(Pots); i++) { for (int i=0; i<getCurrentFirmware()->getCapability(Pots); i++) {
if (radioData.generalSettings.isPotAvailable(i)) { if (radioData.generalSettings.isPotAvailable(i)) {
flags |= (SIMULATOR_FLAGS_S1 << i); flags |= (SIMULATOR_FLAGS_S1 << i);
if (radioData.generalSettings.potConfig[1] == GeneralSettings::POT_MULTIPOS_SWITCH ) { if (radioData.generalSettings.potConfig[1] == GeneralSettings::POT_MULTIPOS_SWITCH ) {
@ -865,7 +865,7 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
} }
dialog = new SimulatorDialogTaranis(parent, simulator, flags); dialog = new SimulatorDialogTaranis(parent, simulator, flags);
QByteArray eeprom(getEEpromSize(board), 0); QByteArray eeprom(getEEpromSize(board), 0);
firmware->saveEEPROM((uint8_t *)eeprom.data(), *simuData); firmware->getEEpromInterface()->save((uint8_t *)eeprom.data(), *simuData);
qDebug() << "Starting Taranis simulation with SD path" << g.profile[g.id()].sdPath(); qDebug() << "Starting Taranis simulation with SD path" << g.profile[g.id()].sdPath();
simulator->setSdPath(g.profile[g.id()].sdPath(), ""); simulator->setSdPath(g.profile[g.id()].sdPath(), "");
dialog->start(eeprom); dialog->start(eeprom);
@ -873,7 +873,7 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
else { else {
dialog = new SimulatorDialog9X(parent, simulator, flags); dialog = new SimulatorDialog9X(parent, simulator, flags);
QByteArray eeprom(getEEpromSize(board), 0); QByteArray eeprom(getEEpromSize(board), 0);
firmware->saveEEPROM((uint8_t *)eeprom.data(), *simuData, 0, firmware->getCapability(SimulatorVariant)); firmware->getEEpromInterface()->save((uint8_t *)eeprom.data(), *simuData, 0, firmware->getCapability(SimulatorVariant));
simulator->setSdPath(g.profile[g.id()].sdPath(), ""); // does 9X need SD card path? I think not. simulator->setSdPath(g.profile[g.id()].sdPath(), ""); // does 9X need SD card path? I think not.
dialog->start(eeprom); dialog->start(eeprom);
} }
@ -900,7 +900,7 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
QPixmap makePixMap(const QImage & image) QPixmap makePixMap(const QImage & image)
{ {
Firmware * firmware = GetCurrentFirmware(); Firmware * firmware = getCurrentFirmware();
QImage result = image.scaled(firmware->getCapability(LcdWidth), firmware->getCapability(LcdHeight)); QImage result = image.scaled(firmware->getCapability(LcdWidth), firmware->getCapability(LcdHeight));
if (firmware->getCapability(LcdDepth) == 4) { if (firmware->getCapability(LcdDepth) == 4) {
result = result.convertToFormat(QImage::Format_RGB32); result = result.convertToFormat(QImage::Format_RGB32);

View file

@ -33,7 +33,7 @@
extern const QColor colors[CPN_MAX_CURVES]; extern const QColor colors[CPN_MAX_CURVES];
#define TMR_NUM_OPTION (TMRMODE_COUNT+2*9+2*GetCurrentFirmware()->getCapability(LogicalSwitches)-1) #define TMR_NUM_OPTION (TMRMODE_COUNT+2*9+2*getCurrentFirmware()->getCapability(LogicalSwitches)-1)
//convert from mode 1 to mode generalSettings.stickMode //convert from mode 1 to mode generalSettings.stickMode
//NOTICE! => 1..4 -> 1..4 //NOTICE! => 1..4 -> 1..4

View file

@ -137,7 +137,7 @@ MainWindow::MainWindow():
if (fileType==STORAGE_TYPE_EEPE || fileType==STORAGE_TYPE_EEPM || fileType==STORAGE_TYPE_BIN) { if (fileType==STORAGE_TYPE_EEPE || fileType==STORAGE_TYPE_EEPM || fileType==STORAGE_TYPE_BIN) {
MdiChild * child = createMdiChild(); MdiChild * child = createMdiChild();
if (child->loadFile(str)) { if (child->loadFile(str)) {
if (!(printing && model >= 0 && (GetCurrentFirmware()->getCapability(Models) == 0 || model<GetCurrentFirmware()->getCapability(Models)) && !printfilename.isEmpty())) { if (!(printing && model >= 0 && (getCurrentFirmware()->getCapability(Models) == 0 || model<getCurrentFirmware()->getCapability(Models)) && !printfilename.isEmpty())) {
statusBar()->showMessage(tr("File loaded"), 2000); statusBar()->showMessage(tr("File loaded"), 2000);
child->show(); child->show();
} }
@ -228,7 +228,7 @@ void MainWindow::checkForUpdates()
} }
else if (checkForUpdatesState & CHECK_FIRMWARE) { else if (checkForUpdatesState & CHECK_FIRMWARE) {
checkForUpdatesState -= CHECK_FIRMWARE; checkForUpdatesState -= CHECK_FIRMWARE;
QString stamp = GetCurrentFirmware()->getStampUrl(); QString stamp = getCurrentFirmware()->getStampUrl();
if (!stamp.isEmpty()) { if (!stamp.isEmpty()) {
networkManager = new QNetworkAccessManager(this); networkManager = new QNetworkAccessManager(this);
connect(networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(checkForFirmwareUpdateFinished(QNetworkReply*))); connect(networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(checkForFirmwareUpdateFinished(QNetworkReply*)));
@ -413,7 +413,7 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount()); layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
if (currentVersion == 0) { if (currentVersion == 0) {
QString rn = GetCurrentFirmware()->getReleaseNotesUrl(); QString rn = getCurrentFirmware()->getReleaseNotesUrl();
QAbstractButton *rnButton = NULL; QAbstractButton *rnButton = NULL;
msgBox.setText(tr("Firmware %1 does not seem to have ever been downloaded.\nRelease %2 is available.\nDo you want to download it now?\n\nWe recommend you view the release notes using the button below to learn about any changes that may be important to you.").arg(current_firmware_variant->getId()).arg(fullVersionString)); msgBox.setText(tr("Firmware %1 does not seem to have ever been downloaded.\nRelease %2 is available.\nDo you want to download it now?\n\nWe recommend you view the release notes using the button below to learn about any changes that may be important to you.").arg(current_firmware_variant->getId()).arg(fullVersionString));
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole); QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
@ -441,7 +441,7 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
} }
} }
else if (version > currentVersion) { else if (version > currentVersion) {
QString rn = GetCurrentFirmware()->getReleaseNotesUrl(); QString rn = getCurrentFirmware()->getReleaseNotesUrl();
QAbstractButton *rnButton = NULL; QAbstractButton *rnButton = NULL;
msgBox.setText(tr("A new version of %1 firmware is available:\n - current is %2\n - newer is %3\n\nDo you want to download it now?\n\nWe recommend you view the release notes using the button below to learn about any changes that may be important to you.").arg(current_firmware_variant->getId()).arg(currentVersionString).arg(fullVersionString)); msgBox.setText(tr("A new version of %1 firmware is available:\n - current is %2\n - newer is %3\n\nDo you want to download it now?\n\nWe recommend you view the release notes using the button below to learn about any changes that may be important to you.").arg(current_firmware_variant->getId()).arg(currentVersionString).arg(fullVersionString));
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole); QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
@ -618,7 +618,7 @@ void MainWindow::loadProfile() // TODO Load all variables - Also HW!
// Set the new profile number // Set the new profile number
int profnum = action->data().toInt(); int profnum = action->data().toInt();
g.id(profnum); g.id(profnum);
current_firmware_variant = GetFirmware(g.profile[g.id()].fwType()); current_firmware_variant = getFirmware(g.profile[g.id()].fwType());
emit FirmwareChanged(); emit FirmwareChanged();
updateMenus(); updateMenus();
} }
@ -673,7 +673,7 @@ void MainWindow::changelog()
void MainWindow::fwchangelog() void MainWindow::fwchangelog()
{ {
Firmware * firmware = GetCurrentFirmware(); Firmware * firmware = getCurrentFirmware();
QString url = firmware->getReleaseNotesUrl(); QString url = firmware->getReleaseNotesUrl();
if (url.isEmpty()) { if (url.isEmpty()) {
QMessageBox::information(this, tr("Firmware updates"), tr("Current firmware does not provide release notes informations.")); QMessageBox::information(this, tr("Firmware updates"), tr("Current firmware does not provide release notes informations."));
@ -740,15 +740,14 @@ void MainWindow::loadBackup()
void MainWindow::readEeprom() void MainWindow::readEeprom()
{ {
if (GetCurrentFirmware()->getBoard()== BOARD_HORUS) { if (getCurrentBoard()== BOARD_HORUS) {
qDebug() << "TODO readEEPROM HORUS"; qDebug() << "TODO readEEPROM HORUS";
} }
else { else {
QString tempFile; QString tempFile;
EEPROMInterface * eepromInterface = GetEepromInterface(); BoardEnum board = getCurrentBoard();
if (IS_ARM(board))
if (IS_ARM(eepromInterface->getBoard()))
tempFile = generateProcessUniqueTempFileName("temp.bin"); tempFile = generateProcessUniqueTempFileName("temp.bin");
else else
tempFile += generateProcessUniqueTempFileName("temp.hex"); tempFile += generateProcessUniqueTempFileName("temp.hex");
@ -836,7 +835,7 @@ void MainWindow::burnFuses()
void MainWindow::compare() void MainWindow::compare()
{ {
CompareDialog *fd = new CompareDialog(this,GetCurrentFirmware()); CompareDialog *fd = new CompareDialog(this,getCurrentFirmware());
fd->setAttribute(Qt::WA_DeleteOnClose, true); fd->setAttribute(Qt::WA_DeleteOnClose, true);
fd->show(); fd->show();
} }
@ -896,7 +895,7 @@ void MainWindow::updateMenus()
updateLanguageActions(); updateLanguageActions();
updateIconSizeActions(); updateIconSizeActions();
updateIconThemeActions(); updateIconThemeActions();
setWindowTitle(tr("OpenTX Companion %1 - Radio: %2 - Profile: %3").arg(VERSION).arg(GetCurrentFirmware()->getName()).arg(g.profile[g.id()].name())); setWindowTitle(tr("OpenTX Companion %1 - Radio: %2 - Profile: %3").arg(VERSION).arg(getCurrentFirmware()->getName()).arg(g.profile[g.id()].name()));
} }
MdiChild * MainWindow::createMdiChild() MdiChild * MainWindow::createMdiChild()
@ -1120,8 +1119,7 @@ void MainWindow::createMenus()
burnMenu->addAction(readFlashAct); burnMenu->addAction(readFlashAct);
burnMenu->addSeparator(); burnMenu->addSeparator();
burnMenu->addSeparator(); burnMenu->addSeparator();
EEPROMInterface *eepromInterface = GetEepromInterface(); if (!IS_ARM(getCurrentBoard())) {
if (!IS_ARM(eepromInterface->getBoard())) {
burnMenu->addAction(burnFusesAct); burnMenu->addAction(burnFusesAct);
burnMenu->addAction(burnListAct); burnMenu->addAction(burnListAct);
} }
@ -1410,7 +1408,7 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event)
void MainWindow::dropEvent(QDropEvent *event) void MainWindow::dropEvent(QDropEvent *event)
{ {
if(GetCurrentFirmware()->getBoard()== BOARD_HORUS) if(getCurrentBoard()== BOARD_HORUS)
return; return;
QList<QUrl> urls = event->mimeData()->urls(); QList<QUrl> urls = event->mimeData()->urls();
if (urls.isEmpty()) if (urls.isEmpty())

View file

@ -42,7 +42,7 @@
MdiChild::MdiChild(MainWindow * parent): MdiChild::MdiChild(MainWindow * parent):
QWidget(), QWidget(),
ui(new Ui::MdiChild), ui(new Ui::MdiChild),
firmware(GetCurrentFirmware()), firmware(getCurrentFirmware()),
isUntitled(true), isUntitled(true),
fileChanged(false) fileChanged(false)
{ {
@ -157,7 +157,7 @@ void MdiChild::showModelsListContextMenu(const QPoint & pos)
void MdiChild::onFirmwareChanged() void MdiChild::onFirmwareChanged()
{ {
Firmware * previous = firmware; Firmware * previous = firmware;
firmware = GetCurrentFirmware(); firmware = getCurrentFirmware();
qDebug() << "onFirmwareChanged" << previous->getName() << "=>" << firmware->getName(); qDebug() << "onFirmwareChanged" << previous->getName() << "=>" << firmware->getName();
BoardEnum board = firmware->getBoard(); BoardEnum board = firmware->getBoard();
@ -453,7 +453,7 @@ bool MdiChild::save()
bool MdiChild::saveAs(bool isNew) bool MdiChild::saveAs(bool isNew)
{ {
QString fileName; QString fileName;
if (IS_SKY9X(GetEepromInterface()->getBoard())) { if (IS_SKY9X(getCurrentBoard())) {
curFile.replace(".eepe", ".bin"); curFile.replace(".eepe", ".bin");
QFileInfo fi(curFile); QFileInfo fi(curFile);
#ifdef __APPLE__ #ifdef __APPLE__
@ -481,7 +481,7 @@ bool MdiChild::saveAs(bool isNew)
bool MdiChild::saveFile(const QString & filename, bool setCurrent) bool MdiChild::saveFile(const QString & filename, bool setCurrent)
{ {
BoardEnum board = GetEepromInterface()->getBoard(); BoardEnum board = getCurrentBoard();
QString path = filename; QString path = filename;
if (IS_SKY9X(board)) { if (IS_SKY9X(board)) {
path.replace(".eepe", ".bin"); path.replace(".eepe", ".bin");

View file

@ -101,7 +101,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
headerLabels << tr("Name"); headerLabels << tr("Name");
} }
headerLabels << tr("Subtrim") << tr("Min") << tr("Max") << tr("Direction"); headerLabels << tr("Subtrim") << tr("Min") << tr("Max") << tr("Direction");
if (IS_TARANIS(GetEepromInterface()->getBoard())) if (IS_TARANIS(firmware->getBoard()))
headerLabels << tr("Curve"); headerLabels << tr("Curve");
if (firmware->getCapability(PPMCenter)) if (firmware->getCapability(PPMCenter))
headerLabels << tr("PPM Center"); headerLabels << tr("PPM Center");
@ -150,7 +150,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
tableLayout->addWidget(i, col++, invCB); tableLayout->addWidget(i, col++, invCB);
// Curve // Curve
if (IS_TARANIS(GetEepromInterface()->getBoard())) { if (IS_TARANIS(firmware->getBoard())) {
QComboBox * curveCB = new QComboBox(this); QComboBox * curveCB = new QComboBox(this);
curveCB->setProperty("index", i); curveCB->setProperty("index", i);
int numcurves = firmware->getCapability(NumCurves); int numcurves = firmware->getCapability(NumCurves);

View file

@ -26,7 +26,7 @@ RepeatComboBox::RepeatComboBox(QWidget *parent, int & repeatParam):
QComboBox(parent), QComboBox(parent),
repeatParam(repeatParam) repeatParam(repeatParam)
{ {
unsigned int step = IS_ARM(GetEepromInterface()->getBoard()) ? 1 : 10; unsigned int step = IS_ARM(getCurrentBoard()) ? 1 : 10;
int value = repeatParam/step; int value = repeatParam/step;
if (step == 1) { if (step == 1) {
@ -53,7 +53,7 @@ void RepeatComboBox::onIndexChanged(int index)
void RepeatComboBox::update() void RepeatComboBox::update()
{ {
unsigned int step = IS_ARM(GetEepromInterface()->getBoard()) ? 1 : 10; unsigned int step = IS_ARM(getCurrentBoard()) ? 1 : 10;
int value = repeatParam/step; int value = repeatParam/step;
if (step == 1) { if (step == 1) {
value++; value++;
@ -395,7 +395,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
if (modified) cfn.param = fswtchParam[i]->value(); if (modified) cfn.param = fswtchParam[i]->value();
fswtchParam[i]->setDecimals(0); fswtchParam[i]->setDecimals(0);
fswtchParam[i]->setSingleStep(1); fswtchParam[i]->setSingleStep(1);
if (IS_ARM(GetEepromInterface()->getBoard())) { if (IS_ARM(getCurrentBoard())) {
fswtchParam[i]->setMinimum(-500); fswtchParam[i]->setMinimum(-500);
fswtchParam[i]->setMaximum(500); fswtchParam[i]->setMaximum(500);
} }
@ -515,7 +515,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
} }
populateFileComboBox(fswtchParamArmT[i], scriptsSet, cfn.paramarm); populateFileComboBox(fswtchParamArmT[i], scriptsSet, cfn.paramarm);
} }
else if (func==FuncBacklight && IS_TARANIS_PLUS(GetEepromInterface()->getBoard())) { else if (func==FuncBacklight && IS_TARANIS_PLUS(getCurrentBoard())) {
if (modified) cfn.param = (uint8_t)fswtchBLcolor[i]->value(); if (modified) cfn.param = (uint8_t)fswtchBLcolor[i]->value();
fswtchBLcolor[i]->setValue(cfn.param); fswtchBLcolor[i]->setValue(cfn.param);
widgetsMask |= CUSTOM_FUNCTION_BL_COLOR; widgetsMask |= CUSTOM_FUNCTION_BL_COLOR;

View file

@ -40,7 +40,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
setWindowTitle(tr("Edit %1").arg(modelPrinter.printInputName(ed->chn))); setWindowTitle(tr("Edit %1").arg(modelPrinter.printInputName(ed->chn)));
QRegExp rx(CHAR_FOR_NAMES_REGEX); QRegExp rx(CHAR_FOR_NAMES_REGEX);
if (IS_TARANIS(GetEepromInterface()->getBoard())) { if (IS_TARANIS(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);
} }

View file

@ -238,7 +238,7 @@ void FlightModePanel::update()
} }
gvValues[i]->setDisabled(model->isGVarLinked(phaseIdx, i)); gvValues[i]->setDisabled(model->isGVarLinked(phaseIdx, i));
gvValues[i]->setValue(model->getGVarFieldValue(phaseIdx, i)); gvValues[i]->setValue(model->getGVarFieldValue(phaseIdx, i));
if (IS_HORUS_OR_TARANIS(GetEepromInterface()->getBoard()) && phaseIdx == 0) { if (IS_HORUS_OR_TARANIS(getCurrentBoard()) && phaseIdx == 0) {
gvPopups[i]->setChecked(model->gvars_popups[i]); gvPopups[i]->setChecked(model->gvars_popups[i]);
} }
} }
@ -471,7 +471,7 @@ void FlightModePanel::fmClear()
if (res == QMessageBox::Yes) { if (res == QMessageBox::Yes) {
phase.clear(phaseIdx); phase.clear(phaseIdx);
if (phaseIdx == 0) { if (phaseIdx == 0) {
if (IS_HORUS_OR_TARANIS(GetEepromInterface()->getBoard())) { if (IS_HORUS_OR_TARANIS(getCurrentBoard())) {
for (int i=0; i < gvCount; ++i) { for (int i=0; i < gvCount; ++i) {
memset(&model->gvars_names[i], 0, sizeof(model->gvars_names[i])); memset(&model->gvars_names[i], 0, sizeof(model->gvars_names[i]));
model->gvars_popups[i] = 0; model->gvars_popups[i] = 0;

View file

@ -867,7 +867,6 @@ void SetupPanel::populateThrottleSourceCB()
void SetupPanel::update() void SetupPanel::update()
{ {
ui->name->setText(model->name); ui->name->setText(model->name);
ui->throttleReverse->setChecked(model->throttleReversed); ui->throttleReverse->setChecked(model->throttleReversed);
populateThrottleSourceCB(); populateThrottleSourceCB();
ui->throttleWarning->setChecked(!model->disableThrottleWarning); ui->throttleWarning->setChecked(!model->disableThrottleWarning);
@ -881,7 +880,7 @@ void SetupPanel::update()
updateBeepCenter(); updateBeepCenter();
updateStartupSwitches(); updateStartupSwitches();
if(IS_HORUS_OR_TARANIS(GetEepromInterface()->getBoard())) { if (IS_HORUS_OR_TARANIS(firmware->getBoard())) {
updatePotWarnings(); updatePotWarnings();
} }
@ -915,7 +914,7 @@ void SetupPanel::updateStartupSwitches()
QCheckBox * cb = startupSwitchesCheckboxes[i]; QCheckBox * cb = startupSwitchesCheckboxes[i];
int index = slider->property("index").toInt(); int index = slider->property("index").toInt();
bool enabled = !(model->switchWarningEnable & (1 << index)); bool enabled = !(model->switchWarningEnable & (1 << index));
if (IS_HORUS_OR_TARANIS(GetEepromInterface()->getBoard())) { if (IS_HORUS_OR_TARANIS(firmware->getBoard())) {
value = (switchStates >> 2*index) & 0x03; value = (switchStates >> 2*index) & 0x03;
if (generalSettings.switchConfig[index] != GeneralSettings::SWITCH_3POS && value == 2) { if (generalSettings.switchConfig[index] != GeneralSettings::SWITCH_3POS && value == 2) {
value = 1; value = 1;
@ -940,7 +939,7 @@ void SetupPanel::startupSwitchEdited(int value)
uint64_t mask; uint64_t mask;
int index = sender()->property("index").toInt(); int index = sender()->property("index").toInt();
if (IS_HORUS_OR_TARANIS(GetEepromInterface()->getBoard())) { if (IS_HORUS_OR_TARANIS(firmware->getBoard())) {
shift = index * 2; shift = index * 2;
mask = 0x03ul << shift; mask = 0x03ul << shift;
} }
@ -956,7 +955,7 @@ void SetupPanel::startupSwitchEdited(int value)
model->switchWarningStates &= ~mask; model->switchWarningStates &= ~mask;
if (IS_HORUS_OR_TARANIS(GetEepromInterface()->getBoard()) && generalSettings.switchConfig[index] != GeneralSettings::SWITCH_3POS) { if (IS_HORUS_OR_TARANIS(firmware->getBoard()) && generalSettings.switchConfig[index] != GeneralSettings::SWITCH_3POS) {
if (value == 1) { if (value == 1) {
value = 2; value = 2;
} }

View file

@ -409,7 +409,7 @@ void TelemetryCustomScreen::updateBar(int line)
RawSource source = screen.body.bars[line].source; RawSource source = screen.body.bars[line].source;
if (source.type != SOURCE_TYPE_NONE) { if (source.type != SOURCE_TYPE_NONE) {
RawSourceRange range = source.getRange(model, generalSettings, RANGE_SINGLE_PRECISION); RawSourceRange range = source.getRange(model, generalSettings, RANGE_SINGLE_PRECISION);
if (!IS_ARM(GetCurrentFirmware()->getBoard())) { if (!IS_ARM(getCurrentBoard())) {
int max = round((range.max - range.min) / range.step); int max = round((range.max - range.min) / range.step);
if (int(255-screen.body.bars[line].barMax) > max) { if (int(255-screen.body.bars[line].barMax) > max) {
screen.body.bars[line].barMax = 255 - max; screen.body.bars[line].barMax = 255 - max;
@ -426,7 +426,7 @@ void TelemetryCustomScreen::updateBar(int line)
maxSB[line]->setMinimum(range.min); maxSB[line]->setMinimum(range.min);
maxSB[line]->setMaximum(range.max); maxSB[line]->setMaximum(range.max);
maxSB[line]->setSingleStep(range.step); maxSB[line]->setSingleStep(range.step);
if (IS_ARM(GetCurrentFirmware()->getBoard())) { if (IS_ARM(getCurrentBoard())) {
maxSB[line]->setValue(range.getValue(screen.body.bars[line].barMax)); maxSB[line]->setValue(range.getValue(screen.body.bars[line].barMax));
} }
else { else {
@ -486,7 +486,7 @@ void TelemetryCustomScreen::barMinChanged(double value)
{ {
if (!lock) { if (!lock) {
int line = sender()->property("index").toInt(); int line = sender()->property("index").toInt();
if (IS_ARM(GetCurrentFirmware()->getBoard())) if (IS_ARM(getCurrentBoard()))
screen.body.bars[line].barMin = round(value / minSB[line]->singleStep()); screen.body.bars[line].barMin = round(value / minSB[line]->singleStep());
else else
screen.body.bars[line].barMin = round((value-minSB[line]->minimum()) / minSB[line]->singleStep()); screen.body.bars[line].barMin = round((value-minSB[line]->minimum()) / minSB[line]->singleStep());
@ -499,7 +499,7 @@ void TelemetryCustomScreen::barMaxChanged(double value)
{ {
if (!lock) { if (!lock) {
int line = sender()->property("index").toInt(); int line = sender()->property("index").toInt();
if (IS_ARM(GetCurrentFirmware()->getBoard())) if (IS_ARM(getCurrentBoard()))
screen.body.bars[line].barMax = round((value) / maxSB[line]->singleStep()); screen.body.bars[line].barMax = round((value) / maxSB[line]->singleStep());
else else
screen.body.bars[line].barMax = 255 - round((value-minSB[line]->minimum()) / maxSB[line]->singleStep()); screen.body.bars[line].barMax = 255 - round((value-minSB[line]->minimum()) / maxSB[line]->singleStep());

View file

@ -67,7 +67,7 @@ QString addFont(const QString & input, const QString & color, const QString & si
QString ModelPrinter::printEEpromSize() QString ModelPrinter::printEEpromSize()
{ {
return tr("%1 bytes").arg(GetEepromInterface()->getSize(model)); return tr("%1 bytes").arg(getCurrentEEpromInterface()->getSize(model));
} }
QString ModelPrinter::printChannelName(int idx) QString ModelPrinter::printChannelName(int idx)

View file

@ -106,7 +106,7 @@ TreeModel::TreeModel(RadioData * radioData, QObject * parent):
radioData(radioData), radioData(radioData),
availableEEpromSize(-1) availableEEpromSize(-1)
{ {
BoardEnum board = GetCurrentFirmware()->getBoard(); BoardEnum board = getCurrentBoard();
QVector<QVariant> labels; QVector<QVariant> labels;
if (!IS_HORUS(board)) if (!IS_HORUS(board))
labels << tr("Index"); labels << tr("Index");
@ -239,7 +239,7 @@ bool TreeModel::setData(const QModelIndex &index, const QVariant & value, int ro
void TreeModel::refresh() void TreeModel::refresh()
{ {
EEPROMInterface * eepromInterface = GetEepromInterface(); EEPROMInterface * eepromInterface = getCurrentEEpromInterface();
BoardEnum board = eepromInterface->getBoard(); BoardEnum board = eepromInterface->getBoard();
if (!IS_SKY9X(board) && !IS_HORUS(board)) { if (!IS_SKY9X(board) && !IS_HORUS(board)) {
@ -366,7 +366,7 @@ void ModelsListWidget::mouseMoveEvent(QMouseEvent *event)
void ModelsListWidget::saveSelection() void ModelsListWidget::saveSelection()
{ {
/*currentSelection.current_item = currentItem(); /*currentSelection.current_item = currentItem();
for (int i=0; i<GetCurrentFirmware()->getCapability(Models)+1; ++i) { for (int i=0; i<getCurrentFirmware()->getCapability(Models)+1; ++i) {
currentSelection.selected[i] = selectionModel()->isSelected(model()->index(i, 0)); currentSelection.selected[i] = selectionModel()->isSelected(model()->index(i, 0));
}*/ }*/
} }
@ -374,7 +374,7 @@ void ModelsListWidget::saveSelection()
void ModelsListWidget::restoreSelection() void ModelsListWidget::restoreSelection()
{ {
/*setCurrentItem(currentSelection.current_item); /*setCurrentItem(currentSelection.current_item);
for (int i=0; i<GetCurrentFirmware()->getCapability(Models)+1; ++i) { for (int i=0; i<getCurrentFirmware()->getCapability(Models)+1; ++i) {
selectionModel()->select(model()->index(i, 0), currentSelection.selected[i] ? QItemSelectionModel::Select : QItemSelectionModel::Deselect); selectionModel()->select(model()->index(i, 0), currentSelection.selected[i] ? QItemSelectionModel::Select : QItemSelectionModel::Deselect);
}*/ }*/
} }
@ -404,7 +404,7 @@ void ModelsListWidget::dragMoveEvent(QDragMoveEvent *event)
if (row >= 0) { if (row >= 0) {
if (header->general_settings) if (header->general_settings)
selectionModel()->select(model()->index(0, 0), QItemSelectionModel::Select); selectionModel()->select(model()->index(0, 0), QItemSelectionModel::Select);
for (int i=row, end=std::min(GetCurrentFirmware()->getCapability(Models)+1, row+header->models_count); i<end; i++) for (int i=row, end=std::min(getCurrentFirmware()->getCapability(Models)+1, row+header->models_count); i<end; i++)
selectionModel()->select(model()->index(i, 0), QItemSelectionModel::Select); selectionModel()->select(model()->index(i, 0), QItemSelectionModel::Select);
} }
} }
@ -429,7 +429,7 @@ void ModelsListWidget::dropEvent(QDropEvent *event)
DragDropHeader * header = (DragDropHeader *)gmData.data(); DragDropHeader * header = (DragDropHeader *)gmData.data();
if (header->general_settings) if (header->general_settings)
selectionModel()->select(model()->index(0, 0), QItemSelectionModel::Select); selectionModel()->select(model()->index(0, 0), QItemSelectionModel::Select);
for (int i=row, end=std::min(GetCurrentFirmware()->getCapability(Models)+1, row+header->models_count); i<end; i++) for (int i=row, end=std::min(getCurrentFirmware()->getCapability(Models)+1, row+header->models_count); i<end; i++)
selectionModel()->select(model()->index(i, 0), QItemSelectionModel::Select); selectionModel()->select(model()->index(i, 0), QItemSelectionModel::Select);
} }
event->acceptProposedAction(); event->acceptProposedAction();
@ -473,9 +473,9 @@ void ModelsListWidget::doCut(QByteArray * gmData)
void ModelsListWidget::duplicate() void ModelsListWidget::duplicate()
{ {
int i = this->currentRow(); int i = this->currentRow();
if (i && i<GetCurrentFirmware()->getCapability(Models)) { if (i && i<getCurrentFirmware()->getCapability(Models)) {
ModelData * model = &radioData->models[i-1]; ModelData * model = &radioData->models[i-1];
while (i<GetCurrentFirmware()->getCapability(Models)) { while (i<getCurrentFirmware()->getCapability(Models)) {
if (radioData->models[i].isEmpty()) { if (radioData->models[i].isEmpty()) {
radioData->models[i] = *model; radioData->models[i] = *model;
strcpy(radioData->models[i].filename, radioData->getNextModelFilename().toStdString().c_str()); strcpy(radioData->models[i].filename, radioData->getNextModelFilename().toStdString().c_str());
@ -484,7 +484,7 @@ void ModelsListWidget::duplicate()
} }
i++; i++;
} }
if (i==GetCurrentFirmware()->getCapability(Models)) { if (i==getCurrentFirmware()->getCapability(Models)) {
QMessageBox::warning(this, "Companion", tr("No free slot available, cannot duplicate"), QMessageBox::Ok); QMessageBox::warning(this, "Companion", tr("No free slot available, cannot duplicate"), QMessageBox::Ok);
} }
} }

View file

@ -268,7 +268,7 @@ QString MultiModelPrinter::printFlightModes()
columns.append("<td><b>" + tr("Fade IN") + "</b></td>"); columns.append("<td><b>" + tr("Fade IN") + "</b></td>");
columns.append("<td><b>" + tr("Fade OUT") + "</b></td>"); columns.append("<td><b>" + tr("Fade OUT") + "</b></td>");
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
columns.append("<td><b>" + GetCurrentFirmware()->getAnalogInputName(i) + " trim</b></td>"); columns.append("<td><b>" + getCurrentFirmware()->getAnalogInputName(i) + " trim</b></td>");
} }
columns.append("</tr>"); columns.append("</tr>");

View file

@ -278,7 +278,7 @@ void FlashProcess::errorWizard()
QMessageBox::warning(NULL, "Companion - Tip of the day", tr("Your radio uses a %1 CPU!!!\n\nPlease check advanced burn options to set the correct cpu type.").arg(DeviceStr)); QMessageBox::warning(NULL, "Companion - Tip of the day", tr("Your radio uses a %1 CPU!!!\n\nPlease check advanced burn options to set the correct cpu type.").arg(DeviceStr));
} }
else { else {
Firmware *firmware = GetCurrentFirmware(); Firmware *firmware = getCurrentFirmware();
QMessageBox::warning(NULL, "Companion - Tip of the day", tr("Your radio uses a %1 CPU!!!\n\nPlease select an appropriate firmware type to program it.").arg(DeviceStr)+FwStr+tr("\nYou are currently using:\n %1").arg(firmware->getName())); QMessageBox::warning(NULL, "Companion - Tip of the day", tr("Your radio uses a %1 CPU!!!\n\nPlease select an appropriate firmware type to program it.").arg(DeviceStr)+FwStr+tr("\nYou are currently using:\n %1").arg(firmware->getName()));
} }
} }

View file

@ -38,11 +38,11 @@
QString getRadioInterfaceCmd() QString getRadioInterfaceCmd()
{ {
burnConfigDialog bcd; burnConfigDialog bcd;
EEPROMInterface *eepromInterface = GetEepromInterface(); BoardEnum board = getCurrentBoard();
if (IS_STM32(eepromInterface->getBoard())) { if (IS_STM32(board)) {
return bcd.getDFU(); return bcd.getDFU();
} }
else if (IS_SKY9X(GetEepromInterface()->getBoard())) { else if (IS_SKY9X(board)) {
return bcd.getSAMBA(); return bcd.getSAMBA();
} }
else { else {
@ -50,17 +50,18 @@ QString getRadioInterfaceCmd()
} }
} }
QStringList getAvrdudeArgs(const QString &cmd, const QString &filename) QStringList getAvrdudeArgs(const QString & cmd, const QString & filename)
{ {
QStringList args; QStringList args;
burnConfigDialog bcd; burnConfigDialog bcd;
QString programmer = bcd.getProgrammer(); QString programmer = bcd.getProgrammer();
QString mcu = bcd.getMCU(); QString mcu = bcd.getMCU();
BoardEnum board = getCurrentBoard();
args << "-c" << programmer << "-p"; args << "-c" << programmer << "-p";
if (IS_2560(GetEepromInterface()->getBoard())) if (IS_2560(board))
args << "m2560"; args << "m2560";
else if (GetEepromInterface()->getBoard() == BOARD_M128) else if (board == BOARD_M128)
args << "m128"; args << "m128";
else else
args << mcu; args << mcu;
@ -86,7 +87,7 @@ QStringList getDfuArgs(const QString & cmd, const QString & filename)
burnConfigDialog bcd; burnConfigDialog bcd;
QString memory = "0x08000000"; QString memory = "0x08000000";
if (cmd == "-U") { if (cmd == "-U") {
memory.append(QString(":%1").arg(GetCurrentFirmware()->getFlashSize())); memory.append(QString(":%1").arg(getCurrentFirmware()->getFlashSize()));
} }
args << bcd.getDFUArgs(); args << bcd.getDFUArgs();
if (!filename.endsWith(".dfu")) { if (!filename.endsWith(".dfu")) {
@ -123,7 +124,7 @@ QStringList getSambaArgs(const QString &tcl)
QStringList getReadEEpromCmd(const QString &filename) QStringList getReadEEpromCmd(const QString &filename)
{ {
QStringList result; QStringList result;
EEPROMInterface *eepromInterface = GetEepromInterface(); EEPROMInterface *eepromInterface = getCurrentEEpromInterface();
if (IS_STM32(eepromInterface->getBoard())) { if (IS_STM32(eepromInterface->getBoard())) {
// impossible // impossible
} }
@ -138,12 +139,12 @@ QStringList getReadEEpromCmd(const QString &filename)
QStringList getWriteEEpromCmd(const QString &filename) QStringList getWriteEEpromCmd(const QString &filename)
{ {
EEPROMInterface *eepromInterface = GetEepromInterface(); BoardEnum board = getCurrentBoard();
if (IS_STM32(eepromInterface->getBoard())) { if (IS_STM32(board)) {
// impossible // impossible
return QStringList(); return QStringList();
} }
else if (IS_SKY9X(eepromInterface->getBoard())) { else if (IS_SKY9X(board)) {
return getSambaArgs(QString("SERIALFLASH::Init 0\n") + "send_file {SerialFlash AT25} \"" + filename + "\" 0x0 0\n"); return getSambaArgs(QString("SERIALFLASH::Init 0\n") + "send_file {SerialFlash AT25} \"" + filename + "\" 0x0 0\n");
} }
else { else {
@ -153,14 +154,14 @@ QStringList getWriteEEpromCmd(const QString &filename)
QStringList getWriteFirmwareArgs(const QString &filename) QStringList getWriteFirmwareArgs(const QString &filename)
{ {
EEPROMInterface *eepromInterface = GetEepromInterface(); BoardEnum board = getCurrentBoard();
if (IS_STM32(eepromInterface->getBoard())) { if (IS_STM32(board)) {
return getDfuArgs("-D", filename); return getDfuArgs("-D", filename);
} }
else if (eepromInterface->getBoard() == BOARD_SKY9X) { else if (board == BOARD_SKY9X) {
return getSambaArgs(QString("send_file {Flash} \"") + filename + "\" 0x400000 0\n" + "FLASH::ScriptGPNMV 2\n"); return getSambaArgs(QString("send_file {Flash} \"") + filename + "\" 0x400000 0\n" + "FLASH::ScriptGPNMV 2\n");
} }
else if (eepromInterface->getBoard() == BOARD_9XRPRO || eepromInterface->getBoard() == BOARD_AR9X) { else if (board == BOARD_9XRPRO || board == BOARD_AR9X) {
return getSambaArgs(QString("send_file {Flash} \"") + filename + "\" 0x400000 0\n" + "FLASH::ScriptGPNMV 2\n"); return getSambaArgs(QString("send_file {Flash} \"") + filename + "\" 0x400000 0\n" + "FLASH::ScriptGPNMV 2\n");
} }
else { else {
@ -170,14 +171,14 @@ QStringList getWriteFirmwareArgs(const QString &filename)
QStringList getReadFirmwareArgs(const QString &filename) QStringList getReadFirmwareArgs(const QString &filename)
{ {
EEPROMInterface *eepromInterface = GetEepromInterface(); BoardEnum board = getCurrentBoard();
if (IS_STM32(eepromInterface->getBoard())) { if (IS_STM32(board)) {
return getDfuArgs("-U", filename); return getDfuArgs("-U", filename);
} }
else if (eepromInterface->getBoard() == BOARD_SKY9X) { else if (board == BOARD_SKY9X) {
return getSambaArgs(QString("receive_file {Flash} \"") + filename + "\" 0x400000 0x40000 0\n"); return getSambaArgs(QString("receive_file {Flash} \"") + filename + "\" 0x400000 0x40000 0\n");
} }
else if (eepromInterface->getBoard() == BOARD_9XRPRO) { else if (board == BOARD_9XRPRO) {
return getSambaArgs(QString("receive_file {Flash} \"") + filename + "\" 0x400000 0x80000 0\n"); return getSambaArgs(QString("receive_file {Flash} \"") + filename + "\" 0x400000 0x80000 0\n");
} }
else { else {
@ -270,7 +271,7 @@ bool readFirmware(const QString &filename, ProgressWidget *progress)
return false; return false;
} }
if (IS_ARM(GetCurrentFirmware()->getBoard())) { if (IS_ARM(getCurrentBoard())) {
QString path = findMassstoragePath("FIRMWARE.BIN"); QString path = findMassstoragePath("FIRMWARE.BIN");
if (!path.isEmpty()) { if (!path.isEmpty()) {
qDebug() << "readFirmware: reading" << path << "into" << filename; qDebug() << "readFirmware: reading" << path << "into" << filename;
@ -294,7 +295,7 @@ bool readFirmware(const QString &filename, ProgressWidget *progress)
bool writeFirmware(const QString &filename, ProgressWidget *progress) bool writeFirmware(const QString &filename, ProgressWidget *progress)
{ {
if (IS_ARM(GetCurrentFirmware()->getBoard())) { if (IS_ARM(getCurrentBoard())) {
QString path = findMassstoragePath("FIRMWARE.BIN"); QString path = findMassstoragePath("FIRMWARE.BIN");
if (!path.isEmpty()) { if (!path.isEmpty()) {
qDebug() << "writeFirmware: writing" << path << "from" << filename; qDebug() << "writeFirmware: writing" << path << "from" << filename;
@ -319,7 +320,7 @@ bool readEeprom(const QString &filename, ProgressWidget *progress)
return false; return false;
} }
if (IS_ARM(GetCurrentFirmware()->getBoard())) { if (IS_ARM(getCurrentBoard())) {
QString path = findMassstoragePath("EEPROM.BIN"); QString path = findMassstoragePath("EEPROM.BIN");
if (path.isEmpty()) { if (path.isEmpty()) {
// On previous OpenTX we called the EEPROM file "TARANIS.BIN" :( // On previous OpenTX we called the EEPROM file "TARANIS.BIN" :(
@ -335,12 +336,12 @@ bool readEeprom(const QString &filename, ProgressWidget *progress)
} }
} }
if (result == false && !IS_STM32(GetCurrentFirmware()->getBoard())) { if (result == false && !IS_STM32(getCurrentBoard())) {
FlashProcess flashProcess(getRadioInterfaceCmd(), getReadEEpromCmd(filename), progress); FlashProcess flashProcess(getRadioInterfaceCmd(), getReadEEpromCmd(filename), progress);
result = flashProcess.run(); result = flashProcess.run();
} }
if (result == false && IS_ARM(GetCurrentFirmware()->getBoard())) { if (result == false && IS_ARM(getCurrentBoard())) {
RadioNotFoundDialog dialog; RadioNotFoundDialog dialog;
dialog.exec(); dialog.exec();
} }
@ -354,7 +355,7 @@ bool readEeprom(const QString &filename, ProgressWidget *progress)
bool writeEeprom(const QString &filename, ProgressWidget *progress) bool writeEeprom(const QString &filename, ProgressWidget *progress)
{ {
if (IS_ARM(GetCurrentFirmware()->getBoard())) { if (IS_ARM(getCurrentBoard())) {
QString path = findMassstoragePath("EEPROM.BIN"); QString path = findMassstoragePath("EEPROM.BIN");
if (path.isEmpty()) { if (path.isEmpty()) {
// On previous OpenTX we called the EEPROM file "TARANIS.BIN" :( // On previous OpenTX we called the EEPROM file "TARANIS.BIN" :(
@ -370,12 +371,12 @@ bool writeEeprom(const QString &filename, ProgressWidget *progress)
} }
} }
if (!IS_TARANIS(GetCurrentFirmware()->getBoard())) { if (!IS_TARANIS(getCurrentBoard())) {
FlashProcess flashProcess(getRadioInterfaceCmd(), getWriteEEpromCmd(filename), progress); FlashProcess flashProcess(getRadioInterfaceCmd(), getWriteEEpromCmd(filename), progress);
return flashProcess.run(); return flashProcess.run();
} }
if (IS_ARM(GetCurrentFirmware()->getBoard())) { if (IS_ARM(getCurrentBoard())) {
RadioNotFoundDialog dialog; RadioNotFoundDialog dialog;
dialog.exec(); dialog.exec();
} }

View file

@ -292,7 +292,7 @@ void SimulatorDialog::initUi(T * ui)
{ {
ui->setupUi(this); ui->setupUi(this);
windowName = tr("Simulating Radio (%1)").arg(GetCurrentFirmware()->getName()); windowName = tr("Simulating Radio (%1)").arg(getCurrentFirmware()->getName());
setWindowTitle(windowName); setWindowTitle(windowName);
lcd = ui->lcd; lcd = ui->lcd;
@ -424,7 +424,7 @@ void SimulatorDialog::setupOutputsDisplay()
tabWidget->insertTab(1, outputsWidget, QString(tr("Outputs"))); tabWidget->insertTab(1, outputsWidget, QString(tr("Outputs")));
// populate outputs // populate outputs
int outputs = std::min(32, GetCurrentFirmware()->getCapability(Outputs)); int outputs = std::min(32, getCurrentFirmware()->getCapability(Outputs));
int column = 0; int column = 0;
for (int i=0; i<outputs; i++) { for (int i=0; i<outputs; i++) {
QLabel * label = new QLabel(tabWidget); QLabel * label = new QLabel(tabWidget);
@ -457,7 +457,7 @@ void SimulatorDialog::setupOutputsDisplay()
} }
// populate logical switches // populate logical switches
int switches = GetCurrentFirmware()->getCapability(LogicalSwitches); int switches = getCurrentFirmware()->getCapability(LogicalSwitches);
int rows = switches / (switches > 16 ? 4 : 2); int rows = switches / (switches > 16 ? 4 : 2);
for (int i=0; i<switches; i++) { for (int i=0; i<switches; i++) {
QFrame * swtch = createLogicalSwitch(tabWidget, i, logicalSwitchLabels); QFrame * swtch = createLogicalSwitch(tabWidget, i, logicalSwitchLabels);
@ -467,8 +467,8 @@ void SimulatorDialog::setupOutputsDisplay()
void SimulatorDialog::setupGVarsDisplay() void SimulatorDialog::setupGVarsDisplay()
{ {
int fmodes = GetCurrentFirmware()->getCapability(FlightModes); int fmodes = getCurrentFirmware()->getCapability(FlightModes);
int gvars = GetCurrentFirmware()->getCapability(Gvars); int gvars = getCurrentFirmware()->getCapability(Gvars);
if (gvars>0) { if (gvars>0) {
// setup GVars tab // setup GVars tab
QWidget * gvarsWidget = new QWidget(); QWidget * gvarsWidget = new QWidget();
@ -539,7 +539,7 @@ void SimulatorDialog::onTimerEvent()
{ {
static unsigned int lcd_counter = 0; static unsigned int lcd_counter = 0;
if (!simulator->timer10ms()) { if (!simulator->timer10ms()) {
QMessageBox::critical(this, "Companion", tr("Firmware %1 error: %2").arg(GetCurrentFirmware()->getName()).arg(simulator->getError())); QMessageBox::critical(this, "Companion", tr("Firmware %1 error: %2").arg(getCurrentFirmware()->getName()).arg(simulator->getError()));
timer->stop(); timer->stop();
return; return;
} }
@ -593,8 +593,8 @@ void SimulatorDialog::onTimerEvent()
void SimulatorDialog::startCommon() void SimulatorDialog::startCommon()
{ {
lastPhase = -1; lastPhase = -1;
numGvars = GetCurrentFirmware()->getCapability(Gvars); numGvars = getCurrentFirmware()->getCapability(Gvars);
numFlightModes = GetCurrentFirmware()->getCapability(FlightModes); numFlightModes = getCurrentFirmware()->getCapability(FlightModes);
simulator->setVolumeGain(g.profile[radioProfileId].volumeGain()); simulator->setVolumeGain(g.profile[radioProfileId].volumeGain());
} }
@ -667,8 +667,8 @@ inline int chVal(int val)
void SimulatorDialog::setValues() void SimulatorDialog::setValues()
{ {
static const int numOutputs = GetCurrentFirmware()->getCapability(Outputs); static const int numOutputs = getCurrentFirmware()->getCapability(Outputs);
static const int numLogicalSwitches = GetCurrentFirmware()->getCapability(LogicalSwitches); static const int numLogicalSwitches = getCurrentFirmware()->getCapability(LogicalSwitches);
static TxOutputs prevOutputs; static TxOutputs prevOutputs;
static unsigned int prevPhase = -1; static unsigned int prevPhase = -1;

View file

@ -375,7 +375,7 @@ int main(int argc, char *argv[])
return finish(2); return finish(2);
} }
current_firmware_variant = GetFirmware(simOptions.firmwareId); current_firmware_variant = getFirmware(simOptions.firmwareId);
g.simuLastProfId(simOptions.profileId); g.simuLastProfId(simOptions.profileId);
g.lastSimulator(simOptions.firmwareId); g.lastSimulator(simOptions.firmwareId);

View file

@ -49,9 +49,9 @@ bool BinEepromFormat::load(RadioData & radioData)
bool BinEepromFormat::write(const RadioData & radioData) bool BinEepromFormat::write(const RadioData & radioData)
{ {
bool result; bool result;
EEPROMInterface * eepromInterface = GetEepromInterface(); EEPROMInterface * eepromInterface = getCurrentEEpromInterface();
uint8_t * eeprom = (uint8_t *)malloc(getEEpromSize(eepromInterface->getBoard())); uint8_t * eeprom = (uint8_t *)malloc(getEEpromSize(eepromInterface->getBoard()));
int eeprom_size = eepromInterface->save(eeprom, radioData, 0, GetCurrentFirmware()->getVariantNumber()); int eeprom_size = eepromInterface->save(eeprom, radioData, 0, getCurrentFirmware()->getVariantNumber());
if (eeprom_size) { if (eeprom_size) {
result = writeToFile(eeprom, eeprom_size); result = writeToFile(eeprom, eeprom_size);
} }

View file

@ -98,7 +98,6 @@ bool Storage::write(const RadioData & radioData)
bool convertEEprom(const QString & sourceEEprom, const QString & destinationEEprom, const QString & firmwareFilename) bool convertEEprom(const QString & sourceEEprom, const QString & destinationEEprom, const QString & firmwareFilename)
{ {
Firmware * currentFirmware = GetCurrentFirmware();
FirmwareInterface firmware(firmwareFilename); FirmwareInterface firmware(firmwareFilename);
if (!firmware.isValid()) if (!firmware.isValid())
return false; return false;
@ -112,7 +111,7 @@ bool convertEEprom(const QString & sourceEEprom, const QString & destinationEEpr
return false; return false;
QByteArray eeprom(EESIZE_MAX, 0); QByteArray eeprom(EESIZE_MAX, 0);
int size = currentFirmware->saveEEPROM((uint8_t *)eeprom.data(), *radioData, version, variant); int size = getCurrentEEpromInterface()->save((uint8_t *)eeprom.data(), *radioData, version, variant);
if (size == 0) { if (size == 0) {
return false; return false;
} }

View file

@ -60,7 +60,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 isTaranis = IS_TARANIS(GetEepromInterface()->getBoard()); bool isTaranis = IS_TARANIS(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++];
@ -89,7 +89,7 @@ void WizMix::addMix(ModelData &model, Input input, int weight, int channel, int
WizMix::operator ModelData() WizMix::operator ModelData()
{ {
int throttleChannel = -1; int throttleChannel = -1;
bool isTaranis = IS_TARANIS(GetEepromInterface()->getBoard()); bool isTaranis = IS_TARANIS(getCurrentBoard());
ModelData model; ModelData model;
model.used = true; model.used = true;