Merge pull request #990 from opentx/bsongis/refactoring_firmware_interface

Bsongis/refactoring firmware interface
This commit is contained in:
Andre Bernet
2014-04-19 17:59:33 +02:00
76 changed files with 1125 additions and 2045 deletions
+65 -71
View File
@@ -11,34 +11,22 @@
#include <QDesktopServices>
#include <QtGui>
appPreferencesDialog::appPreferencesDialog(QWidget *parent) :
AppPreferencesDialog::AppPreferencesDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::appPreferencesDialog)
ui(new Ui::AppPreferencesDialog)
{
ui->setupUi(this);
updateLock=false;
setWindowIcon(CompanionIcon("apppreferences.png"));
QCheckBox * OptionCheckBox[]= {
ui->optionCheckBox_1, ui->optionCheckBox_2, ui->optionCheckBox_3, ui->optionCheckBox_4, ui->optionCheckBox_5, ui->optionCheckBox_6, ui->optionCheckBox_7,
ui->optionCheckBox_8, ui->optionCheckBox_9, ui->optionCheckBox_10, ui->optionCheckBox_11, ui->optionCheckBox_12, ui->optionCheckBox_13, ui->optionCheckBox_14,
ui->optionCheckBox_15,ui->optionCheckBox_16, ui->optionCheckBox_17, ui->optionCheckBox_18, ui->optionCheckBox_19, ui->optionCheckBox_20, ui->optionCheckBox_21,
ui->optionCheckBox_22, ui->optionCheckBox_23, ui->optionCheckBox_24, ui->optionCheckBox_25, ui->optionCheckBox_26, ui->optionCheckBox_27, ui->optionCheckBox_28,
ui->optionCheckBox_29, ui->optionCheckBox_30, ui->optionCheckBox_31, ui->optionCheckBox_32, ui->optionCheckBox_33, ui->optionCheckBox_34, ui->optionCheckBox_35,
ui->optionCheckBox_36, ui->optionCheckBox_37, ui->optionCheckBox_38, ui->optionCheckBox_39, ui->optionCheckBox_40, ui->optionCheckBox_41, ui->optionCheckBox_42,
NULL };
voice=NULL;
connect(ui->langCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(firmwareLangChanged()));
connect(ui->voiceCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(firmwareLangChanged()));
for (int i=0; OptionCheckBox[i]; i++) {
optionsCheckBoxes.push_back(OptionCheckBox[i]);
connect(OptionCheckBox[i], SIGNAL(toggled(bool)), this, SLOT(firmwareOptionChanged(bool)));
}
initSettings();
connect(ui->downloadVerCB, SIGNAL(currentIndexChanged(int)), this, SLOT(baseFirmwareChanged()));
connect(this, SIGNAL(accepted()), this, SLOT(writeValues()));
#ifndef JOYSTICKS
ui->joystickCB->hide();
ui->joystickCB->setDisabled(true);
@@ -46,15 +34,16 @@ appPreferencesDialog::appPreferencesDialog(QWidget *parent) :
ui->joystickChkB->hide();
ui->label_11->hide();
#endif
shrink();
}
appPreferencesDialog::~appPreferencesDialog()
AppPreferencesDialog::~AppPreferencesDialog()
{
delete ui;
}
void appPreferencesDialog::writeValues()
void AppPreferencesDialog::writeValues()
{
g.autoCheckApp(ui->startupCheck_companion9x->isChecked());
g.autoCheckFw(ui->startupCheck_fw->isChecked());
@@ -92,15 +81,14 @@ void appPreferencesDialog::writeValues()
// If a new fw type has been choosen, several things need to reset
g.cpuId( ui->CPU_ID_LE->text() );
current_firmware_variant = getFirmwareVariant();
if ( g.profile[g.id()].fwType() != current_firmware_variant.id)
{
if (g.profile[g.id()].fwType() != current_firmware_variant.id) {
g.profile[g.id()].fwName("");
g.profile[g.id()].initFwVariables();
g.profile[g.id()].fwType( current_firmware_variant.id );
}
}
void appPreferencesDialog::on_snapshotPathButton_clicked()
void AppPreferencesDialog::on_snapshotPathButton_clicked()
{
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your snapshot folder"), g.snapshotDir());
if (!fileName.isEmpty()) {
@@ -110,7 +98,7 @@ void appPreferencesDialog::on_snapshotPathButton_clicked()
}
}
void appPreferencesDialog::initSettings()
void AppPreferencesDialog::initSettings()
{
ui->snapshotClipboardCKB->setChecked(g.snapToClpbrd());
ui->burnFirmware->setChecked(g.profile[g.id()].burnFirmware());
@@ -126,8 +114,10 @@ void appPreferencesDialog::initSettings()
ui->showSplash->setChecked(g.showSplash());
ui->historySize->setValue(g.historySize());
ui->backLightColor->setCurrentIndex(g.backLight());
if (getRadioType(g.profile[g.id()].fwType())==6) // TODO - NOT AT ALL OK. THERE SHOULD BE A COMMON RADIO DEFINITION.
if (IS_TARANIS(GetCurrentFirmware()->getBoard()))
ui->backLightColor->setEnabled(false);
ui->simuSW->setChecked(g.simuSW());
ui->modelWizard_CB->setChecked(g.useWizard());
ui->libraryPath->setText(g.libDir());
@@ -198,9 +188,9 @@ void appPreferencesDialog::initSettings()
ui->CPU_ID_LE->setText(g.cpuId());
FirmwareInfo * current_firmware = GetCurrentFirmware();
FirmwareInterface * current_firmware = GetCurrentFirmware();
foreach(FirmwareInfo * firmware, firmwares) {
foreach(FirmwareInterface * firmware, firmwares) {
ui->downloadVerCB->addItem(firmware->name, firmware->id);
if (current_firmware == firmware) {
ui->downloadVerCB->setCurrentIndex(ui->downloadVerCB->count() - 1);
@@ -211,8 +201,7 @@ void appPreferencesDialog::initSettings()
firmwareChanged();
}
void appPreferencesDialog::on_libraryPathButton_clicked()
void AppPreferencesDialog::on_libraryPathButton_clicked()
{
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your library folder"), g.libDir());
if (!fileName.isEmpty()) {
@@ -221,13 +210,14 @@ void appPreferencesDialog::on_libraryPathButton_clicked()
}
}
void appPreferencesDialog::on_snapshotClipboardCKB_clicked()
void AppPreferencesDialog::on_snapshotClipboardCKB_clicked()
{
if (ui->snapshotClipboardCKB->isChecked()) {
ui->snapshotPath->setDisabled(true);
ui->snapshotPathButton->setDisabled(true);
g.snapToClpbrd(true);
} else {
}
else {
ui->snapshotPath->setEnabled(true);
ui->snapshotPath->setReadOnly(true);
ui->snapshotPathButton->setEnabled(true);
@@ -235,7 +225,7 @@ void appPreferencesDialog::on_snapshotClipboardCKB_clicked()
}
}
void appPreferencesDialog::on_backupPathButton_clicked()
void AppPreferencesDialog::on_backupPathButton_clicked()
{
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your Models and Settings backup folder"), g.backupDir());
if (!fileName.isEmpty()) {
@@ -245,7 +235,7 @@ void appPreferencesDialog::on_backupPathButton_clicked()
ui->backupEnable->setEnabled(true);
}
void appPreferencesDialog::on_ge_pathButton_clicked()
void AppPreferencesDialog::on_ge_pathButton_clicked()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Select Google Earth executable"),ui->ge_lineedit->text());
if (!fileName.isEmpty()) {
@@ -254,7 +244,7 @@ void appPreferencesDialog::on_ge_pathButton_clicked()
}
#ifdef JOYSTICKS
void appPreferencesDialog::on_joystickChkB_clicked() {
void AppPreferencesDialog::on_joystickChkB_clicked() {
if (ui->joystickChkB->isChecked()) {
QStringList joystickNames;
joystickNames << tr("No joysticks found");
@@ -280,7 +270,7 @@ void appPreferencesDialog::on_joystickChkB_clicked() {
}
}
void appPreferencesDialog::on_joystickcalButton_clicked() {
void AppPreferencesDialog::on_joystickcalButton_clicked() {
joystickDialog * jd=new joystickDialog(this, ui->joystickCB->currentIndex());
jd->exec();
}
@@ -288,7 +278,7 @@ void appPreferencesDialog::on_joystickcalButton_clicked() {
// ******** Profile tab functions
void appPreferencesDialog::on_sdPathButton_clicked()
void AppPreferencesDialog::on_sdPathButton_clicked()
{
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select the folder replicating your SD structure"), g.profile[g.id()].sdPath());
if (!fileName.isEmpty()) {
@@ -296,12 +286,12 @@ void appPreferencesDialog::on_sdPathButton_clicked()
}
}
void appPreferencesDialog::on_removeProfileButton_clicked()
void AppPreferencesDialog::on_removeProfileButton_clicked()
{
if ( g.id() == 0 )
if ( g.id() == 0 ) {
QMessageBox::information(this, tr("Not possible to remove profile"), tr("The default profile can not be removed."));
else
{
}
else {
g.profile[g.id()].remove();
g.id( 0 );
initSettings();
@@ -309,7 +299,7 @@ void appPreferencesDialog::on_removeProfileButton_clicked()
}
bool appPreferencesDialog::displayImage( QString fileName )
bool AppPreferencesDialog::displayImage( QString fileName )
{
// Start by clearing the pixmap
ui->imageLabel->setPixmap(QPixmap());
@@ -328,7 +318,7 @@ bool appPreferencesDialog::displayImage( QString fileName )
return true;
}
void appPreferencesDialog::on_SplashSelect_clicked()
void AppPreferencesDialog::on_SplashSelect_clicked()
{
QString supportedImageFormats;
for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) {
@@ -346,13 +336,13 @@ void appPreferencesDialog::on_SplashSelect_clicked()
}
}
void appPreferencesDialog::on_clearImageButton_clicked() {
void AppPreferencesDialog::on_clearImageButton_clicked() {
ui->imageLabel->clear();
ui->SplashFileName->clear();
}
void appPreferencesDialog::showVoice(bool show)
void AppPreferencesDialog::showVoice(bool show)
{
if (show)
showVoice();
@@ -360,13 +350,13 @@ void appPreferencesDialog::showVoice(bool show)
hideVoice();
}
void appPreferencesDialog::showVoice()
void AppPreferencesDialog::showVoice()
{
ui->voiceLabel->show();
ui->voiceCombo->show();
}
void appPreferencesDialog::hideVoice()
void AppPreferencesDialog::hideVoice()
{
ui->voiceLabel->hide();
ui->voiceCombo->hide();
@@ -374,11 +364,11 @@ void appPreferencesDialog::hideVoice()
}
void appPreferencesDialog::baseFirmwareChanged()
void AppPreferencesDialog::baseFirmwareChanged()
{
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
voice=NULL;
foreach(FirmwareInfo * firmware, firmwares) {
foreach(FirmwareInterface * firmware, firmwares) {
if (firmware->id == selected_firmware) {
showVoice(firmware->voice);
populateFirmwareOptions(firmware);
@@ -388,11 +378,11 @@ void appPreferencesDialog::baseFirmwareChanged()
firmwareChanged();
}
FirmwareVariant appPreferencesDialog::getFirmwareVariant()
FirmwareVariant AppPreferencesDialog::getFirmwareVariant()
{
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
bool voice=false;
foreach(FirmwareInfo * firmware, firmwares) {
foreach(FirmwareInterface * firmware, firmwares) {
if (firmware->id == selected_firmware) {
QString id = firmware->id;
foreach(QCheckBox *cb, optionsCheckBoxes) {
@@ -402,7 +392,7 @@ FirmwareVariant appPreferencesDialog::getFirmwareVariant()
id += QString("-") + cb->text();
}
}
if (! firmware->eepromInterface->getCapability(MultiLangVoice)) {
if (! firmware->getCapability(MultiLangVoice)) {
if (ui->voiceCombo->count() && (voice || firmware->voice))
id += QString("-tts") + ui->voiceCombo->currentText();
}
@@ -417,10 +407,10 @@ FirmwareVariant appPreferencesDialog::getFirmwareVariant()
return default_firmware_variant;
}
void appPreferencesDialog::firmwareOptionChanged(bool state)
void AppPreferencesDialog::firmwareOptionChanged(bool state)
{
QCheckBox *cb = qobject_cast<QCheckBox*>(sender());
FirmwareInfo * firmware=NULL;
FirmwareInterface * firmware=NULL;
if (cb && state) {
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
foreach(firmware, firmwares) {
@@ -446,14 +436,16 @@ void appPreferencesDialog::firmwareOptionChanged(bool state)
}
}
}
} else if (cb && !state) {
}
else if (cb && !state) {
if (cb->text()=="voice") {
hideVoice();
}
}
if (voice) {
showVoice(voice->isChecked());
} else if (firmware) {
}
else if (firmware) {
if (firmware->voice) {
showVoice();
}
@@ -461,20 +453,20 @@ void appPreferencesDialog::firmwareOptionChanged(bool state)
return firmwareChanged();
}
void appPreferencesDialog::firmwareLangChanged()
void AppPreferencesDialog::firmwareLangChanged()
{
firmwareChanged();
}
void appPreferencesDialog::firmwareChanged()
void AppPreferencesDialog::firmwareChanged()
{
if (updateLock)
return;
FirmwareVariant variant = getFirmwareVariant();
QString stamp;
stamp.append(variant.firmware->stamp);
QString url=variant.firmware->getUrl(variant.id);
stamp.append(variant.firmware->getStampUrl());
QString url = variant.getFirmwareUrl();
// B-Plan
if (false) {
ui->CPU_ID_LE->show();
@@ -485,9 +477,9 @@ void appPreferencesDialog::firmwareChanged()
}
}
void appPreferencesDialog::populateFirmwareOptions(const FirmwareInfo * firmware)
void AppPreferencesDialog::populateFirmwareOptions(const FirmwareInterface * firmware)
{
const FirmwareInfo * parent = firmware->parent ? firmware->parent : firmware;
const FirmwareInterface * parent = /*firmware->parent ? firmware->parent : */ firmware;
updateLock = true;
@@ -510,20 +502,22 @@ void appPreferencesDialog::populateFirmwareOptions(const FirmwareInfo * firmware
foreach(QList<Option> opts, parent->opts) {
foreach(Option opt, opts) {
if (index >= optionsCheckBoxes.size()) {
qDebug() << "This firmware needs more options checkboxes!";
QCheckBox * checkbox = new QCheckBox(ui->profileTab);
ui->optionsLayout->addWidget(checkbox, optionsCheckBoxes.count()/5, optionsCheckBoxes.count()%5, 1, 1);
optionsCheckBoxes.push_back(checkbox);
connect(checkbox, SIGNAL(toggled(bool)), this, SLOT(firmwareOptionChanged(bool)));
}
else {
QCheckBox *cb = optionsCheckBoxes.at(index++);
if (cb) {
cb->show();
cb->setText(opt.name);
cb->setToolTip(opt.tooltip);
cb->setCheckState(current_firmware_variant.id.contains(opt.name) ? Qt::Checked : Qt::Unchecked);
QCheckBox *cb = optionsCheckBoxes.at(index++);
if (cb) {
cb->show();
cb->setText(opt.name);
cb->setToolTip(opt.tooltip);
cb->setCheckState(current_firmware_variant.id.contains(opt.name) ? Qt::Checked : Qt::Unchecked);
if (opt.name==QString("voice")) {
voice=cb;
showVoice(current_firmware_variant.id.contains(opt.name) ||firmware->voice);
}
if (opt.name==QString("voice")) {
voice=cb;
showVoice(current_firmware_variant.id.contains(opt.name) ||firmware->voice);
}
}
}
@@ -538,7 +532,7 @@ void appPreferencesDialog::populateFirmwareOptions(const FirmwareInfo * firmware
QTimer::singleShot(0, this, SLOT(shrink()));
}
void appPreferencesDialog::shrink()
void AppPreferencesDialog::shrink()
{
resize(0,0);
}
+9 -10
View File
@@ -6,45 +6,44 @@
#include "eeprominterface.h"
namespace Ui {
class appPreferencesDialog;
class AppPreferencesDialog;
}
class Joystick;
class appPreferencesDialog : public QDialog
class AppPreferencesDialog : public QDialog
{
Q_OBJECT
public:
explicit appPreferencesDialog(QWidget *parent = 0);
~appPreferencesDialog();
public:
explicit AppPreferencesDialog(QWidget *parent = 0);
~AppPreferencesDialog();
Joystick *joystick;
private:
private:
QList<QCheckBox *> optionsCheckBoxes;
bool updateLock;
void showVoice(bool);
void showVoice();
void hideVoice();
void populateLocale();
void populateFirmwareOptions(const FirmwareInfo *);
void populateFirmwareOptions(const FirmwareInterface *);
FirmwareVariant getFirmwareVariant();
QCheckBox * voice;
Ui::appPreferencesDialog *ui;
Ui::AppPreferencesDialog *ui;
void initSettings();
bool displayImage( QString fileName );
void loadProfileString(QString profile, QString label);
void loadFromProfile();
private slots:
protected slots:
void shrink();
void firmwareLangChanged();
void baseFirmwareChanged();
void firmwareOptionChanged(bool state);
void firmwareChanged();
void writeValues();
void on_libraryPathButton_clicked();
void on_snapshotPathButton_clicked();
+4 -567
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>appPreferencesDialog</class>
<widget class="QDialog" name="appPreferencesDialog">
<class>AppPreferencesDialog</class>
<widget class="QDialog" name="AppPreferencesDialog">
<property name="geometry">
<rect>
<x>0</x>
@@ -153,554 +153,7 @@
</widget>
</item>
<item row="10" column="1" colspan="5">
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="1">
<widget class="QCheckBox" name="optionCheckBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="optionCheckBox_1">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="optionCheckBox_3">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QCheckBox" name="optionCheckBox_4">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QCheckBox" name="optionCheckBox_10">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QCheckBox" name="optionCheckBox_5">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="optionCheckBox_6">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="optionCheckBox_7">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="optionCheckBox_8">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QCheckBox" name="optionCheckBox_9">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="optionCheckBox_11">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="optionCheckBox_12">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QCheckBox" name="optionCheckBox_13">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QCheckBox" name="optionCheckBox_14">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QCheckBox" name="optionCheckBox_15">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="optionCheckBox_16">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="optionCheckBox_17">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QCheckBox" name="optionCheckBox_18">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QCheckBox" name="optionCheckBox_19">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="optionCheckBox_21">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="3" column="4">
<widget class="QCheckBox" name="optionCheckBox_20">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="optionCheckBox_22">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QCheckBox" name="optionCheckBox_23">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="4" column="4">
<widget class="QCheckBox" name="optionCheckBox_25">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="optionCheckBox_26">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QCheckBox" name="optionCheckBox_24">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="optionCheckBox_27">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="optionCheckBox_31">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QCheckBox" name="optionCheckBox_28">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QCheckBox" name="optionCheckBox_29">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="5" column="4">
<widget class="QCheckBox" name="optionCheckBox_30">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="optionCheckBox_36">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QCheckBox" name="optionCheckBox_32">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QCheckBox" name="optionCheckBox_33">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QCheckBox" name="optionCheckBox_34">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QCheckBox" name="optionCheckBox_37">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QCheckBox" name="optionCheckBox_38">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="7" column="3">
<widget class="QCheckBox" name="optionCheckBox_39">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QCheckBox" name="optionCheckBox_41">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QCheckBox" name="optionCheckBox_42">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="6" column="4">
<widget class="QCheckBox" name="optionCheckBox_35">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
<item row="7" column="4">
<widget class="QCheckBox" name="optionCheckBox_40">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">CheckBox</string>
</property>
</widget>
</item>
</layout>
<layout class="QGridLayout" name="optionsLayout"/>
</item>
<item row="6" column="0">
<widget class="QLabel" name="CPU_ID_LABEL">
@@ -1680,7 +1133,7 @@ May be different from firmware language</string>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>appPreferencesDialog</receiver>
<receiver>AppPreferencesDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
@@ -1693,21 +1146,5 @@ May be different from firmware language</string>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>appPreferencesDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>408</x>
<y>835</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
+1 -1
View File
@@ -327,7 +327,7 @@ void avrOutputDialog::errorWizard()
QMessageBox::warning(this, "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 {
FirmwareInfo *firmware = GetCurrentFirmware();
FirmwareInterface *firmware = GetCurrentFirmware();
QMessageBox::warning(this, "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->name));
}
}
+1 -1
View File
@@ -445,7 +445,7 @@ void burnDialog::on_BurnFlashButton_clicked()
if (hexType==EEPROM_FILE_TYPE) {
QString calib = g.profile[g.id()].stickPotCalib();
QString trainercalib = g.profile[g.id()].trainerCalib();
int potsnum=GetEepromInterface()->getCapability(Pots);
int potsnum=GetCurrentFirmware()->getCapability(Pots);
int8_t vBatCalib=(int8_t) g.profile[g.id()].vBatCalib();
int8_t currentCalib=(int8_t) g.profile[g.id()].currentCalib();
int8_t PPM_Multiplier=(int8_t) g.profile[g.id()].ppmMultiplier();
+3 -1
View File
@@ -104,7 +104,8 @@ int main(int argc, char *argv[])
QPixmap pixmap = QPixmap(g.profile[g.id()].fwType().contains("taranis") ? ":/images/splasht.png" : ":/images/splash.png");
QSplashScreen *splash = new QSplashScreen(pixmap);
RegisterFirmwares();
RegisterEepromInterfaces();
registerOpenTxFirmwares();
current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].fwType());
@@ -124,6 +125,7 @@ int main(int argc, char *argv[])
delete mainWin;
UnregisterFirmwares();
UnregisterEepromInterfaces();
return result;
}
+104 -105
View File
@@ -24,39 +24,38 @@ public:
uint8_t models[C9X_MAX_MODELS];
};
compareDialog::compareDialog(QWidget *parent, GeneralSettings *gg) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
ui(new Ui::compareDialog)
CompareDialog::CompareDialog(QWidget * parent):
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
model1(0),
model2(0),
ui(new Ui::CompareDialog)
{
ui->setupUi(this);
this->setWindowIcon(CompanionIcon("compare.png"));
g_eeGeneral = gg;
eepromInterface = GetEepromInterface();
te = ui->textEdit;
this->setAcceptDrops(true);
model1=0;
model2=0;
// TODO this is really horrible
g_model1=(ModelData *)malloc(sizeof(ModelData));
g_model2=(ModelData *)malloc(sizeof(ModelData));
modeltemp=(ModelData *)malloc(sizeof(ModelData));
//setDragDropOverwriteMode(true);
//setDropIndicatorShown(true);
/*
printFrSky();
*/
te->scrollToAnchor("1");
//setDragDropOverwriteMode(true);
//setDropIndicatorShown(true);
te->scrollToAnchor("1");
}
void compareDialog::dragMoveEvent(QDragMoveEvent *event)
void CompareDialog::dragMoveEvent(QDragMoveEvent *event)
{
if (event->mimeData()->hasFormat("application/x-companion")) {
event->acceptProposedAction();
} else {
}
else {
event->ignore();
}
}
void compareDialog::dragEnterEvent(QDragEnterEvent *event)
void CompareDialog::dragEnterEvent(QDragEnterEvent *event)
{
// accept just text/uri-list mime format
if (event->mimeData()->hasFormat("application/x-companion")) {
@@ -66,16 +65,16 @@ void compareDialog::dragEnterEvent(QDragEnterEvent *event)
}
}
void compareDialog::dragLeaveEvent(QDragLeaveEvent *event)
void CompareDialog::dragLeaveEvent(QDragLeaveEvent *event)
{
event->accept();
}
void compareDialog::printDiff()
void CompareDialog::printDiff()
{
te->clear();
printSetup();
if (GetEepromInterface()->getCapability(FlightPhases)) {
if (GetCurrentFirmware()->getCapability(FlightPhases)) {
printPhases();
}
printExpos();
@@ -89,7 +88,7 @@ void compareDialog::printDiff()
te->scrollToAnchor("1");
}
void compareDialog::dropEvent(QDropEvent *event)
void CompareDialog::dropEvent(QDropEvent *event)
{
QLabel *child = qobject_cast<QLabel*>(childAt(event->pos()));
const QMimeData *mimeData = event->mimeData();
@@ -153,7 +152,7 @@ void compareDialog::dropEvent(QDropEvent *event)
}
}
void compareDialog::closeEvent(QCloseEvent *event)
void CompareDialog::closeEvent(QCloseEvent *event)
{
QByteArray ba = curvefile5.toLatin1();
char *name = ba.data();
@@ -163,12 +162,12 @@ void compareDialog::closeEvent(QCloseEvent *event)
unlink(name);
}
compareDialog::~compareDialog()
CompareDialog::~CompareDialog()
{
delete ui;
}
QString compareDialog::doTC(const QString s, const QString color="", bool bold=false)
QString CompareDialog::doTC(const QString s, const QString color="", bool bold=false)
{
QString str = s;
if(bold) str = "<b>" + str + "</b>";
@@ -176,7 +175,7 @@ QString compareDialog::doTC(const QString s, const QString color="", bool bold=f
return "<td align=center>" + str + "</td>";
}
QString compareDialog::doTR(const QString s, const QString color="", bool bold=false)
QString CompareDialog::doTR(const QString s, const QString color="", bool bold=false)
{
QString str = s;
if(bold) str = "<b>" + str + "</b>";
@@ -184,7 +183,7 @@ QString compareDialog::doTR(const QString s, const QString color="", bool bold=f
return "<td align=right>" + str + "</td>";
}
QString compareDialog::doTL(const QString s, const QString color="", bool bold=false)
QString CompareDialog::doTL(const QString s, const QString color="", bool bold=false)
{
QString str = s;
if(bold) str = "<b>" + str + "</b>";
@@ -192,14 +191,14 @@ QString compareDialog::doTL(const QString s, const QString color="", bool bold=f
return "<td align=left>" + str + "</td>";
}
QString compareDialog::fv(const QString name, const QString value, const QString color="green")
QString CompareDialog::fv(const QString name, const QString value, const QString color="green")
{
return "<b>" + name + ": </b><font color=" +color + ">" + value + "</font><br>";
}
int compareDialog::ModelHasExpo(ExpoData * ExpoArray, ExpoData expo, bool * expoused)
int CompareDialog::ModelHasExpo(ExpoData * ExpoArray, ExpoData expo, bool * expoused)
{
for (int i=0; i< C9X_MAX_EXPOS; i++) {
if ((memcmp(&expo,&ExpoArray[i],sizeof(ExpoData))==0) && (expoused[i]==false)) {
@@ -209,7 +208,7 @@ int compareDialog::ModelHasExpo(ExpoData * ExpoArray, ExpoData expo, bool * expo
return -1;
}
bool compareDialog::ChannelHasExpo(ExpoData * expoArray, uint8_t destCh)
bool CompareDialog::ChannelHasExpo(ExpoData * expoArray, uint8_t destCh)
{
for (int i=0; i< C9X_MAX_EXPOS; i++) {
if ((expoArray[i].chn==destCh)&&(expoArray[i].mode!=0)) {
@@ -219,7 +218,7 @@ bool compareDialog::ChannelHasExpo(ExpoData * expoArray, uint8_t destCh)
return false;
}
int compareDialog::ModelHasMix(MixData * mixArray, MixData mix, bool * mixused)
int CompareDialog::ModelHasMix(MixData * mixArray, MixData mix, bool * mixused)
{
for (int i=0; i< C9X_MAX_MIXERS; i++) {
if ((memcmp(&mix,&mixArray[i],sizeof(MixData))==0) && (mixused[i]==false)) {
@@ -229,7 +228,7 @@ int compareDialog::ModelHasMix(MixData * mixArray, MixData mix, bool * mixused)
return -1;
}
bool compareDialog::ChannelHasMix(MixData * mixArray, uint8_t destCh)
bool CompareDialog::ChannelHasMix(MixData * mixArray, uint8_t destCh)
{
for (int i=0; i< C9X_MAX_MIXERS; i++) {
if (mixArray[i].destCh==destCh) {
@@ -239,7 +238,7 @@ bool compareDialog::ChannelHasMix(MixData * mixArray, uint8_t destCh)
return false;
}
void compareDialog::printSetup()
void CompareDialog::printSetup()
{
QString color;
QString str = "<a name=1></a><table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
@@ -247,8 +246,8 @@ void compareDialog::printSetup()
str.append("<tr><td><table border=0 cellspacing=0 cellpadding=3 width=\"50%\">");
color=getColor1(g_model1->name,g_model2->name);
str.append(fv(tr("Name"), g_model1->name, color));
color=getColor1(eepromInterface->getSize(*g_model1),eepromInterface->getSize(*g_model2));
str.append("<b>"+tr("EEprom Size")+QString(": </b><font color=%2>%1</font><br>").arg(eepromInterface->getSize(*g_model1)).arg(color));
color=getColor1(GetEepromInterface()->getSize(*g_model1), GetEepromInterface()->getSize(*g_model2));
str.append("<b>"+tr("EEprom Size")+QString(": </b><font color=%2>%1</font><br>").arg(GetEepromInterface()->getSize(*g_model1)).arg(color));
color=getColor1(getTimerStr(g_model1->timers[0]), getTimerStr(g_model2->timers[0]));
str.append(fv(tr("Timer1"), getTimerStr(g_model1->timers[0]), color)); //value, mode, count up/down
color=getColor1(getTimerStr(g_model1->timers[1]), getTimerStr(g_model2->timers[1]));
@@ -270,8 +269,8 @@ void compareDialog::printSetup()
str.append("<td><table border=0 cellspacing=0 cellpadding=3 width=\"50%\">");
color=getColor2(g_model1->name,g_model2->name);
str.append(fv(tr("Name"), g_model2->name, color));
color=getColor2(eepromInterface->getSize(*g_model1),eepromInterface->getSize(*g_model2));
str.append("<b>"+tr("EEprom Size")+QString(": </b><font color=%2>%1</font><br>").arg(eepromInterface->getSize(*g_model2)).arg(color));
color=getColor2(GetEepromInterface()->getSize(*g_model1), GetEepromInterface()->getSize(*g_model2));
str.append("<b>"+tr("EEprom Size")+QString(": </b><font color=%2>%1</font><br>").arg(GetEepromInterface()->getSize(*g_model2)).arg(color));
color=getColor2(getTimerStr(g_model1->timers[0]), getTimerStr(g_model2->timers[0]));
str.append(fv(tr("Timer1"), getTimerStr(g_model2->timers[0]),color)); //value, mode, count up/down
color=getColor2(getTimerStr(g_model1->timers[1]), getTimerStr(g_model2->timers[1]));
@@ -293,7 +292,7 @@ void compareDialog::printSetup()
te->append(str);
}
void compareDialog::printPhases()
void CompareDialog::printPhases()
{
QString color;
int i,k;
@@ -308,7 +307,7 @@ void compareDialog::printPhases()
str.append(QString("<td width=\"40\" align=\"center\"><b>%1</b></td>").arg(getInputStr(*g_model1, i)));
}
str.append("</tr>");
for (i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) {
for (i=0; i<GetCurrentFirmware()->getCapability(FlightPhases); i++) {
PhaseData *pd1=&g_model1->phaseData[i];
PhaseData *pd2=&g_model2->phaseData[i];
str.append("<tr><td><b>"+tr("FM")+QString("%1</b> ").arg(i));
@@ -334,7 +333,7 @@ void compareDialog::printPhases()
str.append("</table>");
int gvars=0;
int gvarnum=0;
if (GetEepromInterface()->getCapability(HasVariants)) {
if (GetCurrentFirmware()->getCapability(HasVariants)) {
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
gvars=1;
}
@@ -342,35 +341,35 @@ void compareDialog::printPhases()
gvars=1;
}
if (gvars==1) {
gvarnum=GetEepromInterface()->getCapability(Gvars);
gvarnum=GetCurrentFirmware()->getCapability(Gvars);
}
if ((gvars==1 && GetEepromInterface()->getCapability(GvarsFlightPhases)) || GetEepromInterface()->getCapability(RotaryEncoders)) {
if ((gvars==1 && GetCurrentFirmware()->getCapability(GvarsFlightPhases)) || GetCurrentFirmware()->getCapability(RotaryEncoders)) {
str.append("<br><table border=1 cellspacing=0 cellpadding=1 width=\"100%\">");
str.append("<tr><td style=\"border-style:none;\">&nbsp;</td>");
if (GetEepromInterface()->getCapability(GvarsFlightPhases)) {
if (GetCurrentFirmware()->getCapability(GvarsFlightPhases)) {
str.append(QString("<td colspan=%1 align=center><b>").arg(gvarnum)+tr("Gvars")+"</td>");
}
if (GetEepromInterface()->getCapability(RotaryEncoders)) {
str.append(QString("<td colspan=%1 align=center><b>").arg(GetEepromInterface()->getCapability(RotaryEncoders))+tr("Rot. Enc.")+"</td>");
if (GetCurrentFirmware()->getCapability(RotaryEncoders)) {
str.append(QString("<td colspan=%1 align=center><b>").arg(GetCurrentFirmware()->getCapability(RotaryEncoders))+tr("Rot. Enc.")+"</td>");
}
str.append("</tr><tr><td align=center><b>"+tr("Flight mode name")+"</b></td>");
if (GetEepromInterface()->getCapability(GvarsFlightPhases)) {
if (GetCurrentFirmware()->getCapability(GvarsFlightPhases)) {
for (i=0; i<gvarnum; i++) {
str.append(QString("<td width=\"40\" align=\"center\"><b>GV%1</b><br>%2</td>").arg(i+1).arg(g_model1->gvars_names[i]));
}
}
for (i=0; i<GetEepromInterface()->getCapability(RotaryEncoders); i++) {
for (i=0; i<GetCurrentFirmware()->getCapability(RotaryEncoders); i++) {
str.append(QString("<td align=\"center\"><b>RE%1</b></td>").arg((i==0 ? 'A': 'B')));
}
str.append("</tr>");
for (i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) {
for (i=0; i<GetCurrentFirmware()->getCapability(FlightPhases); i++) {
PhaseData *pd1=&g_model1->phaseData[i];
PhaseData *pd2=&g_model2->phaseData[i];
str.append("<tr><td><b>"+tr("FM")+QString("%1</b> ").arg(i));
color=getColor1(pd1->name,pd2->name);
str.append(QString("<font size=+1 face='Courier New' color=%2>%1</font></td>").arg(pd1->name).arg(color));
if (GetEepromInterface()->getCapability(GvarsFlightPhases)) {
if (GetCurrentFirmware()->getCapability(GvarsFlightPhases)) {
for (k=0; k<gvarnum; k++) {
color=getColor1(pd1->gvars[k],pd2->gvars[k]);
if (pd1->gvars[k]<=1024) {
@@ -383,7 +382,7 @@ void compareDialog::printPhases()
}
}
}
for (k=0; k<GetEepromInterface()->getCapability(RotaryEncoders); k++) {
for (k=0; k<GetCurrentFirmware()->getCapability(RotaryEncoders); k++) {
color=getColor1(pd1->rotaryEncoders[k],pd2->rotaryEncoders[k]);
if (pd1->rotaryEncoders[k]<=1024) {
str.append(QString("<td align=\"right\"><font size=+1 face='Courier New' color=%2>%1").arg(pd1->rotaryEncoders[k]).arg(color)+"</font></td>");
@@ -409,7 +408,7 @@ void compareDialog::printPhases()
str.append(QString("<td width=\"40\" align=\"center\"><b>%1</b></td>").arg(getInputStr(*g_model1, i)));
}
str.append("</tr>");
for (i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) {
for (i=0; i<GetCurrentFirmware()->getCapability(FlightPhases); i++) {
PhaseData *pd1=&g_model1->phaseData[i];
PhaseData *pd2=&g_model2->phaseData[i];
str.append("<tr><td><b>"+tr("FM")+QString("%1</b> ").arg(i));
@@ -434,32 +433,32 @@ void compareDialog::printPhases()
}
str.append("</table>");
if ((gvars==1 && GetEepromInterface()->getCapability(GvarsFlightPhases)) || GetEepromInterface()->getCapability(RotaryEncoders)) {
if ((gvars==1 && GetCurrentFirmware()->getCapability(GvarsFlightPhases)) || GetCurrentFirmware()->getCapability(RotaryEncoders)) {
str.append("<br><table border=1 cellspacing=0 cellpadding=1 width=\"100%\">");
str.append("<tr><td style=\"border-style:none;\">&nbsp;</td>");
if (GetEepromInterface()->getCapability(GvarsFlightPhases)) {
if (GetCurrentFirmware()->getCapability(GvarsFlightPhases)) {
str.append(QString("<td colspan=%1 align=center><b>").arg(gvarnum)+tr("Gvars")+"</td>");
}
if (GetEepromInterface()->getCapability(RotaryEncoders)) {
str.append(QString("<td colspan=%1 align=center><b>").arg(GetEepromInterface()->getCapability(RotaryEncoders))+tr("Rot. Enc.")+"</td>");
if (GetCurrentFirmware()->getCapability(RotaryEncoders)) {
str.append(QString("<td colspan=%1 align=center><b>").arg(GetCurrentFirmware()->getCapability(RotaryEncoders))+tr("Rot. Enc.")+"</td>");
}
str.append("</tr><tr><td align=center ><b>"+tr("Flight mode name")+"</b></td>");
if (GetEepromInterface()->getCapability(GvarsFlightPhases)) {
if (GetCurrentFirmware()->getCapability(GvarsFlightPhases)) {
for (i=0; i<gvarnum; i++) {
str.append(QString("<td width=\"40\" align=\"center\"><b>GV%1</b><br>%2</td>").arg(i+1).arg(g_model2->gvars_names[i]));
}
}
for (i=0; i<GetEepromInterface()->getCapability(RotaryEncoders); i++) {
for (i=0; i<GetCurrentFirmware()->getCapability(RotaryEncoders); i++) {
str.append(QString("<td align=\"center\"><b>RE%1</b></td>").arg((i==0 ? 'A': 'B')));
}
str.append("</tr>");
for (i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) {
for (i=0; i<GetCurrentFirmware()->getCapability(FlightPhases); i++) {
PhaseData *pd1=&g_model1->phaseData[i];
PhaseData *pd2=&g_model2->phaseData[i];
str.append("<tr><td><b>"+tr("FM")+QString("%1</b> ").arg(i));
color=getColor1(pd1->name,pd2->name);
str.append(QString("<font size=+1 face='Courier New' color=%2>%1</font></td>").arg(pd2->name).arg(color));
if (GetEepromInterface()->getCapability(GvarsFlightPhases)) {
if (GetCurrentFirmware()->getCapability(GvarsFlightPhases)) {
for (k=0; k<gvarnum; k++) {
color=getColor1(pd1->gvars[k],pd2->gvars[k]);
if (pd2->gvars[k]<=1024) {
@@ -472,7 +471,7 @@ void compareDialog::printPhases()
}
}
}
for (k=0; k<GetEepromInterface()->getCapability(RotaryEncoders); k++) {
for (k=0; k<GetCurrentFirmware()->getCapability(RotaryEncoders); k++) {
color=getColor1(pd1->rotaryEncoders[k],pd2->rotaryEncoders[k]);
if (pd2->rotaryEncoders[k]<=1024) {
str.append(QString("<td align=\"right\"><font size=+1 face='Courier New' color=%2>%1").arg(pd2->rotaryEncoders[k]).arg(color)+"</font></td>");
@@ -491,20 +490,20 @@ void compareDialog::printPhases()
te->append(str);
}
void compareDialog::printLimits()
void CompareDialog::printLimits()
{
QString color;
QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-after:always;\" width=\"100%\">";
str.append("<tr><td colspan=2><h2>"+tr("Limits")+"</h2></td></tr>");
str.append("<tr><td><table border=1 cellspacing=0 cellpadding=1 width=\"50%\">");
if (GetEepromInterface()->getCapability(HasChNames)) {
if (GetCurrentFirmware()->getCapability(HasChNames)) {
str.append("<tr><td>"+tr("Name")+"</td><td align=center><b>"+tr("Offset")+"</b></td><td align=center><b>"+tr("Min")+"</b></td><td align=center><b>"+tr("Max")+"</b></td><td align=center><b>"+tr("Invert")+"</b></td></tr>");
} else {
str.append("<tr><td></td><td align=center><b>"+tr("Offset")+"</b></td><td align=center><b>"+tr("Min")+"</b></td><td align=center><b>"+tr("Max")+"</b></td><td align=center><b>"+tr("Invert")+"</b></td></tr>");
}
for(int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) {
for(int i=0; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
str.append("<tr>");
if (GetEepromInterface()->getCapability(HasChNames)) {
if (GetCurrentFirmware()->getCapability(HasChNames)) {
QString name1=g_model1->limitData[i].name;
QString name2=g_model2->limitData[i].name;
color=getColor1(name1,name2);
@@ -529,9 +528,9 @@ void compareDialog::printLimits()
str.append("</table></td>");
str.append("<td><table border=1 cellspacing=0 cellpadding=1 width=\"50%\">");
str.append("<tr><td></td><td align=center><b>"+tr("Offset")+"</b></td><td align=center><b>"+tr("Min")+"</b></td><td align=center><b>"+tr("Max")+"</b></td><td align=center><b>"+tr("Invert")+"</b></td></tr>");
for(int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) {
for(int i=0; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
str.append("<tr>");
if (GetEepromInterface()->getCapability(HasChNames)) {
if (GetCurrentFirmware()->getCapability(HasChNames)) {
QString name1=g_model1->limitData[i].name;
QString name2=g_model2->limitData[i].name;
color=getColor2(name1,name2);
@@ -557,17 +556,17 @@ void compareDialog::printLimits()
te->append(str);
}
void compareDialog::printGvars()
void CompareDialog::printGvars()
{
QString color;
int gvars=0;
int gvarnum=0;
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT ) || (!GetEepromInterface()->getCapability(HasVariants) && GetEepromInterface()->getCapability(Gvars))) {
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT ) || (!GetCurrentFirmware()->getCapability(HasVariants) && GetCurrentFirmware()->getCapability(Gvars))) {
gvars=1;
gvarnum=GetEepromInterface()->getCapability(Gvars);
gvarnum=GetCurrentFirmware()->getCapability(Gvars);
}
if (!GetEepromInterface()->getCapability(GvarsFlightPhases) && (gvars==1 && GetEepromInterface()->getCapability(Gvars))) {
if (!GetCurrentFirmware()->getCapability(GvarsFlightPhases) && (gvars==1 && GetCurrentFirmware()->getCapability(Gvars))) {
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
str.append("<tr><td colspan=2><h2>"+tr("Global Variables")+"</h2></td></tr>");
str.append("<tr><td width=50%>");
@@ -605,7 +604,7 @@ void compareDialog::printGvars()
}
}
void compareDialog::printExpos()
void CompareDialog::printExpos()
{
QString color;
bool expoused[C9X_MAX_EXPOS]={false};
@@ -614,7 +613,7 @@ void compareDialog::printExpos()
QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-after:always;\" width=\"100%\"><tr><td><h2>";
str.append(tr("Expo/Dr Settings"));
str.append("</h2></td></tr><tr><td><table border=1 cellspacing=0 cellpadding=3>");
for(uint8_t i=0; i<GetEepromInterface()->getCapability(Outputs); i++) {
for(uint8_t i=0; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
if (ChannelHasExpo(g_model1->expoData, i) || ChannelHasExpo(g_model2->expoData, i)) {
str.append("<tr>");
str.append("<td width=\"45%\">");
@@ -651,12 +650,12 @@ void compareDialog::printExpos()
str += tr("Weight") + QString("%1").arg(getGVarString(ed->weight)).rightJustified(6, ' ');
str += ed->curve.toString().replace("<", "&lt;").replace(">", "&gt;");
if (GetEepromInterface()->getCapability(FlightPhases)) {
if (GetCurrentFirmware()->getCapability(FlightPhases)) {
if(ed->phases) {
if (ed->phases!=(unsigned int)(1<<GetEepromInterface()->getCapability(FlightPhases))-1) {
if (ed->phases!=(unsigned int)(1<<GetCurrentFirmware()->getCapability(FlightPhases))-1) {
int mask=1;
int first=0;
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases);i++) {
for (int i=0; i<GetCurrentFirmware()->getCapability(FlightPhases);i++) {
if (!(ed->phases & mask)) {
first++;
}
@@ -669,7 +668,7 @@ void compareDialog::printExpos()
}
mask=1;
first=1;
for (int j=0; j<GetEepromInterface()->getCapability(FlightPhases);j++) {
for (int j=0; j<GetCurrentFirmware()->getCapability(FlightPhases);j++) {
if (!(ed->phases & mask)) {
PhaseData *pd = &g_model1->phaseData[j];
if (!first) {
@@ -729,12 +728,12 @@ void compareDialog::printExpos()
str += tr("Weight") + QString("%1").arg(getGVarString(ed->weight)).rightJustified(6, ' ');
str += ed->curve.toString().replace("<", "&lt;").replace(">", "&gt;");
if (GetEepromInterface()->getCapability(FlightPhases)) {
if (GetCurrentFirmware()->getCapability(FlightPhases)) {
if(ed->phases) {
if (ed->phases!=(unsigned int)(1<<GetEepromInterface()->getCapability(FlightPhases))-1) {
if (ed->phases!=(unsigned int)(1<<GetCurrentFirmware()->getCapability(FlightPhases))-1) {
int mask=1;
int first=0;
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases);i++) {
for (int i=0; i<GetCurrentFirmware()->getCapability(FlightPhases);i++) {
if (!(ed->phases & mask)) {
first++;
}
@@ -747,7 +746,7 @@ void compareDialog::printExpos()
}
mask=1;
first=1;
for (int j=0; j<GetEepromInterface()->getCapability(FlightPhases);j++) {
for (int j=0; j<GetCurrentFirmware()->getCapability(FlightPhases);j++) {
if (!(ed->phases & mask)) {
PhaseData *pd = &g_model2->phaseData[j];
if (!first) {
@@ -778,21 +777,21 @@ void compareDialog::printExpos()
te->append(str);
}
void compareDialog::printMixers()
void CompareDialog::printMixers()
{
QString color;
QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-after:always;\" width=\"100%\"><tr><td><h2>";
str.append(tr("Mixers"));
str.append("</h2></td></tr><tr><td><table border=1 cellspacing=0 cellpadding=3>");
float scale=GetEepromInterface()->getCapability(SlowScale);
float scale=GetCurrentFirmware()->getCapability(SlowScale);
bool mixused[64]={false};
bool mixused2[64]={false};
for(uint8_t i=1; i<=GetEepromInterface()->getCapability(Outputs); i++) {
for(uint8_t i=1; i<=GetCurrentFirmware()->getCapability(Outputs); i++) {
if (ChannelHasMix(g_model1->mixData, i) || ChannelHasMix(g_model2->mixData, i)) {
str.append("<tr>");
str.append("<td width=\"45%\">");
str.append("<table border=0 cellspacing=0 cellpadding=0>");
for (int j=0; j<GetEepromInterface()->getCapability(Mixes); j++) {
for (int j=0; j<GetCurrentFirmware()->getCapability(Mixes); j++) {
if (g_model1->mixData[j].destCh==i) {
int mix=ModelHasMix(g_model2->mixData, g_model1->mixData[j], mixused);
if (mix>-1) {
@@ -827,12 +826,12 @@ void compareDialog::printMixers()
if (md->delayDown || md->delayUp) str += tr(" Delay(u%1:d%2)").arg(md->delayUp/scale).arg(md->delayDown/scale);
if (md->speedDown || md->speedUp) str += tr(" Slow(u%1:d%2)").arg(md->speedUp/scale).arg(md->speedDown/scale);
if (md->mixWarn) str += " "+tr("Warn")+QString("(%1)").arg(md->mixWarn);
if (GetEepromInterface()->getCapability(FlightPhases)) {
if (GetCurrentFirmware()->getCapability(FlightPhases)) {
if(md->phases) {
if (md->phases!=(unsigned int)(1<<GetEepromInterface()->getCapability(FlightPhases))-1) {
if (md->phases!=(unsigned int)(1<<GetCurrentFirmware()->getCapability(FlightPhases))-1) {
int mask=1;
int first=0;
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases);i++) {
for (int i=0; i<GetCurrentFirmware()->getCapability(FlightPhases);i++) {
if (!(md->phases & mask)) {
first++;
}
@@ -845,7 +844,7 @@ void compareDialog::printMixers()
}
mask=1;
first=1;
for (int j=0; j<GetEepromInterface()->getCapability(FlightPhases);j++) {
for (int j=0; j<GetCurrentFirmware()->getCapability(FlightPhases);j++) {
if (!(md->phases & mask)) {
PhaseData *pd = &g_model1->phaseData[j];
if (!first) {
@@ -870,7 +869,7 @@ void compareDialog::printMixers()
str.append("<td width=\"10%\" align=\"center\" valign=\"middle\"><b>"+tr("CH")+QString("%1</b></td>").arg(i,2,10,QChar('0')));
str.append("<td width=\"45%\">");
str.append("<table border=0 cellspacing=0 cellpadding=0>");
for (int j=0; j<GetEepromInterface()->getCapability(Mixes); j++) {
for (int j=0; j<GetCurrentFirmware()->getCapability(Mixes); j++) {
if (g_model2->mixData[j].destCh==i) {
int mix=ModelHasMix(g_model1->mixData, g_model2->mixData[j],mixused2);
if (mix>-1) {
@@ -906,12 +905,12 @@ void compareDialog::printMixers()
if (md->delayDown || md->delayUp) str += tr(" Delay(u%1:d%2)").arg(md->delayUp/scale).arg(md->delayDown/scale);
if (md->speedDown || md->speedUp) str += tr(" Slow(u%1:d%2)").arg(md->speedUp/scale).arg(md->speedDown/scale);
if (md->mixWarn) str += " "+tr("Warn")+QString("(%1)").arg(md->mixWarn);
if (GetEepromInterface()->getCapability(FlightPhases)) {
if (GetCurrentFirmware()->getCapability(FlightPhases)) {
if(md->phases) {
if (md->phases!=(unsigned int)(1<<GetEepromInterface()->getCapability(FlightPhases))-1) {
if (md->phases!=(unsigned int)(1<<GetCurrentFirmware()->getCapability(FlightPhases))-1) {
int mask=1;
int first=0;
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases);i++) {
for (int i=0; i<GetCurrentFirmware()->getCapability(FlightPhases);i++) {
if (!(md->phases & mask)) {
first++;
}
@@ -924,7 +923,7 @@ void compareDialog::printMixers()
}
mask=1;
first=1;
for (int j=0; j<GetEepromInterface()->getCapability(FlightPhases);j++) {
for (int j=0; j<GetCurrentFirmware()->getCapability(FlightPhases);j++) {
if (!(md->phases & mask)) {
PhaseData *pd = &g_model2->phaseData[j];
if (!first) {
@@ -953,7 +952,7 @@ void compareDialog::printMixers()
te->append(str);
}
void compareDialog::printCurves()
void CompareDialog::printCurves()
{
#if 0
int i,r,g,b,c;
@@ -1033,14 +1032,14 @@ void compareDialog::printCurves()
#endif
}
void compareDialog::printSwitches()
void CompareDialog::printSwitches()
{
int sc=0;
QString color;
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
str.append("<tr><td><h2>"+tr("Logical Switches")+"</h2></td></tr>");
str.append("<tr><td><table border=1 cellspacing=0 cellpadding=1 width=\"100%\">");
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) {
for (int i=0; i<GetCurrentFirmware()->getCapability(LogicalSwitches); i++) {
QString sw1 = g_model1->customSw[i].toString(*g_model1);
QString sw2 = g_model2->customSw[i].toString(*g_model2);
if (!(sw1.isEmpty() && sw2.isEmpty())) {
@@ -1063,7 +1062,7 @@ void compareDialog::printSwitches()
te->append(str);
}
void compareDialog::printFSwitches()
void CompareDialog::printFSwitches()
{
QString color1;
QString color2;
@@ -1083,7 +1082,7 @@ void compareDialog::printFSwitches()
str.append("<td width=\"7%\" align=\"center\"><b>"+tr("Repeat")+"</b></td>");
str.append("<td width=\"7%\" align=\"center\"><b>"+tr("Enable")+"</b></td>");
str.append("</tr>");
for(int i=0; i<GetEepromInterface()->getCapability(CustomFunctions); i++)
for(int i=0; i<GetCurrentFirmware()->getCapability(CustomFunctions); i++)
{
if (g_model1->funcSw[i].swtch.type || g_model2->funcSw[i].swtch.type) {
if ((g_model1->funcSw[i].swtch != g_model2->funcSw[i].swtch) || (g_model1->funcSw[i].func!=g_model2->funcSw[i].func) || (g_model1->funcSw[i].adjustMode!=g_model2->funcSw[i].adjustMode) || (g_model1->funcSw[i].param!=g_model2->funcSw[i].param)) {
@@ -1142,7 +1141,7 @@ void compareDialog::printFSwitches()
te->append(str);
}
void compareDialog::printFrSky()
void CompareDialog::printFrSky()
{
QString color;
float value1,value2;
@@ -1212,10 +1211,10 @@ void compareDialog::printFrSky()
str.append("<td align=\"center\"><font color="+color+">"+QString::number(fd1->rssiAlarms[1].value,10)+"</td>");
str.append("</table>");
#if 0
if (GetEepromInterface()->getCapability(TelemetryBars) || GetEepromInterface()->getCapability(TelemetryCSFields)) {
int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields);
if (GetCurrentFirmware()->getCapability(TelemetryBars) || GetCurrentFirmware()->getCapability(TelemetryCSFields)) {
int cols=GetCurrentFirmware()->getCapability(TelemetryColsCSFields);
if (cols==0) cols=2;
for (int j=0; j<GetEepromInterface()->getCapability(TelemetryCSFields)/(4*cols); j++) {
for (int j=0; j<GetCurrentFirmware()->getCapability(TelemetryCSFields)/(4*cols); j++) {
QString tcols;
QString cwidth;
QString swidth;
@@ -1331,10 +1330,10 @@ void compareDialog::printFrSky()
str.append("<td align=\"center\"><font color="+color+">"+QString::number(fd2->rssiAlarms[1].value,10)+"</td>");
str.append("</table></br>");
#if 0
if (GetEepromInterface()->getCapability(TelemetryBars) || GetEepromInterface()->getCapability(TelemetryCSFields)) {
int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields);
if (GetCurrentFirmware()->getCapability(TelemetryBars) || GetCurrentFirmware()->getCapability(TelemetryCSFields)) {
int cols=GetCurrentFirmware()->getCapability(TelemetryColsCSFields);
if (cols==0) cols=2;
for (int j=0; j<GetEepromInterface()->getCapability(TelemetryCSFields)/(4*cols); j++) {
for (int j=0; j<GetCurrentFirmware()->getCapability(TelemetryCSFields)/(4*cols); j++) {
QString tcols;
QString cwidth;
QString swidth;
@@ -1391,7 +1390,7 @@ void compareDialog::printFrSky()
te->append(str);
}
void compareDialog::on_printButton_clicked()
void CompareDialog::on_printButton_clicked()
{
QPrinter printer;
printer.setPageMargins(10.0,10.0,10.0,10.0,printer.Millimeter);
@@ -1402,7 +1401,7 @@ void compareDialog::on_printButton_clicked()
te->print(&printer);
}
void compareDialog::on_printFileButton_clicked()
void CompareDialog::on_printFileButton_clicked()
{
QPrinter printer;
QString filename = QFileDialog::getSaveFileName(this,tr("Select PDF output file"),QString(),"Pdf File(*.pdf)");
+10 -12
View File
@@ -7,29 +7,27 @@
#include "eeprominterface.h"
namespace Ui {
class compareDialog;
class CompareDialog;
}
class compareDialog : public QDialog
class CompareDialog : public QDialog
{
Q_OBJECT
public:
explicit compareDialog(QWidget *parent = 0, GeneralSettings *gg = 0);
~compareDialog();
void closeEvent(QCloseEvent *event);
public:
CompareDialog(QWidget *parent);
~CompareDialog();
protected:
ModelData * g_model1;
ModelData * g_model2;
ModelData * modeltemp;
int model1;
int model2;
GeneralSettings *g_eeGeneral;
EEPROMInterface *eepromInterface;
private:
Ui::compareDialog *ui;
private:
void closeEvent(QCloseEvent *event);
Ui::CompareDialog *ui;
QString doTC(const QString s, const QString color, bool bold);
QString doTR(const QString s, const QString color, bool bold);
QString doTL(const QString s, const QString color, bool bold);
+2 -2
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>compareDialog</class>
<widget class="QDialog" name="compareDialog">
<class>CompareDialog</class>
<widget class="QDialog" name="CompareDialog">
<property name="geometry">
<rect>
<x>0</x>
+20 -28
View File
@@ -592,7 +592,7 @@ QString LogicalSwitchData::toString(const ModelData & model)
result += RawSwitch(andsw).toString();
}
if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) {
if (GetCurrentFirmware()->getCapability(LogicalSwitchesExt)) {
if (delay)
result += QObject::tr(" Delay %1 sec").arg(delay/10.0);
if (duration)
@@ -644,7 +644,7 @@ QStringList FuncSwData::toStringList()
result << item.toString();
}
else if ((func==FuncPlayPrompt) || (func==FuncPlayBoth)) {
if ( GetEepromInterface()->getCapability(VoicesAsNumbers)) {
if ( GetCurrentFirmware()->getCapability(VoicesAsNumbers)) {
result << QString("%1").arg(param);
} else {
result << paramarm;
@@ -774,7 +774,7 @@ QString FuncSwData::paramToString()
return item.toString();
}
else if ((func==FuncPlayPrompt) || (func==FuncPlayBoth)) {
if ( GetEepromInterface()->getCapability(VoicesAsNumbers)) {
if ( GetCurrentFirmware()->getCapability(VoicesAsNumbers)) {
return QString("%1").arg(param);
} else {
return paramarm;
@@ -839,7 +839,7 @@ GeneralSettings::GeneralSettings()
stickMode = g.profile[g.id()].defaultMode();
QString t_calib=g.profile[g.id()].stickPotCalib();
int potsnum=GetEepromInterface()->getCapability(Pots);
int potsnum=GetCurrentFirmware()->getCapability(Pots);
if (t_calib.isEmpty()) {
return;
}
@@ -1186,13 +1186,13 @@ ModelData ModelData::removeGlobalVars()
QList<EEPROMInterface *> eepromInterfaces;
void RegisterEepromInterfaces()
{
eepromInterfaces.push_back(new OpenTxInterface(BOARD_STOCK));
eepromInterfaces.push_back(new OpenTxInterface(BOARD_M128));
eepromInterfaces.push_back(new OpenTxInterface(BOARD_GRUVIN9X));
eepromInterfaces.push_back(new OpenTxInterface(BOARD_SKY9X));
eepromInterfaces.push_back(new OpenTxInterface(BOARD_TARANIS));
eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_STOCK));
eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_M128));
eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_GRUVIN9X));
eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_SKY9X));
eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_TARANIS));
if (g.rev4aSupport())
eepromInterfaces.push_back(new OpenTxInterface(BOARD_TARANIS_REV4a));
eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_TARANIS_REV4a));
eepromInterfaces.push_back(new Gruvin9xInterface(BOARD_STOCK));
eepromInterfaces.push_back(new Gruvin9xInterface(BOARD_GRUVIN9X));
eepromInterfaces.push_back(new Ersky9xInterface());
@@ -1209,25 +1209,17 @@ void UnregisterEepromInterfaces()
OpenTxEepromCleanup();
}
QList<FirmwareInfo *> firmwares;
QList<FirmwareInterface *> firmwares;
FirmwareVariant default_firmware_variant;
FirmwareVariant current_firmware_variant;
void RegisterFirmwares()
{
RegisterOpen9xFirmwares();
default_firmware_variant = GetFirmwareVariant("opentx-9x-heli-templates-en");
current_firmware_variant = default_firmware_variant;
RegisterEepromInterfaces();
}
void UnregisterFirmwares()
{
UnregisterEepromInterfaces();
UnregisterOpen9xFirmwares();
foreach (FirmwareInterface * f, firmwares) {
delete f;
}
}
bool LoadEeprom(RadioData &radioData, const uint8_t *eeprom, const int size)
{
foreach(EEPROMInterface *eepromInterface, eepromInterfaces) {
@@ -1264,7 +1256,7 @@ FirmwareVariant GetFirmwareVariant(QString id)
{
FirmwareVariant result;
foreach(FirmwareInfo * firmware, firmwares) {
foreach(FirmwareInterface * firmware, firmwares) {
if (id.contains(firmware->id+"-") || (!id.contains("-") && id.contains(firmware->id))) {
result.id = id;
result.firmware = firmware;
@@ -1276,13 +1268,13 @@ FirmwareVariant GetFirmwareVariant(QString id)
return default_firmware_variant;
}
void FirmwareInfo::addOption(const char *option, QString tooltip, uint32_t variant)
void FirmwareInterface::addOption(const char *option, QString tooltip, uint32_t variant)
{
Option options[] = { { option, tooltip, variant }, { NULL } };
addOptions(options);
}
unsigned int FirmwareInfo::getVariant(const QString & variantId)
unsigned int FirmwareInterface::getVariant(const QString & variantId)
{
unsigned int variant = variantBase;
QStringList options = variantId.mid(id.length()+1).split("-", QString::SkipEmptyParts);
@@ -1298,17 +1290,17 @@ unsigned int FirmwareInfo::getVariant(const QString & variantId)
return variant;
}
void FirmwareInfo::addLanguage(const char *lang)
void FirmwareInterface::addLanguage(const char *lang)
{
languages.push_back(lang);
}
void FirmwareInfo::addTTSLanguage(const char *lang)
void FirmwareInterface::addTTSLanguage(const char *lang)
{
ttslanguages.push_back(lang);
}
void FirmwareInfo::addOptions(Option options[])
void FirmwareInterface::addOptions(Option options[])
{
QList<Option> opts;
for (int i=0; options[i].name; i++) {
+75 -66
View File
@@ -1130,12 +1130,8 @@ class EEPROMInterface
virtual int getSize(GeneralSettings &) = 0;
virtual int getCapability(const Capability) = 0;
virtual int isAvailable(Protocol proto, int port=0) = 0;
virtual SimulatorInterface * getSimulator() { return NULL; }
virtual const int getEEpromSize() = 0;
virtual const int getMaxModels() = 0;
@@ -1244,8 +1240,9 @@ inline void applyStickModeToModel(ModelData &model, unsigned int mode)
model.swashRingData.collectiveSource.index = applyStickMode(model.swashRingData.collectiveSource.index + 1, mode) - 1;
}
void RegisterFirmwares();
void RegisterEepromInterfaces();
void UnregisterFirmwares();
void registerOpenTxFirmwares();
bool LoadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index);
bool LoadEeprom(RadioData &radioData, const uint8_t *eeprom, int size);
@@ -1257,50 +1254,27 @@ struct Option {
uint32_t variant;
};
class FirmwareInfo {
public:
FirmwareInfo():
parent(NULL),
id(QString::null),
eepromInterface(NULL),
voice(false),
variantBase(0)
{
}
class FirmwareInterface {
virtual ~FirmwareInfo()
public:
virtual ~FirmwareInterface()
{
delete eepromInterface;
}
FirmwareInfo(const QString & id, const QString & name, EEPROMInterface * eepromInterface, const QString & url = QString(), const QString & stamp = QString(), const QString & rnurl = QString(), bool voice = false):
parent(NULL),
FirmwareInterface(const QString & id, const QString & name, const BoardEnum board, EEPROMInterface * eepromInterface, bool voice = false):
id(id),
name(name),
board(board),
eepromInterface(eepromInterface),
url(url),
stamp(stamp),
rnurl(rnurl),
voice(voice),
variantBase(0)
{
}
FirmwareInfo(const QString & id, EEPROMInterface * eepromInterface, const QString & url, const QString & stamp = QString(), const QString & rnurl = QString(), bool voice=false):
parent(NULL),
id(id),
name(QString::null),
eepromInterface(eepromInterface),
url(url),
stamp(stamp),
rnurl(rnurl),
voice(voice),
variantBase(0)
inline void setVariantBase(unsigned int variant)
{
}
void setVariantBase(unsigned int variant) {
this->variantBase = variant;
variantBase = variant;
}
unsigned int getVariant(const QString & id);
@@ -1313,71 +1287,104 @@ class FirmwareInfo {
virtual void addOptions(Option options[]);
QStringList get_options() {
if (parent)
return id.mid(parent->id.length()+1).split("-", QString::SkipEmptyParts);
else
return QStringList();
}
int saveEEPROM(uint8_t *eeprom, RadioData &radioData, uint32_t variant=0, unsigned int version=0) {
inline int saveEEPROM(uint8_t *eeprom, RadioData &radioData, uint32_t variant=0, unsigned int version=0)
{
return eepromInterface->save(eeprom, radioData, variant, version);
}
virtual QString getUrl(const QString &fwId) {
if (url.contains("%1"))
return url.arg(fwId);
else
return url;
virtual QString getStampUrl() = 0;
virtual QString getReleaseNotesUrl() = 0;
virtual QString getFirmwareUrl(QString & id) = 0;
inline BoardEnum getBoard()
{
return board;
}
virtual QString getRnUrl(const QString &fwId) {
if (rnurl.contains("%1"))
return rnurl.arg(fwId);
else
return rnurl;
inline EEPROMInterface * getEepromInterface()
{
return eepromInterface;
}
virtual int getCapability(const Capability) = 0;
virtual SimulatorInterface * getSimulator()
{
return NULL;
}
public:
QList<const char *> languages;
QList<const char *> ttslanguages;
QList< QList<Option> > opts;
FirmwareInfo *parent;
QString id;
QString name;
protected:
BoardEnum board;
EEPROMInterface * eepromInterface;
QString url;
QString stamp;
QString rnurl;
public:
bool voice;
protected:
unsigned int variantBase;
private:
FirmwareInterface();
};
struct FirmwareVariant {
QString id;
FirmwareInfo *firmware;
unsigned int variant;
class FirmwareVariant
{
public:
FirmwareVariant():
firmware(NULL),
variant(0)
{
}
FirmwareVariant(QString & id, FirmwareInterface * firmware, unsigned int variant):
id(id),
firmware(firmware),
variant(variant)
{
}
QString getFirmwareUrl()
{
if (firmware)
return firmware->getFirmwareUrl(id);
else
return "";
}
QString id;
FirmwareInterface * firmware;
unsigned int variant;
};
extern QList<FirmwareInfo *> firmwares;
extern QList<FirmwareInterface *> firmwares;
extern FirmwareVariant default_firmware_variant;
extern FirmwareVariant current_firmware_variant;
FirmwareVariant GetFirmwareVariant(QString id);
inline FirmwareInfo * GetFirmware(QString id)
inline FirmwareInterface * GetFirmware(QString id)
{
return GetFirmwareVariant(id).firmware;
}
inline FirmwareInfo * GetCurrentFirmware()
inline FirmwareInterface * GetCurrentFirmware()
{
return current_firmware_variant.firmware;
}
inline EEPROMInterface * GetEepromInterface()
{
return GetCurrentFirmware()->eepromInterface;
return GetCurrentFirmware()->getEepromInterface();
}
inline unsigned int GetCurrentFirmwareVariant()
@@ -1385,6 +1392,8 @@ inline unsigned int GetCurrentFirmwareVariant()
return current_firmware_variant.variant;
}
void UnregisterEepromInterfaces();
inline int divRoundClosest(const int n, const int d)
{
return ((n < 0) ^ (d < 0)) ? ((n - d/2)/d) : ((n + d/2)/d);
@@ -200,75 +200,6 @@ int Er9xInterface::getSize(GeneralSettings &settings)
return 0;
}
int Er9xInterface::getCapability(const Capability capability)
{
switch (capability) {
case FlightPhases:
return 4;
case Mixes:
return ER9X_MAX_MIXERS;
case PPMExtCtrl:
return 1;
case ModelTrainerEnable:
return 1;
case Timer2ThrTrig:
return 1;
case OffsetWeight:
return 125;
case SoundMod:
return 1;
case SoundPitch:
return 1;
case Haptic:
return 1;
case Timers:
return 1;
case Pots:
return 3;
case Switches:
return 7;
case SwitchesPositions:
return 9;
case CustomFunctions:
return 0;
case LogicalSwitches:
return 12;
case CustomAndSwitches:
return 5;
case CSFunc:
return 13;
case Outputs:
return 16;
case Simulation:
return 1;
case Telemetry:
return TM_HASTELEMETRY|TM_HASWSHH;
case TelemetryUnits:
return 1;
case TelemetryMaxMultiplier:
return 2;
case MaxVolume:
return 7;
case SlowScale:
return 1;
case SlowRange:
return 15;
case LCDWidth:
return 128;
case VoicesAsNumbers:
case HasAltitudeSel:
case HasContrast:
case HasVolume:
case ModelVoice:
case Gvars:
return 7;
case GetThrSwitch:
return DSW_THR;
default:
return 0;
}
}
int Er9xInterface::isAvailable(Protocol prot, int port)
{
switch (prot) {
@@ -282,13 +213,6 @@ int Er9xInterface::isAvailable(Protocol prot, int port)
}
}
SimulatorInterface * Er9xInterface::getSimulator()
{
return NULL; // new Er9xSimulator(this);
}
void Er9xInterface::appendTextElement(QDomDocument * qdoc, QDomElement * pe, QString name, QString value)
{
QDomElement e = qdoc->createElement(name);
@@ -46,12 +46,8 @@ class Er9xInterface : public EEPROMInterface
virtual int getSize(GeneralSettings &settings);
virtual int getCapability(const Capability);
virtual int isAvailable(Protocol proto, int port=0);
virtual SimulatorInterface * getSimulator();
protected:
EFile *efile;
@@ -244,74 +244,6 @@ int Ersky9xInterface::getSize(GeneralSettings &settings)
return 0;
}
int Ersky9xInterface::getCapability(const Capability capability)
{
switch (capability) {
case Mixes:
return ERSKY9X_MAX_MIXERS_V11;
case PPMExtCtrl:
return 1;
case ModelTrainerEnable:
return 1;
case Timer2ThrTrig:
return 1;
case SoundMod:
return 1;
case SoundPitch:
return 1;
case Haptic:
return 1;
case ModelVoice:
return 1;
case Timers:
return 2;
case Pots:
return 3;
case Gvars:
return 7;
case Switches:
return 7;
case SwitchesPositions:
return 9;
case CustomFunctions:
return 0;
case LogicalSwitches:
return ERSKY9X_NUM_CSW_V11;
case CustomAndSwitches:
return 1;
case CSFunc:
return 13;
case Outputs:
return ERSKY9X_NUM_CHNOUT_V11;
case Simulation:
return 1;
case Telemetry:
return TM_HASTELEMETRY|TM_HASWSHH;
case TelemetryUnits:
return 1;
case OptrexDisplay:
return 1;
case HasAltitudeSel:
case HasCurrentCalibration:
case HasVolume:
case HasBrightness:
case HasContrast:
return 1;
case OffsetWeight:
return 125;
case MaxVolume:
return 23;
case TelemetryMaxMultiplier:
return 2;
case LCDWidth:
return 128;
case GetThrSwitch:
return DSW_THR;
default:
return 0;
}
}
int Ersky9xInterface::isAvailable(Protocol prot, int port)
{
switch (prot) {
@@ -325,13 +257,6 @@ int Ersky9xInterface::isAvailable(Protocol prot, int port)
}
}
SimulatorInterface * Ersky9xInterface::getSimulator()
{
return NULL; // new Ersky9xSimulator(this);
}
void Ersky9xInterface::appendTextElement(QDomDocument * qdoc, QDomElement * pe, QString name, QString value)
{
QDomElement e = qdoc->createElement(name);
@@ -46,12 +46,8 @@ class Ersky9xInterface : public EEPROMInterface
virtual int getSize(GeneralSettings &settings);
virtual int getCapability(const Capability);
virtual int isAvailable(Protocol proto, int port=0);
virtual SimulatorInterface * getSimulator();
protected:
EFile *efile;
@@ -216,59 +216,6 @@ int Gruvin9xInterface::getSize(GeneralSettings &settings)
return 0;
}
int Gruvin9xInterface::getCapability(const Capability capability)
{
switch (capability) {
case Mixes:
return G9X_MAX_MIXERS;
case FlightPhases:
return G9X_MAX_PHASES;
case FlightPhasesHaveFades:
return 1;
case Timers:
return 2;
case Pots:
return 3;
case Switches:
return 7;
case SwitchesPositions:
return 9;
case CustomFunctions:
return 12;
case LogicalSwitches:
return 12;
case CSFunc:
return 13;
case Outputs:
return 16;
case ExtendedTrims:
return 500;
case Simulation:
return true;
case OffsetWeight:
return 125;
case HasContrast:
return true;
case Telemetry:
return TM_HASTELEMETRY|TM_HASWSHH;
case TelemetryMaxMultiplier:
return 1;
case SlowScale:
return 2;
case SlowRange:
return 15;
case LCDWidth:
return 128;
case HasSDLogs:
case Haptic:
return 1;
case GetThrSwitch:
return DSW_THR;
default:
return false;
}
}
int Gruvin9xInterface::isAvailable(Protocol proto, int port)
{
switch (proto) {
@@ -283,8 +230,3 @@ int Gruvin9xInterface::isAvailable(Protocol proto, int port)
return 0;
}
}
SimulatorInterface * Gruvin9xInterface::getSimulator()
{
return NULL;
}
@@ -47,12 +47,8 @@ class Gruvin9xInterface : public EEPROMInterface
virtual int getSize(GeneralSettings &settings);
virtual int getCapability(const Capability);
virtual int isAvailable(Protocol proto, int port=0);
virtual SimulatorInterface * getSimulator();
protected:
template <class T>
@@ -106,8 +106,7 @@ uint8_t getStickMode()
using namespace Open9xGruvin9x;
Open9xGruvin9xSimulator::Open9xGruvin9xSimulator(OpenTxInterface * open9xInterface):
open9xInterface(open9xInterface)
Open9xGruvin9xSimulator::Open9xGruvin9xSimulator()
{
}
@@ -20,13 +20,13 @@
#include "simulatorinterface.h"
class RadioData;
class OpenTxInterface;
class OpenTxEepromInterface;
class Open9xGruvin9xSimulator : public SimulatorInterface {
public:
Open9xGruvin9xSimulator(OpenTxInterface *);
Open9xGruvin9xSimulator();
virtual void start(QByteArray & eeprom, bool tests=true);
@@ -54,9 +54,6 @@ class Open9xGruvin9xSimulator : public SimulatorInterface {
virtual const char * getError();
protected:
OpenTxInterface * open9xInterface;
};
#endif
@@ -104,8 +104,7 @@ uint8_t getStickMode()
using namespace Open9xM128;
Open9xM128Simulator::Open9xM128Simulator(OpenTxInterface * open9xInterface):
open9xInterface(open9xInterface)
Open9xM128Simulator::Open9xM128Simulator()
{
}
@@ -20,13 +20,13 @@
#include "simulatorinterface.h"
class RadioData;
class OpenTxInterface;
class OpenTxEepromInterface;
class Open9xM128Simulator : public SimulatorInterface {
public:
Open9xM128Simulator(OpenTxInterface *);
Open9xM128Simulator();
virtual void start(QByteArray & eeprom, bool tests=true);
@@ -54,9 +54,6 @@ class Open9xM128Simulator : public SimulatorInterface {
virtual const char * getError();
protected:
OpenTxInterface * open9xInterface;
};
#endif
@@ -135,8 +135,7 @@ uint8_t getStickMode()
using namespace Open9xSky9x;
Open9xSky9xSimulator::Open9xSky9xSimulator(OpenTxInterface * open9xInterface):
open9xInterface(open9xInterface)
Open9xSky9xSimulator::Open9xSky9xSimulator()
{
QString path=g.profile[g.id()].sdPath()+"/";
int i=0;
@@ -20,13 +20,13 @@
#include "simulatorinterface.h"
class RadioData;
class OpenTxInterface;
class OpenTxEepromInterface;
class Open9xSky9xSimulator : public SimulatorInterface {
public:
Open9xSky9xSimulator(OpenTxInterface *);
Open9xSky9xSimulator();
virtual void start(QByteArray & eeprom, bool tests=true);
@@ -54,9 +54,6 @@ class Open9xSky9xSimulator : public SimulatorInterface {
virtual const char * getError();
protected:
OpenTxInterface * open9xInterface;
};
#endif
@@ -176,8 +176,7 @@ void resetTrims()
using namespace Open9xX9D;
OpentxTaranisSimulator::OpentxTaranisSimulator(OpenTxInterface * open9xInterface):
open9xInterface(open9xInterface)
OpentxTaranisSimulator::OpentxTaranisSimulator()
{
taranisSimulatorBoard = GetEepromInterface()->getBoard();
QString path=g.profile[g.id()].sdPath()+"/";
@@ -20,13 +20,13 @@
#include "simulatorinterface.h"
class RadioData;
class OpenTxInterface;
class OpenTxEepromInterface;
class OpentxTaranisSimulator : public SimulatorInterface {
public:
OpentxTaranisSimulator(OpenTxInterface *);
OpentxTaranisSimulator();
virtual void start(QByteArray & eeprom, bool tests=true);
@@ -54,9 +54,6 @@ class OpentxTaranisSimulator : public SimulatorInterface {
virtual const char * getError();
protected:
OpenTxInterface * open9xInterface;
};
#endif
@@ -2475,7 +2475,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
if (board==BOARD_SKY9X && version >= 216) {
internalField.Append(new UnsignedField<8>(modelData.nPotsToWarn));
for (int i=0; i < GetEepromInterface()->getCapability(Pots); i++) {
for (int i=0; i < GetCurrentFirmware()->getCapability(Pots); i++) {
internalField.Append(new SignedField<8>(modelData.potPosition[i]));
}
}
@@ -2499,7 +2499,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
internalField.Append(new ZCharField<4>(modelData.inputNames[i]));
}
internalField.Append(new UnsignedField<8>(modelData.nPotsToWarn));
for (int i=0; i < GetEepromInterface()->getCapability(Pots); i++) {
for (int i=0; i < GetCurrentFirmware()->getCapability(Pots); i++) {
internalField.Append(new SignedField<8>(modelData.potPosition[i]));
}
}
+311 -311
View File
@@ -43,18 +43,18 @@ size_t SizeOfArray( T(&)[ N ] )
return N;
}
OpenTxInterface::OpenTxInterface(BoardEnum board):
OpenTxEepromInterface::OpenTxEepromInterface(BoardEnum board):
EEPROMInterface(board),
efile(new EFile())
{
}
OpenTxInterface::~OpenTxInterface()
OpenTxEepromInterface::~OpenTxEepromInterface()
{
delete efile;
}
const char * OpenTxInterface::getName()
const char * OpenTxEepromInterface::getName()
{
switch (board) {
case BOARD_STOCK:
@@ -74,7 +74,7 @@ const char * OpenTxInterface::getName()
}
}
const int OpenTxInterface::getEEpromSize()
const int OpenTxEepromInterface::getEEpromSize()
{
switch (board) {
case BOARD_STOCK:
@@ -94,7 +94,7 @@ const int OpenTxInterface::getEEpromSize()
}
}
const int OpenTxInterface::getMaxModels()
const int OpenTxEepromInterface::getMaxModels()
{
if (IS_ARM(board))
return 60;
@@ -107,7 +107,7 @@ const int OpenTxInterface::getMaxModels()
}
template <class T>
bool OpenTxInterface::loadModel(ModelData &model, uint8_t *data, int index, unsigned int stickMode)
bool OpenTxEepromInterface::loadModel(ModelData &model, uint8_t *data, int index, unsigned int stickMode)
{
T _model;
@@ -140,7 +140,7 @@ bool OpenTxInterface::loadModel(ModelData &model, uint8_t *data, int index, unsi
}
template <class T>
bool OpenTxInterface::loadModelVariant(unsigned int index, ModelData &model, uint8_t *data, unsigned int version, unsigned int variant)
bool OpenTxEepromInterface::loadModelVariant(unsigned int index, ModelData &model, uint8_t *data, unsigned int version, unsigned int variant)
{
T open9xModel(model, board, version, variant);
@@ -167,7 +167,7 @@ bool OpenTxInterface::loadModelVariant(unsigned int index, ModelData &model, uin
return true;
}
bool OpenTxInterface::loadModel(uint8_t version, ModelData &model, uint8_t *data, int index, unsigned int variant, unsigned int stickMode)
bool OpenTxEepromInterface::loadModel(uint8_t version, ModelData &model, uint8_t *data, int index, unsigned int variant, unsigned int stickMode)
{
if (version == 201) {
return loadModel<Open9xModelData_v201>(model, data, index, stickMode);
@@ -248,7 +248,7 @@ bool OpenTxInterface::loadModel(uint8_t version, ModelData &model, uint8_t *data
}
template <class T>
bool OpenTxInterface::loadGeneral(GeneralSettings &settings, unsigned int version)
bool OpenTxEepromInterface::loadGeneral(GeneralSettings &settings, unsigned int version)
{
QByteArray eepromData(sizeof(settings), 0); // GeneralSettings should be always bigger than the EEPROM struct
T open9xSettings(settings, board, version);
@@ -264,7 +264,7 @@ bool OpenTxInterface::loadGeneral(GeneralSettings &settings, unsigned int versio
}
template <class T>
bool OpenTxInterface::saveGeneral(GeneralSettings &settings, BoardEnum board, uint32_t version, uint32_t variant)
bool OpenTxEepromInterface::saveGeneral(GeneralSettings &settings, BoardEnum board, uint32_t version, uint32_t variant)
{
T open9xSettings(settings, board, version, variant);
// open9xSettings.Dump();
@@ -275,7 +275,7 @@ bool OpenTxInterface::saveGeneral(GeneralSettings &settings, BoardEnum board, ui
}
template <class T>
bool OpenTxInterface::saveModel(unsigned int index, ModelData &model, unsigned int version, unsigned int variant)
bool OpenTxEepromInterface::saveModel(unsigned int index, ModelData &model, unsigned int version, unsigned int variant)
{
T open9xModel(model, board, version, variant);
// open9xModel.Dump();
@@ -285,12 +285,12 @@ bool OpenTxInterface::saveModel(unsigned int index, ModelData &model, unsigned i
return (sz == eeprom.size());
}
bool OpenTxInterface::loadxml(RadioData &radioData, QDomDocument &doc)
bool OpenTxEepromInterface::loadxml(RadioData &radioData, QDomDocument &doc)
{
return false;
}
bool OpenTxInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
bool OpenTxEepromInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
{
std::cout << "trying " << getName() << " import...";
@@ -352,7 +352,7 @@ bool OpenTxInterface::load(RadioData &radioData, const uint8_t *eeprom, int size
return true;
}
int OpenTxInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version)
int OpenTxEepromInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version)
{
EEPROMWarnings.clear();
@@ -364,6 +364,7 @@ int OpenTxInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t varian
version = 216;
break;
case BOARD_GRUVIN9X:
case BOARD_MEGA2560:
version = 216;
break;
case BOARD_M128:
@@ -405,7 +406,7 @@ int OpenTxInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t varian
return size;
}
int OpenTxInterface::getSize(ModelData &model)
int OpenTxEepromInterface::getSize(ModelData &model)
{
if (board == BOARD_SKY9X)
return 0;
@@ -428,7 +429,7 @@ int OpenTxInterface::getSize(ModelData &model)
return efile->size(0);
}
int OpenTxInterface::getSize(GeneralSettings &settings)
int OpenTxEepromInterface::getSize(GeneralSettings &settings)
{
if (board == BOARD_SKY9X)
return 0;
@@ -448,7 +449,7 @@ int OpenTxInterface::getSize(GeneralSettings &settings)
return efile->size(0);
}
int OpenTxInterface::getCapability(const Capability capability)
int OpenTxFirmware::getCapability(const Capability capability)
{
switch (capability) {
case ModelImage:
@@ -692,7 +693,7 @@ int OpenTxInterface::getCapability(const Capability capability)
}
}
int OpenTxInterface::isAvailable(Protocol proto, int port)
int OpenTxEepromInterface::isAvailable(Protocol proto, int port)
{
if (IS_TARANIS(board)) {
switch (port) {
@@ -777,31 +778,14 @@ int OpenTxInterface::isAvailable(Protocol proto, int port)
}
}
SimulatorInterface * OpenTxInterface::getSimulator()
{
switch (board) {
case BOARD_STOCK:
return new Open9xSimulator(this);
case BOARD_M128:
return new Open9xM128Simulator(this);
case BOARD_GRUVIN9X:
return new Open9xGruvin9xSimulator(this);
case BOARD_SKY9X:
return new Open9xSky9xSimulator(this);
case BOARD_TARANIS:
case BOARD_TARANIS_REV4a:
return new OpentxTaranisSimulator(this);
default:
return NULL;
}
}
template<typename T, size_t SIZE>
size_t getSizeA(T (&)[SIZE]) {
return SIZE;
}
bool OpenTxInterface::checkVersion(unsigned int version)
bool OpenTxEepromInterface::checkVersion(unsigned int version)
{
switch(version) {
case 201:
@@ -867,7 +851,7 @@ bool OpenTxInterface::checkVersion(unsigned int version)
return true;
}
bool OpenTxInterface::checkVariant(unsigned int version, unsigned int variant)
bool OpenTxEepromInterface::checkVariant(unsigned int version, unsigned int variant)
{
if (board == BOARD_M128 && !(variant & 0x8000)) {
if (version == 212) {
@@ -889,7 +873,7 @@ bool OpenTxInterface::checkVariant(unsigned int version, unsigned int variant)
}
}
bool OpenTxInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
bool OpenTxEepromInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
{
std::cout << "trying " << getName() << " backup import...";
@@ -930,311 +914,327 @@ bool OpenTxInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esiz
return true;
}
QString geturl( int board)
QString OpenTxFirmware::getFirmwareUrl(QString & id)
{
QString url = g.compileServer();
if (url.isEmpty()){
url= OPENTX_FIRMWARE_DOWNLOADS;
g.compileServer(url);
}
switch(board) {
case BOARD_STOCK:
case BOARD_M128:
case BOARD_GRUVIN9X:
url.append("/getfw.php?fw=%1.hex");
break;
case BOARD_SKY9X:
case BOARD_TARANIS:
case BOARD_TARANIS_REV4a:
url.append("/getfw.php?fw=%1.bin");
break;
default:
url.clear();
break;
}
return url;
QString url = g.compileServer();
if (url.isEmpty()){
url = OPENTX_FIRMWARE_DOWNLOADS;
g.compileServer(url);
}
switch(board) {
case BOARD_STOCK:
case BOARD_M128:
case BOARD_GRUVIN9X:
url.append(QString("/getfw.php?fw=%1.hex").arg(id));
break;
case BOARD_SKY9X:
case BOARD_TARANIS:
case BOARD_TARANIS_REV4a:
url.append(QString("/getfw.php?fw=%1.bin").arg(id));
break;
default:
url.clear();
break;
}
return url;
}
QString getstamp( int board)
QString OpenTxFirmware::getReleaseNotesUrl()
{
QString url = g.compileServer();
if (url.isEmpty()){
url= OPENTX_FIRMWARE_DOWNLOADS;
g.compileServer(url);
}
url.append("/stamp-opentx-");
switch(board) {
case BOARD_STOCK:
url.append("9x.txt");
break;
case BOARD_M128:
url.append("9x128.txt");
break;
case BOARD_GRUVIN9X:
url.append("gruvin9x.txt");
break;
case BOARD_SKY9X:
url.append("sky9x.txt");
break;
case BOARD_TARANIS:
case BOARD_TARANIS_REV4a:
url.append("taranis.txt");
break;
default:
url.clear();
break;
}
return url;
QString url = g.compileServer();
if (url.isEmpty()){
url = OPENTX_FIRMWARE_DOWNLOADS;
g.compileServer(url);
}
url.append("/releasenotes-");
switch(board) {
case BOARD_STOCK:
case BOARD_M128:
case BOARD_GRUVIN9X:
case BOARD_SKY9X:
url.append("9x.txt");
break;
case BOARD_TARANIS:
case BOARD_TARANIS_REV4a:
url.append("taranis.txt");
break;
default:
url.clear();
break;
}
return url;
}
QString getrnurl( int board)
QString OpenTxFirmware::getStampUrl()
{
QString url = g.compileServer();
if (url.isEmpty()){
url= OPENTX_FIRMWARE_DOWNLOADS;
g.compileServer(url);
}
url.append("/releasenotes-");
switch(board) {
case BOARD_STOCK:
case BOARD_M128:
case BOARD_GRUVIN9X:
case BOARD_SKY9X:
url.append("9x.txt");
break;
case BOARD_TARANIS:
case BOARD_TARANIS_REV4a:
url.append("taranis.txt");
break;
default:
url.clear();
break;
}
return url;
QString url = g.compileServer();
if (url.isEmpty()){
url= OPENTX_FIRMWARE_DOWNLOADS;
g.compileServer(url);
}
url.append("/stamp-opentx-");
switch(board) {
case BOARD_STOCK:
url.append("9x.txt");
break;
case BOARD_M128:
url.append("9x128.txt");
break;
case BOARD_GRUVIN9X:
url.append("gruvin9x.txt");
break;
case BOARD_SKY9X:
url.append("sky9x.txt");
break;
case BOARD_TARANIS:
case BOARD_TARANIS_REV4a:
url.append("taranis.txt");
break;
default:
url.clear();
break;
}
return url;
}
void RegisterOpen9xFirmwares()
SimulatorInterface * OpenTxFirmware::getSimulator()
{
Open9xFirmware * open9x;
switch (board) {
case BOARD_STOCK:
return new Open9xSimulator();
case BOARD_M128:
return new Open9xM128Simulator();
case BOARD_GRUVIN9X:
return new Open9xGruvin9xSimulator();
case BOARD_SKY9X:
return new Open9xSky9xSimulator();
case BOARD_TARANIS:
case BOARD_TARANIS_REV4a:
return new OpentxTaranisSimulator();
default:
return NULL;
}
}
void registerOpenTxFirmwares()
{
OpenTxFirmware * openTx;
Option ext_options[] = { { "frsky", QObject::tr("Support for frsky telemetry mod"), FRSKY_VARIANT }, { "telemetrez", QObject::tr("Support for telemetry easy board"), FRSKY_VARIANT }, { "jeti", QObject::tr("Support for jeti telemetry mod"), 0 }, { "ardupilot", QObject::tr("Support for receiving ardupilot data"), 0 }, { "nmea", QObject::tr("Support for receiving NMEA data"), 0 }, { "mavlink", QObject::tr("Support for MAVLINK devices"), MAVLINK_VARIANT }, { NULL } };
Option nav_options[] = { { "rotenc", QObject::tr("Rotary Encoder use in menus navigation") }, { "potscroll", QObject::tr("Pots use in menus navigation") }, { NULL } };
Option extr_options[] = { { "frsky", QObject::tr("Support for frsky telemetry mod"), FRSKY_VARIANT }, { "jeti", QObject::tr("Support for jeti telemetry mod"), 0 }, { "ardupilot", QObject::tr("Support for receiving ardupilot data"), 0 }, { "nmea", QObject::tr("Support for receiving NMEA data"), 0 }, { "mavlink", QObject::tr("Support for MAVLINK devices"), MAVLINK_VARIANT }, { NULL } };
Option fai_options[] = { { "faichoice", QObject::tr("Possibility to enable FAI MODE at field") }, { "faimode", QObject::tr("FAI MODE always enabled") }, { NULL } };
/* 9x board */
open9x = new Open9xFirmware("opentx-9x", QObject::tr("OpenTX for 9X board"), new OpenTxInterface(BOARD_STOCK), geturl(BOARD_STOCK), getstamp(BOARD_STOCK), getrnurl(BOARD_STOCK), false);
open9x->addOptions(ext_options);
open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
open9x->addOption("nosplash", QObject::tr("No splash screen"));
open9x->addOption("nofp", QObject::tr("No flight modes"));
open9x->addOption("nocurves", QObject::tr("Disable curves menus"));
open9x->addOption("audio", QObject::tr("Support for radio modified with regular speaker"));
open9x->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
open9x->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode"));
// NOT TESTED open9x->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
open9x->addOption("DSM2", QObject::tr("Support for DSM2 modules"));
open9x->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
open9x->addOption("ppmus", QObject::tr("Channel values displayed in us"));
open9x->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
open9x->addOption("symlimits", QObject::tr("Symetrical Limits"));
open9x->addOptions(nav_options);
open9x->addOption("sp22", QObject::tr("SmartieParts 2.2 Backlight support"));
open9x->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
open9x->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
open9x->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time"));
open9x->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
open9x->addOption("battgraph", QObject::tr("Battery graph"));
open9x->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
open9x->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
open9x->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
open9x->addOption("pgbar", QObject::tr("EEprom write progress bar"));
open9x->addOption("imperial", QObject::tr("Imperial units"));
open9x->addOption("nowshh", QObject::tr("No Winged Shadow How High support"));
open9x->addOption("novario", QObject::tr("No vario support"));
open9x->addOption("nogps", QObject::tr("No GPS support"));
open9x->addOption("nogauges", QObject::tr("No gauges in the custom telemetry screen"));
open9x->addOption("fasoffset", QObject::tr("Allow compensating for offset errors in FrSky FAS current sensors"));
open9x->addOptions(fai_options);
firmwares.push_back(open9x);
openTx = new OpenTxFirmware("opentx-9x", QObject::tr("OpenTX for 9X board"), BOARD_STOCK, false);
openTx->addOptions(ext_options);
openTx->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
openTx->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
openTx->addOption("nosplash", QObject::tr("No splash screen"));
openTx->addOption("nofp", QObject::tr("No flight modes"));
openTx->addOption("nocurves", QObject::tr("Disable curves menus"));
openTx->addOption("audio", QObject::tr("Support for radio modified with regular speaker"));
openTx->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
openTx->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode"));
// NOT TESTED openTx->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
openTx->addOption("DSM2", QObject::tr("Support for DSM2 modules"));
openTx->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
openTx->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
openTx->addOption("symlimits", QObject::tr("Symetrical Limits"));
openTx->addOptions(nav_options);
openTx->addOption("sp22", QObject::tr("SmartieParts 2.2 Backlight support"));
openTx->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
openTx->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
openTx->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time"));
openTx->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
openTx->addOption("battgraph", QObject::tr("Battery graph"));
openTx->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
openTx->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
openTx->addOption("pgbar", QObject::tr("EEprom write progress bar"));
openTx->addOption("imperial", QObject::tr("Imperial units"));
openTx->addOption("nowshh", QObject::tr("No Winged Shadow How High support"));
openTx->addOption("novario", QObject::tr("No vario support"));
openTx->addOption("nogps", QObject::tr("No GPS support"));
openTx->addOption("nogauges", QObject::tr("No gauges in the custom telemetry screen"));
openTx->addOption("fasoffset", QObject::tr("Allow compensating for offset errors in FrSky FAS current sensors"));
openTx->addOptions(fai_options);
firmwares.push_back(openTx);
/* 9x board with M128 chip */
open9x = new Open9xFirmware("opentx-9x128", QObject::tr("OpenTX for M128 / 9X board"), new OpenTxInterface(BOARD_M128), geturl(BOARD_M128), getstamp(BOARD_M128),getrnurl(BOARD_M128), false);
open9x->addOptions(ext_options);
open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
open9x->addOption("nosplash", QObject::tr("No splash screen"));
open9x->addOption("nofp", QObject::tr("No flight modes"));
open9x->addOption("nocurves", QObject::tr("Disable curves menus"));
open9x->addOption("audio", QObject::tr("Support for radio modified with regular speaker"));
open9x->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
open9x->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode"));
// NOT TESTED open9x->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
open9x->addOption("DSM2", QObject::tr("Support for DSM2 modules"));
open9x->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
open9x->addOption("ppmus", QObject::tr("Channel values displayed in us"));
open9x->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
open9x->addOption("symlimits", QObject::tr("Symetrical Limits"));
open9x->addOptions(nav_options);
open9x->addOption("sp22", QObject::tr("SmartieParts 2.2 Backlight support"));
open9x->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
open9x->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
open9x->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time"));
open9x->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
open9x->addOption("battgraph", QObject::tr("Battery graph"));
open9x->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
open9x->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
open9x->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
open9x->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
open9x->addOption("imperial", QObject::tr("Imperial units"));
open9x->addOptions(fai_options);
firmwares.push_back(open9x);
openTx = new OpenTxFirmware("opentx-9x128", QObject::tr("OpenTX for M128 / 9X board"), BOARD_M128, false);
openTx->addOptions(ext_options);
openTx->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
openTx->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
openTx->addOption("nosplash", QObject::tr("No splash screen"));
openTx->addOption("nofp", QObject::tr("No flight modes"));
openTx->addOption("nocurves", QObject::tr("Disable curves menus"));
openTx->addOption("audio", QObject::tr("Support for radio modified with regular speaker"));
openTx->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
openTx->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode"));
// NOT TESTED openTx->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
openTx->addOption("DSM2", QObject::tr("Support for DSM2 modules"));
openTx->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
openTx->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
openTx->addOption("symlimits", QObject::tr("Symetrical Limits"));
openTx->addOptions(nav_options);
openTx->addOption("sp22", QObject::tr("SmartieParts 2.2 Backlight support"));
openTx->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
openTx->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
openTx->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time"));
openTx->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
openTx->addOption("battgraph", QObject::tr("Battery graph"));
openTx->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
openTx->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
openTx->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
openTx->addOption("imperial", QObject::tr("Imperial units"));
openTx->addOptions(fai_options);
firmwares.push_back(openTx);
/* 9XR board */
open9x = new Open9xFirmware("opentx-9xr", QObject::tr("OpenTX for 9XR"), new OpenTxInterface(BOARD_STOCK), geturl(BOARD_STOCK), getstamp(BOARD_STOCK),getrnurl(BOARD_STOCK), false);
open9x->addOptions(extr_options);
open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
open9x->addOption("nosplash", QObject::tr("No splash screen"));
open9x->addOption("nofp", QObject::tr("No flight modes"));
open9x->addOption("nocurves", QObject::tr("Disable curves menus"));
open9x->addOption("audio", QObject::tr("Support for radio modified with regular speaker"));
open9x->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
open9x->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode"));
// NOT TESTED open9x->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
open9x->addOption("DSM2", QObject::tr("Support for DSM2 modules"));
open9x->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
open9x->addOption("ppmus", QObject::tr("Channel values displayed in us"));
open9x->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
open9x->addOption("symlimits", QObject::tr("Symetrical Limits"));
open9x->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
open9x->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
open9x->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
open9x->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
open9x->addOption("battgraph", QObject::tr("Battery graph"));
open9x->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
open9x->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
open9x->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
open9x->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
open9x->addOption("imperial", QObject::tr("Imperial units"));
open9x->addOption("nowshh", QObject::tr("No Winged Shadow How High support"));
open9x->addOption("novario", QObject::tr("No vario support"));
open9x->addOption("nogps", QObject::tr("No GPS support"));
open9x->addOption("nogauges", QObject::tr("No gauges in the custom telemetry screen"));
open9x->addOptions(fai_options);
firmwares.push_back(open9x);
openTx = new OpenTxFirmware("opentx-9xr", QObject::tr("OpenTX for 9XR"), BOARD_STOCK, false);
openTx->addOptions(extr_options);
openTx->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
openTx->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
openTx->addOption("nosplash", QObject::tr("No splash screen"));
openTx->addOption("nofp", QObject::tr("No flight modes"));
openTx->addOption("nocurves", QObject::tr("Disable curves menus"));
openTx->addOption("audio", QObject::tr("Support for radio modified with regular speaker"));
openTx->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
openTx->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode"));
// NOT TESTED openTx->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
openTx->addOption("DSM2", QObject::tr("Support for DSM2 modules"));
openTx->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
openTx->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
openTx->addOption("symlimits", QObject::tr("Symetrical Limits"));
openTx->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
openTx->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
openTx->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
openTx->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
openTx->addOption("battgraph", QObject::tr("Battery graph"));
openTx->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
openTx->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
openTx->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
openTx->addOption("imperial", QObject::tr("Imperial units"));
openTx->addOption("nowshh", QObject::tr("No Winged Shadow How High support"));
openTx->addOption("novario", QObject::tr("No vario support"));
openTx->addOption("nogps", QObject::tr("No GPS support"));
openTx->addOption("nogauges", QObject::tr("No gauges in the custom telemetry screen"));
openTx->addOptions(fai_options);
firmwares.push_back(openTx);
/* 9XR board with M128 chip */
open9x = new Open9xFirmware("opentx-9xr128", QObject::tr("OpenTX for 9XR with M128 chip"), new OpenTxInterface(BOARD_M128), geturl(BOARD_M128), getstamp(BOARD_M128),getrnurl(BOARD_M128), false);
open9x->addOptions(extr_options);
open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
open9x->addOption("nosplash", QObject::tr("No splash screen"));
open9x->addOption("nofp", QObject::tr("No flight modes"));
open9x->addOption("nocurves", QObject::tr("Disable curves menus"));
open9x->addOption("audio", QObject::tr("Support for radio modified with regular speaker"));
open9x->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
open9x->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode"));
// NOT TESTED open9x->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
open9x->addOption("DSM2", QObject::tr("Support for DSM2 modules"));
open9x->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
open9x->addOption("ppmus", QObject::tr("Channel values displayed in us"));
open9x->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
open9x->addOption("symlimits", QObject::tr("Symetrical Limits"));
open9x->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
open9x->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
open9x->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
open9x->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
open9x->addOption("battgraph", QObject::tr("Battery graph"));
open9x->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
open9x->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
open9x->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
open9x->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
open9x->addOption("imperial", QObject::tr("Imperial units"));
open9x->addOptions(fai_options);
firmwares.push_back(open9x);
openTx = new OpenTxFirmware("opentx-9xr128", QObject::tr("OpenTX for 9XR with M128 chip"), BOARD_M128, false);
openTx->addOptions(extr_options);
openTx->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
openTx->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
openTx->addOption("nosplash", QObject::tr("No splash screen"));
openTx->addOption("nofp", QObject::tr("No flight modes"));
openTx->addOption("nocurves", QObject::tr("Disable curves menus"));
openTx->addOption("audio", QObject::tr("Support for radio modified with regular speaker"));
openTx->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
openTx->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode"));
// NOT TESTED openTx->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
openTx->addOption("DSM2", QObject::tr("Support for DSM2 modules"));
openTx->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
openTx->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
openTx->addOption("symlimits", QObject::tr("Symetrical Limits"));
openTx->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
openTx->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
openTx->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
openTx->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
openTx->addOption("battgraph", QObject::tr("Battery graph"));
openTx->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
openTx->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
openTx->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
openTx->addOption("imperial", QObject::tr("Imperial units"));
openTx->addOptions(fai_options);
firmwares.push_back(openTx);
/* Gruvin9x board */
open9x = new Open9xFirmware("opentx-gruvin9x", QObject::tr("OpenTX for Gruvin9x board / 9X"), new OpenTxInterface(BOARD_GRUVIN9X), geturl(BOARD_GRUVIN9X), getstamp(BOARD_GRUVIN9X),getrnurl(BOARD_GRUVIN9X), false);
open9x->setVariantBase(FRSKY_VARIANT);
open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
open9x->addOption("nofp", QObject::tr("No flight modes"));
open9x->addOption("nocurves", QObject::tr("Disable curves menus"));
open9x->addOption("sdcard", QObject::tr("Support for SD memory card"));
open9x->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
open9x->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
openTx = new OpenTxFirmware("opentx-gruvin9x", QObject::tr("OpenTX for Gruvin9x board / 9X"), BOARD_GRUVIN9X, false);
openTx->setVariantBase(FRSKY_VARIANT);
openTx->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
openTx->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
openTx->addOption("nofp", QObject::tr("No flight modes"));
openTx->addOption("nocurves", QObject::tr("Disable curves menus"));
openTx->addOption("sdcard", QObject::tr("Support for SD memory card"));
openTx->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
openTx->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
Option dsm2_options[] = { { "DSM2", QObject::tr("Support for DSM2 modules"), 0 }, { "DSM2PPM", QObject::tr("Support for DSM2 modules using ppm instead of true serial"), 0 }, { NULL } };
open9x->addOptions(dsm2_options);
open9x->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
open9x->addOption("ppmus", QObject::tr("Channel values displayed in us"));
open9x->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
open9x->addOption("symlimits", QObject::tr("Symetrical Limits"));
open9x->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
open9x->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
open9x->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
open9x->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time"));
open9x->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
open9x->addOption("battgraph", QObject::tr("Battery graph"));
open9x->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
open9x->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
open9x->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
open9x->addOption("imperial", QObject::tr("Imperial units"));
open9x->addOptions(fai_options);
firmwares.push_back(open9x);
openTx->addOptions(dsm2_options);
openTx->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
openTx->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
openTx->addOption("symlimits", QObject::tr("Symetrical Limits"));
openTx->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
openTx->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
openTx->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
openTx->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time"));
openTx->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
openTx->addOption("battgraph", QObject::tr("Battery graph"));
openTx->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
openTx->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
openTx->addOption("imperial", QObject::tr("Imperial units"));
openTx->addOptions(fai_options);
firmwares.push_back(openTx);
#ifndef __APPLE__
/* SKY9X board */
open9x = new Open9xFirmware("opentx-sky9x", QObject::tr("OpenTX for Sky9x board / 9X"), new OpenTxInterface(BOARD_SKY9X), geturl(BOARD_SKY9X), getstamp(BOARD_SKY9X),getrnurl(BOARD_SKY9X), true);
open9x->setVariantBase(FRSKY_VARIANT);
open9x->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
open9x->addOption("nofp", QObject::tr("No flight modes"));
open9x->addOption("nocurves", QObject::tr("Disable curves menus"));
open9x->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
open9x->addOption("ppmus", QObject::tr("Channel values displayed in us"));
open9x->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
open9x->addOption("symlimits", QObject::tr("Symetrical Limits"));
open9x->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
open9x->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
open9x->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
open9x->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time"));
open9x->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
open9x->addOption("battgraph", QObject::tr("Battery graph"));
open9x->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
open9x->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
open9x->addOption("tsticks", QObject::tr("Use FrSky Taranis sticks in a 9X/9XR"));
open9x->addOption("bluetooth", QObject::tr("Bluetooth interface"));
open9x->addOptions(fai_options);
firmwares.push_back(open9x);
openTx = new OpenTxFirmware("opentx-sky9x", QObject::tr("OpenTX for Sky9x board / 9X"), BOARD_SKY9X, true);
openTx->setVariantBase(FRSKY_VARIANT);
openTx->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
openTx->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
openTx->addOption("nofp", QObject::tr("No flight modes"));
openTx->addOption("nocurves", QObject::tr("Disable curves menus"));
openTx->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
openTx->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
openTx->addOption("symlimits", QObject::tr("Symetrical Limits"));
openTx->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
openTx->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
openTx->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
openTx->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time"));
openTx->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
openTx->addOption("battgraph", QObject::tr("Battery graph"));
openTx->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
openTx->addOption("tsticks", QObject::tr("Use FrSky Taranis sticks in a 9X/9XR"));
openTx->addOption("bluetooth", QObject::tr("Bluetooth interface"));
openTx->addOptions(fai_options);
firmwares.push_back(openTx);
#endif
/* Taranis board */
open9x = new Open9xFirmware("opentx-taranis", QObject::tr("OpenTX for FrSky Taranis"), new OpenTxInterface(BOARD_TARANIS), geturl(BOARD_TARANIS), getstamp(BOARD_TARANIS),getrnurl(BOARD_TARANIS), true);
open9x->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support"));
open9x->addOption("notemplates", QObject::tr("Disable TEMPLATES menu"));
open9x->addOption("nogvars", QObject::tr("Disable Global variables"));
open9x->addOption("ppmus", QObject::tr("Channel values displayed in us"));
open9x->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
open9x->addOptions(fai_options);
firmwares.push_back(open9x);
openTx = new OpenTxFirmware("opentx-taranis", QObject::tr("OpenTX for FrSky Taranis"), BOARD_TARANIS, true);
openTx->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support"));
openTx->addOption("notemplates", QObject::tr("Disable TEMPLATES menu"));
openTx->addOption("nogvars", QObject::tr("Disable Global variables"));
openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
openTx->addOptions(fai_options);
firmwares.push_back(openTx);
if (g.rev4aSupport()) {
open9x = new Open9xFirmware("opentx-taranisrev4a", QObject::tr("OpenTX for FrSky Taranis Rev4a"), new OpenTxInterface(BOARD_TARANIS_REV4a), geturl(BOARD_TARANIS_REV4a), getstamp(BOARD_TARANIS_REV4a),getrnurl(BOARD_TARANIS), true);
open9x->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support"));
open9x->addOption("notemplates", QObject::tr("Disable TEMPLATES menu"));
open9x->addOption("nogvars", QObject::tr("Disable Global variables"));
open9x->addOption("ppmus", QObject::tr("Channel values displayed in us"));
open9x->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
open9x->addOptions(fai_options);
firmwares.push_back(open9x);
openTx = new OpenTxFirmware("opentx-taranisrev4a", QObject::tr("OpenTX for FrSky Taranis Rev4a"), BOARD_TARANIS_REV4a, true);
openTx->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support"));
openTx->addOption("notemplates", QObject::tr("Disable TEMPLATES menu"));
openTx->addOption("nogvars", QObject::tr("Disable Global variables"));
openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
openTx->addOptions(fai_options);
firmwares.push_back(openTx);
}
default_firmware_variant = GetFirmwareVariant("opentx-9x-heli-templates-en");
current_firmware_variant = default_firmware_variant;
}
void UnregisterOpen9xFirmwares()
{
foreach (FirmwareInfo * f, firmwares) {
qDebug() << "UnregisterOpen9xFirmwares(): deleting " << QString::number(reinterpret_cast<uint64_t>(f), 16 );
delete f;
}
}
@@ -23,13 +23,13 @@
class EFile;
class OpenTxInterface : public EEPROMInterface
class OpenTxEepromInterface : public EEPROMInterface
{
public:
OpenTxInterface(BoardEnum board);
OpenTxEepromInterface(BoardEnum board);
virtual ~OpenTxInterface();
virtual ~OpenTxEepromInterface();
virtual const char * getName();
@@ -49,12 +49,8 @@ class OpenTxInterface : public EEPROMInterface
virtual int getSize(GeneralSettings &);
virtual int getCapability(const Capability);
virtual int isAvailable(Protocol proto, int port=0);
virtual SimulatorInterface * getSimulator();
protected:
bool checkVersion(unsigned int version);
@@ -82,10 +78,10 @@ class OpenTxInterface : public EEPROMInterface
};
class Open9xFirmware: public FirmwareInfo {
class OpenTxFirmware: public FirmwareInterface {
public:
Open9xFirmware(const QString & id, const QString & name, EEPROMInterface * eepromInterface, const QString & url = QString(), const QString & stamp = QString(), const QString & rnurl = QString(), bool voice = false):
FirmwareInfo(id, name, eepromInterface, url, stamp, rnurl, voice)
OpenTxFirmware(const QString & id, const QString & name, const BoardEnum board, bool voice = false):
FirmwareInterface(id, name, board, new OpenTxEepromInterface(board), voice)
{
addLanguage("en");
addLanguage("fr");
@@ -109,61 +105,19 @@ class Open9xFirmware: public FirmwareInfo {
addTTSLanguage("es");
}
virtual unsigned int getEepromVersion(unsigned int revision) {
switch(this->eepromInterface->getBoard()) {
case BOARD_SKY9X:
if (revision == 0)
return 212;
if (revision >= 1217)
return 212;
if (revision >= 1174)
return 211;
if (revision >= 1031)
return 210;
if (revision >= 791)
return 209;
if (revision >= 641)
return 208;
break;
case BOARD_GRUVIN9X:
if (revision == 0)
return 211;
if (revision >= 1217)
return 211;
if (revision >= 1174)
return 210;
if (revision >= 791)
return 209;
if (revision >= 641)
return 208;
if (revision >= 547)
return 207;
break;
default:
if (revision == 0)
return 211;
if (revision >= 1217)
return 211;
if (revision >= 1174)
return 210;
if (revision >= 791)
return 209;
if (revision >= 641)
return 208;
break;
}
if (revision >= 321)
return 205;
else if (revision >= 217)
return 204;
else if (revision >= 184)
return 203;
else
return 202;
}
virtual QString getStampUrl();
virtual QString getReleaseNotesUrl();
virtual QString getFirmwareUrl(QString & id);
virtual int getCapability(const Capability);
virtual SimulatorInterface * getSimulator();
};
void RegisterOpen9xFirmwares();
void UnregisterOpen9xFirmwares();
void registerOpenTxFirmwares();
#endif
@@ -110,8 +110,7 @@ uint8_t getStickMode()
using namespace Open9x;
Open9xSimulator::Open9xSimulator(OpenTxInterface * open9xInterface):
open9xInterface(open9xInterface)
Open9xSimulator::Open9xSimulator()
{
#define INIT_IMPORT
#include "simulatorimport.h"
@@ -144,7 +143,6 @@ void Open9xSimulator::start(QByteArray & eeprom, bool tests)
void Open9xSimulator::start(const char * filename, bool tests)
{
// open9xInterface->save(&Open9x::eeprom[0], radioData, SIMU_STOCK_VARIANTS);
StartEepromThread(filename);
StartMainThread(tests);
}
@@ -19,13 +19,13 @@
#include "simulatorinterface.h"
class OpenTxInterface;
class OpenTxEepromInterface;
class Open9xSimulator : public SimulatorInterface {
public:
Open9xSimulator(OpenTxInterface *);
Open9xSimulator();
virtual void start(QByteArray & eeprom, bool tests=true);
@@ -53,10 +53,6 @@ class Open9xSimulator : public SimulatorInterface {
virtual const char * getError();
protected:
OpenTxInterface * open9xInterface;
};
#endif
@@ -140,45 +140,6 @@ int Th9xInterface::getSize(GeneralSettings &settings)
return 0;
}
int Th9xInterface::getCapability(const Capability capability)
{
switch (capability) {
case Mixes:
return TH9X_MAX_MIXERS;
case Timers:
return 1;
case Pots:
return 3;
case Switches:
return 7;
case SwitchesPositions:
return 9;
case CustomFunctions:
return 0;
case LogicalSwitches:
return TH9X_MAX_SWITCHES;
case Outputs:
return 8;
case OffsetWeight:
return 125;
case Simulation:
return 1;
case HasContrast:
case CSFunc:
return 13;
case SlowScale:
return 1;
case SlowRange:
return 10;
case LCDWidth:
return 128;
case GetThrSwitch:
return DSW_THR;
default:
return 0;
}
}
int Th9xInterface::isAvailable(Protocol proto, int port)
{
switch (proto) {
@@ -192,9 +153,3 @@ int Th9xInterface::isAvailable(Protocol proto, int port)
return 0;
}
}
SimulatorInterface * Th9xInterface::getSimulator()
{
return NULL; // new Th9xSimulator(this);
}
@@ -46,12 +46,8 @@ class Th9xInterface : public EEPROMInterface
virtual int getSize(GeneralSettings &);
virtual int getCapability(const Capability);
virtual int isAvailable(Protocol proto, int port=0);
virtual SimulatorInterface * getSimulator();
protected:
EFile *efile;
+8 -8
View File
@@ -7,21 +7,21 @@
#include <QDesktopServices>
#include <QtGui>
fwPreferencesDialog::fwPreferencesDialog(QWidget *parent) :
FirmwarePreferencesDialog::FirmwarePreferencesDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::fwPreferencesDialog)
ui(new Ui::FirmwarePreferencesDialog)
{
ui->setupUi(this);
setWindowIcon(CompanionIcon("fwpreferences.png"));
initSettings();
}
fwPreferencesDialog::~fwPreferencesDialog()
FirmwarePreferencesDialog::~FirmwarePreferencesDialog()
{
delete ui;
}
void fwPreferencesDialog::initSettings()
void FirmwarePreferencesDialog::initSettings()
{
ui->fwTypeLbl->setText(g.profile[g.id()].fwType());
int revision = g.fwRev.get(g.profile[g.id()].fwType());
@@ -29,7 +29,7 @@ void fwPreferencesDialog::initSettings()
ui->lastRevisionLbl->setText(QString("%1").arg(revision));
}
void fwPreferencesDialog::on_checkFWUpdates_clicked()
void FirmwarePreferencesDialog::on_checkFWUpdates_clicked()
{
MainWindow * mw = (MainWindow *)this->parent();
QString fwType = g.profile[g.id()].fwType();
@@ -37,14 +37,14 @@ void fwPreferencesDialog::on_checkFWUpdates_clicked()
initSettings();
}
void fwPreferencesDialog::on_fw_dnld_clicked()
void FirmwarePreferencesDialog::on_fw_dnld_clicked()
{
MainWindow * mw = (MainWindow *)this->parent();
mw->downloadLatestFW(current_firmware_variant.firmware, g.profile[g.id()].fwType());
mw->downloadLatestFW(current_firmware_variant);
initSettings();
}
void fwPreferencesDialog::on_voice_dnld_clicked()
void FirmwarePreferencesDialog::on_voice_dnld_clicked()
{
QString url="http://fw.opentx.it/voices/";
QString fwType = g.profile[g.id()].fwType();
+8 -8
View File
@@ -6,24 +6,24 @@
#include "eeprominterface.h"
namespace Ui {
class fwPreferencesDialog;
class FirmwarePreferencesDialog;
}
class Joystick;
class fwPreferencesDialog : public QDialog
class FirmwarePreferencesDialog : public QDialog
{
Q_OBJECT
public:
explicit fwPreferencesDialog(QWidget *parent = 0);
~fwPreferencesDialog();
public:
explicit FirmwarePreferencesDialog(QWidget *parent = 0);
~FirmwarePreferencesDialog();
private:
Ui::fwPreferencesDialog *ui;
private:
Ui::FirmwarePreferencesDialog *ui;
void initSettings();
private slots:
private slots:
void on_fw_dnld_clicked();
void on_voice_dnld_clicked();
void on_checkFWUpdates_clicked();
+3 -3
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>fwPreferencesDialog</class>
<widget class="QDialog" name="fwPreferencesDialog">
<class>FirmwarePreferencesDialog</class>
<widget class="QDialog" name="FirmwarePreferencesDialog">
<property name="geometry">
<rect>
<x>0</x>
@@ -231,7 +231,7 @@ May be different from firmware language</string>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>fwPreferencesDialog</receiver>
<receiver>FirmwarePreferencesDialog</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
+22 -22
View File
@@ -83,7 +83,7 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
switchDefPosEditLock=true;
populateBacklightCB(ui->backlightswCB, g_eeGeneral.backlightMode);
bool voice = current_firmware_variant.id.contains("voice");
if (!GetEepromInterface()->getCapability(MultiLangVoice)) {
if (!GetCurrentFirmware()->getCapability(MultiLangVoice)) {
ui->VoiceLang_label->hide();
ui->voiceLang_CB->hide();
} else {
@@ -102,11 +102,11 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
mavbaudEditLock=false;
}
if (!GetEepromInterface()->getCapability(HasContrast)) {
if (!GetCurrentFirmware()->getCapability(HasContrast)) {
ui->contrastSB->hide();
ui->label_contrast->hide();
}
if (!GetEepromInterface()->getCapability(HasSoundMixer)) {
if (!GetCurrentFirmware()->getCapability(HasSoundMixer)) {
ui->beepVolume_SL->hide();
ui->beepVolume_label->hide();
ui->varioVolume_SL->hide();
@@ -131,28 +131,28 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->varioPMax_SB->setValue(700+(g_eeGeneral.varioPitch*10)+1000+(g_eeGeneral.varioRange*10));
ui->varioR0_SB->setValue(500+(g_eeGeneral.varioRepeat*10));
}
if (!GetEepromInterface()->getCapability(HasFAIMode)) {
if (!GetCurrentFirmware()->getCapability(HasFAIMode)) {
ui->faimode_CB->hide();
ui->label_faimode->hide();
}
else {
ui->faimode_CB->setChecked(g_eeGeneral.fai);
}
if (!GetEepromInterface()->getCapability( HasPxxCountry)) {
if (!GetCurrentFirmware()->getCapability( HasPxxCountry)) {
ui->countrycode_label->hide();
ui->countrycode_CB->hide();
layout()->removeItem(ui->pxxCountry);
} else {
ui->countrycode_CB->setCurrentIndex(g_eeGeneral.countryCode);
}
if (!GetEepromInterface()->getCapability( HasGeneralUnits)) {
if (!GetCurrentFirmware()->getCapability( HasGeneralUnits)) {
ui->units_label->hide();
ui->units_CB->hide();
} else {
ui->units_CB->setCurrentIndex(g_eeGeneral.imperial);
}
if (!GetEepromInterface()->getCapability(TelemetryTimeshift)) {
if (!GetCurrentFirmware()->getCapability(TelemetryTimeshift)) {
ui->label_timezone->hide();
ui->timezoneSB->hide();
ui->timezoneSB->setDisabled(true);
@@ -162,24 +162,24 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->gpsFormatCB->setCurrentIndex(g_eeGeneral.gpsFormat);
ui->timezoneSB->setValue(g_eeGeneral.timezone);
if (!GetEepromInterface()->getCapability(OptrexDisplay)) {
if (!GetCurrentFirmware()->getCapability(OptrexDisplay)) {
ui->label_displayType->hide();
ui->displayTypeCB->setDisabled(true);
ui->displayTypeCB->hide();
}
if (!GetEepromInterface()->getCapability(HasVolume) && !voice) {
if (!GetCurrentFirmware()->getCapability(HasVolume) && !voice) {
ui->volume_SB->hide();
ui->volume_SB->setDisabled(true);
ui->label_volume->hide();
} else {
ui->volume_SB->setMaximum(GetEepromInterface()->getCapability(MaxVolume));
ui->volume_SB->setMaximum(GetCurrentFirmware()->getCapability(MaxVolume));
}
if (!GetEepromInterface()->getCapability(HasBrightness)) {
if (!GetCurrentFirmware()->getCapability(HasBrightness)) {
ui->BLBright_SB->hide();
ui->BLBright_SB->setDisabled(true);
ui->label_BLBright->hide();
}
if (!GetEepromInterface()->getCapability(HasCurrentCalibration)) {
if (!GetCurrentFirmware()->getCapability(HasCurrentCalibration)) {
ui->CurrentCalib_SB->hide();
ui->CurrentCalib_SB->setDisabled(true);
ui->label_CurrentCalib->hide();
@@ -187,31 +187,31 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->tabWidget->setCurrentIndex(0);
if (!GetEepromInterface()->getCapability(SoundMod)) {
if (!GetCurrentFirmware()->getCapability(SoundMod)) {
ui->soundModeCB->setDisabled(true);
ui->label_soundMode->hide();
ui->soundModeCB->hide();
}
if (!GetEepromInterface()->getCapability(SoundPitch)) {
if (!GetCurrentFirmware()->getCapability(SoundPitch)) {
ui->speakerPitchSB->setDisabled(true);
ui->label_speakerPitch->hide();
ui->speakerPitchSB->hide();
}
if (!GetEepromInterface()->getCapability(Haptic)) {
if (!GetCurrentFirmware()->getCapability(Haptic)) {
ui->hapticStrengthSB->setDisabled(true);
ui->hapticStrengthSB->hide();
ui->label_hapticStrengthSB->hide();
}
if (!GetEepromInterface()->getCapability(HapticMode)) {
if (!GetCurrentFirmware()->getCapability(HapticMode)) {
ui->hapticmodeCB->setDisabled(true);
ui->hapticmodeCB->hide();
ui->label_hapticmode->hide();
}
int renumber=GetEepromInterface()->getCapability(RotaryEncoders);
int renumber=GetCurrentFirmware()->getCapability(RotaryEncoders);
if (renumber==0) {
ui->re_label->hide();
ui->re_CB->hide();
@@ -247,7 +247,7 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->trnMode_4->setCurrentIndex(g_eeGeneral.trainer.mix[3].mode);
ui->trnChn_4->setCurrentIndex(g_eeGeneral.trainer.mix[3].src);
ui->trnWeight_4->setValue(g_eeGeneral.trainer.mix[3].weight);
int potsnum=GetEepromInterface()->getCapability(Pots);
int potsnum=GetCurrentFirmware()->getCapability(Pots);
if (potsnum==3) {
ui->label_pot4->hide();
ui->ana8Neg->hide();
@@ -261,7 +261,7 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
connect(tpmsld[i], SIGNAL(valueChanged(int)),this,SLOT(unlockSwitchEdited()));
}
if (GetEepromInterface()->getCapability(MultiposPots)) {
if (GetCurrentFirmware()->getCapability(MultiposPots)) {
ui->pot1Type->setCurrentIndex(g_eeGeneral.potsType[0]);
ui->pot2Type->setCurrentIndex(g_eeGeneral.potsType[1]);
ui->pot3Type->setCurrentIndex(g_eeGeneral.potsType[2]);
@@ -334,7 +334,7 @@ void GeneralEdit::setValues()
ui->beeperCB->setCurrentIndex(g_eeGeneral.beeperMode+2);
ui->channelorderCB->setCurrentIndex(g_eeGeneral.templateSetup);
ui->stickmodeCB->setCurrentIndex(g_eeGeneral.stickMode);
if (!GetEepromInterface()->getCapability(HapticLength)) {
if (!GetCurrentFirmware()->getCapability(HapticLength)) {
ui->label_HL->hide();
ui->hapticLengthCB->hide();
} else {
@@ -911,7 +911,7 @@ 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=GetEepromInterface()->getCapability(Pots);
int potsnum=GetCurrentFirmware()->getCapability(Pots);
if (calib.isEmpty()) {
return;
} else {
@@ -1021,7 +1021,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=GetEepromInterface()->getCapability(Pots);
int potsnum=GetCurrentFirmware()->getCapability(Pots);
if (name.isEmpty()) {
ui->calstore_PB->setDisabled(true);
return;
+34 -58
View File
@@ -62,7 +62,7 @@ QString getInputStr(ModelData & model, int index)
{
QString result;
if (GetEepromInterface()->getCapability(VirtualInputs)) {
if (GetCurrentFirmware()->getCapability(VirtualInputs)) {
result = model.inputNames[index];
if (result.isEmpty()) {
result = QObject::tr("Input%1").arg(index+1, 2, 10, QChar('0'));
@@ -126,7 +126,7 @@ QString getProtocolStr(const int proto)
void populatePhasesCB(QComboBox *b, int value)
{
for (int i=-GetEepromInterface()->getCapability(FlightPhases); i<=GetEepromInterface()->getCapability(FlightPhases); i++) {
for (int i=-GetCurrentFirmware()->getCapability(FlightPhases); i<=GetCurrentFirmware()->getCapability(FlightPhases); i++) {
if (i < 0)
b->addItem(QObject::tr("!Flight mode %1").arg(-i-1), i);
else if (i > 0)
@@ -134,13 +134,13 @@ void populatePhasesCB(QComboBox *b, int value)
else
b->addItem(QObject::tr("----"), 0);
}
b->setCurrentIndex(value + GetEepromInterface()->getCapability(FlightPhases));
b->setCurrentIndex(value + GetCurrentFirmware()->getCapability(FlightPhases));
}
bool gvarsEnabled()
{
int gvars=0;
if (GetEepromInterface()->getCapability(HasVariants)) {
if (GetCurrentFirmware()->getCapability(HasVariants)) {
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
gvars=1;
}
@@ -278,7 +278,7 @@ void CurveGroup::update()
break;
case CurveReference::CURVE_REF_CUSTOM:
{
int numcurves = GetEepromInterface()->getCapability(NumCurves);
int numcurves = GetCurrentFirmware()->getCapability(NumCurves);
if (lastType != curve.type) {
lastType = curve.type;
curveValueCB->clear();
@@ -330,7 +330,7 @@ void CurveGroup::valuesChanged()
curve = CurveReference(CurveReference::CURVE_REF_FUNC, curveValueCB->currentIndex());
break;
case 3:
curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, curveValueCB->currentIndex() - GetEepromInterface()->getCapability(NumCurves));
curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, curveValueCB->currentIndex() - GetCurrentFirmware()->getCapability(NumCurves));
break;
}
@@ -341,7 +341,7 @@ void CurveGroup::valuesChanged()
void populateGvarUseCB(QComboBox *b, unsigned int phase)
{
b->addItem(QObject::tr("Own value"));
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) {
for (int i=0; i<GetCurrentFirmware()->getCapability(FlightPhases); i++) {
if (i != (int)phase) {
b->addItem(QObject::tr("Flight mode %1 value").arg(i));
}
@@ -376,7 +376,7 @@ void populateAndSwitchCB(QComboBox *b, const RawSwitch & value)
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
for (int i=1; i<=GetEepromInterface()->getCapability(SwitchesPositions); i++) {
for (int i=1; i<=GetCurrentFirmware()->getCapability(SwitchesPositions); i++) {
item = RawSwitch(SWITCH_TYPE_SWITCH, i);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
@@ -402,13 +402,13 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
if (item == value) b->setCurrentIndex(b->count()-1);
}
for (int i=-GetEepromInterface()->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=-GetEepromInterface()->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);
@@ -420,17 +420,17 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
if (item == value) b->setCurrentIndex(b->count()-1);
}
for (int i=GetEepromInterface()->getCapability(MultiposPots)-1; i>=0; i--) {
for (int i=GetCurrentFirmware()->getCapability(MultiposPots)-1; i>=0; i--) {
if (generalSettings.potsType[i] == 2/* TODO constant*/) {
for (int j=-GetEepromInterface()->getCapability(MultiposPotsPositions); j<0; j++) {
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, -i*GetEepromInterface()->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=-GetEepromInterface()->getCapability(SwitchesPositions); i<0; i++) {
for (int i=-GetCurrentFirmware()->getCapability(SwitchesPositions); i<0; i++) {
item = RawSwitch(SWITCH_TYPE_SWITCH, i);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
@@ -449,16 +449,16 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
if (item == value) b->setCurrentIndex(b->count()-1);
}
for (int i=1; i<=GetEepromInterface()->getCapability(SwitchesPositions); i++) {
for (int i=1; i<=GetCurrentFirmware()->getCapability(SwitchesPositions); i++) {
item = RawSwitch(SWITCH_TYPE_SWITCH, i);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
}
for (int i=0; i<GetEepromInterface()->getCapability(MultiposPots); i++) {
for (int i=0; i<GetCurrentFirmware()->getCapability(MultiposPots); i++) {
if (generalSettings.potsType[i] == 2/* TODO constant*/) {
for (int j=1; j<=GetEepromInterface()->getCapability(MultiposPotsPositions); j++) {
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i*GetEepromInterface()->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);
}
@@ -471,13 +471,13 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
if (item == value) b->setCurrentIndex(b->count()-1);
}
for (int i=1; i<=GetEepromInterface()->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);
}
for (int i=1; i<=GetEepromInterface()->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);
@@ -499,7 +499,7 @@ void populateGVCB(QComboBox *b, int value)
b->clear();
int pgvars = GetEepromInterface()->getCapability(Gvars);
int pgvars = GetCurrentFirmware()->getCapability(Gvars);
for (int i=-pgvars; i<=-1; i++) {
int16_t gval = (int16_t)(-10000+i);
b->addItem(QObject::tr("-GV%1").arg(-i), gval);
@@ -543,7 +543,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
}
if (flags & POPULATE_VIRTUAL_INPUTS) {
int virtualInputs = GetEepromInterface()->getCapability(VirtualInputs);
int virtualInputs = GetCurrentFirmware()->getCapability(VirtualInputs);
for (int i=0; i<virtualInputs; i++) {
item = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i, &model);
b->addItem(item.toString(), item.toValue());
@@ -552,12 +552,12 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
}
if (flags & POPULATE_SOURCES) {
for (int i=0; i<4+GetEepromInterface()->getCapability(Pots); i++) {
for (int i=0; i<4+GetCurrentFirmware()->getCapability(Pots); i++) {
item = RawSource(SOURCE_TYPE_STICK, i);
b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
for (int i=0; i<GetEepromInterface()->getCapability(RotaryEncoders); i++) {
for (int i=0; i<GetCurrentFirmware()->getCapability(RotaryEncoders); i++) {
item = RawSource(SOURCE_TYPE_ROTARY_ENCODER, i);
b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
@@ -579,13 +579,13 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
}
if (flags & POPULATE_SWITCHES) {
for (int i=0; i<GetEepromInterface()->getCapability(Switches); i++) {
for (int i=0; i<GetCurrentFirmware()->getCapability(Switches); i++) {
item = RawSource(SOURCE_TYPE_SWITCH, i);
b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) {
for (int i=0; i<GetCurrentFirmware()->getCapability(LogicalSwitches); i++) {
item = RawSource(SOURCE_TYPE_CUSTOM_SWITCH, i);
b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
@@ -599,13 +599,13 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
if (item == source) b->setCurrentIndex(b->count()-1);
}
for (int i=0; i<GetEepromInterface()->getCapability(TrainerInputs); i++) {
for (int i=0; i<GetCurrentFirmware()->getCapability(TrainerInputs); i++) {
item = RawSource(SOURCE_TYPE_PPM, i);
b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
for (int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) {
for (int i=0; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
item = RawSource(SOURCE_TYPE_CH, i);
b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
@@ -628,7 +628,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
}
if (flags & POPULATE_GVARS) {
for (int i=0; i<GetEepromInterface()->getCapability(Gvars); i++) {
for (int i=0; i<GetCurrentFirmware()->getCapability(Gvars); i++) {
item = RawSource(SOURCE_TYPE_GVAR, i);
b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
@@ -775,7 +775,7 @@ QString getFrSkyProtocol(int protocol)
{
switch(protocol) {
case 2:
if ((GetEepromInterface()->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)");
@@ -830,7 +830,7 @@ QString getProtocol(ModelData * g_model)
QString getPhasesStr(unsigned int phases, ModelData & model)
{
int numphases = GetEepromInterface()->getCapability(FlightPhases);
int numphases = GetCurrentFirmware()->getCapability(FlightPhases);
if (numphases && phases) {
QString str;
@@ -906,7 +906,7 @@ CompanionIcon::CompanionIcon(QString baseimage)
void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
{
SimulatorInterface * si = GetEepromInterface()->getSimulator();
SimulatorInterface * si = GetCurrentFirmware()->getSimulator();
if (si) {
delete si;
RadioData * simuData = new RadioData(radioData);
@@ -918,14 +918,14 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
if (radioData.generalSettings.stickMode & 1) {
flags |= SIMULATOR_FLAGS_STICK_MODE_LEFT;
}
BoardEnum board = GetEepromInterface()->getBoard();
BoardEnum board = GetCurrentFirmware()->getBoard();
SimulatorDialog * sd;
if (IS_TARANIS(board))
sd = new SimulatorDialogTaranis(parent, flags);
else
sd = new SimulatorDialog9X(parent, flags);
QByteArray eeprom(GetEepromInterface()->getEEpromSize(), 0);
GetEepromInterface()->save((uint8_t *)eeprom.data(), *simuData, GetEepromInterface()->getCapability(SimulatorVariant));
GetEepromInterface()->save((uint8_t *)eeprom.data(), *simuData, GetCurrentFirmware()->getCapability(SimulatorVariant));
delete simuData;
sd->start(eeprom);
sd->exec();
@@ -958,27 +958,3 @@ QPixmap makePixMap( QImage image, QString firmwareType )
}
return(QPixmap::fromImage(image));
}
int getRadioType(QString firmwareType)
{
if (firmwareType.contains( "taranis" )) return 6;
if (firmwareType.contains( "sky9x" )) return 5;
if (firmwareType.contains( "gruvin9x")) return 4;
if (firmwareType.contains( "9xr128" )) return 3;
if (firmwareType.contains( "9xr" )) return 2;
if (firmwareType.contains( "9x128" )) return 1;
return 0; // 9x
}
QString getDefaultFwType( int radioType )
{
switch (radioType){
case 6: return "opentx-taranis-en";
case 5: return "opentx-sky9x-en";
case 4: return "opentx-gruvin9x-en";
case 3: return "opentx-9xr128-en";
case 2: return "opentx-9xr-en";
case 1: return "opentx-9x128-en";
default: return "opentx-9x-en";
}
}
+1 -7
View File
@@ -6,7 +6,7 @@
extern const QColor colors[C9X_MAX_CURVES];
#define TMR_NUM_OPTION (TMR_VAROFS+2*9+2*GetEepromInterface()->getCapability(LogicalSwitches)-1)
#define TMR_NUM_OPTION (TMR_VAROFS+2*9+2*GetCurrentFirmware()->getCapability(LogicalSwitches)-1)
//convert from mode 1 to mode generalSettings.stickMode
//NOTICE! => 1..4 -> 1..4
@@ -128,10 +128,4 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx);
// Format a pixmap to fit on the radio using a specific firmware
QPixmap makePixMap( QImage image, QString firmwareType );
// Return a radio type derived from a firmware type string
int getRadioType(QString firmwareType);
// Return the default firmware string for a specified radio
QString getDefaultFwType( int radioType );
#endif // HELPERS_H
+30 -30
View File
@@ -198,7 +198,7 @@ void MainWindow::checkForUpdates(bool ignoreSettings, QString & fwId)
check1done = true;
check2done = true;
fwToUpdate = fwId;
QString stamp = GetFirmware(fwToUpdate)->stamp;
QString stamp = GetFirmware(fwToUpdate)->getStampUrl();
if (!stamp.isEmpty()) {
if (g.autoCheckFw() || ignoreSettings) {
@@ -299,15 +299,15 @@ void MainWindow::updateDownloaded()
}
}
void MainWindow::downloadLatestFW(FirmwareInfo * firmware, const QString & firmwareId)
void MainWindow::downloadLatestFW(FirmwareVariant & firmware)
{
QString url, ext, cpuid;
url = firmware->getUrl(firmwareId);
url = firmware.getFirmwareUrl();
cpuid=g.cpuId();
ext = url.mid(url.lastIndexOf("."));
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.flashDir() + "/" + firmwareId + ext);
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.flashDir() + "/" + firmware.id + ext);
if (!fileName.isEmpty()) {
downloadedFW = firmwareId;
downloadedFW = firmware.id;
needRename=true;
g.profile[g.id()].fwName( fileName );
if (!cpuid.isEmpty()) {
@@ -468,7 +468,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
if (OldFwRev == 0) {
showcheckForUpdatesResult = false; // update is available - do not show dialog
QString rn = GetFirmware(fwToUpdate)->rnurl;
QString rn = GetFirmware(fwToUpdate)->getReleaseNotesUrl();
QAbstractButton *rnButton = NULL;
msgBox.setWindowTitle("Companion");
msgBox.setInformativeText(tr("Firmware %1 does not seem to have ever been downloaded.\nVersion %2 is available.\nDo you want to download it now ?").arg(fwToUpdate).arg(NewFwRev));
@@ -495,9 +495,10 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
} else {
ignore = true;
}
} else if (NewFwRev > OldFwRev) {
}
else if (NewFwRev > OldFwRev) {
showcheckForUpdatesResult = false; // update is available - do not show dialog
QString rn = GetFirmware(fwToUpdate)->rnurl;
QString rn = GetFirmware(fwToUpdate)->getReleaseNotesUrl();
QAbstractButton *rnButton;
msgBox.setText("Companion");
msgBox.setInformativeText(tr("A new version of %1 firmware is available (current %2 - newer %3).\nDo you want to download it now ?").arg(fwToUpdate).arg(OldFwRev).arg(NewFwRev));
@@ -536,7 +537,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
}
} else if (download == true) {
if (warning>0) {
QString rn = GetFirmware(fwToUpdate)->rnurl;
QString rn = GetFirmware(fwToUpdate)->getReleaseNotesUrl();
if (!rn.isEmpty()) {
int ret2 = QMessageBox::warning(this, "Companion", tr("Release notes contain very important informations. Do you want to see them now ?"), QMessageBox::Yes | QMessageBox::No);
if (ret2 == QMessageBox::Yes) {
@@ -546,7 +547,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
}
}
downloadedFW = fwToUpdate;
QString url = GetFirmware(fwToUpdate)->getUrl(fwToUpdate);
QString url = GetFirmwareVariant(fwToUpdate).getFirmwareUrl();
QString ext = url.mid(url.lastIndexOf("."));
needRename=false;
bool addversion=g.profile[g.id()].renameFwFiles();
@@ -716,14 +717,14 @@ void MainWindow::loadProfile() //TODO Load all variables - Also HW!
void MainWindow::appPrefs()
{
appPreferencesDialog *pd = new appPreferencesDialog(this);
AppPreferencesDialog *pd = new AppPreferencesDialog(this);
pd->exec();
updateMenus();
}
void MainWindow::fwPrefs()
{
fwPreferencesDialog *pd = new fwPreferencesDialog(this);
FirmwarePreferencesDialog *pd = new FirmwarePreferencesDialog(this);
pd->exec();
foreach (QMdiSubWindow *window, mdiArea->subWindowList()) {
MdiChild *mdiChild = qobject_cast<MdiChild *>(window->widget());
@@ -746,11 +747,12 @@ void MainWindow::changelog()
void MainWindow::fwchangelog()
{
FirmwareInfo *currfirm = GetCurrentFirmware();
QString rn=currfirm->rnurl;
FirmwareInterface *currfirm = GetCurrentFirmware();
QString rn=currfirm->getReleaseNotesUrl();
if (rn.isEmpty()) {
QMessageBox::information(this, tr("Firmware updates"), tr("Current firmware does not provide release notes informations."));
} else {
}
else {
contributorsDialog *cd = new contributorsDialog(this,2, rn);
cd->exec();
}
@@ -1257,7 +1259,7 @@ bool MainWindow::isValidEEPROM(QString eepromfile)
bool MainWindow::convertEEPROM(QString backupFile, QString restoreFile, QString flashFile)
{
FirmwareInfo *firmware = GetCurrentFirmware();
FirmwareInterface *firmware = GetCurrentFirmware();
FlashInterface flash(flashFile);
if (!flash.isValid())
return false;
@@ -1290,9 +1292,6 @@ bool MainWindow::convertEEPROM(QString backupFile, QString restoreFile, QString
version = fwEEprom.toInt();
}
}
else {
version = ((Open9xFirmware *)firmware)->getEepromVersion(revision);
}
}
QFile file(backupFile);
@@ -1490,8 +1489,9 @@ void MainWindow::burnFuses()
void MainWindow::compare()
{
compareDialog *fd = new compareDialog(this);
fd->show();
CompareDialog *fd = new CompareDialog(this);
fd->show();
delete fd;
}
void MainWindow::logFile()
@@ -1546,17 +1546,17 @@ void MainWindow::updateMenus()
MdiChild *MainWindow::createMdiChild()
{
MdiChild *child = new MdiChild;
mdiArea->addSubWindow(child);
if(!child->parentWidget()->isMaximized() && !child->parentWidget()->isMinimized())
child->parentWidget()->resize(400, 400);
MdiChild *child = new MdiChild();
mdiArea->addSubWindow(child);
if(!child->parentWidget()->isMaximized() && !child->parentWidget()->isMinimized())
child->parentWidget()->resize(400, 400);
connect(child, SIGNAL(copyAvailable(bool)),cutAct, SLOT(setEnabled(bool)));
connect(child, SIGNAL(copyAvailable(bool)),copyAct, SLOT(setEnabled(bool)));
connect(child, SIGNAL(copyAvailable(bool)),simulateAct, SLOT(setEnabled(bool)));
connect(child, SIGNAL(copyAvailable(bool)),printAct, SLOT(setEnabled(bool)));
connect(child, SIGNAL(copyAvailable(bool)),cutAct, SLOT(setEnabled(bool)));
connect(child, SIGNAL(copyAvailable(bool)),copyAct, SLOT(setEnabled(bool)));
connect(child, SIGNAL(copyAvailable(bool)),simulateAct, SLOT(setEnabled(bool)));
connect(child, SIGNAL(copyAvailable(bool)),printAct, SLOT(setEnabled(bool)));
return child;
return child;
}
QAction * MainWindow::addAct(QString icon, QString sName, QString lName, QKeySequence::StandardKey shortcut, const char *slot, QObject *slotObj)
+7 -7
View File
@@ -63,24 +63,24 @@ QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
friend class fwPreferencesDialog;
friend class FirmwarePreferencesDialog;
friend class MdiChild; // TODO GetAvrdudeArgs could be external to this class
Q_OBJECT
public:
public:
MainWindow();
protected:
protected:
void closeEvent(QCloseEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
public slots:
void downloadLatestFW(FirmwareInfo *firmware, const QString & firmwareId);
public slots:
void downloadLatestFW(FirmwareVariant & firmware);
private slots:
private slots:
void openDocURL();
void setLanguage(QString langString);
@@ -157,7 +157,7 @@ private slots:
QMenu * createProfilesMenu();
void autoClose();
private:
private:
void createActions();
QAction * addAct(QString, QString, QString, QKeySequence::StandardKey, const char *, QObject *slotObj=NULL);
QAction * addAct(QActionGroup *, QString, QString, const char *);
+12 -8
View File
@@ -66,6 +66,7 @@
MdiChild::MdiChild():
QWidget(),
ui(new Ui::mdiChild),
firmware(GetCurrentFirmware()),
isUntitled(true),
fileChanged(false)
{
@@ -103,7 +104,7 @@ void MdiChild::qSleep(int ms)
void MdiChild::eepromInterfaceChanged()
{
ui->modelsList->refreshList();
ui->SimulateTxButton->setEnabled(GetEepromInterface()->getCapability(Simulation));
ui->SimulateTxButton->setEnabled(GetCurrentFirmware()/*firmware*/->getCapability(Simulation));
updateTitle();
}
@@ -181,7 +182,7 @@ void MdiChild::modelEdit()
QApplication::setOverrideCursor(Qt::WaitCursor);
checkAndInitModel( row );
ModelData &model = radioData.models[row - 1];
ModelEdit *t = new ModelEdit(radioData, (row - 1), false, this);
ModelEdit *t = new ModelEdit(this, radioData, (row - 1), GetCurrentFirmware()/*firmware*/);
t->setWindowTitle(tr("Editing model %1: ").arg(row) + model.name);
connect(t, SIGNAL(modified()), this, SLOT(setModified()));
t->show();
@@ -663,15 +664,18 @@ void MdiChild::simulate()
void MdiChild::print(int model, QString filename)
{
PrintDialog * pd = NULL;
if (model>=0 && !filename.isEmpty()) {
printDialog *pd = new printDialog(this, &radioData.generalSettings, &radioData.models[model], filename);
pd->show();
pd = new PrintDialog(this, GetCurrentFirmware()/*firmware*/, &radioData.generalSettings, &radioData.models[model], filename);
}
else {
if(ui->modelsList->currentRow()<1) return;
printDialog *pd = new printDialog(this, &radioData.generalSettings, &radioData.models[ui->modelsList->currentRow()-1]);
else if (ui->modelsList->currentRow() > 0) {
pd = new PrintDialog(this, GetCurrentFirmware()/*firmware*/, &radioData.generalSettings, &radioData.models[ui->modelsList->currentRow()-1]);
}
if (pd) {
pd->show();
delete pd;
}
}
+8 -6
View File
@@ -59,7 +59,7 @@ class MdiChild : public QWidget
Q_OBJECT
public:
public:
MdiChild();
~MdiChild();
@@ -78,18 +78,18 @@ public:
void eepromInterfaceChanged();
void setEEpromAvail(int eavail);
signals:
signals:
void copyAvailable(bool val);
protected:
protected:
void closeEvent(QCloseEvent *event);
private slots:
private slots:
void documentWasModified();
void on_SimulateTxButton_clicked();
void qSleep(int ms);
public slots:
public slots:
void checkAndInitModel(int row);
void generalEdit();
void modelEdit();
@@ -105,7 +105,7 @@ public slots:
void setModified();
void updateTitle();
private:
private:
bool maybeSave();
void setCurrentFile(const QString &fileName);
QString strippedName(const QString &fullFileName);
@@ -115,6 +115,8 @@ private:
Ui::mdiChild *ui;
QString curFile;
FirmwareInterface * firmware;
RadioData radioData;
bool isUntitled;
+12 -12
View File
@@ -6,14 +6,14 @@
#include <QCheckBox>
#include <QDoubleSpinBox>
Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & generalSettings):
ModelPanel(parent, model, generalSettings)
Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
ModelPanel(parent, model, generalSettings, firmware)
{
QGridLayout * gridLayout = new QGridLayout(this);
bool minimize = false;
int col = 1;
if (GetEepromInterface()->getCapability(ChannelsName))
if (firmware->getCapability(ChannelsName))
{
minimize=true;
addLabel(gridLayout, tr("Name"), col++);
@@ -24,12 +24,12 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
addLabel(gridLayout, tr("Direction"), col++, minimize);
if (IS_TARANIS(GetEepromInterface()->getBoard()))
addLabel(gridLayout, tr("Curve"), col++, minimize);
if (GetEepromInterface()->getCapability(PPMCenter))
if (firmware->getCapability(PPMCenter))
addLabel(gridLayout, tr("PPM Center"), col++, minimize);
if (GetEepromInterface()->getCapability(SYMLimits))
if (firmware->getCapability(SYMLimits))
addLabel(gridLayout, tr("Linear Subtrim"), col++, true);
for (int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) {
for (int i=0; i<firmware->getCapability(Outputs); i++) {
col = 0;
// Channel label
@@ -39,7 +39,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
gridLayout->addWidget(label, i+1, col++, 1, 1);
// Channel name
int nameLen = GetEepromInterface()->getCapability(ChannelsName);
int nameLen = firmware->getCapability(ChannelsName);
if (nameLen > 0) {
QLineEdit * name = new QLineEdit(this);
name->setProperty("index", i);
@@ -103,7 +103,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
QComboBox * curveCB = new QComboBox(this);
curveCB->setProperty("index", i);
int numcurves = GetEepromInterface()->getCapability(NumCurves);
int numcurves = firmware->getCapability(NumCurves);
for (int j=-numcurves; j<=numcurves; j++) {
curveCB->addItem(CurveReference(CurveReference::CURVE_REF_CUSTOM, j).toString(), j);
}
@@ -113,7 +113,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
}
// PPM center
if (GetEepromInterface()->getCapability(PPMCenter)) {
if (firmware->getCapability(PPMCenter)) {
QSpinBox * center = new QSpinBox(this);
center->setProperty("index", i);
center->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
@@ -126,7 +126,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
}
// Symetrical limits
if (GetEepromInterface()->getCapability(SYMLimits)) {
if (firmware->getCapability(SYMLimits)) {
QCheckBox * symlimits = new QCheckBox(this);
symlimits->setProperty("index", i);
symlimits->setChecked(model.limitData[i].symetrical);
@@ -135,7 +135,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
}
}
// Push the rows up
addVSpring(gridLayout, 0,GetEepromInterface()->getCapability(Outputs)+1);
addVSpring(gridLayout, 0,firmware->getCapability(Outputs)+1);
}
Channels::~Channels()
@@ -188,7 +188,7 @@ void Channels::maxEdited()
void Channels::refreshExtendedLimits()
{
for (int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) {
for (int i=0; i<firmware->getCapability(Outputs); i++) {
QDoubleSpinBox * minDSB = minSpins[i];
QDoubleSpinBox * maxDSB = maxSpins[i];
+1 -1
View File
@@ -9,7 +9,7 @@ class Channels : public ModelPanel
Q_OBJECT
public:
Channels(QWidget *parent, ModelData & model, GeneralSettings & generalSettings);
Channels(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
~Channels();
private:
+10 -10
View File
@@ -92,8 +92,8 @@ float curveSymmetricalX(float x, float coeff, float yMin, float yMid, float yMax
return y;
}
Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSettings):
ModelPanel(parent, model, generalSettings),
Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
ModelPanel(parent, model, generalSettings, firmware),
ui(new Ui::Curves),
currentCurve(0)
{
@@ -101,7 +101,7 @@ Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSet
lock = true;
if (!GetEepromInterface()->getCapability(HasCvNames)) {
if (!firmware->getCapability(HasCvNames)) {
ui->curveName->hide();
ui->curveNameLabel->hide();
}
@@ -110,7 +110,7 @@ Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSet
scene->setItemIndexMethod(QGraphicsScene::NoIndex);
ui->curvePreview->setScene(scene);
for (int i=0; i<GetEepromInterface()->getCapability(NumCurves); i++) {
for (int i=0; i<firmware->getCapability(NumCurves); i++) {
visibleCurves[i] = false;
// The reset curve button
@@ -164,7 +164,7 @@ Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSet
ui->pointsLayout->addWidget(spnx[i], i, 1, 1, 1);
bool insert;
if (GetEepromInterface()->getCapability(EnhancedCurves)) {
if (firmware->getCapability(EnhancedCurves)) {
insert = (i >= 1);
}
else {
@@ -220,7 +220,7 @@ void Curves::update()
{
lock = true;
if (GetEepromInterface()->getCapability(HasCvNames)) {
if (firmware->getCapability(HasCvNames)) {
ui->curveName->setText(model.curves[currentCurve].name);
}
@@ -242,7 +242,7 @@ void Curves::updateCurveType()
int index = 0;
if (GetEepromInterface()->getCapability(EnhancedCurves)) {
if (firmware->getCapability(EnhancedCurves)) {
index = model.curves[currentCurve].count - 2;
}
else {
@@ -288,7 +288,7 @@ void Curves::updateCurve()
pen.setWidth(1);
pen.setStyle(Qt::SolidLine);
int numcurves = GetEepromInterface()->getCapability(NumCurves);
int numcurves = firmware->getCapability(NumCurves);
for (int k=0; k<numcurves; k++) {
pen.setColor(colors[k]);
if (currentCurve!=k && visibleCurves[k]) {
@@ -406,7 +406,7 @@ void Curves::onNodeUnfocus()
bool Curves::allowCurveType(int points, CurveData::CurveType type)
{
int numcurves = GetEepromInterface()->getCapability(NumCurves);
int numcurves = firmware->getCapability(NumCurves);
int totalpoints = 0;
for (int i=0; i<numcurves; i++) {
@@ -415,7 +415,7 @@ bool Curves::allowCurveType(int points, CurveData::CurveType type)
totalpoints += cvPoints + (cvType==CurveData::CURVE_TYPE_CUSTOM ? cvPoints-2 : 0);
}
int fwpoints = GetEepromInterface()->getCapability(NumCurvePoints);
int fwpoints = firmware->getCapability(NumCurvePoints);
if (totalpoints > fwpoints) {
QMessageBox::warning(this, "companion", tr("Not enough free points in EEPROM to store the curve."));
return false;
+1 -1
View File
@@ -21,7 +21,7 @@ class Curves : public ModelPanel
Q_OBJECT
public:
Curves(QWidget *parent, ModelData & model, GeneralSettings & generalSettings);
Curves(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
virtual ~Curves();
virtual void update();
+16 -16
View File
@@ -47,8 +47,8 @@ void RepeatComboBox::update()
setCurrentIndex(value);
}
CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings):
ModelPanel(parent, model, generalSettings),
CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
ModelPanel(parent, model, generalSettings, firmware),
initialized(false)
#if defined(PHONON)
,
@@ -66,9 +66,9 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
addEmptyLabel(gridLayout, 5 );
lock = true;
int num_fsw = GetEepromInterface()->getCapability(CustomFunctions);
int num_fsw = firmware->getCapability(CustomFunctions);
if (!GetEepromInterface()->getCapability(VoicesAsNumbers)) {
if (!firmware->getCapability(VoicesAsNumbers)) {
for (int i=0; i<num_fsw; i++) {
if (model.funcSw[i].func==FuncPlayPrompt || model.funcSw[i].func==FuncBackgroundMusic) {
QString temp = model.funcSw[i].paramarm;
@@ -87,7 +87,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
lang="en";
path.append(lang);
QDir qd(path);
int vml= GetEepromInterface()->getCapability(VoicesMaxLength)+4;
int vml= firmware->getCapability(VoicesMaxLength)+4;
if (qd.exists()) {
QStringList filters;
filters << "*.wav" << "*.WAV";
@@ -227,7 +227,7 @@ void CustomFunctionsPanel::playMusic()
QDir qd(path);
QString track;
if (qd.exists()) {
if (GetEepromInterface()->getCapability(VoicesAsNumbers)) {
if (firmware->getCapability(VoicesAsNumbers)) {
track = path + QString("/%1.wav").arg(int(fswtchParam[index]->value()), 4, 10, (const QChar)'0');
}
else {
@@ -360,7 +360,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM + CUSTOM_FUNCTION_ENABLE;
}
else if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) {
if (index != FuncBackgroundMusic && GetEepromInterface()->getCapability(HasFuncRepeat)) {
if (index != FuncBackgroundMusic && firmware->getCapability(HasFuncRepeat)) {
widgetsMask |= CUSTOM_FUNCTION_REPEAT;
fswtchRepeat[i]->update();
}
@@ -370,7 +370,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM + CUSTOM_FUNCTION_REPEAT;
}
else if (index==FuncPlayPrompt || index==FuncPlayBoth) {
if (GetEepromInterface()->getCapability(VoicesAsNumbers)) {
if (firmware->getCapability(VoicesAsNumbers)) {
fswtchParam[i]->setDecimals(0);
fswtchParam[i]->setSingleStep(1);
fswtchParam[i]->setMinimum(0);
@@ -407,7 +407,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM;
if (modified) {
memset(model.funcSw[i].paramarm, 0, sizeof(model.funcSw[i].paramarm));
int vml = GetEepromInterface()->getCapability(VoicesMaxLength);
int vml = firmware->getCapability(VoicesMaxLength);
if (fswtchParamArmT[i]->currentText() != "----") {
widgetsMask |= CUSTOM_FUNCTION_PLAY;
for (int j=0; j<std::min(fswtchParamArmT[i]->currentText().length(), vml); j++) {
@@ -427,7 +427,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM;
if (modified) {
memset(model.funcSw[i].paramarm, 0, sizeof(model.funcSw[i].paramarm));
int vml=GetEepromInterface()->getCapability(VoicesMaxLength);
int vml=firmware->getCapability(VoicesMaxLength);
if (fswtchParamArmT[i]->currentText() != "----") {
widgetsMask |= CUSTOM_FUNCTION_PLAY;
for (int j=0; j<std::min(fswtchParamArmT[i]->currentText().length(),vml); j++) {
@@ -476,7 +476,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
void CustomFunctionsPanel::update()
{
lock = true;
for (int i=0; i<GetEepromInterface()->getCapability(CustomFunctions); i++) {
for (int i=0; i<firmware->getCapability(CustomFunctions); i++) {
if (!initialized) {
populateSwitchCB(fswtchSwtch[i], model.funcSw[i].swtch, generalSettings, POPULATE_ONOFF);
populateFuncCB(fswtchFunc[i], model.funcSw[i].func);
@@ -562,24 +562,24 @@ void CustomFunctionsPanel::populateFuncCB(QComboBox *b, unsigned int value)
b->clear();
for (unsigned int i=0; i<FuncCount; i++) {
b->addItem(FuncSwData(AssignFunc(i)).funcToString());
if (!GetEepromInterface()->getCapability(HasVolume)) {
if (!firmware->getCapability(HasVolume)) {
if (i==FuncVolume || i==FuncBackgroundMusic || i==FuncBackgroundMusicPause) {
QModelIndex index = b->model()->index(i, 0);
QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1);
}
}
if ((i==FuncPlayHaptic) && !GetEepromInterface()->getCapability(Haptic)) {
if ((i==FuncPlayHaptic) && !firmware->getCapability(Haptic)) {
QModelIndex index = b->model()->index(i, 0);
QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1);
}
if ((i==FuncPlayBoth) && !GetEepromInterface()->getCapability(HasBeeper)) {
if ((i==FuncPlayBoth) && !firmware->getCapability(HasBeeper)) {
QModelIndex index = b->model()->index(i, 0);
QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1);
}
if ((i==FuncLogs) && !GetEepromInterface()->getCapability(HasSDLogs)) {
if ((i==FuncLogs) && !firmware->getCapability(HasSDLogs)) {
QModelIndex index = b->model()->index(i, 0);
QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1);
@@ -640,7 +640,7 @@ void CustomFunctionsPanel::populateFuncParamCB(QComboBox *b, const ModelData & m
qs.append( QObject::tr("Timer2"));
qs.append( QObject::tr("All"));
qs.append( QObject::tr("Telemetry"));
int reCount = GetEepromInterface()->getCapability(RotaryEncoders);
int reCount = firmware->getCapability(RotaryEncoders);
if (reCount == 1) {
qs.append( QObject::tr("Rotary Encoder"));
}
+1 -1
View File
@@ -36,7 +36,7 @@ class CustomFunctionsPanel : public ModelPanel
Q_OBJECT
public:
CustomFunctionsPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings);
CustomFunctionsPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
~CustomFunctionsPanel();
virtual void update();
+12 -11
View File
@@ -2,11 +2,12 @@
#include "ui_expodialog.h"
#include "helpers.h"
ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, GeneralSettings & generalSettings, char * inputName) :
ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, GeneralSettings & generalSettings, FirmwareInterface * firmware, char * inputName) :
QDialog(parent),
ui(new Ui::ExpoDialog),
model(model),
generalSettings(generalSettings),
firmware(firmware),
ed(expoData),
inputName(inputName)
{
@@ -28,7 +29,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
ui->sideCB->setCurrentIndex(ed->mode-1);
if (!GetEepromInterface()->getCapability(FlightPhases)) {
if (!firmware->getCapability(FlightPhases)) {
ui->label_phases->hide();
for (int i=0; i<9; i++) {
lb_fp[i]->hide();
@@ -43,13 +44,13 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
}
mask <<= 1;
}
for (int i=GetEepromInterface()->getCapability(FlightPhases); i<9;i++) {
for (int i=firmware->getCapability(FlightPhases); i<9;i++) {
lb_fp[i]->hide();
cb_fp[i]->hide();
}
}
if (GetEepromInterface()->getCapability(VirtualInputs)) {
if (firmware->getCapability(VirtualInputs)) {
ui->inputName->setMaxLength(4);
populateSourceCB(ui->sourceCB, ed->srcRaw, model, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS | POPULATE_TELEMETRY);
ui->sourceCB->removeItem(0);
@@ -69,7 +70,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
ui->trimCB->addItem(tr("Ail"), 4);
ui->trimCB->setCurrentIndex(1 - ed->carryTrim);
int expolength = GetEepromInterface()->getCapability(HasExpoNames);
int expolength = firmware->getCapability(HasExpoNames);
if (!expolength) {
ui->lineNameLabel->hide();
ui->lineName->hide();
@@ -96,7 +97,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
for (int i=0; i<9; i++) {
connect(cb_fp[i], SIGNAL(toggled(bool)), this, SLOT(valuesChanged()));
}
if (GetEepromInterface()->getCapability(VirtualInputs))
if (firmware->getCapability(VirtualInputs))
connect(ui->inputName, SIGNAL(editingFinished()), this, SLOT(valuesChanged()));
QTimer::singleShot(0, this, SLOT(shrink()));
@@ -111,7 +112,7 @@ ExpoDialog::~ExpoDialog()
void ExpoDialog::updateScale()
{
if (GetEepromInterface()->getCapability(VirtualInputs) && ed->srcRaw.type == SOURCE_TYPE_TELEMETRY) {
if (firmware->getCapability(VirtualInputs) && ed->srcRaw.type == SOURCE_TYPE_TELEMETRY) {
RawSourceRange range = ed->srcRaw.getRange();
ui->scaleLabel->show();
ui->scale->show();
@@ -153,11 +154,11 @@ void ExpoDialog::valuesChanged()
ed->phases<<=1;
}
ed->phases>>=1;
if (GetEepromInterface()->getCapability(FlightPhases)) {
if (firmware->getCapability(FlightPhases)) {
int zeros=0;
int ones=0;
int phtemp=ed->phases;
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) {
for (int i=0; i<firmware->getCapability(FlightPhases); i++) {
if (phtemp & 1) {
ones++;
}
@@ -168,7 +169,7 @@ void ExpoDialog::valuesChanged()
}
if (zeros==1) {
phtemp=ed->phases;
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) {
for (int i=0; i<firmware->getCapability(FlightPhases); i++) {
if ((phtemp & 1)==0) {
break;
}
@@ -177,7 +178,7 @@ void ExpoDialog::valuesChanged()
}
else if (ones==1) {
phtemp=ed->phases;
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) {
for (int i=0; i<firmware->getCapability(FlightPhases); i++) {
if (phtemp & 1) {
break;
}
+2 -1
View File
@@ -14,7 +14,7 @@ namespace Ui {
class ExpoDialog : public QDialog {
Q_OBJECT
public:
ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expodata, GeneralSettings & generalSettings, char * inputName);
ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expodata, GeneralSettings & generalSettings, FirmwareInterface * firmware, char * inputName);
~ExpoDialog();
protected:
@@ -28,6 +28,7 @@ class ExpoDialog : public QDialog {
Ui::ExpoDialog * ui;
ModelData & model;
GeneralSettings & generalSettings;
FirmwareInterface * firmware;
ExpoData * ed;
char * inputName;
GVarGroup * gvGroup;
+20 -20
View File
@@ -5,24 +5,24 @@
#include <QComboBox>
#include <QGridLayout>
FlightMode::FlightMode(QWidget * parent, ModelData & model, int phaseIdx, GeneralSettings & generalSettings):
ModelPanel(parent, model, generalSettings),
FlightMode::FlightMode(QWidget * parent, ModelData & model, int phaseIdx, GeneralSettings & generalSettings, FirmwareInterface * firmware):
ModelPanel(parent, model, generalSettings, firmware),
ui(new Ui::FlightMode),
phaseIdx(phaseIdx),
phase(model.phaseData[phaseIdx]),
reCount(GetEepromInterface()->getCapability(RotaryEncoders)),
gvCount(((!GetEepromInterface()->getCapability(HasVariants)) || (GetCurrentFirmwareVariant() & GVARS_VARIANT)) ?
GetEepromInterface()->getCapability(Gvars) : 0)
reCount(firmware->getCapability(RotaryEncoders)),
gvCount(((!firmware->getCapability(HasVariants)) || (GetCurrentFirmwareVariant() & GVARS_VARIANT)) ?
firmware->getCapability(Gvars) : 0)
{
ui->setupUi(this);
int modesCount = GetEepromInterface()->getCapability(FlightPhases);
int modesCount = firmware->getCapability(FlightPhases);
// Phase name
QRegExp rx(CHAR_FOR_NAMES_REGEX);
if (modesCount) {
ui->name->setValidator(new QRegExpValidator(rx, this));
ui->name->setMaxLength(GetEepromInterface()->getCapability(FlightModesName));
ui->name->setMaxLength(firmware->getCapability(FlightModesName));
connect(ui->name, SIGNAL(editingFinished()), this, SLOT(phaseName_editingFinished()));
}
else {
@@ -39,9 +39,9 @@ FlightMode::FlightMode(QWidget * parent, ModelData & model, int phaseIdx, Genera
}
// FadeIn / FadeOut
if (GetEepromInterface()->getCapability(FlightPhasesHaveFades)) {
int scale = GetEepromInterface()->getCapability(SlowScale);
int range = GetEepromInterface()->getCapability(SlowRange);
if (firmware->getCapability(FlightPhasesHaveFades)) {
int scale = firmware->getCapability(SlowScale);
int range = firmware->getCapability(SlowRange);
ui->fadeIn->setMaximum(float(range)/scale);
ui->fadeIn->setSingleStep(1.0/scale);
ui->fadeIn->setDecimals((scale==1 ? 0 :1) );
@@ -130,7 +130,7 @@ FlightMode::FlightMode(QWidget * parent, ModelData & model, int phaseIdx, Genera
label->setText(tr("GVAR%1").arg(i+1));
gvLayout->addWidget(label, i, col++, 1, 1);
// GVar name
int nameLen = GetEepromInterface()->getCapability(GvarsName);
int nameLen = firmware->getCapability(GvarsName);
if (nameLen > 0) {
gvNames[i] = new QLineEdit(ui->gvGB);
gvNames[i]->setProperty("index", i);
@@ -183,12 +183,12 @@ void FlightMode::update()
{
ui->name->setText(phase.name);
int scale = GetEepromInterface()->getCapability(SlowScale);
int scale = firmware->getCapability(SlowScale);
ui->fadeIn->setValue(float(phase.fadeIn)/scale);
ui->fadeOut->setValue(float(phase.fadeOut)/scale);
for (int i=0; i<4; i++) {
int trimsMax = GetEepromInterface()->getCapability(ExtendedTrims);
int trimsMax = firmware->getCapability(ExtendedTrims);
if (trimsMax == 0 || !model.extendedTrims) {
trimsMax = 125;
}
@@ -249,7 +249,7 @@ void FlightMode::phaseSwitch_currentIndexChanged(int index)
void FlightMode::phaseFadeIn_editingFinished()
{
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(sender());
int scale = GetEepromInterface()->getCapability(SlowScale);
int scale = firmware->getCapability(SlowScale);
phase.fadeIn = round(spinBox->value()*scale);
emit modified();
}
@@ -257,7 +257,7 @@ void FlightMode::phaseFadeIn_editingFinished()
void FlightMode::phaseFadeOut_editingFinished()
{
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(sender());
int scale = GetEepromInterface()->getCapability(SlowScale);
int scale = firmware->getCapability(SlowScale);
phase.fadeOut = round(spinBox->value()*scale);
emit modified();
}
@@ -418,14 +418,14 @@ void FlightMode::phaseTrimSlider_valueChanged()
/**********************************************************/
FlightModes::FlightModes(QWidget * parent, ModelData & model, GeneralSettings & generalSettings):
ModelPanel(parent, model, generalSettings),
modesCount(GetEepromInterface()->getCapability(FlightPhases))
FlightModes::FlightModes(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
ModelPanel(parent, model, generalSettings, firmware),
modesCount(firmware->getCapability(FlightPhases))
{
QGridLayout * gridLayout = new QGridLayout(this);
tabWidget = new QTabWidget(this);
for (int i=0; i<modesCount; i++) {
FlightMode *tab = new FlightMode(tabWidget, model, i, generalSettings);
FlightMode *tab = new FlightMode(tabWidget, model, i, generalSettings, firmware);
tab->setProperty("index", i);
panels << tab;
connect(tab, SIGNAL(modified()), this, SLOT(onPhaseModified()));
@@ -449,7 +449,7 @@ QString FlightModes::getTabName(int index)
{
QString result = tr("Flight Mode %1").arg(index);
const char *name = model.phaseData[index].name;
if (GetEepromInterface()->getCapability(FlightModesName) && strlen(name) > 0) {
if (firmware->getCapability(FlightModesName) && strlen(name) > 0) {
result += tr(" (%1)").arg(name);
}
else if (index == 0) {
+2 -2
View File
@@ -18,7 +18,7 @@ class FlightMode : public ModelPanel
Q_OBJECT
public:
FlightMode(QWidget *parent, ModelData &model, int modeIdx, GeneralSettings & generalSettings);
FlightMode(QWidget *parent, ModelData &model, int modeIdx, GeneralSettings & generalSettings, FirmwareInterface * firmware);
virtual ~FlightMode();
virtual void update();
@@ -66,7 +66,7 @@ class FlightModes : public ModelPanel
Q_OBJECT
public:
FlightModes(QWidget *parent, ModelData & model, GeneralSettings & generalSettings);
FlightModes(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
virtual ~FlightModes();
virtual void update();
+2 -2
View File
@@ -2,8 +2,8 @@
#include "ui_heli.h"
#include "helpers.h"
HeliPanel::HeliPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings):
ModelPanel(parent, model, generalSettings),
HeliPanel::HeliPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
ModelPanel(parent, model, generalSettings, firmware),
ui(new Ui::Heli)
{
ui->setupUi(this);
+1 -1
View File
@@ -12,7 +12,7 @@ class HeliPanel : public ModelPanel
Q_OBJECT
public:
HeliPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings);
HeliPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
~HeliPanel();
void update();
+10 -10
View File
@@ -3,8 +3,8 @@
#include "expodialog.h"
#include "helpers.h"
InputsPanel::InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings):
ModelPanel(parent, model, generalSettings),
InputsPanel::InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
ModelPanel(parent, model, generalSettings, firmware),
expoInserted(false)
{
QGridLayout * exposLayout = new QGridLayout(this);
@@ -47,7 +47,7 @@ void InputsPanel::update()
{
lock = true;
int inputsCount = GetEepromInterface()->getCapability(VirtualInputs);
int inputsCount = firmware->getCapability(VirtualInputs);
if (inputsCount == 0)
inputsCount = NUM_STICKS;
@@ -75,20 +75,20 @@ void InputsPanel::update()
}
if (curDest!=(int)md->chn) {
if (GetEepromInterface()->getCapability(VirtualInputs))
if (firmware->getCapability(VirtualInputs))
str = QString("%1").arg(getInputStr(model, md->chn), -8, ' ');
else
str = getInputStr(model, md->chn);
curDest = md->chn;
}
else {
if (GetEepromInterface()->getCapability(VirtualInputs))
if (firmware->getCapability(VirtualInputs))
str = " ";
else
str = " ";
}
if (GetEepromInterface()->getCapability(VirtualInputs)) {
if (firmware->getCapability(VirtualInputs)) {
str += " " + tr("Source(%1)").arg(md->srcRaw.toString());
if (md->carryTrim>0) {
str += " " + tr("No Trim");
@@ -113,7 +113,7 @@ void InputsPanel::update()
if (md->swtch.type != SWITCH_TYPE_NONE) str += " " + tr("Switch(%1)").arg(md->swtch.toString());
if (GetEepromInterface()->getCapability(HasExpoNames)) {
if (firmware->getCapability(HasExpoNames)) {
QString expoName = md->name;
if (!expoName.isEmpty()) str += QString(" [%1]").arg(expoName);
}
@@ -171,13 +171,13 @@ void InputsPanel::gm_openExpo(int index)
emit modified();
update();
if (GetEepromInterface()->getCapability(VirtualInputs))
if (firmware->getCapability(VirtualInputs))
strcpy(inputName, model.inputNames[mixd.chn]);
ExpoDialog *g = new ExpoDialog(this, model, &mixd, generalSettings, inputName);
ExpoDialog *g = new ExpoDialog(this, model, &mixd, generalSettings, firmware, inputName);
if (g->exec()) {
model.expoData[index] = mixd;
if (GetEepromInterface()->getCapability(VirtualInputs))
if (firmware->getCapability(VirtualInputs))
strcpy(model.inputNames[mixd.chn], inputName);
emit modified();
update();
+1 -1
View File
@@ -9,7 +9,7 @@ class InputsPanel : public ModelPanel
Q_OBJECT
public:
InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings);
InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
virtual ~InputsPanel();
virtual void update();
+11 -11
View File
@@ -7,8 +7,8 @@
#include <QDoubleSpinBox>
#include "helpers.h"
LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings):
ModelPanel(parent, model, generalSettings),
LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
ModelPanel(parent, model, generalSettings, firmware),
selectedSwitch(0)
{
QGridLayout * gridLayout = new QGridLayout(this);
@@ -18,13 +18,13 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
addLabel(gridLayout, tr("V1"), col++);
addLabel(gridLayout, tr("V2"), col++);
addLabel(gridLayout, tr("AND Switch"), col++);
if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) {
if (firmware->getCapability(LogicalSwitchesExt)) {
addLabel(gridLayout, tr("Duration"), col++);
addLabel(gridLayout, tr("Delay"), col++);
}
lock = true;
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) {
for (int i=0; i<firmware->getCapability(LogicalSwitches); i++) {
// The label
QLabel * label = new QLabel(this);
label->setProperty("index", i);
@@ -90,7 +90,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
connect(cswitchAnd[i], SIGNAL(currentIndexChanged(int)), this, SLOT(andEdited(int)));
gridLayout->addWidget(cswitchAnd[i], i+1, 4);
if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) {
if (firmware->getCapability(LogicalSwitchesExt)) {
// Duration
cswitchDuration[i] = new QDoubleSpinBox(this);
cswitchDuration[i]->setProperty("index", i);
@@ -115,7 +115,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
}
}
// Push rows upward
addVSpring(gridLayout,0,GetEepromInterface()->getCapability(LogicalSwitches)+1);
addVSpring(gridLayout,0,firmware->getCapability(LogicalSwitches)+1);
lock = false;
}
@@ -276,7 +276,7 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
{
case LS_FAMILY_VOFS:
mask |= SOURCE1_VISIBLE | VALUE2_VISIBLE;
populateSourceCB(cswitchSource1[i], source, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
populateSourceCB(cswitchSource1[i], source, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
cswitchOffset[i]->setDecimals(range.decimals);
cswitchOffset[i]->setSingleStep(range.step);
if (model.customSw[i].func == LS_FN_DPOS || model.customSw[i].func == LS_FN_DAPOS) {
@@ -304,8 +304,8 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
break;
case LS_FAMILY_VCOMP:
mask |= SOURCE1_VISIBLE | SOURCE2_VISIBLE;
populateSourceCB(cswitchSource1[i], RawSource(model.customSw[i].val1), model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
populateSourceCB(cswitchSource2[i], RawSource(model.customSw[i].val2), model, POPULATE_SOURCES | POPULATE_TRIMS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
populateSourceCB(cswitchSource1[i], RawSource(model.customSw[i].val1), model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
populateSourceCB(cswitchSource2[i], RawSource(model.customSw[i].val2), model, POPULATE_SOURCES | POPULATE_TRIMS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
break;
case LS_FAMILY_TIMER:
mask |= VALUE1_VISIBLE | VALUE2_VISIBLE;
@@ -331,7 +331,7 @@ void LogicalSwitchesPanel::updateLine(int i)
setSwitchWidgetVisibility(i);
lock = true;
populateAndSwitchCB(cswitchAnd[i], RawSwitch(model.customSw[i].andsw));
if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) {
if (firmware->getCapability(LogicalSwitchesExt)) {
cswitchDuration[i]->setValue(model.customSw[i].duration/10.0);
cswitchDelay[i]->setValue(model.customSw[i].delay/10.0);
}
@@ -340,7 +340,7 @@ void LogicalSwitchesPanel::updateLine(int i)
void LogicalSwitchesPanel::update()
{
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) {
for (int i=0; i<firmware->getCapability(LogicalSwitches); i++) {
updateLine(i);
}
}
+1 -1
View File
@@ -10,7 +10,7 @@ class LogicalSwitchesPanel : public ModelPanel
Q_OBJECT
public:
LogicalSwitchesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings);
LogicalSwitchesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
virtual ~LogicalSwitchesPanel();
virtual void update();
+12 -11
View File
@@ -3,11 +3,12 @@
#include "eeprominterface.h"
#include "helpers.h"
MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, GeneralSettings & generalSettings) :
MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, GeneralSettings & generalSettings, FirmwareInterface * firmware) :
QDialog(parent),
ui(new Ui::MixerDialog),
model(model),
generalSettings(generalSettings),
firmware(firmware),
md(mixdata),
lock(false)
{
@@ -21,7 +22,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
populateSourceCB(ui->sourceCB, md->srcRaw, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
ui->sourceCB->removeItem(0);
int limit = GetEepromInterface()->getCapability(OffsetWeight);
int limit = firmware->getCapability(OffsetWeight);
gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, md->weight, 100, -limit, limit);
gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, md->sOffset, 0, -limit, limit);
@@ -29,12 +30,12 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
ui->MixDR_CB->setChecked(md->noExpo==0);
if (GetEepromInterface()->getCapability(VirtualInputs) || !GetEepromInterface()->getCapability(MixesWithoutExpo)) {
if (firmware->getCapability(VirtualInputs) || !firmware->getCapability(MixesWithoutExpo)) {
ui->MixDR_CB->hide();
ui->label_MixDR->hide();
}
if (!GetEepromInterface()->getCapability(VirtualInputs)) {
if (!firmware->getCapability(VirtualInputs)) {
ui->trimCB->addItem(tr("Rud"));
ui->trimCB->addItem(tr("Ele"));
ui->trimCB->addItem(tr("Thr"));
@@ -43,7 +44,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
ui->trimCB->setCurrentIndex(1 - md->carryTrim);
int namelength = GetEepromInterface()->getCapability(HasMixerNames);
int namelength = firmware->getCapability(HasMixerNames);
if (!namelength) {
ui->label_name->hide();
ui->mixerName->hide();
@@ -54,7 +55,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
ui->mixerName->setValidator(new QRegExpValidator(rx, this));
ui->mixerName->setText(md->name);
if (!GetEepromInterface()->getCapability(FlightPhases)) {
if (!firmware->getCapability(FlightPhases)) {
ui->label_phases->hide();
for (int i=0; i<9; i++) {
lb_fp[i]->hide();
@@ -69,7 +70,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
}
mask <<= 1;
}
for (int i=GetEepromInterface()->getCapability(FlightPhases); i<9;i++) {
for (int i=firmware->getCapability(FlightPhases); i<9;i++) {
lb_fp[i]->hide();
cb_fp[i]->hide();
}
@@ -78,8 +79,8 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
populateSwitchCB(ui->switchesCB, md->swtch, generalSettings);
ui->warningCB->setCurrentIndex(md->mixWarn);
ui->mltpxCB->setCurrentIndex(md->mltpx);
int scale=GetEepromInterface()->getCapability(SlowScale);
float range=GetEepromInterface()->getCapability(SlowRange);
int scale=firmware->getCapability(SlowScale);
float range=firmware->getCapability(SlowRange);
ui->slowDownSB->setMaximum(range/scale);
ui->slowDownSB->setSingleStep(1.0/scale);
ui->slowDownSB->setDecimals((scale==1 ? 0 :1));
@@ -142,7 +143,7 @@ void MixerDialog::valuesChanged()
lock = true;
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
md->srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt(), &model);
if (!GetEepromInterface()->getCapability(VirtualInputs) && GetEepromInterface()->getCapability(MixesWithoutExpo)) {
if (!firmware->getCapability(VirtualInputs) && firmware->getCapability(MixesWithoutExpo)) {
bool drVisible = (md->srcRaw.type == SOURCE_TYPE_STICK && md->srcRaw.index < NUM_STICKS);
ui->MixDR_CB->setEnabled(drVisible);
ui->label_MixDR->setEnabled(drVisible);
@@ -152,7 +153,7 @@ void MixerDialog::valuesChanged()
md->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
md->mixWarn = ui->warningCB->currentIndex();
md->mltpx = (MltpxValue)ui->mltpxCB->currentIndex();
int scale=GetEepromInterface()->getCapability(SlowScale);
int scale=firmware->getCapability(SlowScale);
md->delayDown = round(ui->delayDownSB->value()*scale);
md->delayUp = round(ui->delayUpSB->value()*scale);
md->speedDown = round(ui->slowDownSB->value()*scale);
+2 -1
View File
@@ -14,7 +14,7 @@ namespace Ui {
class MixerDialog : public QDialog {
Q_OBJECT
public:
MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, GeneralSettings & generalSettings);
MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, GeneralSettings & generalSettings, FirmwareInterface * firmware);
~MixerDialog();
protected:
@@ -28,6 +28,7 @@ class MixerDialog : public QDialog {
Ui::MixerDialog *ui;
ModelData & model;
GeneralSettings & generalSettings;
FirmwareInterface * firmware;
MixData *md;
bool lock;
GVarGroup * gvWeightGroup;
+20 -20
View File
@@ -3,8 +3,8 @@
// #include <QMessageBox>
// #include "expodialog.h"
MixesPanel::MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings):
ModelPanel(parent, model, generalSettings),
MixesPanel::MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
ModelPanel(parent, model, generalSettings, firmware),
mixInserted(false),
highlightedSource(0)
{
@@ -46,10 +46,10 @@ MixesPanel::~MixesPanel()
QString MixesPanel::getChannelLabel(int curDest)
{
QString str;
int outputs = GetEepromInterface()->getCapability(Outputs);
str = QObject::tr("CH%1").arg(curDest);
// TODO not nice, Qt brings a function for that, I don't remember right now
(str.length() < 4) ? str.append(" ") : str.append(" ");
if (GetEepromInterface()->getCapability(HasChNames)) {
if (firmware->getCapability(HasChNames)) {
QString name = model.limitData[curDest-1].name;
if (!name.isEmpty()) {
name = QString("(") + name + QString(")");
@@ -68,9 +68,9 @@ void MixesPanel::update()
MixerlistWidget->clear();
unsigned int curDest = 0;
int i;
unsigned int outputs = GetEepromInterface()->getCapability(Outputs);
unsigned int outputs = firmware->getCapability(Outputs);
for (i=0; i<GetEepromInterface()->getCapability(Mixes); i++) {
for (i=0; i<firmware->getCapability(Mixes); i++) {
MixData *md = &model.mixData[i];
// qDebug() << "md->destCh: " << md->destCh;
if (md->destCh==0 || md->destCh>outputs) continue;
@@ -185,7 +185,7 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
if (md->sOffset) str += " " + Qt::escape(tr("Offset(%1)").arg(getGVarString(md->sOffset)));
if (md->curve.value) str += " " + Qt::escape(md->curve.toString());
int scale = GetEepromInterface()->getCapability(SlowScale);
int scale = firmware->getCapability(SlowScale);
if (scale == 0)
scale = 1;
if (md->delayDown || md->delayUp)
@@ -193,7 +193,7 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
if (md->speedDown || md->speedUp)
str += Qt::escape(tr(" Slow(u%1:d%2)").arg((double)md->speedUp/scale).arg((double)md->speedDown/scale));
if (md->mixWarn) str += Qt::escape(tr(" Warn(%1)").arg(md->mixWarn));
if (GetEepromInterface()->getCapability(HasMixerNames)) {
if (firmware->getCapability(HasMixerNames)) {
QString MixerName;
MixerName.append(md->name);
if (!MixerName.isEmpty()) {
@@ -206,14 +206,14 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
bool MixesPanel::gm_insertMix(int idx)
{
if (idx<0 || idx>=GetEepromInterface()->getCapability(Mixes) || model.mixData[GetEepromInterface()->getCapability(Mixes)-1].destCh > 0) {
if (idx<0 || idx>=firmware->getCapability(Mixes) || model.mixData[firmware->getCapability(Mixes)-1].destCh > 0) {
QMessageBox::information(this, "companion", tr("Not enough available mixers!"));
return false;
}
int i = model.mixData[idx].destCh;
memmove(&model.mixData[idx+1],&model.mixData[idx],
(GetEepromInterface()->getCapability(Mixes)-(idx+1))*sizeof(MixData) );
(firmware->getCapability(Mixes)-(idx+1))*sizeof(MixData) );
memset(&model.mixData[idx],0,sizeof(MixData));
model.mixData[idx].srcRaw = RawSource(SOURCE_TYPE_NONE);
model.mixData[idx].destCh = i;
@@ -224,19 +224,19 @@ bool MixesPanel::gm_insertMix(int idx)
void MixesPanel::gm_deleteMix(int index)
{
memmove(&model.mixData[index],&model.mixData[index+1],
(GetEepromInterface()->getCapability(Mixes)-(index+1))*sizeof(MixData));
memset(&model.mixData[GetEepromInterface()->getCapability(Mixes)-1],0,sizeof(MixData));
(firmware->getCapability(Mixes)-(index+1))*sizeof(MixData));
memset(&model.mixData[firmware->getCapability(Mixes)-1],0,sizeof(MixData));
}
void MixesPanel::gm_openMix(int index)
{
if(index<0 || index>=GetEepromInterface()->getCapability(Mixes)) return;
if(index<0 || index>=firmware->getCapability(Mixes)) return;
MixData mixd(model.mixData[index]);
emit modified();
update();
MixerDialog *g = new MixerDialog(this, model, &mixd, generalSettings);
MixerDialog *g = new MixerDialog(this, model, &mixd, generalSettings, firmware);
if(g->exec()) {
model.mixData[index] = mixd;
emit modified();
@@ -254,8 +254,8 @@ void MixesPanel::gm_openMix(int index)
int MixesPanel::getMixerIndex(unsigned int dch)
{
int i = 0;
while ((model.mixData[i].destCh<=dch) && (model.mixData[i].destCh) && (i<GetEepromInterface()->getCapability(Mixes))) i++;
if(i==GetEepromInterface()->getCapability(Mixes)) return -1;
while ((model.mixData[i].destCh<=dch) && (model.mixData[i].destCh) && (i<firmware->getCapability(Mixes))) i++;
if(i==firmware->getCapability(Mixes)) return -1;
return i;
}
@@ -291,7 +291,7 @@ QList<int> MixesPanel::createMixListFromSelected()
QList<int> list;
foreach(QListWidgetItem *item, MixerlistWidget->selectedItems()) {
int idx= item->data(Qt::UserRole).toByteArray().at(0);
if(idx>=0 && idx<GetEepromInterface()->getCapability(Mixes)) list << idx;
if(idx>=0 && idx<firmware->getCapability(Mixes)) list << idx;
}
return list;
}
@@ -364,7 +364,7 @@ void MixesPanel::pasteMixerMimeData(const QMimeData * mimeData, int destIdx)
int i = 0;
while(i<mxData.size()) {
idx++;
if(idx==GetEepromInterface()->getCapability(Mixes)) break;
if(idx==firmware->getCapability(Mixes)) break;
if (!gm_insertMix(idx))
break;
@@ -510,7 +510,7 @@ void MixesPanel::mixerlistWidget_KeyPress(QKeyEvent *event)
int MixesPanel::gm_moveMix(int idx, bool dir) //true=inc=down false=dec=up
{
if(idx>GetEepromInterface()->getCapability(Mixes) || (idx==GetEepromInterface()->getCapability(Mixes) && dir)) return idx;
if(idx>firmware->getCapability(Mixes) || (idx==firmware->getCapability(Mixes) && dir)) return idx;
int tdx = dir ? idx+1 : idx-1;
MixData &src=model.mixData[idx];
@@ -519,7 +519,7 @@ int MixesPanel::gm_moveMix(int idx, bool dir) //true=inc=down false=dec=up
if (src.destCh == 1 && !dir)
return idx;
unsigned int outputs = GetEepromInterface()->getCapability(Outputs);
unsigned int outputs = firmware->getCapability(Outputs);
if((src.destCh==0) || (src.destCh>outputs) || (tgt.destCh>outputs)) return idx;
if (tgt.destCh!=src.destCh) {
+1 -1
View File
@@ -10,7 +10,7 @@ class MixesPanel : public ModelPanel
Q_OBJECT
public:
MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings);
MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
virtual ~MixesPanel();
virtual void update();
+15 -14
View File
@@ -14,31 +14,32 @@
#include "appdata.h"
#include <QScrollArea>
ModelEdit::ModelEdit(RadioData & radioData, int modelId, bool openWizard, bool isNew, QWidget *parent) :
ModelEdit::ModelEdit(QWidget * parent, RadioData & radioData, int modelId, FirmwareInterface * firmware) :
QDialog(parent),
ui(new Ui::ModelEdit),
modelId(modelId),
model(radioData.models[modelId]),
generalSettings(radioData.generalSettings)
generalSettings(radioData.generalSettings),
firmware(firmware)
{
ui->setupUi(this);
setWindowIcon(CompanionIcon("edit.png"));
restoreGeometry(g.modelEditGeo());
ui->pushButton->setIcon(CompanionIcon("simulate.png"));
Setup * setupPanel = new Setup(this, model, generalSettings);
SetupPanel * setupPanel = new SetupPanel(this, model, generalSettings, firmware);
addTab(setupPanel, tr("Setup"));
addTab(new HeliPanel(this, model, generalSettings), tr("Heli"));
addTab(new FlightModes(this, model, generalSettings), tr("Flight Modes"));
addTab(new InputsPanel(this, model, generalSettings), tr("Inputs"));
addTab(new MixesPanel(this, model, generalSettings), tr("Mixes"));
Channels * chnPanel = new Channels(this, model, generalSettings);
addTab(new HeliPanel(this, model, generalSettings, firmware), tr("Heli"));
addTab(new FlightModes(this, model, generalSettings, firmware), tr("Flight Modes"));
addTab(new InputsPanel(this, model, generalSettings, firmware), tr("Inputs"));
addTab(new MixesPanel(this, model, generalSettings, firmware), tr("Mixes"));
Channels * chnPanel = new Channels(this, model, generalSettings, firmware);
addTab(chnPanel, tr("Servos"));
addTab(new Curves(this, model, generalSettings), tr("Curves"));
addTab(new LogicalSwitchesPanel(this, model, generalSettings), tr("Logical Switches"));
if (GetEepromInterface()->getCapability(CustomFunctions))
addTab(new CustomFunctionsPanel(this, model, generalSettings), tr("Special Functions"));
if (GetEepromInterface()->getCapability(Telemetry) & TM_HASTELEMETRY)
addTab(new TelemetryPanel(this, model, generalSettings), tr("Telemetry"));
addTab(new Curves(this, model, generalSettings, firmware), tr("Curves"));
addTab(new LogicalSwitchesPanel(this, model, generalSettings, firmware), tr("Logical Switches"));
if (firmware->getCapability(CustomFunctions))
addTab(new CustomFunctionsPanel(this, model, generalSettings, firmware), tr("Special Functions"));
if (firmware->getCapability(Telemetry) & TM_HASTELEMETRY)
addTab(new TelemetryPanel(this, model, generalSettings, firmware), tr("Telemetry"));
connect(setupPanel, SIGNAL(extendedLimitsToggled()), chnPanel, SLOT(refreshExtendedLimits()));
}
+2 -1
View File
@@ -13,7 +13,7 @@ class ModelEdit : public QDialog
Q_OBJECT
public:
explicit ModelEdit(RadioData & radioData, int modelId , bool openWizard =false, bool inNew =false, QWidget *parent = 0);
ModelEdit(QWidget * parent, RadioData & radioData, int modelId, FirmwareInterface * firmware);
~ModelEdit();
protected:
@@ -32,6 +32,7 @@ class ModelEdit : public QDialog
int modelId;
ModelData & model;
GeneralSettings & generalSettings;
FirmwareInterface * firmware;
QVector<ModelPanel *> panels;
void addTab(ModelPanel *panel, QString text);
+2 -1
View File
@@ -1,10 +1,11 @@
#include "modelpanel.h"
#include <QLabel>
ModelPanel::ModelPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings):
ModelPanel::ModelPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
QWidget(parent),
model(model),
generalSettings(generalSettings),
firmware(firmware),
lock(false)
{
}
+2 -1
View File
@@ -10,7 +10,7 @@ class ModelPanel : public QWidget
Q_OBJECT
public:
ModelPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings);
ModelPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
virtual ~ModelPanel();
signals:
@@ -22,6 +22,7 @@ class ModelPanel : public QWidget
protected:
ModelData & model;
GeneralSettings & generalSettings;
FirmwareInterface * firmware;
bool lock;
void addLabel(QGridLayout * gridLayout, QString text, int col, bool mimimize=false);
void addEmptyLabel(QGridLayout * gridLayout, int col);
+48 -48
View File
@@ -5,8 +5,8 @@
#include "helpers.h"
#include "appdata.h"
TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings):
ModelPanel(parent, model, generalSettings),
TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings, FirmwareInterface * firmware):
ModelPanel(parent, model, generalSettings, firmware),
timer(timer),
ui(new Ui::Timer)
{
@@ -17,7 +17,7 @@ TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, Ge
// Mode
populateSwitchCB(ui->mode, timer.mode, generalSettings, POPULATE_TIMER_MODES);
if (!GetEepromInterface()->getCapability(PermTimers)) {
if (!firmware->getCapability(PermTimers)) {
ui->persistent->hide();
ui->persistentValue->hide();
}
@@ -41,7 +41,7 @@ void TimerPanel::update()
int sec = timer.val % 60;
ui->value->setTime(QTime(0, min, sec));
if (GetEepromInterface()->getCapability(PermTimers)) {
if (firmware->getCapability(PermTimers)) {
int sign = 1;
int pvalue = timer.pvalue;
if (pvalue < 0) {
@@ -94,8 +94,8 @@ void TimerPanel::on_minuteBeep_toggled(bool checked)
/******************************************************************************/
ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module, GeneralSettings & generalSettings, int moduleIdx):
ModelPanel(parent, model, generalSettings),
ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module, GeneralSettings & generalSettings, FirmwareInterface * firmware, int moduleIdx):
ModelPanel(parent, model, generalSettings, firmware),
module(module),
moduleIdx(moduleIdx),
ui(new Ui::Module)
@@ -112,7 +112,7 @@ ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module
else {
ui->label_trainerMode->hide();
ui->trainerMode->hide();
if (GetEepromInterface()->getCapability(NumModules) > 1) {
if (firmware->getCapability(NumModules) > 1) {
if (moduleIdx == 0)
label = tr("Internal Radio System");
else
@@ -132,7 +132,7 @@ ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module
}
}
if (GetEepromInterface()->getCapability(HasFailsafe)) {
if (firmware->getCapability(HasFailsafe)) {
for (int i=0; i<16; i++) {
QLabel * label = new QLabel(this);
label->setText(QString::number(i+1));
@@ -211,7 +211,7 @@ void ModulePanel::update()
ui->channelsCount->setVisible(mask & MASK_CHANNELS_RANGE);
ui->channelsCount->setEnabled(mask & MASK_CHANNELS_COUNT);
ui->channelsCount->setValue(module.channelsCount);
ui->channelsCount->setSingleStep(GetEepromInterface()->getCapability(HasPPMStart) ? 1 : 2);
ui->channelsCount->setSingleStep(firmware->getCapability(HasPPMStart) ? 1 : 2);
// PPM settings fields
ui->label_ppmPolarity->setVisible(mask & MASK_PPM_FIELDS);
@@ -223,10 +223,10 @@ void ModulePanel::update()
ui->label_ppmFrameLength->setVisible(mask & MASK_PPM_FIELDS);
ui->ppmFrameLength->setVisible(mask & MASK_PPM_FIELDS);
ui->ppmFrameLength->setMinimum(module.channelsCount*(model.extendedLimits ? 2.250 :2)+3.5);
ui->ppmFrameLength->setMaximum(GetEepromInterface()->getCapability(PPMFrameLength));
ui->ppmFrameLength->setMaximum(firmware->getCapability(PPMFrameLength));
ui->ppmFrameLength->setValue(22.5+((double)module.ppmFrameLength)*0.5);
if (GetEepromInterface()->getCapability(HasFailsafe)) {
if (firmware->getCapability(HasFailsafe)) {
ui->label_failsafeMode->setVisible(mask & MASK_FAILSAFES);
ui->failsafeMode->setVisible(mask & MASK_FAILSAFES);
ui->failsafeMode->setCurrentIndex(module.failsafeMode);
@@ -323,8 +323,8 @@ void ModulePanel::onFailsafeSpinChanged(double value)
/******************************************************************************/
Setup::Setup(QWidget *parent, ModelData & model, GeneralSettings & generalSettings):
ModelPanel(parent, model, generalSettings),
SetupPanel::SetupPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
ModelPanel(parent, model, generalSettings, firmware),
ui(new Ui::Setup)
{
lock = true;
@@ -336,23 +336,23 @@ Setup::Setup(QWidget *parent, ModelData & model, GeneralSettings & generalSettin
ui->name->setMaxLength(IS_TARANIS(GetEepromInterface()->getBoard()) ? 12 : 10);
for (int i=0; i<C9X_MAX_TIMERS; i++) {
timers[i] = new TimerPanel(this, model, model.timers[i], generalSettings);
timers[i] = new TimerPanel(this, model, model.timers[i], generalSettings, firmware);
ui->gridLayout->addWidget(timers[i], 1+i, 1);
connect(timers[i], SIGNAL(modified()), this, SLOT(onChildModified()));
}
for (int i=0; i<GetEepromInterface()->getCapability(NumModules); i++) {
modules[i] = new ModulePanel(this, model, model.moduleData[i], generalSettings, i);
for (int i=0; i<firmware->getCapability(NumModules); i++) {
modules[i] = new ModulePanel(this, model, model.moduleData[i], generalSettings, firmware, i);
ui->modulesLayout->addWidget(modules[i]);
connect(modules[i], SIGNAL(modified()), this, SLOT(onChildModified()));
}
if (GetEepromInterface()->getCapability(ModelTrainerEnable)) {
modules[C9X_NUM_MODULES] = new ModulePanel(this, model, model.moduleData[C9X_NUM_MODULES], generalSettings, -1);
if (firmware->getCapability(ModelTrainerEnable)) {
modules[C9X_NUM_MODULES] = new ModulePanel(this, model, model.moduleData[C9X_NUM_MODULES], generalSettings, firmware, -1);
ui->modulesLayout->addWidget(modules[C9X_NUM_MODULES]);
}
if (GetEepromInterface()->getCapability(ModelImage)) {
if (firmware->getCapability(ModelImage)) {
QStringList items;
items.append("");
QString path = g.profile[g.id()].sdPath();
@@ -399,13 +399,13 @@ Setup::Setup(QWidget *parent, ModelData & model, GeneralSettings & generalSettin
ui->imagePreview->hide();
}
if (!GetEepromInterface()->getCapability(HasDisplayText)) {
if (!firmware->getCapability(HasDisplayText)) {
ui->displayText->hide();
}
// Beep Center checkboxes
int analogs = 4 + GetEepromInterface()->getCapability(Pots);
for (int i=0; i<analogs+GetEepromInterface()->getCapability(RotaryEncoders); i++) {
int analogs = 4 + firmware->getCapability(Pots);
for (int i=0; i<analogs+firmware->getCapability(RotaryEncoders); i++) {
QCheckBox * checkbox = new QCheckBox(this);
checkbox->setProperty("index", i);
checkbox->setText(i<analogs ? AnalogString(i) : RotaryEncoderString(i-analogs));
@@ -415,7 +415,7 @@ Setup::Setup(QWidget *parent, ModelData & model, GeneralSettings & generalSettin
}
// Startup switches warnings
for (int i=0; i<GetEepromInterface()->getCapability(Switches)-1; i++) {
for (int i=0; i<firmware->getCapability(Switches)-1; i++) {
QLabel * label = new QLabel(this);
QSlider * slider = new QSlider(this);
QCheckBox * cb = new QCheckBox(this);
@@ -449,11 +449,11 @@ Setup::Setup(QWidget *parent, ModelData & model, GeneralSettings & generalSettin
startupSwitchesSliders << slider;
startupSwitchesCheckboxes << cb;
}
ui->switchesStartupLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, GetEepromInterface()->getCapability(Switches));
ui->switchesStartupLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, firmware->getCapability(Switches));
// Pot warnings
if(IS_TARANIS(GetEepromInterface()->getBoard())) {
for (int i=0; i<GetEepromInterface()->getCapability(Pots); i++) {
for (int i=0; i<firmware->getCapability(Pots); i++) {
QCheckBox * cb = new QCheckBox(this);
cb->setProperty("index", i+1);
cb->setText(AnalogString(i+4));
@@ -469,43 +469,43 @@ Setup::Setup(QWidget *parent, ModelData & model, GeneralSettings & generalSettin
lock = false;
}
Setup::~Setup()
SetupPanel::~SetupPanel()
{
delete ui;
}
void Setup::on_extendedLimits_toggled(bool checked)
void SetupPanel::on_extendedLimits_toggled(bool checked)
{
model.extendedLimits = checked;
emit extendedLimitsToggled();
emit modified();
}
void Setup::on_throttleWarning_toggled(bool checked)
void SetupPanel::on_throttleWarning_toggled(bool checked)
{
model.disableThrottleWarning = !checked;
emit modified();
}
void Setup::on_throttleReverse_toggled(bool checked)
void SetupPanel::on_throttleReverse_toggled(bool checked)
{
model.throttleReversed = checked;
emit modified();
}
void Setup::on_extendedTrims_toggled(bool checked)
void SetupPanel::on_extendedTrims_toggled(bool checked)
{
model.extendedTrims = checked;
emit modified();
}
void Setup::on_trimIncrement_currentIndexChanged(int index)
void SetupPanel::on_trimIncrement_currentIndexChanged(int index)
{
model.trimInc = index-2;
emit modified();
}
void Setup::on_throttleSource_currentIndexChanged(int index)
void SetupPanel::on_throttleSource_currentIndexChanged(int index)
{
if (!lock) {
model.thrTraceSrc = ui->throttleSource->itemData(index).toInt();
@@ -513,14 +513,14 @@ void Setup::on_throttleSource_currentIndexChanged(int index)
}
}
void Setup::on_name_editingFinished()
void SetupPanel::on_name_editingFinished()
{
int length = ui->name->maxLength();
strncpy(model.name, ui->name->text().toAscii(), length);
emit modified();
}
void Setup::on_image_currentIndexChanged(int index)
void SetupPanel::on_image_currentIndexChanged(int index)
{
if (!lock) {
strncpy(model.bitmap, ui->image->currentText().toAscii(), 10);
@@ -552,7 +552,7 @@ void Setup::on_image_currentIndexChanged(int index)
}
}
void Setup::populateThrottleSourceCB()
void SetupPanel::populateThrottleSourceCB()
{
const QString sources9x[] = { QObject::tr("THR"), QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3")};
const QString sourcesTaranis[] = { QObject::tr("THR"), QObject::tr("S1"), QObject::tr("S2"), QObject::tr("S3"), QObject::tr("LS"), QObject::tr("RS")};
@@ -585,7 +585,7 @@ void Setup::populateThrottleSourceCB()
lock = false;
}
void Setup::update()
void SetupPanel::update()
{
ui->name->setText(model.name);
@@ -615,20 +615,20 @@ void Setup::update()
modules[i]->update();
}
void Setup::updateBeepCenter()
void SetupPanel::updateBeepCenter()
{
for (int i=0; i<centerBeepCheckboxes.size(); i++) {
centerBeepCheckboxes[i]->setChecked(model.beepANACenter & (0x01 << i));
}
}
void Setup::updateStartupSwitches()
void SetupPanel::updateStartupSwitches()
{
lock = true;
unsigned int switchStates = model.switchWarningStates;
for (int i=0; i<GetEepromInterface()->getCapability(Switches)-1; i++) {
for (int i=0; i<firmware->getCapability(Switches)-1; i++) {
QSlider * slider = startupSwitchesSliders[i];
QCheckBox * cb = startupSwitchesCheckboxes[i];
bool enabled = !(model.nSwToWarn & (1 << i));
@@ -647,7 +647,7 @@ void Setup::updateStartupSwitches()
lock = false;
}
void Setup::startupSwitchEdited(int value)
void SetupPanel::startupSwitchEdited(int value)
{
if (!lock) {
int shift = 0;
@@ -686,7 +686,7 @@ void Setup::startupSwitchEdited(int value)
}
}
void Setup::startupSwitchToggled(bool checked)
void SetupPanel::startupSwitchToggled(bool checked)
{
if (!lock) {
int index = sender()->property("index").toInt()-1;
@@ -701,7 +701,7 @@ void Setup::startupSwitchToggled(bool checked)
}
}
void Setup::updatePotWarnings()
void SetupPanel::updatePotWarnings()
{
lock = true;
int mode = model.nPotsToWarn >> 6;
@@ -719,7 +719,7 @@ void Setup::updatePotWarnings()
lock = false;
}
void Setup::potWarningToggled(bool checked)
void SetupPanel::potWarningToggled(bool checked)
{
if (!lock) {
int index = sender()->property("index").toInt()-1;
@@ -734,7 +734,7 @@ void Setup::potWarningToggled(bool checked)
}
}
void Setup::on_potWarningMode_currentIndexChanged(int index)
void SetupPanel::on_potWarningMode_currentIndexChanged(int index)
{
if (!lock) {
int mask = 0xC0;
@@ -746,19 +746,19 @@ void Setup::on_potWarningMode_currentIndexChanged(int index)
}
}
void Setup::on_displayText_toggled(bool checked)
void SetupPanel::on_displayText_toggled(bool checked)
{
model.displayText = checked;
emit modified();
}
void Setup::on_throttleTrim_toggled(bool checked)
void SetupPanel::on_throttleTrim_toggled(bool checked)
{
model.thrTrim = checked;
emit modified();
}
void Setup::onBeepCenterToggled(bool checked)
void SetupPanel::onBeepCenterToggled(bool checked)
{
if (!lock) {
int index = sender()->property("index").toInt();
@@ -771,7 +771,7 @@ void Setup::onBeepCenterToggled(bool checked)
}
}
void Setup::onChildModified()
void SetupPanel::onChildModified()
{
emit modified();
}
+5 -5
View File
@@ -20,7 +20,7 @@ class TimerPanel : public ModelPanel
Q_OBJECT
public:
TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings);
TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings, FirmwareInterface * firmware);
virtual ~TimerPanel();
virtual void update();
@@ -42,7 +42,7 @@ class ModulePanel : public ModelPanel
Q_OBJECT
public:
ModulePanel(QWidget *parent, ModelData & model, ModuleData & module, GeneralSettings & generalSettings, int moduleIdx);
ModulePanel(QWidget *parent, ModelData & model, ModuleData & module, GeneralSettings & generalSettings, FirmwareInterface * firmware, int moduleIdx);
virtual ~ModulePanel();
virtual void update();
@@ -66,13 +66,13 @@ class ModulePanel : public ModelPanel
QVector<QDoubleSpinBox *> failsafeSpins;
};
class Setup : public ModelPanel
class SetupPanel : public ModelPanel
{
Q_OBJECT
public:
Setup(QWidget *parent, ModelData & model, GeneralSettings & generalSettings);
virtual ~Setup();
SetupPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
virtual ~SetupPanel();
virtual void update();
+28 -28
View File
@@ -5,8 +5,8 @@
#include "helpers.h"
#include "appdata.h"
TelemetryAnalog::TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog):
QWidget(parent),
TelemetryAnalog::TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
ModelPanel(parent, model, generalSettings, firmware),
ui(new Ui::TelemetryAnalog),
analog(analog),
lock(false)
@@ -17,11 +17,11 @@ TelemetryAnalog::TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog):
if (analog.type==0 || analog.type==1 || analog.type==2) {
ui->RatioSB->setDecimals(1);
ui->RatioSB->setMaximum(25.5*GetEepromInterface()->getCapability(TelemetryMaxMultiplier));
ui->RatioSB->setMaximum(25.5*firmware->getCapability(TelemetryMaxMultiplier));
}
else {
ui->RatioSB->setDecimals(0);
ui->RatioSB->setMaximum(255*GetEepromInterface()->getCapability(TelemetryMaxMultiplier));
ui->RatioSB->setMaximum(255*firmware->getCapability(TelemetryMaxMultiplier));
}
ui->RatioSB->setValue(ratio);
@@ -43,7 +43,7 @@ TelemetryAnalog::TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog):
ui->alarm2Label->setText(tr("Critical Alarm"));
}
if (!(GetEepromInterface()->getCapability(Telemetry) & TM_HASOFFSET)) {
if (!(firmware->getCapability(Telemetry) & TM_HASOFFSET)) {
ui->CalibSB->hide();
ui->CalibLabel->hide();
}
@@ -87,11 +87,11 @@ void TelemetryAnalog::on_UnitCB_currentIndexChanged(int index)
case 1:
case 2:
ui->RatioSB->setDecimals(1);
ui->RatioSB->setMaximum(25.5*GetEepromInterface()->getCapability(TelemetryMaxMultiplier));
ui->RatioSB->setMaximum(25.5*firmware->getCapability(TelemetryMaxMultiplier));
break;
default:
ui->RatioSB->setDecimals(0);
ui->RatioSB->setMaximum(255*GetEepromInterface()->getCapability(TelemetryMaxMultiplier));
ui->RatioSB->setMaximum(255*firmware->getCapability(TelemetryMaxMultiplier));
break;
}
ui->RatioSB->setValue(ratio);
@@ -280,15 +280,15 @@ TelemetryAnalog::~TelemetryAnalog()
/******************************************************/
TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen, GeneralSettings & generalSettings):
ModelPanel(parent, model, generalSettings),
TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen, GeneralSettings & generalSettings, FirmwareInterface * firmware):
ModelPanel(parent, model, generalSettings, firmware),
ui(new Ui::TelemetryCustomScreen),
screen(screen)
{
ui->setupUi(this);
for (int l=0; l<4; l++) {
for (int c=0; c<GetEepromInterface()->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
for (int c=0; c<firmware->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
fieldsCB[l][c] = new QComboBox(this);
fieldsCB[l][c]->setProperty("index", c + (l<<8));
populateTelemetrySourceCB(fieldsCB[l][c], screen.body.lines[l].source[c], l==3, model.frsky.usrProto);
@@ -366,7 +366,7 @@ void TelemetryCustomScreen::update()
if (screen.type == 0) {
for (int l=0; l<4; l++) {
for (int c=0; c<GetEepromInterface()->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
for (int c=0; c<firmware->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
fieldsCB[l][c]->setCurrentIndex(screen.body.lines[l].source[c]);
}
}
@@ -465,26 +465,26 @@ void TelemetryCustomScreen::barMaxChanged(double value)
/******************************************************/
TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings):
ModelPanel(parent, model, generalSettings),
TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
ModelPanel(parent, model, generalSettings, firmware),
ui(new Ui::Telemetry)
{
ui->setupUi(this);
if (GetEepromInterface()->getCapability(NoTelemetryProtocol)) {
if (firmware->getCapability(NoTelemetryProtocol)) {
model.frsky.usrProto = 1;
}
analogs[0] = new TelemetryAnalog(this, model.frsky.channels[0]);
analogs[0] = new TelemetryAnalog(this, model.frsky.channels[0], model, generalSettings, firmware);
ui->A1Layout->addWidget(analogs[0]);
connect(analogs[0], SIGNAL(modified()), this, SLOT(onAnalogModified()));
analogs[1] = new TelemetryAnalog(this, model.frsky.channels[1]);
analogs[1] = new TelemetryAnalog(this, model.frsky.channels[1], model, generalSettings, firmware);
ui->A2Layout->addWidget(analogs[1]);
connect(analogs[1], SIGNAL(modified()), this, SLOT(onAnalogModified()));
for (int i=0; i<GetEepromInterface()->getCapability(TelemetryCustomScreens); i++) {
TelemetryCustomScreen * tab = new TelemetryCustomScreen(this, model, model.frsky.screens[i], generalSettings);
for (int i=0; i<firmware->getCapability(TelemetryCustomScreens); i++) {
TelemetryCustomScreen * tab = new TelemetryCustomScreen(this, model, model.frsky.screens[i], generalSettings, firmware);
ui->customScreens->addTab(tab, tr("Telemetry screen %1").arg(i+1));
}
@@ -508,7 +508,7 @@ void TelemetryPanel::setup()
lock=true;
//frsky Settings
if (!GetEepromInterface()->getCapability(TelemetryRSSIModel) ) {
if (!firmware->getCapability(TelemetryRSSIModel) ) {
ui->RSSIGB->hide();
}
ui->rssiAlarm1SB->setValue(model.frsky.rssiAlarms[0].value);
@@ -524,7 +524,7 @@ void TelemetryPanel::setup()
ui->rssiAlarm2Label->setText(tr("Critical Alarm"));
}
if (!GetEepromInterface()->getCapability(HasAltitudeSel)) {
if (!firmware->getCapability(HasAltitudeSel)) {
ui->AltitudeGPS_ChkB->hide();
}
else {
@@ -538,7 +538,7 @@ void TelemetryPanel::setup()
ui->AltitudeToolbar_ChkB->hide();
}
int varioCap = GetEepromInterface()->getCapability(HasVario);
int varioCap = firmware->getCapability(HasVario);
if (!varioCap) {
ui->varioLimitMax_DSB->hide();
ui->varioLimitMinOff_ChkB->hide();
@@ -554,7 +554,7 @@ void TelemetryPanel::setup()
ui->varioSource_label->hide();
}
else {
if (!GetEepromInterface()->getCapability(HasVarioSink)) {
if (!firmware->getCapability(HasVarioSink)) {
ui->varioLimitMinOff_ChkB->hide();
ui->varioLimitMin_DSB->hide();
ui->varioLimitCenterMin_DSB->hide();
@@ -584,18 +584,18 @@ void TelemetryPanel::setup()
}
}
if (!(GetEepromInterface()->getCapability(HasAltitudeSel)||GetEepromInterface()->getCapability(HasVario))) {
if (!(firmware->getCapability(HasAltitudeSel)||firmware->getCapability(HasVario))) {
ui->altimetryGB->hide();
}
if (GetEepromInterface()->getCapability(NoTelemetryProtocol)) {
if (firmware->getCapability(NoTelemetryProtocol)) {
ui->frskyProtoCB->setDisabled(true);
}
else {
ui->frskyProtoCB->setEnabled(true);
}
if (!GetEepromInterface()->getCapability(TelemetryUnits)) {
if (!firmware->getCapability(TelemetryUnits)) {
ui->frskyUnitsCB->setDisabled(true);
int index=0;
if (firmware_id.contains("imperial")) {
@@ -604,7 +604,7 @@ void TelemetryPanel::setup()
ui->frskyUnitsCB->setCurrentIndex(index);
}
if ((GetEepromInterface()->getCapability(Telemetry)&TM_HASWSHH)) {
if ((firmware->getCapability(Telemetry)&TM_HASWSHH)) {
ui->frskyProtoCB->addItem(tr("Winged Shadow How High"));
}
else {
@@ -612,7 +612,7 @@ void TelemetryPanel::setup()
}
ui->variousGB->hide();
if (!(GetEepromInterface()->getCapability(HasFasOffset)) && !(firmware_id.contains("fasoffset"))) {
if (!(firmware->getCapability(HasFasOffset)) && !(firmware_id.contains("fasoffset"))) {
ui->fasOffset_label->hide();
ui->fasOffset_DSB->hide();
}
@@ -621,7 +621,7 @@ void TelemetryPanel::setup()
ui->variousGB->show();
}
if (!(GetEepromInterface()->getCapability(HasMahPersistent))) {
if (!(firmware->getCapability(HasMahPersistent))) {
ui->mahCount_label->hide();
ui->mahCount_SB->hide();
ui->mahCount_ChkB->hide();
+5 -5
View File
@@ -12,14 +12,14 @@ namespace Ui {
class Telemetry;
}
class TelemetryAnalog : public QWidget
class TelemetryAnalog: public ModelPanel
{
Q_OBJECT
friend class TelemetryPanel;
public:
TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog);
TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
virtual ~TelemetryAnalog();
signals:
@@ -45,12 +45,12 @@ class TelemetryAnalog : public QWidget
void update();
};
class TelemetryCustomScreen : public ModelPanel
class TelemetryCustomScreen: public ModelPanel
{
Q_OBJECT
public:
TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen, GeneralSettings & generalSettings);
TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen, GeneralSettings & generalSettings, FirmwareInterface * firmware);
~TelemetryCustomScreen();
void update();
@@ -79,7 +79,7 @@ class TelemetryPanel : public ModelPanel
Q_OBJECT
public:
TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings);
TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
virtual ~TelemetryPanel();
signals:
+8 -8
View File
@@ -10,7 +10,7 @@ void ModelEdit::setCurve(uint8_t c, int8_t ar[])
{
int len=sizeof(ar)/sizeof(int8_t);
if (GetEepromInterface()->getCapability(NumCurves)>c) {
if (firmware->getCapability(NumCurves)>c) {
if (len<9) {
model.curves[c].count=5;
model.curves[c].custom=false;
@@ -100,7 +100,7 @@ void Templates::applyNumericTemplate(uint64_t tpl)
for (int i=0; i<10 ; i++) {
rx[i]=false;
}
int thrsw=GetEepromInterface()->getCapability(GetThrSwitch);
int thrsw=firmware->getCapability(GetThrSwitch);
MixData *md = &model.mixData[0];
uint8_t spo2ch=(tpl & 0x0F);
tpl>>=4;
@@ -554,7 +554,7 @@ void Templates::applyTemplate(uint8_t idx)
int8_t heli_ar4[] = {-30, -15, 0, 50, 100};
int8_t heli_ar5[] = {-100, -50, 0, 50, 100};
int thrsw=GetEepromInterface()->getCapability(GetThrSwitch);
int thrsw=firmware->getCapability(GetThrSwitch);
MixData *md = &model.mixData[0];
//CC(STK) -> vSTK
@@ -715,7 +715,7 @@ void Templates::applyTemplate(uint8_t idx)
bool found=true;
while (found) {
found=false;
for (int i=0; i< GetEepromInterface()->getCapability(Mixes); i++) {
for (int i=0; i< firmware->getCapability(Mixes); i++) {
if (model.mixData[i].destCh==6) {
gm_deleteMix(i);
found=true;
@@ -827,7 +827,7 @@ void Templates::applyTemplate(uint8_t idx)
bool found=true;
while (found) {
found=false;
for (int i=0; i< GetEepromInterface()->getCapability(Mixes); i++) {
for (int i=0; i< firmware->getCapability(Mixes); i++) {
if (model.mixData[i].destCh==5) {
gm_deleteMix(i);
found=true;
@@ -867,11 +867,11 @@ void Templates::applyTemplate(uint8_t idx)
MixData* Templates::setDest(uint8_t dch)
{
uint8_t i = 0;
while ((g_model.mixData[i].destCh<=dch) && (g_model.mixData[i].destCh) && (i<GetEepromInterface()->getCapability(Mixes))) i++;
if(i==GetEepromInterface()->getCapability(Mixes)) return &g_model.mixData[0];
while ((g_model.mixData[i].destCh<=dch) && (g_model.mixData[i].destCh) && (i<firmware->getCapability(Mixes))) i++;
if(i==firmware->getCapability(Mixes)) return &g_model.mixData[0];
memmove(&g_model.mixData[i+1],&g_model.mixData[i],
(GetEepromInterface()->getCapability(Mixes)-(i+1))*sizeof(MixData) );
(firmware->getCapability(Mixes)-(i+1))*sizeof(MixData) );
memset(&g_model.mixData[i],0,sizeof(MixData));
g_model.mixData[i].destCh = dch;
return &g_model.mixData[i];
+80 -79
View File
@@ -14,16 +14,16 @@
#define ISIZE 200 // curve image size
#define ISIZEW 400 // curve image size
printDialog::printDialog(QWidget *parent, GeneralSettings *gg, ModelData *gm, QString filename) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
ui(new Ui::printDialog)
PrintDialog::PrintDialog(QWidget *parent, FirmwareInterface * firmware, GeneralSettings *gg, ModelData *gm, QString filename) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
firmware(firmware),
g_eeGeneral(gg),
g_model(gm),
printfilename(filename),
ui(new Ui::PrintDialog)
{
ui->setupUi(this);
this->setWindowIcon(CompanionIcon("print.png"));
g_model = gm;
g_eeGeneral = gg;
printfilename=filename;
eepromInterface = GetEepromInterface();
te = ui->textEdit;
setWindowTitle(tr("Setup for: ") + g_model->name);
@@ -32,13 +32,14 @@ printDialog::printDialog(QWidget *parent, GeneralSettings *gg, ModelData *gm, QS
if (modelname.isEmpty()) {
curvefile5=QString("%1/curve5.png").arg(qd->tempPath());
curvefile9=QString("%1/curve9.png").arg(qd->tempPath());
} else {
}
else {
curvefile5=QString("%1/%2-curve5.png").arg(qd->tempPath()).arg(modelname);
curvefile9=QString("%1/%2-curve9.png").arg(qd->tempPath()).arg(modelname);
}
printSetup();
int gvars=0;
if (GetEepromInterface()->getCapability(HasVariants)) {
if (firmware->getCapability(HasVariants)) {
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
gvars=1;
}
@@ -66,7 +67,7 @@ printDialog::printDialog(QWidget *parent, GeneralSettings *gg, ModelData *gm, QS
}
}
void printDialog::closeEvent(QCloseEvent *event)
void PrintDialog::closeEvent(QCloseEvent *event)
{
if (printfilename.isEmpty()) {
QByteArray ba = curvefile5.toLatin1();
@@ -78,7 +79,7 @@ void printDialog::closeEvent(QCloseEvent *event)
}
}
printDialog::~printDialog()
PrintDialog::~PrintDialog()
{
delete ui;
}
@@ -107,15 +108,15 @@ QString doTL(const QString s, const QString color="", bool bold=false)
return "<td align=left>" + str + "</td>";
}
QString printDialog::fv(const QString name, const QString value)
QString PrintDialog::fv(const QString name, const QString value)
{
return "<b>" + name + ": </b><font color=green>" + value + "</font><br>";
}
void printDialog::printSetup()
void PrintDialog::printSetup()
{
int gvars=0;
if (GetEepromInterface()->getCapability(HasVariants)) {
if (firmware->getCapability(HasVariants)) {
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
gvars=1;
}
@@ -123,15 +124,15 @@ void printDialog::printSetup()
gvars=1;
}
QString str = "<a name=1></a><table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
str.append(QString("<tr><td colspan=%1 ><table border=0 width=\"100%\"><tr><td><h1>").arg((GetEepromInterface()->getCapability(FlightPhases) && gvars==0) ? 2 : 1));
str.append(QString("<tr><td colspan=%1 ><table border=0 width=\"100%\"><tr><td><h1>").arg((firmware->getCapability(FlightPhases) && gvars==0) ? 2 : 1));
str.append(g_model->name);
str.append("&nbsp;(");
str.append(eepromInterface->getName());
str.append(firmware->getEepromInterface()->getName());
str.append(")</h1></td><td align=right valign=top NOWRAP><font size=-1>"+tr("printed on: %1").arg(QDateTime::currentDateTime().toString(Qt::SystemLocaleShortDate))+"</font></td></tr></table></td></tr><tr><td><table border=0 cellspacing=0 cellpadding=3>");
str.append("<tr><td><h2>"+tr("General Model Settings")+"</h2></td></tr>");
str.append("<tr><td>");
str.append(fv(tr("Name"), g_model->name));
str.append("<b>"+tr("EEprom Size")+QString(": </b><font color=green>%1</font><br>").arg(eepromInterface->getSize(*g_model)));
str.append("<b>"+tr("EEprom Size")+QString(": </b><font color=green>%1</font><br>").arg(firmware->getEepromInterface()->getSize(*g_model)));
str.append(fv(tr("Timer1"), getTimerStr(g_model->timers[0]))); //value, mode, count up/down
str.append(fv(tr("Timer2"), getTimerStr(g_model->timers[1]))); //value, mode, count up/down
str.append(fv(tr("Protocol"), getProtocol(g_model))); //proto, numch, delay,
@@ -151,19 +152,19 @@ void printDialog::printSetup()
te->append(str);
}
QString printDialog::printPhases()
QString PrintDialog::printPhases()
{
int gvars=0;
int gvarnum=0;
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT ) || (!GetEepromInterface()->getCapability(HasVariants) && GetEepromInterface()->getCapability(Gvars))) {
if (GetEepromInterface()->getCapability(GvarsFlightPhases)) {
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT ) || (!firmware->getCapability(HasVariants) && firmware->getCapability(Gvars))) {
if (firmware->getCapability(GvarsFlightPhases)) {
gvars=1;
gvarnum=GetEepromInterface()->getCapability(Gvars);
gvarnum=firmware->getCapability(Gvars);
}
}
QString str="";
str.append(QString("<table border=1 cellspacing=0 cellpadding=3 width=\"100%\"><tr><td colspan=%1><h2>").arg(gvars==0 ? 8+GetEepromInterface()->getCapability(RotaryEncoders) : 8+gvarnum+GetEepromInterface()->getCapability(RotaryEncoders)));
str.append(QString("<table border=1 cellspacing=0 cellpadding=3 width=\"100%\"><tr><td colspan=%1><h2>").arg(gvars==0 ? 8+firmware->getCapability(RotaryEncoders) : 8+gvarnum+firmware->getCapability(RotaryEncoders)));
str.append(tr("Flight modes Settings"));
str.append("</h2></td></tr><tr><td style=\"border-style:none;\">&nbsp;</td><td colspan=2 align=center><b>");
str.append(tr("Fades")+"</b></td>");
@@ -171,8 +172,8 @@ QString printDialog::printPhases()
if (gvars) {
str.append(QString("<td colspan=%1 align=center><b>").arg(gvarnum)+tr("Gvars")+"</b></td>");
}
if (GetEepromInterface()->getCapability(RotaryEncoders)) {
str.append(QString("<td colspan=%1 align=center><b>").arg(GetEepromInterface()->getCapability(RotaryEncoders))+tr("Rot.Enc.")+"</b></td>");
if (firmware->getCapability(RotaryEncoders)) {
str.append(QString("<td colspan=%1 align=center><b>").arg(firmware->getCapability(RotaryEncoders))+tr("Rot.Enc.")+"</b></td>");
}
str.append("<td rowspan=2 align=\"center\" valign=\"bottom\"><b>"+tr("Switch")+"</b></td></tr><tr><td align=center width=\"90\"><b>"+tr("Flight mode name"));
str.append("</b></td><td align=center width=\"30\"><b>"+tr("IN")+"</b></td><td align=center width=\"30\"><b>"+tr("OUT")+"</b></td>");
@@ -184,11 +185,11 @@ QString printDialog::printPhases()
str.append(QString("<td width=\"40\" align=\"center\"><b>GV%1</b><br>%2</td>").arg(i+1).arg(g_model->gvars_names[i]));
}
}
for (int i=0; i<GetEepromInterface()->getCapability(RotaryEncoders); i++) {
for (int i=0; i<firmware->getCapability(RotaryEncoders); i++) {
str.append(QString("<td align=\"center\"><b>RE%1</b></td>").arg((i==0 ? 'A': 'B')));
}
str.append("</tr>");
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) {
for (int i=0; i<firmware->getCapability(FlightPhases); i++) {
PhaseData *pd=&g_model->phaseData[i];
str.append("<tr><td><b>"+tr("FM")+QString("%1</b> <font size=+1 face='Courier New' color=green>%2</font></td><td width=\"30\" align=\"right\"><font size=+1 face='Courier New' color=green>%3</font></td><td width=\"30\" align=\"right\"><font size=+1 face='Courier New' color=green>%4</font></td>").arg(i).arg(pd->name).arg(pd->fadeIn).arg(pd->fadeOut));
for (int k=0; k<4; k++) {
@@ -210,7 +211,7 @@ QString printDialog::printPhases()
}
}
}
for (int k=0; k<GetEepromInterface()->getCapability(RotaryEncoders); k++) {
for (int k=0; k<firmware->getCapability(RotaryEncoders); k++) {
if (pd->rotaryEncoders[k]<=1024) {
str.append(QString("<td align=\"right\"><font size=+1 face='Courier New' color=green>%1").arg(pd->rotaryEncoders[k])+"</font></td>");
}
@@ -227,7 +228,7 @@ QString printDialog::printPhases()
return(str);
}
void printDialog::printExpo()
void PrintDialog::printExpo()
{
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\"><tr><td><h2>";
str.append(tr("Expo/Dr Settings"));
@@ -264,12 +265,12 @@ void printDialog::printExpo()
str += tr("Weight") + QString("%1").arg(getGVarString(ed->weight,true)).rightJustified(6, ' ');
str += ed->curve.toString().replace("<", "&lt;").replace(">", "&gt;");
if (GetEepromInterface()->getCapability(FlightPhases)) {
if (firmware->getCapability(FlightPhases)) {
if(ed->phases) {
if (ed->phases!=(unsigned int)(1<<GetEepromInterface()->getCapability(FlightPhases))-1) {
if (ed->phases!=(unsigned int)(1<<firmware->getCapability(FlightPhases))-1) {
int mask=1;
int first=0;
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases);i++) {
for (int i=0; i<firmware->getCapability(FlightPhases);i++) {
if (!(ed->phases & mask)) {
first++;
}
@@ -282,7 +283,7 @@ void printDialog::printExpo()
}
mask=1;
first=1;
for (int j=0; j<GetEepromInterface()->getCapability(FlightPhases);j++) {
for (int j=0; j<firmware->getCapability(FlightPhases);j++) {
if (!(ed->phases & mask)) {
PhaseData *pd = &g_model->phaseData[j];
if (!first) {
@@ -303,7 +304,7 @@ void printDialog::printExpo()
if (ed->swtch.type)
str += " " + tr("Switch") + QString("(%1)").arg(ed->swtch.toString());
str += ed->curve.toString().replace("<", "&lt;").replace(">", "&gt;");
if (GetEepromInterface()->getCapability(HasExpoNames)) {
if (firmware->getCapability(HasExpoNames)) {
QString ExpoName;
ExpoName.append(ed->name);
if (!ExpoName.isEmpty()) {
@@ -318,21 +319,21 @@ void printDialog::printExpo()
}
void printDialog::printMixes()
void PrintDialog::printMixes()
{
QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-after:always;\" width=\"100%\"><tr><td><h2>";
str.append(tr("Mixers"));
str.append("</h2></td></tr><tr><td><table border=0 cellspacing=0 cellpadding=3>");
unsigned int lastCHN = 255;
for(int i=0; i<GetEepromInterface()->getCapability(Mixes); i++) {
for(int i=0; i<firmware->getCapability(Mixes); i++) {
MixData *md = &g_model->mixData[i];
if(!md->destCh || md->destCh>(unsigned int)GetEepromInterface()->getCapability(Outputs) ) break;
if(!md->destCh || md->destCh>(unsigned int)firmware->getCapability(Outputs) ) break;
str.append("<tr><td><font size=+1 face='Courier New'><b>");
if(lastCHN!=md->destCh) {
lastCHN=md->destCh;
QString chname=tr("CH")+QString("%1 ").arg(lastCHN,2,10,QChar('0'));
if (GetEepromInterface()->getCapability(HasChNames)) {
if (firmware->getCapability(HasChNames)) {
QString name=g_model->limitData[md->destCh-1].name;
if (!name.isEmpty()) {
name.append(" ");
@@ -356,16 +357,16 @@ void printDialog::printMixes()
if (md->carryTrim) str += " " + tr("noTrim");
if (md->sOffset) str += " "+ tr("Offset") + QString(" %1").arg(getGVarString(md->sOffset));
str += md->curve.toString().replace("<", "&lt;").replace(">", "&gt;");
float scale=GetEepromInterface()->getCapability(SlowScale);
float scale=firmware->getCapability(SlowScale);
if (md->delayDown || md->delayUp) str += tr(" Delay(u%1:d%2)").arg(md->delayUp/scale).arg(md->delayDown/scale);
if (md->speedDown || md->speedUp) str += tr(" Slow(u%1:d%2)").arg(md->speedUp/scale).arg(md->speedDown/scale);
if (md->mixWarn) str += " "+tr("Warn")+QString("(%1)").arg(md->mixWarn);
if (GetEepromInterface()->getCapability(FlightPhases)) {
if (firmware->getCapability(FlightPhases)) {
if(md->phases) {
if (md->phases!=(unsigned int)(1<<GetEepromInterface()->getCapability(FlightPhases))-1) {
if (md->phases!=(unsigned int)(1<<firmware->getCapability(FlightPhases))-1) {
int mask=1;
int first=0;
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) {
for (int i=0; i<firmware->getCapability(FlightPhases); i++) {
if (!(md->phases & mask)) {
first++;
}
@@ -378,7 +379,7 @@ void printDialog::printMixes()
}
mask=1;
first=1;
for (int j=0; j<GetEepromInterface()->getCapability(FlightPhases);j++) {
for (int j=0; j<firmware->getCapability(FlightPhases);j++) {
if (!(md->phases & mask)) {
PhaseData *pd = &g_model->phaseData[j];
if (!first) {
@@ -396,7 +397,7 @@ void printDialog::printMixes()
}
}
}
if (GetEepromInterface()->getCapability(HasMixerNames)) {
if (firmware->getCapability(HasMixerNames)) {
QString MixerName;
MixerName.append(md->name);
if (!MixerName.isEmpty()) {
@@ -409,41 +410,41 @@ void printDialog::printMixes()
te->append(str);
}
void printDialog::printLimits()
void PrintDialog::printLimits()
{
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
int numcol;
numcol=(GetEepromInterface()->getCapability(Outputs)+1)>17 ? 17:GetEepromInterface()->getCapability(Outputs)+1;
numcol=(firmware->getCapability(Outputs)+1)>17 ? 17:firmware->getCapability(Outputs)+1;
str.append(QString("<tr><td colspan=%1><h2>").arg(numcol)+tr("Limits")+"</h2></td></tr>");
str.append("<tr><td>&nbsp;</td>");
if (GetEepromInterface()->getCapability(Outputs)<17) {
for(int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) {
if (firmware->getCapability(Outputs)<17) {
for(int i=0; i<firmware->getCapability(Outputs); i++) {
str.append(doTC(tr("CH")+QString(" %1").arg(i+1,2,10,QChar('0')),"",true));
}
str.append("</tr>");
if (GetEepromInterface()->getCapability(HasChNames)) {
if (firmware->getCapability(HasChNames)) {
str.append("<tr><td><b>"+tr("Name")+"</b></td>");
for(int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) {
for(int i=0; i<firmware->getCapability(Outputs); i++) {
str.append(doTR(g_model->limitData[i].name,"green"));
}
}
str.append("<tr><td><b>"+tr("Offset")+"</b></td>");
for(int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) {
for(int i=0; i<firmware->getCapability(Outputs); i++) {
str.append(doTR(QString::number((qreal)g_model->limitData[i].offset/10, 'f', 1),"green"));
}
str.append("</tr>");
str.append("<tr><td><b>"+tr("Min")+"</b></td>");
for(int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) {
for(int i=0; i<firmware->getCapability(Outputs); i++) {
str.append(doTR(QString::number(g_model->limitData[i].min),"green"));
}
str.append("</tr>");
str.append("<tr><td><b>"+tr("Max")+"</b></td>");
for(int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) {
for(int i=0; i<firmware->getCapability(Outputs); i++) {
str.append(doTR(QString::number(g_model->limitData[i].max),"green"));
}
str.append("</tr>");
str.append("<tr><td><b>"+tr("Invert")+"</b></td>");
for(int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) {
for(int i=0; i<firmware->getCapability(Outputs); i++) {
str.append(doTR(QString(g_model->limitData[i].revert ? tr("INV") : tr("NOR")),"green"));
}
} else {
@@ -451,7 +452,7 @@ void printDialog::printLimits()
str.append(doTC(tr("CH")+QString(" %1").arg(i+1,2,10,QChar('0')),"",true));
}
str.append("</tr>");
if (GetEepromInterface()->getCapability(HasChNames)) {
if (firmware->getCapability(HasChNames)) {
str.append("<tr><td><b>"+tr("Name")+"</b></td>");
for(int i=0; i<16; i++) {
str.append(doTR(g_model->limitData[i].name,"green"));
@@ -479,33 +480,33 @@ void printDialog::printLimits()
str.append("</tr>");
str.append(QString("<tr><td colspan=%1>&nbsp;").arg(numcol)+"</td></tr>");
str.append("<tr><td>&nbsp;</td>");
for(int i=16; i<GetEepromInterface()->getCapability(Outputs); i++) {
for(int i=16; i<firmware->getCapability(Outputs); i++) {
str.append(doTC(tr("CH")+QString(" %1").arg(i+1,2,10,QChar('0')),"",true));
}
str.append("</tr>");
if (GetEepromInterface()->getCapability(HasChNames)) {
if (firmware->getCapability(HasChNames)) {
str.append("<tr><td><b>"+tr("Name")+"</b></td>");
for(int i=16; i<GetEepromInterface()->getCapability(Outputs); i++) {
for(int i=16; i<firmware->getCapability(Outputs); i++) {
str.append(doTR(g_model->limitData[i].name,"green"));
}
}
str.append("<tr><td><b>"+tr("Offset")+"</b></td>");
for(int i=16; i<GetEepromInterface()->getCapability(Outputs); i++) {
for(int i=16; i<firmware->getCapability(Outputs); i++) {
str.append(doTR(QString::number((qreal)g_model->limitData[i].offset/10, 'f', 1),"green"));
}
str.append("</tr>");
str.append("<tr><td><b>"+tr("Min")+"</b></td>");
for(int i=16; i<GetEepromInterface()->getCapability(Outputs); i++) {
for(int i=16; i<firmware->getCapability(Outputs); i++) {
str.append(doTR(QString::number(g_model->limitData[i].min),"green"));
}
str.append("</tr>");
str.append("<tr><td><b>"+tr("Max")+"</b></td>");
for(int i=16; i<GetEepromInterface()->getCapability(Outputs); i++) {
for(int i=16; i<firmware->getCapability(Outputs); i++) {
str.append(doTR(QString::number(g_model->limitData[i].max),"green"));
}
str.append("</tr>");
str.append("<tr><td><b>"+tr("Invert")+"</b></td>");
for(int i=16; i<GetEepromInterface()->getCapability(Outputs); i++) {
for(int i=16; i<firmware->getCapability(Outputs); i++) {
str.append(doTR(QString(g_model->limitData[i].revert ? tr("INV") : tr("NOR")),"green"));
}
}
@@ -515,7 +516,7 @@ void printDialog::printLimits()
te->append(str);
}
void printDialog::printCurves()
void PrintDialog::printCurves()
{
int i,r,g,b,c,count;
char buffer[16];
@@ -524,7 +525,7 @@ void printDialog::printCurves()
QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-before:auto;\" width=\"100%\"><tr><td><h2>";
str.append(tr("Curves"));
str.append("</h2></td></tr><tr><td>");
int numcurves=GetEepromInterface()->getCapability(NumCurves);
int numcurves=firmware->getCapability(NumCurves);
if (numcurves==0) {
numcurves=16;
}
@@ -622,14 +623,14 @@ void printDialog::printCurves()
te->append(str);
}
void printDialog::printSwitches()
void PrintDialog::printSwitches()
{
int sc=0;
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
str.append("<tr><td><h2>"+tr("Logical Switches")+"</h2></td></tr>");
str.append("<tr><td><table border=0 cellspacing=0 cellpadding=3>");
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) {
for (int i=0; i<firmware->getCapability(LogicalSwitches); i++) {
if (g_model->customSw[i].func) {
str.append("<tr>");
if (i<9) {
@@ -649,15 +650,15 @@ void printDialog::printSwitches()
te->append(str);
}
void printDialog::printGvars()
void PrintDialog::printGvars()
{
int gvars=0;
int gvarnum=0;
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT ) || (!GetEepromInterface()->getCapability(HasVariants) && GetEepromInterface()->getCapability(Gvars))) {
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT ) || (!firmware->getCapability(HasVariants) && firmware->getCapability(Gvars))) {
gvars=1;
gvarnum=GetEepromInterface()->getCapability(Gvars);
gvarnum=firmware->getCapability(Gvars);
}
if (!GetEepromInterface()->getCapability(GvarsFlightPhases) && (gvars==1 && GetEepromInterface()->getCapability(Gvars))) {
if (!firmware->getCapability(GvarsFlightPhases) && (gvars==1 && firmware->getCapability(Gvars))) {
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
str.append("<tr><td><h2>"+tr("Global Variables")+"</h2></td></tr>");
str.append("<tr><td><table border=1 cellspacing=0 cellpadding=3 width=100>");
@@ -679,7 +680,7 @@ void printDialog::printGvars()
}
}
void printDialog::printFSwitches()
void PrintDialog::printFSwitches()
{
int sc=0;
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
@@ -691,7 +692,7 @@ void printDialog::printFSwitches()
str.append(doTL(tr("Repeat"), "", true));
str.append(doTL(tr("Enabled"), "", true));
str.append("</tr>");
for(int i=0; i<GetEepromInterface()->getCapability(CustomFunctions); i++) {
for(int i=0; i<firmware->getCapability(CustomFunctions); i++) {
if (g_model->funcSw[i].swtch.type!=SWITCH_TYPE_NONE) {
str.append("<tr>");
str.append(doTC(g_model->funcSw[i].swtch.toString(),"green"));
@@ -718,7 +719,7 @@ void printDialog::printFSwitches()
te->append(str);
}
void printDialog::printFrSky()
void PrintDialog::printFrSky()
{
int tc=0;
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
@@ -756,10 +757,10 @@ void printDialog::printFrSky()
str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("Blades")+"</b></td><td colspan=8 align=\"left\">"+fd->blades+"</td></tr>");
str.append("<tr><td colspan=10 align=\"Left\" height=\"4px\"></td></tr></table>");
#if 0
if (GetEepromInterface()->getCapability(TelemetryBars) || (GetEepromInterface()->getCapability(TelemetryCSFields))) {
int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields);
if (firmware->getCapability(TelemetryBars) || (firmware->getCapability(TelemetryCSFields))) {
int cols=firmware->getCapability(TelemetryColsCSFields);
if (cols==0) cols=2;
for (int j=0; j<GetEepromInterface()->getCapability(TelemetryCSFields)/(4*cols); j++ ) {
for (int j=0; j<firmware->getCapability(TelemetryCSFields)/(4*cols); j++ ) {
if (fd->screens[j].type==0) {
if (cols==2) {
str.append("<table border=1 cellspacing=0 cellpadding=3 width=\"100%\"><tr><td colspan=3 align=\"Left\"><b>"+tr("Custom Telemetry View")+"</b></td></tr>");
@@ -804,7 +805,7 @@ void printDialog::printFrSky()
te->append(str);
}
void printDialog::on_printButton_clicked()
void PrintDialog::on_printButton_clicked()
{
QPrinter printer;
printer.setPageMargins(10.0,10.0,10.0,10.0,printer.Millimeter);
@@ -815,7 +816,7 @@ void printDialog::on_printButton_clicked()
te->print(&printer);
}
void printDialog::on_printFileButton_clicked()
void PrintDialog::on_printFileButton_clicked()
{
QString fn = QFileDialog::getSaveFileName(this,tr("Select PDF output file"),QString(),tr("ODF files (*.odt);;PDF Files(*.pdf);;HTML-Files (*.htm *.html);;All Files (*)"));
if (fn.isEmpty())
@@ -835,7 +836,7 @@ void printDialog::on_printFileButton_clicked()
}
}
void printDialog::printToFile()
void PrintDialog::printToFile()
{
if (printfilename.isEmpty())
return;
@@ -854,7 +855,7 @@ void printDialog::printToFile()
}
}
void printDialog::autoClose()
void PrintDialog::autoClose()
{
this->close();
}
+9 -8
View File
@@ -7,26 +7,27 @@
#include "eeprominterface.h"
namespace Ui {
class printDialog;
class PrintDialog;
}
class printDialog : public QDialog
class PrintDialog : public QDialog
{
Q_OBJECT
public:
explicit printDialog(QWidget *parent = 0, GeneralSettings *gg = 0, ModelData *gm = 0, QString filename="");
explicit PrintDialog(QWidget *parent, FirmwareInterface * firmware, GeneralSettings *gg, ModelData *gm, QString filename="");
~printDialog();
~PrintDialog();
void closeEvent(QCloseEvent *event);
ModelData *g_model;
GeneralSettings *g_eeGeneral;
EEPROMInterface *eepromInterface;
FirmwareInterface * firmware;
GeneralSettings * g_eeGeneral;
ModelData * g_model;
QString printfilename;
private:
Ui::printDialog *ui;
Ui::PrintDialog *ui;
void printSetup();
QString printPhases();
+2 -2
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>printDialog</class>
<widget class="QDialog" name="printDialog">
<class>PrintDialog</class>
<widget class="QDialog" name="PrintDialog">
<property name="geometry">
<rect>
<x>0</x>
+5 -5
View File
@@ -335,7 +335,7 @@ void SimulatorDialog::initUi(T * ui)
windowName = tr("Simulating Radio (%1)").arg(txInterface->getName());
setWindowTitle(windowName);
simulator = txInterface->getSimulator();
simulator = GetCurrentFirmware()->getSimulator();
lcd->setData(simulator->getLcd(), lcdWidth, 64, lcdDepth);
if (flags & SIMULATOR_FLAGS_STICK_MODE_LEFT) {
@@ -349,7 +349,7 @@ void SimulatorDialog::initUi(T * ui)
setTrims();
int outputs = std::min(16, txInterface->getCapability(Outputs));
int outputs = std::min(16, GetCurrentFirmware()->getCapability(Outputs));
for (int i=0; i<outputs; i++) {
int column = i / (outputs/2);
int line = i % (outputs/2);
@@ -390,7 +390,7 @@ void SimulatorDialog::initUi(T * ui)
channelsLayout->addWidget(value, line, column == 0 ? 2 : 3, 1, 1);
}
int switches = txInterface->getCapability(LogicalSwitches);
int switches = GetCurrentFirmware()->getCapability(LogicalSwitches);
for (int i=0; i<switches; i++) {
QFrame * swtch = new QFrame(tabWidget);
swtch->setAutoFillBackground(true);
@@ -689,7 +689,7 @@ void SimulatorDialog::setValues()
Trims trims;
simulator->getTrims(trims);
for (int i=0; i<std::min(16, GetEepromInterface()->getCapability(Outputs)); i++) {
for (int i=0; i<std::min(16, GetCurrentFirmware()->getCapability(Outputs)); i++) {
channelSliders[i]->setValue(chVal(outputs.chans[i]));
channelValues[i]->setText(QString("%1").arg((qreal)outputs.chans[i]*100/1024, 0, 'f', 1));
}
@@ -703,7 +703,7 @@ void SimulatorDialog::setValues()
QString CSWITCH_ON = "QLabel { background-color: #4CC417 }";
QString CSWITCH_OFF = "QLabel { }";
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) {
for (int i=0; i<GetCurrentFirmware()->getCapability(LogicalSwitches); i++) {
logicalSwitchLabels[i]->setStyleSheet(outputs.vsw[i] ? CSWITCH_ON : CSWITCH_OFF);
}
+3 -1
View File
@@ -99,7 +99,9 @@ int main(int argc, char *argv[])
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
RegisterFirmwares();
RegisterEepromInterfaces();
registerOpenTxFirmwares();
SimulatorDialog *dialog;
const char * eepromFileName;
QString fileName;