mirror of
https://github.com/EdgeTX/edgetx.git
synced 2025-07-24 00:35:14 +03:00
[Companion] Fixes
This commit is contained in:
parent
38c7f1c7d3
commit
1924d28be3
34 changed files with 297 additions and 325 deletions
|
@ -143,7 +143,7 @@ void AppPreferencesDialog::initSettings()
|
|||
ui->backLightColor->setCurrentIndex(g.backLight());
|
||||
ui->volumeGain->setValue(g.profile[g.id()].volumeGain() / 10.0);
|
||||
|
||||
if (IS_TARANIS(GetCurrentFirmware()->getBoard())) {
|
||||
if (IS_TARANIS(getCurrentBoard())) {
|
||||
ui->backLightColor->setEnabled(false);
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ void AppPreferencesDialog::initSettings()
|
|||
}
|
||||
ui->lblGeneralSettings->setText(hwSettings);
|
||||
|
||||
Firmware * current_firmware = GetCurrentFirmware();
|
||||
Firmware * current_firmware = getCurrentFirmware();
|
||||
|
||||
foreach(Firmware * firmware, firmwares) {
|
||||
ui->downloadVerCB->addItem(firmware->getName(), firmware->getId());
|
||||
|
@ -358,7 +358,7 @@ bool AppPreferencesDialog::displayImage(const QString & fileName)
|
|||
return false;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -427,7 +427,7 @@ Firmware * AppPreferencesDialog::getFirmwareVariant()
|
|||
id += QString("-") + ui->langCombo->currentText();
|
||||
}
|
||||
|
||||
return GetFirmware(id);
|
||||
return getFirmware(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@ burnConfigDialog::burnConfigDialog(QWidget *parent) :
|
|||
|
||||
getSettings();
|
||||
populateProgrammers();
|
||||
EEPROMInterface *eepromInterface = GetEepromInterface();
|
||||
if (IS_STM32(eepromInterface->getBoard())) {
|
||||
BoardEnum board = getCurrentBoard();
|
||||
if (IS_STM32(board)) {
|
||||
setWindowTitle(tr("DFU-UTIL Configuration"));
|
||||
ui->avrArgs->hide();
|
||||
ui->avrdude_location->hide();
|
||||
|
@ -60,7 +60,7 @@ burnConfigDialog::burnConfigDialog(QWidget *parent) :
|
|||
ui->samba_port->hide();
|
||||
ui->sb_browse->hide();
|
||||
}
|
||||
else if (IS_SKY9X(eepromInterface->getBoard())) {
|
||||
else if (IS_SKY9X(board)) {
|
||||
setWindowTitle(tr("SAM-BA Configuration"));
|
||||
ui->avrArgs->hide();
|
||||
ui->avrdude_location->hide();
|
||||
|
@ -328,13 +328,13 @@ void burnConfigDialog::on_pushButton_4_clicked()
|
|||
|
||||
void burnConfigDialog::on_advCtrChkB_toggled(bool checked)
|
||||
{
|
||||
EEPROMInterface *eepromInterface = GetEepromInterface();
|
||||
BoardEnum board = getCurrentBoard();
|
||||
if (checked) {
|
||||
if (IS_STM32(eepromInterface->getBoard())) {
|
||||
if (IS_STM32(board)) {
|
||||
ui->label_dfu2->show();
|
||||
ui->dfuArgs->show();
|
||||
}
|
||||
else if (IS_SKY9X(eepromInterface->getBoard())) {
|
||||
else if (IS_SKY9X(board)) {
|
||||
ui->label_sb2->show();
|
||||
ui->arm_mcu->show();
|
||||
}
|
||||
|
@ -347,11 +347,11 @@ void burnConfigDialog::on_advCtrChkB_toggled(bool checked)
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (IS_STM32(eepromInterface->getBoard())) {
|
||||
if (IS_STM32(board)) {
|
||||
ui->label_dfu2->hide();
|
||||
ui->dfuArgs->hide();
|
||||
}
|
||||
else if (IS_SKY9X(eepromInterface->getBoard())) {
|
||||
else if (IS_SKY9X(board)) {
|
||||
ui->label_sb2->hide();
|
||||
ui->arm_mcu->hide();
|
||||
}
|
||||
|
|
|
@ -103,7 +103,6 @@ int main(int argc, char *argv[])
|
|||
#endif
|
||||
|
||||
registerStorageFactories();
|
||||
registerEEpromInterfaces();
|
||||
registerOpenTxFirmwares();
|
||||
registerSimulators();
|
||||
|
||||
|
@ -118,7 +117,7 @@ int main(int argc, char *argv[])
|
|||
QPixmap pixmap = QPixmap(splashScreen);
|
||||
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();
|
||||
if (g.showSplash()) {
|
||||
|
|
|
@ -247,7 +247,7 @@ QString SensorData::unitString() const
|
|||
|
||||
bool RawSource::isTimeBased() const
|
||||
{
|
||||
if (IS_ARM(GetCurrentFirmware()->getBoard()))
|
||||
if (IS_ARM(getCurrentBoard()))
|
||||
return (type == SOURCE_TYPE_SPECIAL && index > 0);
|
||||
else
|
||||
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)
|
||||
{
|
||||
if (IS_ARM(GetCurrentFirmware()->getBoard()))
|
||||
if (IS_ARM(getCurrentBoard()))
|
||||
return float(value) * step;
|
||||
else
|
||||
return min + float(value) * step;
|
||||
|
@ -265,7 +265,7 @@ RawSourceRange RawSource::getRange(const ModelData * model, const GeneralSetting
|
|||
{
|
||||
RawSourceRange result;
|
||||
|
||||
Firmware * firmware = GetCurrentFirmware();
|
||||
Firmware * firmware = getCurrentFirmware();
|
||||
int board = firmware->getBoard();
|
||||
bool singleprec = (flags & RANGE_SINGLE_PRECISION);
|
||||
|
||||
|
@ -567,7 +567,7 @@ QString RawSource::toString(const ModelData * model) const
|
|||
case SOURCE_TYPE_LUA_OUTPUT:
|
||||
return QObject::tr("LUA%1%2").arg(index/16+1).arg(QChar('a'+index%16));
|
||||
case SOURCE_TYPE_STICK:
|
||||
return GetCurrentFirmware()->getAnalogInputName(index);
|
||||
return getCurrentFirmware()->getAnalogInputName(index);
|
||||
case SOURCE_TYPE_TRIM:
|
||||
return CHECK_IN_ARRAY(trims, index);
|
||||
case SOURCE_TYPE_ROTARY_ENCODER:
|
||||
|
@ -575,7 +575,7 @@ QString RawSource::toString(const ModelData * model) const
|
|||
case SOURCE_TYPE_MAX:
|
||||
return QObject::tr("MAX");
|
||||
case SOURCE_TYPE_SWITCH:
|
||||
return GetCurrentFirmware()->getSwitch(index).name;
|
||||
return getCurrentFirmware()->getSwitch(index).name;
|
||||
case SOURCE_TYPE_CUSTOM_SWITCH:
|
||||
return QObject::tr("L%1").arg(index+1);
|
||||
case SOURCE_TYPE_CYC:
|
||||
|
@ -587,7 +587,7 @@ QString RawSource::toString(const ModelData * model) const
|
|||
case SOURCE_TYPE_SPECIAL:
|
||||
return CHECK_IN_ARRAY(special, index);
|
||||
case SOURCE_TYPE_TELEMETRY:
|
||||
if (IS_ARM(GetEepromInterface()->getBoard())) {
|
||||
if (IS_ARM(getCurrentBoard())) {
|
||||
div_t qr = div(index, 3);
|
||||
QString result = QString(model ? model->sensorData[qr.quot].label : QString("[T%1]").arg(qr.quot+1));
|
||||
if (qr.rem) result += qr.rem == 1 ? "-" : "+";
|
||||
|
@ -607,14 +607,14 @@ bool RawSource::isPot() const
|
|||
{
|
||||
return (type == SOURCE_TYPE_STICK &&
|
||||
index >= CPN_MAX_STICKS &&
|
||||
index < CPN_MAX_STICKS+GetCurrentFirmware()->getCapability(Pots));
|
||||
index < CPN_MAX_STICKS+getCurrentFirmware()->getCapability(Pots));
|
||||
}
|
||||
|
||||
bool RawSource::isSlider() const
|
||||
{
|
||||
return (type == SOURCE_TYPE_STICK &&
|
||||
index >= CPN_MAX_STICKS+GetCurrentFirmware()->getCapability(Pots) &&
|
||||
index < CPN_MAX_STICKS+GetCurrentFirmware()->getCapability(Pots)+GetCurrentFirmware()->getCapability(Sliders));
|
||||
index >= CPN_MAX_STICKS+getCurrentFirmware()->getCapability(Pots) &&
|
||||
index < CPN_MAX_STICKS+getCurrentFirmware()->getCapability(Pots)+getCurrentFirmware()->getCapability(Sliders));
|
||||
}
|
||||
|
||||
QString RawSwitch::toString() const
|
||||
|
@ -655,12 +655,12 @@ QString RawSwitch::toString() const
|
|||
return QString("!") + RawSwitch(type, -index).toString();
|
||||
}
|
||||
else {
|
||||
BoardEnum board = GetEepromInterface()->getBoard();
|
||||
BoardEnum board = getCurrentBoard();
|
||||
switch(type) {
|
||||
case SWITCH_TYPE_SWITCH:
|
||||
if (IS_HORUS_OR_TARANIS(board)) {
|
||||
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 };
|
||||
return QString(sw.name) + QString(positions[qr.rem]);
|
||||
}
|
||||
|
@ -791,7 +791,7 @@ QString LogicalSwitchData::funcToString() const
|
|||
void CustomFunctionData::clear()
|
||||
{
|
||||
memset(this, 0, sizeof(CustomFunctionData));
|
||||
if (!GetCurrentFirmware()->getCapability(SafetyChannelCustomFunction)) {
|
||||
if (!getCurrentFirmware()->getCapability(SafetyChannelCustomFunction)) {
|
||||
func = FuncTrainer;
|
||||
}
|
||||
}
|
||||
|
@ -864,8 +864,8 @@ QString CustomFunctionData::funcToString() const
|
|||
void CustomFunctionData::populateResetParams(const ModelData * model, QComboBox * b, unsigned int value = 0)
|
||||
{
|
||||
int val = 0;
|
||||
Firmware * firmware = GetCurrentFirmware();
|
||||
BoardEnum board = GetEepromInterface()->getBoard();
|
||||
Firmware * firmware = getCurrentFirmware();
|
||||
BoardEnum board = firmware->getBoard();
|
||||
|
||||
b->addItem(QObject::tr("Timer1"), val++);
|
||||
b->addItem(QObject::tr("Timer2"), val++);
|
||||
|
@ -946,7 +946,7 @@ QString CustomFunctionData::paramToString(const ModelData * model) const
|
|||
return item.toString(model);
|
||||
}
|
||||
else if ((func==FuncPlayPrompt) || (func==FuncPlayBoth)) {
|
||||
if ( GetCurrentFirmware()->getCapability(VoicesAsNumbers)) {
|
||||
if ( getCurrentFirmware()->getCapability(VoicesAsNumbers)) {
|
||||
return QString("%1").arg(param);
|
||||
}
|
||||
else {
|
||||
|
@ -977,7 +977,7 @@ QString CustomFunctionData::repeatToString() const
|
|||
return "";
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -1070,13 +1070,13 @@ bool GeneralSettings::switchSourceAllowedTaranis(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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -1093,11 +1093,13 @@ GeneralSettings::GeneralSettings()
|
|||
calibSpanPos[i] = 0x180;
|
||||
}
|
||||
|
||||
for (int i=0; i<GetCurrentFirmware()->getCapability(FactoryInstalledSwitches); i++) {
|
||||
switchConfig[i] = GetCurrentFirmware()->getSwitch(i).type;
|
||||
Firmware * firmware = getCurrentFirmware();
|
||||
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)) {
|
||||
potConfig[0] = POT_WITH_DETENT;
|
||||
potConfig[1] = POT_MULTIPOS_SWITCH;
|
||||
|
@ -1136,7 +1138,7 @@ GeneralSettings::GeneralSettings()
|
|||
stickMode = g.profile[g.id()].defaultMode();
|
||||
|
||||
QString t_calib = g.profile[g.id()].stickPotCalib();
|
||||
int potsnum = GetCurrentFirmware()->getCapability(Pots);
|
||||
int potsnum = getCurrentFirmware()->getCapability(Pots);
|
||||
if (!t_calib.isEmpty()) {
|
||||
QString t_trainercalib=g.profile[g.id()].trainerCalib();
|
||||
int8_t t_txVoltageCalibration=(int8_t)g.profile[g.id()].txVoltageCalibration();
|
||||
|
@ -1290,7 +1292,7 @@ RawSourceRange FrSkyChannelData::getRange() const
|
|||
void FrSkyScreenData::clear()
|
||||
{
|
||||
memset(this, 0, sizeof(FrSkyScreenData));
|
||||
if (!IS_ARM(GetCurrentFirmware()->getBoard())) {
|
||||
if (!IS_ARM(getCurrentBoard())) {
|
||||
type = TELEMETRY_SCREEN_NUMBERS;
|
||||
}
|
||||
}
|
||||
|
@ -1421,7 +1423,7 @@ void ModelData::clearInputs()
|
|||
expoData[i].clear();
|
||||
|
||||
//clear all input names
|
||||
if (GetCurrentFirmware()->getCapability(VirtualInputs)) {
|
||||
if (getCurrentFirmware()->getCapability(VirtualInputs)) {
|
||||
for (int i=0; i<CPN_MAX_INPUTS; i++) {
|
||||
inputNames[i][0] = 0;
|
||||
}
|
||||
|
@ -1436,7 +1438,7 @@ void ModelData::clearMixes()
|
|||
|
||||
RadioData::RadioData()
|
||||
{
|
||||
models.resize(GetCurrentFirmware()->getCapability(Models));
|
||||
models.resize(getCurrentFirmware()->getCapability(Models));
|
||||
}
|
||||
|
||||
void ModelData::clear()
|
||||
|
@ -1448,7 +1450,7 @@ void ModelData::clear()
|
|||
moduleData[0].ppm.delay = 300;
|
||||
moduleData[1].ppm.delay = 300;
|
||||
moduleData[2].ppm.delay = 300;
|
||||
int board = GetEepromInterface()->getBoard();
|
||||
int board = getCurrentBoard();
|
||||
if (IS_HORUS_OR_TARANIS(board)) {
|
||||
moduleData[0].protocol = PULSES_PXX_XJT_X16;
|
||||
moduleData[1].protocol = PULSES_OFF;
|
||||
|
@ -1519,7 +1521,7 @@ QString removeAccents(const QString & str)
|
|||
|
||||
void ModelData::setDefaultInputs(const GeneralSettings & settings)
|
||||
{
|
||||
BoardEnum board = GetEepromInterface()->getBoard();
|
||||
BoardEnum board = getCurrentBoard();
|
||||
if (IS_ARM(board)) {
|
||||
for (int i=0; i<CPN_MAX_STICKS; i++) {
|
||||
ExpoData * expo = &expoData[i];
|
||||
|
@ -1534,7 +1536,7 @@ void ModelData::setDefaultInputs(const GeneralSettings & settings)
|
|||
|
||||
void ModelData::setDefaultMixes(const GeneralSettings & settings)
|
||||
{
|
||||
BoardEnum board = GetEepromInterface()->getBoard();
|
||||
BoardEnum board = getCurrentBoard();
|
||||
if (IS_ARM(board)) {
|
||||
setDefaultInputs(settings);
|
||||
}
|
||||
|
@ -1658,20 +1660,13 @@ ModelData ModelData::removeGlobalVars()
|
|||
int ModelData::getChannelsMax(bool forceExtendedLimits) const
|
||||
{
|
||||
if (forceExtendedLimits || extendedLimits)
|
||||
return IS_TARANIS(GetCurrentFirmware()->getBoard()) ? 150 : 125;
|
||||
return IS_TARANIS(getCurrentBoard()) ? 150 : 125;
|
||||
else
|
||||
return 100;
|
||||
}
|
||||
|
||||
QList<EEPROMInterface *> eepromInterfaces;
|
||||
|
||||
void registerEEpromInterfaces()
|
||||
{
|
||||
registerOpenTxEEpromInterfaces();
|
||||
// eepromInterfaces.push_back(new Ersky9xInterface());
|
||||
// eepromInterfaces.push_back(new Er9xInterface());
|
||||
}
|
||||
|
||||
void unregisterEEpromInterfaces()
|
||||
{
|
||||
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) {
|
||||
Firmware * result = firmware->getFirmwareVariant(id);
|
||||
|
@ -1849,9 +1844,9 @@ void Firmware::addOptions(Option options[])
|
|||
this->opts.push_back(opts);
|
||||
}
|
||||
|
||||
SimulatorInterface *GetCurrentFirmwareSimulator()
|
||||
SimulatorInterface * getCurrentSimulator()
|
||||
{
|
||||
QString firmwareId = GetCurrentFirmware()->getId();
|
||||
QString firmwareId = getCurrentFirmware()->getId();
|
||||
SimulatorFactory * factory = getSimulatorFactory(firmwareId);
|
||||
if (factory)
|
||||
return factory->create();
|
||||
|
@ -1859,7 +1854,8 @@ SimulatorInterface *GetCurrentFirmwareSimulator()
|
|||
return NULL;
|
||||
}
|
||||
|
||||
unsigned int getNumSubtypes(MultiModuleRFProtocols type) {
|
||||
unsigned int getNumSubtypes(MultiModuleRFProtocols type)
|
||||
{
|
||||
switch (type) {
|
||||
case MM_RF_PROTO_HISKY:
|
||||
case MM_RF_PROTO_SYMAX:
|
||||
|
|
|
@ -288,29 +288,28 @@ struct Option {
|
|||
class Firmware {
|
||||
|
||||
public:
|
||||
Firmware(const QString & id, const QString & name, const BoardEnum board, EEPROMInterface * eepromInterface):
|
||||
Firmware(const QString & id, const QString & name, BoardEnum board):
|
||||
id(id),
|
||||
name(name),
|
||||
board(board),
|
||||
eepromInterface(eepromInterface),
|
||||
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),
|
||||
name(name),
|
||||
board(board),
|
||||
eepromInterface(eepromInterface),
|
||||
variantBase(0),
|
||||
base(base)
|
||||
base(base),
|
||||
eepromInterface(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~Firmware()
|
||||
{
|
||||
delete eepromInterface;
|
||||
}
|
||||
|
||||
inline const Firmware * getFirmwareBase() const
|
||||
|
@ -318,12 +317,6 @@ class Firmware {
|
|||
return base ? base : this;
|
||||
}
|
||||
|
||||
// TODO needed?
|
||||
inline void setVariantBase(unsigned int variant)
|
||||
{
|
||||
variantBase = variant;
|
||||
}
|
||||
|
||||
virtual Firmware * getFirmwareVariant(const QString & id) { return NULL; }
|
||||
|
||||
unsigned int getVariantNumber();
|
||||
|
@ -336,37 +329,37 @@ class Firmware {
|
|||
|
||||
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 getReleaseNotesUrl() = 0;
|
||||
|
||||
virtual QString getFirmwareUrl() = 0;
|
||||
|
||||
inline BoardEnum getBoard() const
|
||||
BoardEnum getBoard() const
|
||||
{
|
||||
return board;
|
||||
}
|
||||
|
||||
inline QString getName() const
|
||||
void setEEpromInterface(EEPROMInterface * interface)
|
||||
{
|
||||
eepromInterface = interface;
|
||||
}
|
||||
|
||||
EEPROMInterface * getEEpromInterface()
|
||||
{
|
||||
return eepromInterface;
|
||||
}
|
||||
|
||||
QString getName() const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
inline QString getId() const
|
||||
QString getId() const
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
inline EEPROMInterface * getEepromInterface()
|
||||
{
|
||||
return eepromInterface;
|
||||
}
|
||||
|
||||
virtual int getCapability(Capability) = 0;
|
||||
|
||||
struct Switch {
|
||||
|
@ -380,8 +373,6 @@ class Firmware {
|
|||
|
||||
virtual QTime getMaxTimerStart() = 0;
|
||||
|
||||
virtual bool isTelemetrySourceAvailable(int source) = 0;
|
||||
|
||||
virtual int isAvailable(PulsesProtocol proto, int port=0) = 0;
|
||||
|
||||
const int getFlashSize();
|
||||
|
@ -395,9 +386,9 @@ class Firmware {
|
|||
QString id;
|
||||
QString name;
|
||||
BoardEnum board;
|
||||
EEPROMInterface * eepromInterface;
|
||||
unsigned int variantBase;
|
||||
Firmware * base;
|
||||
EEPROMInterface * eepromInterface;
|
||||
|
||||
private:
|
||||
Firmware();
|
||||
|
@ -408,18 +399,23 @@ extern QList<Firmware *> firmwares;
|
|||
extern Firmware * default_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;
|
||||
}
|
||||
|
||||
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)
|
||||
|
@ -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] : "???")
|
||||
|
||||
SimulatorInterface * GetCurrentFirmwareSimulator();
|
||||
|
||||
extern QList<EEPROMInterface *> eepromInterfaces;
|
||||
|
||||
bool loadFile(RadioData & radioData, const QString & filename);
|
||||
|
|
|
@ -3468,7 +3468,7 @@ void OpenTxModelData::afterImport()
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,9 +45,10 @@ size_t SizeOfArray(T(&)[N])
|
|||
return N;
|
||||
}
|
||||
|
||||
OpenTxEepromInterface::OpenTxEepromInterface(BoardEnum board):
|
||||
EEPROMInterface(board),
|
||||
efile(new RleFile())
|
||||
OpenTxEepromInterface::OpenTxEepromInterface(OpenTxFirmware * firmware):
|
||||
EEPROMInterface(firmware->getBoard()),
|
||||
efile(new RleFile()),
|
||||
firmware(firmware)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -215,28 +216,6 @@ bool OpenTxEepromInterface::saveModel(unsigned int index, ModelData &model, uint
|
|||
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)
|
||||
{
|
||||
std::cout << "trying " << getName() << " import...";
|
||||
|
@ -304,10 +283,16 @@ unsigned long OpenTxEepromInterface::load(RadioData &radioData, const uint8_t *
|
|||
}
|
||||
|
||||
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)) {
|
||||
std::cout << " ko\n";
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
if (getCurrentFirmware()->getCapability(Models) == 0) {
|
||||
radioData.models.resize(i);
|
||||
}
|
||||
return errors.to_ulong();
|
||||
}
|
||||
}
|
||||
|
@ -358,7 +343,7 @@ int OpenTxEepromInterface::save(uint8_t * eeprom, const RadioData & radioData, u
|
|||
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()) {
|
||||
result = saveModel<OpenTxModelData>(i, (ModelData &)radioData.models[i], version, variant);
|
||||
if (!result) {
|
||||
|
@ -397,7 +382,7 @@ int OpenTxEepromInterface::getSize(const ModelData &model)
|
|||
QByteArray tmp(EESIZE_MAX, 0);
|
||||
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;
|
||||
open9xModel.Export(eeprom);
|
||||
|
@ -416,7 +401,7 @@ int OpenTxEepromInterface::getSize(const GeneralSettings &settings)
|
|||
QByteArray tmp(EESIZE_MAX, 0);
|
||||
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();
|
||||
|
||||
QByteArray eeprom;
|
||||
|
@ -886,17 +871,6 @@ QTime OpenTxFirmware::getMaxTimerStart()
|
|||
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)
|
||||
{
|
||||
if (IS_HORUS_OR_TARANIS(board)) {
|
||||
|
@ -1269,6 +1243,17 @@ void addOpenTxLcdOptions(OpenTxFirmware * firmware)
|
|||
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()
|
||||
{
|
||||
OpenTxFirmware * firmware;
|
||||
|
@ -1296,31 +1281,31 @@ void registerOpenTxFirmwares()
|
|||
/* FrSky Taranis X9D+ board */
|
||||
firmware = new OpenTxFirmware("opentx-x9d+", QObject::tr("FrSky Taranis X9D+"), BOARD_TARANIS_X9DP);
|
||||
addOpenTxTaranisOptions(firmware);
|
||||
firmwares.push_back(firmware);
|
||||
registerOpenTxFirmware(firmware);
|
||||
|
||||
/* FrSky Taranis X9D board */
|
||||
firmware = new OpenTxFirmware("opentx-x9d", QObject::tr("FrSky Taranis X9D"), BOARD_TARANIS_X9D);
|
||||
firmware->addOption("haptic", QObject::tr("Haptic module installed"));
|
||||
addOpenTxTaranisOptions(firmware);
|
||||
firmwares.push_back(firmware);
|
||||
registerOpenTxFirmware(firmware);
|
||||
|
||||
/* FrSky Taranis X9E board */
|
||||
firmware = new OpenTxFirmware("opentx-x9e", QObject::tr("FrSky Taranis X9E"), BOARD_TARANIS_X9E);
|
||||
firmware->addOption("shutdownconfirm", QObject::tr("Confirmation before radio shutdown"));
|
||||
firmware->addOption("horussticks", QObject::tr("Horus gimbals installed (Hall sensors)"));
|
||||
addOpenTxTaranisOptions(firmware);
|
||||
firmwares.push_back(firmware);
|
||||
registerOpenTxFirmware(firmware);
|
||||
|
||||
/* FrSky X7 board */
|
||||
firmware = new OpenTxFirmware("opentx-x7", QObject::tr("FrSky Taranis X7"), BOARD_TARANIS_X7);
|
||||
addOpenTxTaranisOptions(firmware);
|
||||
firmwares.push_back(firmware);
|
||||
registerOpenTxFirmware(firmware);
|
||||
|
||||
/* FrSky Horus board */
|
||||
firmware = new OpenTxFirmware("opentx-horus", QObject::tr("FrSky Horus"), BOARD_HORUS);
|
||||
addOpenTxFrskyOptions(firmware);
|
||||
firmware->addOption("pcbdev", QObject::tr("Use ONLY with first DEV pcb version"));
|
||||
firmwares.push_back(firmware);
|
||||
registerOpenTxFirmware(firmware);
|
||||
|
||||
/* 9XR-Pro */
|
||||
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("sqt5font", QObject::tr("Use alternative SQT5 font"));
|
||||
addOpenTxCommonOptions(firmware);
|
||||
firmwares.push_back(firmware);
|
||||
registerOpenTxFirmware(firmware);
|
||||
|
||||
/* 9XR board with M128 chip */
|
||||
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("sqt5font", QObject::tr("Use alternative SQT5 font"));
|
||||
addOpenTxCommonOptions(firmware);
|
||||
firmwares.push_back(firmware);
|
||||
registerOpenTxFirmware(firmware);
|
||||
|
||||
/* 9XR board */
|
||||
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("sqt5font", QObject::tr("Use alternative SQT5 font"));
|
||||
addOpenTxCommonOptions(firmware);
|
||||
firmwares.push_back(firmware);
|
||||
registerOpenTxFirmware(firmware);
|
||||
|
||||
/* 9x board */
|
||||
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("sqt5font", QObject::tr("Use alternative SQT5 font"));
|
||||
addOpenTxCommonOptions(firmware);
|
||||
firmwares.push_back(firmware);
|
||||
registerOpenTxFirmware(firmware);
|
||||
|
||||
/* 9x board with M128 chip */
|
||||
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("sqt5font", QObject::tr("Use alternative SQT5 font"));
|
||||
addOpenTxCommonOptions(firmware);
|
||||
firmwares.push_back(firmware);
|
||||
registerOpenTxFirmware(firmware);
|
||||
|
||||
/* ar9x board */
|
||||
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("volume", QObject::tr("i2c volume control added"));
|
||||
addOpenTxCommonOptions(firmware);
|
||||
firmwares.push_back(firmware);
|
||||
registerOpenTxFirmware(firmware);
|
||||
|
||||
/* Sky9x board */
|
||||
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("sqt5font", QObject::tr("Use alternative SQT5 font"));
|
||||
addOpenTxCommonOptions(firmware);
|
||||
firmwares.push_back(firmware);
|
||||
registerOpenTxFirmware(firmware);
|
||||
|
||||
/* Gruvin9x board */
|
||||
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("sqt5font", QObject::tr("Use alternative SQT5 font"));
|
||||
addOpenTxCommonOptions(firmware);
|
||||
firmwares.push_back(firmware);
|
||||
registerOpenTxFirmware(firmware);
|
||||
|
||||
/* MEGA2560 board */
|
||||
firmware = new OpenTxFirmware("opentx-mega2560", QObject::tr("DIY MEGA2560 radio"), BOARD_MEGA2560);
|
||||
|
@ -1572,9 +1557,9 @@ void registerOpenTxFirmwares()
|
|||
firmware->addOption("imperial", QObject::tr("Imperial units"));
|
||||
firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -1599,7 +1584,7 @@ bool loadFromByteArray(T & dest, const QByteArray & data)
|
|||
template <class T, class M>
|
||||
bool saveToByteArray(const T & dest, QByteArray & data)
|
||||
{
|
||||
BoardEnum board = GetCurrentFirmware()->getBoard();
|
||||
BoardEnum board = getCurrentBoard();
|
||||
foreach(OpenTxEepromInterface * eepromInterface, opentxEEpromInterfaces) {
|
||||
if (eepromInterface->getBoard() == board) {
|
||||
return eepromInterface->saveToByteArray<T, M>(dest, data);
|
||||
|
|
|
@ -24,12 +24,13 @@
|
|||
#include "eeprominterface.h"
|
||||
|
||||
class RleFile;
|
||||
class OpenTxFirmware;
|
||||
|
||||
class OpenTxEepromInterface : public EEPROMInterface
|
||||
{
|
||||
public:
|
||||
|
||||
OpenTxEepromInterface(BoardEnum board);
|
||||
OpenTxEepromInterface(OpenTxFirmware * firmware);
|
||||
|
||||
virtual ~OpenTxEepromInterface();
|
||||
|
||||
|
@ -79,18 +80,21 @@ class OpenTxEepromInterface : public EEPROMInterface
|
|||
|
||||
RleFile * efile;
|
||||
|
||||
OpenTxFirmware * firmware;
|
||||
|
||||
};
|
||||
|
||||
class OpenTxFirmware: public Firmware
|
||||
{
|
||||
public:
|
||||
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):
|
||||
Firmware(id, name, board, new OpenTxEepromInterface(board))
|
||||
Firmware(id, name, board)
|
||||
{
|
||||
addLanguage("en");
|
||||
addLanguage("cz");
|
||||
|
@ -133,8 +137,6 @@ class OpenTxFirmware: public Firmware
|
|||
|
||||
virtual QTime getMaxTimerStart();
|
||||
|
||||
virtual bool isTelemetrySourceAvailable(int source);
|
||||
|
||||
virtual int isAvailable(PulsesProtocol proto, int port=0);
|
||||
|
||||
protected:
|
||||
|
@ -145,7 +147,6 @@ class OpenTxFirmware: public Firmware
|
|||
|
||||
void registerOpenTxFirmwares();
|
||||
void unregisterOpenTxFirmwares();
|
||||
void registerOpenTxEEpromInterfaces();
|
||||
|
||||
extern QList<OpenTxEepromInterface *> opentxEEpromInterfaces;
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ bool FlashEEpromDialog::patchCalibration()
|
|||
{
|
||||
QString calib = g.profile[g.id()].stickPotCalib();
|
||||
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 txCurrentCalibration = (int8_t) g.profile[g.id()].txCurrentCalibration();
|
||||
int8_t PPM_Multiplier = (int8_t) g.profile[g.id()].ppmMultiplier();
|
||||
|
@ -223,8 +223,8 @@ void FlashEEpromDialog::on_burnButton_clicked()
|
|||
if (patch) {
|
||||
QString filename = generateProcessUniqueTempFileName("temp.bin");
|
||||
QFile file(filename);
|
||||
uint8_t *eeprom = (uint8_t*)malloc(getEEpromSize(GetCurrentFirmware()->getBoard()));
|
||||
int eeprom_size = GetEepromInterface()->save(eeprom, *radioData, 0, GetCurrentFirmware()->getVariantNumber());
|
||||
uint8_t *eeprom = (uint8_t*)malloc(getEEpromSize(getCurrentBoard()));
|
||||
int eeprom_size = getCurrentEEpromInterface()->save(eeprom, *radioData, 0, getCurrentFirmware()->getVariantNumber());
|
||||
if (!eeprom_size) {
|
||||
QMessageBox::warning(this, tr("Error"), tr("Cannot write file %1:\n%2.").arg(filename).arg(file.errorString()));
|
||||
return;
|
||||
|
|
|
@ -54,7 +54,7 @@ fwName(g.profile[g.id()].fwName())
|
|||
ui->useProfileSplash->setDisabled(true);
|
||||
}
|
||||
|
||||
if (IS_STM32(GetEepromInterface()->getBoard())) {
|
||||
if (IS_STM32(getCurrentBoard())) {
|
||||
// No backup on Taranis ... could be done if in massstorage
|
||||
ui->backupEEprom->hide();
|
||||
ui->backupEEprom->setCheckState(Qt::Unchecked);
|
||||
|
|
|
@ -35,7 +35,7 @@ FirmwarePreferencesDialog::FirmwarePreferencesDialog(QWidget *parent) :
|
|||
setWindowIcon(CompanionIcon("fwpreferences.png"));
|
||||
initSettings();
|
||||
|
||||
foreach(const char *lang, GetCurrentFirmware()->getFirmwareBase()->ttslanguages) {
|
||||
foreach(const char *lang, getCurrentFirmware()->getFirmwareBase()->ttslanguages) {
|
||||
ui->voiceCombo->addItem(lang);
|
||||
if (current_firmware_variant->getId().contains(QString("-tts%1").arg(lang)))
|
||||
ui->voiceCombo->setCurrentIndex(ui->voiceCombo->count() - 1);
|
||||
|
|
|
@ -44,7 +44,7 @@ CalibrationPanel::CalibrationPanel(QWidget * parent, GeneralSettings & generalSe
|
|||
headerLabels << QObject::tr("Negative span") << QObject::tr("Mid value") << QObject::tr("Positive span");
|
||||
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);
|
||||
|
||||
for(int i = 0; i < rows; ++i) {
|
||||
|
|
|
@ -101,8 +101,8 @@ void GeneralEdit::on_calretrieve_PB_clicked()
|
|||
{
|
||||
int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt();
|
||||
QString calib=g.profile[profile_id].stickPotCalib();
|
||||
int potsnum=GetCurrentFirmware()->getCapability(Pots)+GetCurrentFirmware()->getCapability(Sliders);
|
||||
int numSwPots=GetCurrentFirmware()->getCapability(Switches)+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);
|
||||
if (calib.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ void GeneralEdit::on_calretrieve_PB_clicked()
|
|||
generalSettings.txCurrentCalibration=txCurrentCalibration;
|
||||
generalSettings.txVoltageCalibration=txVoltageCalibration;
|
||||
generalSettings.vBatWarn=vBatWarn;
|
||||
if (GetCurrentFirmware()->getCapability(HasBatMeterRange)) {
|
||||
if (getCurrentFirmware()->getCapability(HasBatMeterRange)) {
|
||||
generalSettings.vBatMin = (int8_t) g.profile[profile_id].vBatMin();
|
||||
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();
|
||||
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);
|
||||
byte16=(int16_t)Byte.toInt(&ok,16);
|
||||
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());
|
||||
}
|
||||
}
|
||||
offset = GetCurrentFirmware()->getCapability(Switches);
|
||||
for (int i=0; i<(GetCurrentFirmware()->getCapability(Pots)); i++) {
|
||||
offset = getCurrentFirmware()->getCapability(Switches);
|
||||
for (int i=0; i<(getCurrentFirmware()->getCapability(Pots)); i++) {
|
||||
Byte=hwtypes.mid(i+offset,1);
|
||||
byte16=(int16_t)Byte.toInt(&ok,16);
|
||||
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());
|
||||
}
|
||||
}
|
||||
offset += GetCurrentFirmware()->getCapability(Pots);
|
||||
for (int i=0; i<(GetCurrentFirmware()->getCapability(Sliders)); i++) {
|
||||
offset += getCurrentFirmware()->getCapability(Pots);
|
||||
for (int i=0; i<(getCurrentFirmware()->getCapability(Sliders)); i++) {
|
||||
Byte=hwtypes.mid(i+offset,1);
|
||||
byte16=(int16_t)Byte.toInt(&ok,16);
|
||||
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();
|
||||
|
||||
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()) {
|
||||
ui->calstore_PB->setDisabled(true);
|
||||
return;
|
||||
|
@ -279,15 +279,15 @@ void GeneralEdit::on_calstore_PB_clicked()
|
|||
for (int i=0; i<CPN_MAX_STICKS; i++) {
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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].txCurrentCalibration( generalSettings.txCurrentCalibration );
|
||||
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].vBatMax( generalSettings.vBatMax );
|
||||
}
|
||||
|
|
|
@ -207,7 +207,7 @@ ui(new Ui::GeneralSetup)
|
|||
ui->memwarnChkB->setChecked(!generalSettings.disableMemoryWarning); //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->splashScreenDuration->setCurrentIndex(3-generalSettings.splashDuration);
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ ui(new Ui::GeneralSetup)
|
|||
}
|
||||
ui->blAlarm_ChkB->setChecked(generalSettings.flashBeep);
|
||||
|
||||
if (!GetCurrentFirmware()->getCapability(HasBatMeterRange)) {
|
||||
if (!firmware->getCapability(HasBatMeterRange)) {
|
||||
ui->batMeterRangeLabel->hide();
|
||||
ui->HasBatMeterMinRangeLabel->hide();
|
||||
ui->HasBatMeterMaxRangeLabel->hide();
|
||||
|
@ -365,7 +365,7 @@ void GeneralSetupPanel::setValues()
|
|||
ui->beeperCB->setCurrentIndex(generalSettings.beeperMode+2);
|
||||
ui->channelorderCB->setCurrentIndex(generalSettings.templateSetup);
|
||||
ui->stickmodeCB->setCurrentIndex(generalSettings.stickMode);
|
||||
if (GetCurrentFirmware()->getCapability(Haptic)) {
|
||||
if (firmware->getCapability(Haptic)) {
|
||||
ui->hapticLengthCB->setCurrentIndex(generalSettings.hapticLength+2);
|
||||
}
|
||||
else {
|
||||
|
@ -380,7 +380,7 @@ void GeneralSetupPanel::setValues()
|
|||
ui->hapticStrength->setValue(generalSettings.hapticStrength);
|
||||
ui->hapticmodeCB->setCurrentIndex(generalSettings.hapticMode+2);
|
||||
|
||||
if (GetCurrentFirmware()->getCapability(HasBatMeterRange)) {
|
||||
if (firmware->getCapability(HasBatMeterRange)) {
|
||||
ui->vBatMinDSB->setValue((double)(generalSettings.vBatMin + 90) / 10);
|
||||
ui->vBatMaxDSB->setValue((double)(generalSettings.vBatMax + 120) / 10);
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ void getFileComboBoxValue(QComboBox * b, char * dest, int length)
|
|||
|
||||
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)
|
||||
b->addItem(QObject::tr("!Flight mode %1").arg(-i-1), i);
|
||||
else if (i > 0)
|
||||
|
@ -123,7 +123,7 @@ void populatePhasesCB(QComboBox *b, int value)
|
|||
else
|
||||
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):
|
||||
|
@ -138,7 +138,7 @@ GVarGroup::GVarGroup(QCheckBox * weightGV, QAbstractSpinBox * weightSB, QComboBo
|
|||
lock(true),
|
||||
panel(panel)
|
||||
{
|
||||
if (allowGvars && GetCurrentFirmware()->getCapability(Gvars)) {
|
||||
if (allowGvars && getCurrentFirmware()->getCapability(Gvars)) {
|
||||
populateGVCB(*weightCB, weight, model);
|
||||
connect(weightGV, SIGNAL(stateChanged(int)), this, SLOT(gvarCBChanged(int)));
|
||||
connect(weightCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
|
||||
|
@ -242,7 +242,7 @@ void CurveGroup::update()
|
|||
curveTypeCB->setCurrentIndex(found);
|
||||
|
||||
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) {
|
||||
curveGVarCB->setChecked(true);
|
||||
if (lastType != CurveReference::CURVE_REF_DIFF && lastType != CurveReference::CURVE_REF_EXPO) {
|
||||
|
@ -278,7 +278,7 @@ void CurveGroup::update()
|
|||
break;
|
||||
case CurveReference::CURVE_REF_CUSTOM:
|
||||
{
|
||||
int numcurves = GetCurrentFirmware()->getCapability(NumCurves);
|
||||
int numcurves = getCurrentFirmware()->getCapability(NumCurves);
|
||||
if (lastType != curve.type) {
|
||||
lastType = curve.type;
|
||||
curveValueCB->clear();
|
||||
|
@ -367,7 +367,7 @@ void CurveGroup::valuesChanged()
|
|||
void populateGvarUseCB(QComboBox *b, unsigned int phase)
|
||||
{
|
||||
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) {
|
||||
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)
|
||||
{
|
||||
BoardEnum board = GetCurrentFirmware()->getBoard();
|
||||
BoardEnum board = getCurrentBoard();
|
||||
RawSwitch item;
|
||||
|
||||
b->clear();
|
||||
|
@ -384,7 +384,7 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
|
|||
if (context != MixesContext && context != GlobalFunctionsContext) {
|
||||
// !FMx
|
||||
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);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
|
@ -393,14 +393,14 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
|
|||
}
|
||||
|
||||
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);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
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);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
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);
|
||||
}
|
||||
|
||||
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) {
|
||||
for (int j=-GetCurrentFirmware()->getCapability(MultiposPotsPositions); j<0; j++) {
|
||||
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, -i*GetCurrentFirmware()->getCapability(MultiposPotsPositions)+j);
|
||||
for (int j=-getCurrentFirmware()->getCapability(MultiposPotsPositions); j<0; j++) {
|
||||
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, -i*getCurrentFirmware()->getCapability(MultiposPotsPositions)+j);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
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);
|
||||
if (IS_HORUS_OR_TARANIS(board) && !generalSettings.switchPositionAllowedTaranis(i)) {
|
||||
continue;
|
||||
|
@ -444,7 +444,7 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
|
|||
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);
|
||||
if (IS_HORUS_OR_TARANIS(board) && !generalSettings.switchPositionAllowedTaranis(i)) {
|
||||
continue;
|
||||
|
@ -453,10 +453,10 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
|
|||
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) {
|
||||
for (int j=1; j<=GetCurrentFirmware()->getCapability(MultiposPotsPositions); j++) {
|
||||
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i*GetCurrentFirmware()->getCapability(MultiposPotsPositions)+j);
|
||||
for (int j=1; j<=getCurrentFirmware()->getCapability(MultiposPotsPositions); j++) {
|
||||
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i*getCurrentFirmware()->getCapability(MultiposPotsPositions)+j);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
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);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
|
@ -497,7 +497,7 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
|
|||
// FMx
|
||||
if (context != MixesContext && context != GlobalFunctionsContext) {
|
||||
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);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
|
@ -514,7 +514,7 @@ void populateGVCB(QComboBox & b, int value, const ModelData & model)
|
|||
|
||||
b.clear();
|
||||
|
||||
int count = GetCurrentFirmware()->getCapability(Gvars);
|
||||
int count = getCurrentFirmware()->getCapability(Gvars);
|
||||
for (int i=-count; i<=-1; i++) {
|
||||
int16_t gval = (int16_t)(-10000+i);
|
||||
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)
|
||||
{
|
||||
BoardEnum board = GetCurrentFirmware()->getBoard();
|
||||
BoardEnum board = getCurrentBoard();
|
||||
RawSource item;
|
||||
|
||||
b->clear();
|
||||
|
@ -558,8 +558,8 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
|
|||
}
|
||||
|
||||
if (flags & POPULATE_SCRIPT_OUTPUTS) {
|
||||
for (int i=0; i<GetCurrentFirmware()->getCapability(LuaScripts); i++) {
|
||||
for (int j=0; j<GetCurrentFirmware()->getCapability(LuaOutputsPerScript); j++) {
|
||||
for (int i=0; i<getCurrentFirmware()->getCapability(LuaScripts); i++) {
|
||||
for (int j=0; j<getCurrentFirmware()->getCapability(LuaOutputsPerScript); j++) {
|
||||
item = RawSource(SOURCE_TYPE_LUA_OUTPUT, i*16+j);
|
||||
b->addItem(item.toString(model), item.toValue());
|
||||
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)) {
|
||||
int virtualInputs = GetCurrentFirmware()->getCapability(VirtualInputs);
|
||||
int virtualInputs = getCurrentFirmware()->getCapability(VirtualInputs);
|
||||
for (int i=0; i<virtualInputs; i++) {
|
||||
if (model->isInputValid(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) {
|
||||
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);
|
||||
// skip unavailable pots and sliders
|
||||
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());
|
||||
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);
|
||||
b->addItem(item.toString(model), item.toValue());
|
||||
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) {
|
||||
for (int i=0; i<GetCurrentFirmware()->getCapability(Switches); i++) {
|
||||
for (int i=0; i<getCurrentFirmware()->getCapability(Switches); i++) {
|
||||
item = RawSource(SOURCE_TYPE_SWITCH, i);
|
||||
b->addItem(item.toString(model), item.toValue());
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
b->addItem(item.toString(model), item.toValue());
|
||||
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);
|
||||
}
|
||||
|
||||
for (int i=0; i<GetCurrentFirmware()->getCapability(TrainerInputs); i++) {
|
||||
for (int i=0; i<getCurrentFirmware()->getCapability(TrainerInputs); i++) {
|
||||
item = RawSource(SOURCE_TYPE_PPM, i);
|
||||
b->addItem(item.toString(model), item.toValue());
|
||||
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);
|
||||
b->addItem(item.toString(model), item.toValue());
|
||||
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 (IS_ARM(GetCurrentFirmware()->getBoard())) {
|
||||
if (IS_ARM(getCurrentBoard())) {
|
||||
for (int i=0; i<5; ++i) {
|
||||
item = RawSource(SOURCE_TYPE_SPECIAL, i);
|
||||
b->addItem(item.toString(model), item.toValue());
|
||||
|
@ -667,9 +667,9 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
|
|||
}
|
||||
else {
|
||||
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;
|
||||
if (i==TELEMETRY_SOURCE_SWR && !GetCurrentFirmware()->getCapability(SportTelemetry))
|
||||
if (i==TELEMETRY_SOURCE_SWR && !getCurrentFirmware()->getCapability(SportTelemetry))
|
||||
continue;
|
||||
if (i==TELEMETRY_SOURCE_TIMER3 && !IS_ARM(board))
|
||||
continue;
|
||||
|
@ -681,7 +681,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
|
|||
}
|
||||
|
||||
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);
|
||||
b->addItem(item.toString(model), item.toValue());
|
||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
||||
|
@ -752,7 +752,7 @@ QString getFrSkyProtocol(int protocol)
|
|||
{
|
||||
switch(protocol) {
|
||||
case 2:
|
||||
if ((GetCurrentFirmware()->getCapability(Telemetry) & TM_HASWSHH))
|
||||
if ((getCurrentFirmware()->getCapability(Telemetry) & TM_HASWSHH))
|
||||
return QObject::tr("Winged Shadow How High");
|
||||
else
|
||||
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)
|
||||
{
|
||||
QString settingsPath;
|
||||
Firmware * firmware = GetCurrentFirmware();
|
||||
SimulatorInterface * simulator = GetCurrentFirmwareSimulator();
|
||||
Firmware * firmware = getCurrentFirmware();
|
||||
SimulatorInterface * simulator = getCurrentSimulator();
|
||||
if (simulator) {
|
||||
#if defined(WIN32) && defined(WIN_USE_CONSOLE_STDIO)
|
||||
AllocConsole();
|
||||
|
@ -833,7 +833,7 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
|
|||
if (radioData.generalSettings.stickMode & 1) {
|
||||
flags |= SIMULATOR_FLAGS_STICK_MODE_LEFT;
|
||||
}
|
||||
BoardEnum board = GetCurrentFirmware()->getBoard();
|
||||
BoardEnum board = getCurrentBoard();
|
||||
SimulatorDialog * dialog;
|
||||
|
||||
if (board == BOARD_HORUS) {
|
||||
|
@ -850,12 +850,12 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
|
|||
else if (board == BOARD_FLAMENCO) {
|
||||
dialog = new SimulatorDialogFlamenco(parent, simulator, flags);
|
||||
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(), "");
|
||||
dialog->start(eeprom);
|
||||
}
|
||||
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)) {
|
||||
flags |= (SIMULATOR_FLAGS_S1 << i);
|
||||
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);
|
||||
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();
|
||||
simulator->setSdPath(g.profile[g.id()].sdPath(), "");
|
||||
dialog->start(eeprom);
|
||||
|
@ -873,7 +873,7 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
|
|||
else {
|
||||
dialog = new SimulatorDialog9X(parent, simulator, flags);
|
||||
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.
|
||||
dialog->start(eeprom);
|
||||
}
|
||||
|
@ -900,7 +900,7 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
|
|||
|
||||
QPixmap makePixMap(const QImage & image)
|
||||
{
|
||||
Firmware * firmware = GetCurrentFirmware();
|
||||
Firmware * firmware = getCurrentFirmware();
|
||||
QImage result = image.scaled(firmware->getCapability(LcdWidth), firmware->getCapability(LcdHeight));
|
||||
if (firmware->getCapability(LcdDepth) == 4) {
|
||||
result = result.convertToFormat(QImage::Format_RGB32);
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
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
|
||||
//NOTICE! => 1..4 -> 1..4
|
||||
|
|
|
@ -137,7 +137,7 @@ MainWindow::MainWindow():
|
|||
if (fileType==STORAGE_TYPE_EEPE || fileType==STORAGE_TYPE_EEPM || fileType==STORAGE_TYPE_BIN) {
|
||||
MdiChild * child = createMdiChild();
|
||||
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);
|
||||
child->show();
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ void MainWindow::checkForUpdates()
|
|||
}
|
||||
else if (checkForUpdatesState & CHECK_FIRMWARE) {
|
||||
checkForUpdatesState -= CHECK_FIRMWARE;
|
||||
QString stamp = GetCurrentFirmware()->getStampUrl();
|
||||
QString stamp = getCurrentFirmware()->getStampUrl();
|
||||
if (!stamp.isEmpty()) {
|
||||
networkManager = new QNetworkAccessManager(this);
|
||||
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());
|
||||
|
||||
if (currentVersion == 0) {
|
||||
QString rn = GetCurrentFirmware()->getReleaseNotesUrl();
|
||||
QString rn = getCurrentFirmware()->getReleaseNotesUrl();
|
||||
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));
|
||||
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
|
||||
|
@ -441,7 +441,7 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
|
|||
}
|
||||
}
|
||||
else if (version > currentVersion) {
|
||||
QString rn = GetCurrentFirmware()->getReleaseNotesUrl();
|
||||
QString rn = getCurrentFirmware()->getReleaseNotesUrl();
|
||||
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));
|
||||
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
|
||||
int profnum = action->data().toInt();
|
||||
g.id(profnum);
|
||||
current_firmware_variant = GetFirmware(g.profile[g.id()].fwType());
|
||||
current_firmware_variant = getFirmware(g.profile[g.id()].fwType());
|
||||
emit FirmwareChanged();
|
||||
updateMenus();
|
||||
}
|
||||
|
@ -673,7 +673,7 @@ void MainWindow::changelog()
|
|||
|
||||
void MainWindow::fwchangelog()
|
||||
{
|
||||
Firmware * firmware = GetCurrentFirmware();
|
||||
Firmware * firmware = getCurrentFirmware();
|
||||
QString url = firmware->getReleaseNotesUrl();
|
||||
if (url.isEmpty()) {
|
||||
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()
|
||||
{
|
||||
if (GetCurrentFirmware()->getBoard()== BOARD_HORUS) {
|
||||
if (getCurrentBoard()== BOARD_HORUS) {
|
||||
qDebug() << "TODO readEEPROM HORUS";
|
||||
}
|
||||
else {
|
||||
QString tempFile;
|
||||
|
||||
EEPROMInterface * eepromInterface = GetEepromInterface();
|
||||
|
||||
if (IS_ARM(eepromInterface->getBoard()))
|
||||
BoardEnum board = getCurrentBoard();
|
||||
if (IS_ARM(board))
|
||||
tempFile = generateProcessUniqueTempFileName("temp.bin");
|
||||
else
|
||||
tempFile += generateProcessUniqueTempFileName("temp.hex");
|
||||
|
@ -836,7 +835,7 @@ void MainWindow::burnFuses()
|
|||
|
||||
void MainWindow::compare()
|
||||
{
|
||||
CompareDialog *fd = new CompareDialog(this,GetCurrentFirmware());
|
||||
CompareDialog *fd = new CompareDialog(this,getCurrentFirmware());
|
||||
fd->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
fd->show();
|
||||
}
|
||||
|
@ -896,7 +895,7 @@ void MainWindow::updateMenus()
|
|||
updateLanguageActions();
|
||||
updateIconSizeActions();
|
||||
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()
|
||||
|
@ -1120,8 +1119,7 @@ void MainWindow::createMenus()
|
|||
burnMenu->addAction(readFlashAct);
|
||||
burnMenu->addSeparator();
|
||||
burnMenu->addSeparator();
|
||||
EEPROMInterface *eepromInterface = GetEepromInterface();
|
||||
if (!IS_ARM(eepromInterface->getBoard())) {
|
||||
if (!IS_ARM(getCurrentBoard())) {
|
||||
burnMenu->addAction(burnFusesAct);
|
||||
burnMenu->addAction(burnListAct);
|
||||
}
|
||||
|
@ -1410,7 +1408,7 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event)
|
|||
|
||||
void MainWindow::dropEvent(QDropEvent *event)
|
||||
{
|
||||
if(GetCurrentFirmware()->getBoard()== BOARD_HORUS)
|
||||
if(getCurrentBoard()== BOARD_HORUS)
|
||||
return;
|
||||
QList<QUrl> urls = event->mimeData()->urls();
|
||||
if (urls.isEmpty())
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
MdiChild::MdiChild(MainWindow * parent):
|
||||
QWidget(),
|
||||
ui(new Ui::MdiChild),
|
||||
firmware(GetCurrentFirmware()),
|
||||
firmware(getCurrentFirmware()),
|
||||
isUntitled(true),
|
||||
fileChanged(false)
|
||||
{
|
||||
|
@ -157,7 +157,7 @@ void MdiChild::showModelsListContextMenu(const QPoint & pos)
|
|||
void MdiChild::onFirmwareChanged()
|
||||
{
|
||||
Firmware * previous = firmware;
|
||||
firmware = GetCurrentFirmware();
|
||||
firmware = getCurrentFirmware();
|
||||
qDebug() << "onFirmwareChanged" << previous->getName() << "=>" << firmware->getName();
|
||||
|
||||
BoardEnum board = firmware->getBoard();
|
||||
|
@ -453,7 +453,7 @@ bool MdiChild::save()
|
|||
bool MdiChild::saveAs(bool isNew)
|
||||
{
|
||||
QString fileName;
|
||||
if (IS_SKY9X(GetEepromInterface()->getBoard())) {
|
||||
if (IS_SKY9X(getCurrentBoard())) {
|
||||
curFile.replace(".eepe", ".bin");
|
||||
QFileInfo fi(curFile);
|
||||
#ifdef __APPLE__
|
||||
|
@ -481,7 +481,7 @@ bool MdiChild::saveAs(bool isNew)
|
|||
|
||||
bool MdiChild::saveFile(const QString & filename, bool setCurrent)
|
||||
{
|
||||
BoardEnum board = GetEepromInterface()->getBoard();
|
||||
BoardEnum board = getCurrentBoard();
|
||||
QString path = filename;
|
||||
if (IS_SKY9X(board)) {
|
||||
path.replace(".eepe", ".bin");
|
||||
|
|
|
@ -101,7 +101,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
|||
headerLabels << tr("Name");
|
||||
}
|
||||
headerLabels << tr("Subtrim") << tr("Min") << tr("Max") << tr("Direction");
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard()))
|
||||
if (IS_TARANIS(firmware->getBoard()))
|
||||
headerLabels << tr("Curve");
|
||||
if (firmware->getCapability(PPMCenter))
|
||||
headerLabels << tr("PPM Center");
|
||||
|
@ -150,7 +150,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
|||
tableLayout->addWidget(i, col++, invCB);
|
||||
|
||||
// Curve
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
if (IS_TARANIS(firmware->getBoard())) {
|
||||
QComboBox * curveCB = new QComboBox(this);
|
||||
curveCB->setProperty("index", i);
|
||||
int numcurves = firmware->getCapability(NumCurves);
|
||||
|
|
|
@ -26,7 +26,7 @@ RepeatComboBox::RepeatComboBox(QWidget *parent, int & repeatParam):
|
|||
QComboBox(parent),
|
||||
repeatParam(repeatParam)
|
||||
{
|
||||
unsigned int step = IS_ARM(GetEepromInterface()->getBoard()) ? 1 : 10;
|
||||
unsigned int step = IS_ARM(getCurrentBoard()) ? 1 : 10;
|
||||
int value = repeatParam/step;
|
||||
|
||||
if (step == 1) {
|
||||
|
@ -53,7 +53,7 @@ void RepeatComboBox::onIndexChanged(int index)
|
|||
|
||||
void RepeatComboBox::update()
|
||||
{
|
||||
unsigned int step = IS_ARM(GetEepromInterface()->getBoard()) ? 1 : 10;
|
||||
unsigned int step = IS_ARM(getCurrentBoard()) ? 1 : 10;
|
||||
int value = repeatParam/step;
|
||||
if (step == 1) {
|
||||
value++;
|
||||
|
@ -395,7 +395,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
|||
if (modified) cfn.param = fswtchParam[i]->value();
|
||||
fswtchParam[i]->setDecimals(0);
|
||||
fswtchParam[i]->setSingleStep(1);
|
||||
if (IS_ARM(GetEepromInterface()->getBoard())) {
|
||||
if (IS_ARM(getCurrentBoard())) {
|
||||
fswtchParam[i]->setMinimum(-500);
|
||||
fswtchParam[i]->setMaximum(500);
|
||||
}
|
||||
|
@ -515,7 +515,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
|||
}
|
||||
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();
|
||||
fswtchBLcolor[i]->setValue(cfn.param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_BL_COLOR;
|
||||
|
|
|
@ -40,7 +40,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
|
|||
setWindowTitle(tr("Edit %1").arg(modelPrinter.printInputName(ed->chn)));
|
||||
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);
|
||||
gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, ed->offset, model, 0, -100, 100);
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ void FlightModePanel::update()
|
|||
}
|
||||
gvValues[i]->setDisabled(model->isGVarLinked(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]);
|
||||
}
|
||||
}
|
||||
|
@ -471,7 +471,7 @@ void FlightModePanel::fmClear()
|
|||
if (res == QMessageBox::Yes) {
|
||||
phase.clear(phaseIdx);
|
||||
if (phaseIdx == 0) {
|
||||
if (IS_HORUS_OR_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
if (IS_HORUS_OR_TARANIS(getCurrentBoard())) {
|
||||
for (int i=0; i < gvCount; ++i) {
|
||||
memset(&model->gvars_names[i], 0, sizeof(model->gvars_names[i]));
|
||||
model->gvars_popups[i] = 0;
|
||||
|
|
|
@ -867,7 +867,6 @@ void SetupPanel::populateThrottleSourceCB()
|
|||
void SetupPanel::update()
|
||||
{
|
||||
ui->name->setText(model->name);
|
||||
|
||||
ui->throttleReverse->setChecked(model->throttleReversed);
|
||||
populateThrottleSourceCB();
|
||||
ui->throttleWarning->setChecked(!model->disableThrottleWarning);
|
||||
|
@ -881,7 +880,7 @@ void SetupPanel::update()
|
|||
updateBeepCenter();
|
||||
updateStartupSwitches();
|
||||
|
||||
if(IS_HORUS_OR_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
if (IS_HORUS_OR_TARANIS(firmware->getBoard())) {
|
||||
updatePotWarnings();
|
||||
}
|
||||
|
||||
|
@ -915,7 +914,7 @@ void SetupPanel::updateStartupSwitches()
|
|||
QCheckBox * cb = startupSwitchesCheckboxes[i];
|
||||
int index = slider->property("index").toInt();
|
||||
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;
|
||||
if (generalSettings.switchConfig[index] != GeneralSettings::SWITCH_3POS && value == 2) {
|
||||
value = 1;
|
||||
|
@ -940,7 +939,7 @@ void SetupPanel::startupSwitchEdited(int value)
|
|||
uint64_t mask;
|
||||
int index = sender()->property("index").toInt();
|
||||
|
||||
if (IS_HORUS_OR_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
if (IS_HORUS_OR_TARANIS(firmware->getBoard())) {
|
||||
shift = index * 2;
|
||||
mask = 0x03ul << shift;
|
||||
}
|
||||
|
@ -956,7 +955,7 @@ void SetupPanel::startupSwitchEdited(int value)
|
|||
|
||||
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) {
|
||||
value = 2;
|
||||
}
|
||||
|
|
|
@ -409,7 +409,7 @@ void TelemetryCustomScreen::updateBar(int line)
|
|||
RawSource source = screen.body.bars[line].source;
|
||||
if (source.type != SOURCE_TYPE_NONE) {
|
||||
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);
|
||||
if (int(255-screen.body.bars[line].barMax) > max) {
|
||||
screen.body.bars[line].barMax = 255 - max;
|
||||
|
@ -426,7 +426,7 @@ void TelemetryCustomScreen::updateBar(int line)
|
|||
maxSB[line]->setMinimum(range.min);
|
||||
maxSB[line]->setMaximum(range.max);
|
||||
maxSB[line]->setSingleStep(range.step);
|
||||
if (IS_ARM(GetCurrentFirmware()->getBoard())) {
|
||||
if (IS_ARM(getCurrentBoard())) {
|
||||
maxSB[line]->setValue(range.getValue(screen.body.bars[line].barMax));
|
||||
}
|
||||
else {
|
||||
|
@ -486,7 +486,7 @@ void TelemetryCustomScreen::barMinChanged(double value)
|
|||
{
|
||||
if (!lock) {
|
||||
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());
|
||||
else
|
||||
screen.body.bars[line].barMin = round((value-minSB[line]->minimum()) / minSB[line]->singleStep());
|
||||
|
@ -499,7 +499,7 @@ void TelemetryCustomScreen::barMaxChanged(double value)
|
|||
{
|
||||
if (!lock) {
|
||||
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());
|
||||
else
|
||||
screen.body.bars[line].barMax = 255 - round((value-minSB[line]->minimum()) / maxSB[line]->singleStep());
|
||||
|
|
|
@ -67,7 +67,7 @@ QString addFont(const QString & input, const QString & color, const QString & si
|
|||
|
||||
QString ModelPrinter::printEEpromSize()
|
||||
{
|
||||
return tr("%1 bytes").arg(GetEepromInterface()->getSize(model));
|
||||
return tr("%1 bytes").arg(getCurrentEEpromInterface()->getSize(model));
|
||||
}
|
||||
|
||||
QString ModelPrinter::printChannelName(int idx)
|
||||
|
|
|
@ -106,7 +106,7 @@ TreeModel::TreeModel(RadioData * radioData, QObject * parent):
|
|||
radioData(radioData),
|
||||
availableEEpromSize(-1)
|
||||
{
|
||||
BoardEnum board = GetCurrentFirmware()->getBoard();
|
||||
BoardEnum board = getCurrentBoard();
|
||||
QVector<QVariant> labels;
|
||||
if (!IS_HORUS(board))
|
||||
labels << tr("Index");
|
||||
|
@ -239,7 +239,7 @@ bool TreeModel::setData(const QModelIndex &index, const QVariant & value, int ro
|
|||
|
||||
void TreeModel::refresh()
|
||||
{
|
||||
EEPROMInterface * eepromInterface = GetEepromInterface();
|
||||
EEPROMInterface * eepromInterface = getCurrentEEpromInterface();
|
||||
BoardEnum board = eepromInterface->getBoard();
|
||||
|
||||
if (!IS_SKY9X(board) && !IS_HORUS(board)) {
|
||||
|
@ -366,7 +366,7 @@ void ModelsListWidget::mouseMoveEvent(QMouseEvent *event)
|
|||
void ModelsListWidget::saveSelection()
|
||||
{
|
||||
/*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));
|
||||
}*/
|
||||
}
|
||||
|
@ -374,7 +374,7 @@ void ModelsListWidget::saveSelection()
|
|||
void ModelsListWidget::restoreSelection()
|
||||
{
|
||||
/*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);
|
||||
}*/
|
||||
}
|
||||
|
@ -404,7 +404,7 @@ void ModelsListWidget::dragMoveEvent(QDragMoveEvent *event)
|
|||
if (row >= 0) {
|
||||
if (header->general_settings)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -429,7 +429,7 @@ void ModelsListWidget::dropEvent(QDropEvent *event)
|
|||
DragDropHeader * header = (DragDropHeader *)gmData.data();
|
||||
if (header->general_settings)
|
||||
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);
|
||||
}
|
||||
event->acceptProposedAction();
|
||||
|
@ -473,9 +473,9 @@ void ModelsListWidget::doCut(QByteArray * gmData)
|
|||
void ModelsListWidget::duplicate()
|
||||
{
|
||||
int i = this->currentRow();
|
||||
if (i && i<GetCurrentFirmware()->getCapability(Models)) {
|
||||
if (i && i<getCurrentFirmware()->getCapability(Models)) {
|
||||
ModelData * model = &radioData->models[i-1];
|
||||
while (i<GetCurrentFirmware()->getCapability(Models)) {
|
||||
while (i<getCurrentFirmware()->getCapability(Models)) {
|
||||
if (radioData->models[i].isEmpty()) {
|
||||
radioData->models[i] = *model;
|
||||
strcpy(radioData->models[i].filename, radioData->getNextModelFilename().toStdString().c_str());
|
||||
|
@ -484,7 +484,7 @@ void ModelsListWidget::duplicate()
|
|||
}
|
||||
i++;
|
||||
}
|
||||
if (i==GetCurrentFirmware()->getCapability(Models)) {
|
||||
if (i==getCurrentFirmware()->getCapability(Models)) {
|
||||
QMessageBox::warning(this, "Companion", tr("No free slot available, cannot duplicate"), QMessageBox::Ok);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -268,7 +268,7 @@ QString MultiModelPrinter::printFlightModes()
|
|||
columns.append("<td><b>" + tr("Fade IN") + "</b></td>");
|
||||
columns.append("<td><b>" + tr("Fade OUT") + "</b></td>");
|
||||
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>");
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,11 +38,11 @@
|
|||
QString getRadioInterfaceCmd()
|
||||
{
|
||||
burnConfigDialog bcd;
|
||||
EEPROMInterface *eepromInterface = GetEepromInterface();
|
||||
if (IS_STM32(eepromInterface->getBoard())) {
|
||||
BoardEnum board = getCurrentBoard();
|
||||
if (IS_STM32(board)) {
|
||||
return bcd.getDFU();
|
||||
}
|
||||
else if (IS_SKY9X(GetEepromInterface()->getBoard())) {
|
||||
else if (IS_SKY9X(board)) {
|
||||
return bcd.getSAMBA();
|
||||
}
|
||||
else {
|
||||
|
@ -56,11 +56,12 @@ QStringList getAvrdudeArgs(const QString &cmd, const QString &filename)
|
|||
burnConfigDialog bcd;
|
||||
QString programmer = bcd.getProgrammer();
|
||||
QString mcu = bcd.getMCU();
|
||||
BoardEnum board = getCurrentBoard();
|
||||
|
||||
args << "-c" << programmer << "-p";
|
||||
if (IS_2560(GetEepromInterface()->getBoard()))
|
||||
if (IS_2560(board))
|
||||
args << "m2560";
|
||||
else if (GetEepromInterface()->getBoard() == BOARD_M128)
|
||||
else if (board == BOARD_M128)
|
||||
args << "m128";
|
||||
else
|
||||
args << mcu;
|
||||
|
@ -86,7 +87,7 @@ QStringList getDfuArgs(const QString & cmd, const QString & filename)
|
|||
burnConfigDialog bcd;
|
||||
QString memory = "0x08000000";
|
||||
if (cmd == "-U") {
|
||||
memory.append(QString(":%1").arg(GetCurrentFirmware()->getFlashSize()));
|
||||
memory.append(QString(":%1").arg(getCurrentFirmware()->getFlashSize()));
|
||||
}
|
||||
args << bcd.getDFUArgs();
|
||||
if (!filename.endsWith(".dfu")) {
|
||||
|
@ -123,7 +124,7 @@ QStringList getSambaArgs(const QString &tcl)
|
|||
QStringList getReadEEpromCmd(const QString &filename)
|
||||
{
|
||||
QStringList result;
|
||||
EEPROMInterface *eepromInterface = GetEepromInterface();
|
||||
EEPROMInterface *eepromInterface = getCurrentEEpromInterface();
|
||||
if (IS_STM32(eepromInterface->getBoard())) {
|
||||
// impossible
|
||||
}
|
||||
|
@ -138,12 +139,12 @@ QStringList getReadEEpromCmd(const QString &filename)
|
|||
|
||||
QStringList getWriteEEpromCmd(const QString &filename)
|
||||
{
|
||||
EEPROMInterface *eepromInterface = GetEepromInterface();
|
||||
if (IS_STM32(eepromInterface->getBoard())) {
|
||||
BoardEnum board = getCurrentBoard();
|
||||
if (IS_STM32(board)) {
|
||||
// impossible
|
||||
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");
|
||||
}
|
||||
else {
|
||||
|
@ -153,14 +154,14 @@ QStringList getWriteEEpromCmd(const QString &filename)
|
|||
|
||||
QStringList getWriteFirmwareArgs(const QString &filename)
|
||||
{
|
||||
EEPROMInterface *eepromInterface = GetEepromInterface();
|
||||
if (IS_STM32(eepromInterface->getBoard())) {
|
||||
BoardEnum board = getCurrentBoard();
|
||||
if (IS_STM32(board)) {
|
||||
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");
|
||||
}
|
||||
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");
|
||||
}
|
||||
else {
|
||||
|
@ -170,14 +171,14 @@ QStringList getWriteFirmwareArgs(const QString &filename)
|
|||
|
||||
QStringList getReadFirmwareArgs(const QString &filename)
|
||||
{
|
||||
EEPROMInterface *eepromInterface = GetEepromInterface();
|
||||
if (IS_STM32(eepromInterface->getBoard())) {
|
||||
BoardEnum board = getCurrentBoard();
|
||||
if (IS_STM32(board)) {
|
||||
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");
|
||||
}
|
||||
else if (eepromInterface->getBoard() == BOARD_9XRPRO) {
|
||||
else if (board == BOARD_9XRPRO) {
|
||||
return getSambaArgs(QString("receive_file {Flash} \"") + filename + "\" 0x400000 0x80000 0\n");
|
||||
}
|
||||
else {
|
||||
|
@ -270,7 +271,7 @@ bool readFirmware(const QString &filename, ProgressWidget *progress)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (IS_ARM(GetCurrentFirmware()->getBoard())) {
|
||||
if (IS_ARM(getCurrentBoard())) {
|
||||
QString path = findMassstoragePath("FIRMWARE.BIN");
|
||||
if (!path.isEmpty()) {
|
||||
qDebug() << "readFirmware: reading" << path << "into" << filename;
|
||||
|
@ -294,7 +295,7 @@ bool readFirmware(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");
|
||||
if (!path.isEmpty()) {
|
||||
qDebug() << "writeFirmware: writing" << path << "from" << filename;
|
||||
|
@ -319,7 +320,7 @@ bool readEeprom(const QString &filename, ProgressWidget *progress)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (IS_ARM(GetCurrentFirmware()->getBoard())) {
|
||||
if (IS_ARM(getCurrentBoard())) {
|
||||
QString path = findMassstoragePath("EEPROM.BIN");
|
||||
if (path.isEmpty()) {
|
||||
// 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);
|
||||
result = flashProcess.run();
|
||||
}
|
||||
|
||||
if (result == false && IS_ARM(GetCurrentFirmware()->getBoard())) {
|
||||
if (result == false && IS_ARM(getCurrentBoard())) {
|
||||
RadioNotFoundDialog dialog;
|
||||
dialog.exec();
|
||||
}
|
||||
|
@ -354,7 +355,7 @@ bool readEeprom(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");
|
||||
if (path.isEmpty()) {
|
||||
// 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);
|
||||
return flashProcess.run();
|
||||
}
|
||||
|
||||
if (IS_ARM(GetCurrentFirmware()->getBoard())) {
|
||||
if (IS_ARM(getCurrentBoard())) {
|
||||
RadioNotFoundDialog dialog;
|
||||
dialog.exec();
|
||||
}
|
||||
|
|
|
@ -292,7 +292,7 @@ void SimulatorDialog::initUi(T * ui)
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
windowName = tr("Simulating Radio (%1)").arg(GetCurrentFirmware()->getName());
|
||||
windowName = tr("Simulating Radio (%1)").arg(getCurrentFirmware()->getName());
|
||||
setWindowTitle(windowName);
|
||||
|
||||
lcd = ui->lcd;
|
||||
|
@ -424,7 +424,7 @@ void SimulatorDialog::setupOutputsDisplay()
|
|||
tabWidget->insertTab(1, outputsWidget, QString(tr("Outputs")));
|
||||
|
||||
// populate outputs
|
||||
int outputs = std::min(32, GetCurrentFirmware()->getCapability(Outputs));
|
||||
int outputs = std::min(32, getCurrentFirmware()->getCapability(Outputs));
|
||||
int column = 0;
|
||||
for (int i=0; i<outputs; i++) {
|
||||
QLabel * label = new QLabel(tabWidget);
|
||||
|
@ -457,7 +457,7 @@ void SimulatorDialog::setupOutputsDisplay()
|
|||
}
|
||||
|
||||
// populate logical switches
|
||||
int switches = GetCurrentFirmware()->getCapability(LogicalSwitches);
|
||||
int switches = getCurrentFirmware()->getCapability(LogicalSwitches);
|
||||
int rows = switches / (switches > 16 ? 4 : 2);
|
||||
for (int i=0; i<switches; i++) {
|
||||
QFrame * swtch = createLogicalSwitch(tabWidget, i, logicalSwitchLabels);
|
||||
|
@ -467,8 +467,8 @@ void SimulatorDialog::setupOutputsDisplay()
|
|||
|
||||
void SimulatorDialog::setupGVarsDisplay()
|
||||
{
|
||||
int fmodes = GetCurrentFirmware()->getCapability(FlightModes);
|
||||
int gvars = GetCurrentFirmware()->getCapability(Gvars);
|
||||
int fmodes = getCurrentFirmware()->getCapability(FlightModes);
|
||||
int gvars = getCurrentFirmware()->getCapability(Gvars);
|
||||
if (gvars>0) {
|
||||
// setup GVars tab
|
||||
QWidget * gvarsWidget = new QWidget();
|
||||
|
@ -539,7 +539,7 @@ void SimulatorDialog::onTimerEvent()
|
|||
{
|
||||
static unsigned int lcd_counter = 0;
|
||||
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();
|
||||
return;
|
||||
}
|
||||
|
@ -593,8 +593,8 @@ void SimulatorDialog::onTimerEvent()
|
|||
void SimulatorDialog::startCommon()
|
||||
{
|
||||
lastPhase = -1;
|
||||
numGvars = GetCurrentFirmware()->getCapability(Gvars);
|
||||
numFlightModes = GetCurrentFirmware()->getCapability(FlightModes);
|
||||
numGvars = getCurrentFirmware()->getCapability(Gvars);
|
||||
numFlightModes = getCurrentFirmware()->getCapability(FlightModes);
|
||||
simulator->setVolumeGain(g.profile[radioProfileId].volumeGain());
|
||||
}
|
||||
|
||||
|
@ -667,8 +667,8 @@ inline int chVal(int val)
|
|||
|
||||
void SimulatorDialog::setValues()
|
||||
{
|
||||
static const int numOutputs = GetCurrentFirmware()->getCapability(Outputs);
|
||||
static const int numLogicalSwitches = GetCurrentFirmware()->getCapability(LogicalSwitches);
|
||||
static const int numOutputs = getCurrentFirmware()->getCapability(Outputs);
|
||||
static const int numLogicalSwitches = getCurrentFirmware()->getCapability(LogicalSwitches);
|
||||
static TxOutputs prevOutputs;
|
||||
static unsigned int prevPhase = -1;
|
||||
|
||||
|
|
|
@ -375,7 +375,7 @@ int main(int argc, char *argv[])
|
|||
return finish(2);
|
||||
}
|
||||
|
||||
current_firmware_variant = GetFirmware(simOptions.firmwareId);
|
||||
current_firmware_variant = getFirmware(simOptions.firmwareId);
|
||||
|
||||
g.simuLastProfId(simOptions.profileId);
|
||||
g.lastSimulator(simOptions.firmwareId);
|
||||
|
|
|
@ -49,9 +49,9 @@ bool BinEepromFormat::load(RadioData & radioData)
|
|||
bool BinEepromFormat::write(const RadioData & radioData)
|
||||
{
|
||||
bool result;
|
||||
EEPROMInterface * eepromInterface = GetEepromInterface();
|
||||
EEPROMInterface * eepromInterface = getCurrentEEpromInterface();
|
||||
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) {
|
||||
result = writeToFile(eeprom, eeprom_size);
|
||||
}
|
||||
|
|
|
@ -98,7 +98,6 @@ bool Storage::write(const RadioData & radioData)
|
|||
|
||||
bool convertEEprom(const QString & sourceEEprom, const QString & destinationEEprom, const QString & firmwareFilename)
|
||||
{
|
||||
Firmware * currentFirmware = GetCurrentFirmware();
|
||||
FirmwareInterface firmware(firmwareFilename);
|
||||
if (!firmware.isValid())
|
||||
return false;
|
||||
|
@ -112,7 +111,7 @@ bool convertEEprom(const QString & sourceEEprom, const QString & destinationEEpr
|
|||
return false;
|
||||
|
||||
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) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
if (input != NO_INPUT) {
|
||||
bool isTaranis = IS_TARANIS(GetEepromInterface()->getBoard());
|
||||
bool isTaranis = IS_TARANIS(getCurrentBoard());
|
||||
|
||||
if (input >= RUDDER_INPUT && input <= AILERONS_INPUT) {
|
||||
MixData & mix = model.mixData[mixIndex++];
|
||||
|
@ -89,7 +89,7 @@ void WizMix::addMix(ModelData &model, Input input, int weight, int channel, int
|
|||
WizMix::operator ModelData()
|
||||
{
|
||||
int throttleChannel = -1;
|
||||
bool isTaranis = IS_TARANIS(GetEepromInterface()->getBoard());
|
||||
bool isTaranis = IS_TARANIS(getCurrentBoard());
|
||||
|
||||
ModelData model;
|
||||
model.used = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue