1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-23 00:05:17 +03:00

Firmware options refactoring. It allows

FirmwareInterface::getCapability() to know which options are enabled in
the preferences. The Heli tab and the GVars are displayed according to
these options.
This commit is contained in:
bsongis 2014-06-18 10:43:35 +02:00
parent 571b498a82
commit e6391f04c4
22 changed files with 489 additions and 650 deletions

View file

@ -19,10 +19,6 @@ AppPreferencesDialog::AppPreferencesDialog(QWidget *parent) :
updateLock=false;
setWindowIcon(CompanionIcon("apppreferences.png"));
voice=NULL;
connect(ui->langCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(firmwareLangChanged()));
connect(ui->voiceCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(firmwareLangChanged()));
initSettings();
connect(ui->downloadVerCB, SIGNAL(currentIndexChanged(int)), this, SLOT(baseFirmwareChanged()));
connect(this, SIGNAL(accepted()), this, SLOT(writeValues()));
@ -80,10 +76,11 @@ void AppPreferencesDialog::writeValues()
// If a new fw type has been choosen, several things need to reset
current_firmware_variant = getFirmwareVariant();
if (g.profile[g.id()].fwType() != current_firmware_variant.id) {
QString id = current_firmware_variant->getId();
if (g.profile[g.id()].fwType() != id) {
g.profile[g.id()].fwName("");
g.profile[g.id()].initFwVariables();
g.profile[g.id()].fwType( current_firmware_variant.id );
g.profile[g.id()].fwType(id);
}
}
@ -103,8 +100,7 @@ void AppPreferencesDialog::initSettings()
ui->burnFirmware->setChecked(g.profile[g.id()].burnFirmware());
ui->snapshotPath->setText(g.snapshotDir());
ui->snapshotPath->setReadOnly(true);
if (ui->snapshotClipboardCKB->isChecked())
{
if (ui->snapshotClipboardCKB->isChecked()) {
ui->snapshotPath->setDisabled(true);
ui->snapshotPathButton->setDisabled(true);
}
@ -114,8 +110,9 @@ void AppPreferencesDialog::initSettings()
ui->historySize->setValue(g.historySize());
ui->backLightColor->setCurrentIndex(g.backLight());
if (IS_TARANIS(GetCurrentFirmware()->getBoard()))
if (IS_TARANIS(GetCurrentFirmware()->getBoard())) {
ui->backLightColor->setEnabled(false);
}
ui->simuSW->setChecked(g.simuSW());
ui->modelWizard_CB->setChecked(g.useWizard());
@ -189,13 +186,12 @@ void AppPreferencesDialog::initSettings()
foreach(FirmwareInterface * firmware, firmwares) {
ui->downloadVerCB->addItem(firmware->getName(), firmware->getId());
if (current_firmware == firmware) {
if (current_firmware->getFirmwareBase() == firmware) {
ui->downloadVerCB->setCurrentIndex(ui->downloadVerCB->count() - 1);
}
}
baseFirmwareChanged();
firmwareChanged();
}
void AppPreferencesDialog::on_libraryPathButton_clicked()
@ -333,7 +329,8 @@ void AppPreferencesDialog::on_SplashSelect_clicked()
}
}
void AppPreferencesDialog::on_clearImageButton_clicked() {
void AppPreferencesDialog::on_clearImageButton_clicked()
{
ui->imageLabel->clear();
ui->SplashFileName->clear();
}
@ -341,65 +338,45 @@ void AppPreferencesDialog::on_clearImageButton_clicked() {
void AppPreferencesDialog::showVoice(bool show)
{
if (show)
showVoice();
else
hideVoice();
}
void AppPreferencesDialog::showVoice()
{
ui->voiceLabel->show();
ui->voiceCombo->show();
}
void AppPreferencesDialog::hideVoice()
{
ui->voiceLabel->hide();
ui->voiceCombo->hide();
ui->voiceLabel->setVisible(show);
ui->voiceCombo->setVisible(show);
QTimer::singleShot(0, this, SLOT(shrink()));
}
void AppPreferencesDialog::baseFirmwareChanged()
{
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
voice=NULL;
foreach(FirmwareInterface * firmware, firmwares) {
if (firmware->getId() == selected_firmware) {
showVoice(firmware->voice);
populateFirmwareOptions(firmware);
break;
}
}
firmwareChanged();
}
FirmwareVariant AppPreferencesDialog::getFirmwareVariant()
FirmwareInterface * AppPreferencesDialog::getFirmwareVariant()
{
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
bool voice=false;
foreach(FirmwareInterface * firmware, firmwares) {
QString id = firmware->getId();
if (id == selected_firmware) {
foreach(QCheckBox *cb, optionsCheckBoxes) {
if (cb->isChecked()) {
if (cb->text()=="voice" && cb->isChecked())
voice=true;
id += QString("-") + cb->text();
}
}
if (voice) {
if (ui->voiceCombo->count() && (voice || firmware->voice))
if (voice && voice->isChecked()) {
id += QString("-tts") + ui->voiceCombo->currentText();
}
else {
hideVoice();
}
if (ui->langCombo->count())
id += QString("-") + ui->langCombo->currentText();
return GetFirmwareVariant(id);
if (ui->langCombo->count()) {
id += QString("-") + ui->langCombo->currentText();
}
return GetFirmware(id);
}
}
@ -410,6 +387,9 @@ FirmwareVariant AppPreferencesDialog::getFirmwareVariant()
void AppPreferencesDialog::firmwareOptionChanged(bool state)
{
QCheckBox *cb = qobject_cast<QCheckBox*>(sender());
if (cb == voice) {
showVoice(voice->isChecked());
}
FirmwareInterface * firmware=NULL;
if (cb && state) {
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
@ -421,74 +401,37 @@ void AppPreferencesDialog::firmwareOptionChanged(bool state)
foreach(Option other, opts) {
if (other.name != opt.name) {
foreach(QCheckBox *ocb, optionsCheckBoxes) {
if (ocb->text() == other.name)
if (ocb->text() == other.name) {
ocb->setChecked(false);
}
}
}
if (voice) {
showVoice(voice->isChecked());
}
return firmwareChanged();
}
}
}
}
}
}
else if (cb && !state) {
if (cb->text()=="voice") {
hideVoice();
}
}
if (voice) {
showVoice(voice->isChecked());
}
else if (firmware) {
if (firmware->voice) {
showVoice();
}
}
return firmwareChanged();
}
void AppPreferencesDialog::firmwareLangChanged()
{
firmwareChanged();
}
void AppPreferencesDialog::firmwareChanged()
{
if (updateLock)
return;
FirmwareVariant variant = getFirmwareVariant();
QString stamp;
stamp.append(variant.firmware->getStampUrl());
QString url = variant.getFirmwareUrl();
}
}
}
}
}
}
}
void AppPreferencesDialog::populateFirmwareOptions(const FirmwareInterface * firmware)
{
const FirmwareInterface * parent = /*firmware->parent ? firmware->parent : */ firmware;
const FirmwareInterface * parent = firmware->getFirmwareBase();
updateLock = true;
QString id = current_firmware_variant->getId();
ui->langCombo->clear();
foreach(const char *lang, parent->languages) {
ui->langCombo->addItem(lang);
if (current_firmware_variant.id.endsWith(lang))
if (id.endsWith(lang)) {
ui->langCombo->setCurrentIndex(ui->langCombo->count() - 1);
}
ui->voiceCombo->clear();
foreach(const char *lang, parent->ttslanguages) {
ui->voiceCombo->addItem(lang);
if (current_firmware_variant.id.contains(QString("-tts%1").arg(lang)))
ui->voiceCombo->setCurrentIndex(ui->voiceCombo->count() - 1);
}
showVoice(ui->langCombo->count()!=0);
voice = NULL; // we will search for a voice checkbox
int index = 0;
foreach(QList<Option> opts, parent->opts) {
@ -505,21 +448,30 @@ void AppPreferencesDialog::populateFirmwareOptions(const FirmwareInterface * fir
cb->show();
cb->setText(opt.name);
cb->setToolTip(opt.tooltip);
cb->setCheckState(current_firmware_variant.id.contains(opt.name) ? Qt::Checked : Qt::Unchecked);
cb->setCheckState(id.contains(opt.name) ? Qt::Checked : Qt::Unchecked);
if (opt.name == QString("voice")) {
voice = cb;
}
}
}
}
if (opt.name==QString("voice")) {
voice=cb;
showVoice(current_firmware_variant.id.contains(opt.name) ||firmware->voice);
}
}
}
}
for (; index<optionsCheckBoxes.size(); index++) {
QCheckBox *cb = optionsCheckBoxes.at(index);
cb->hide();
cb->setCheckState(Qt::Unchecked);
}
ui->voiceCombo->clear();
foreach(const char *lang, parent->ttslanguages) {
ui->voiceCombo->addItem(lang);
if (id.contains(QString("-tts%1").arg(lang))) {
ui->voiceCombo->setCurrentIndex(ui->voiceCombo->count() - 1);
}
}
showVoice(voice && voice->isChecked());
updateLock = false;
QTimer::singleShot(0, this, SLOT(shrink()));
}

View file

@ -28,7 +28,7 @@ class AppPreferencesDialog : public QDialog
void hideVoice();
void populateLocale();
void populateFirmwareOptions(const FirmwareInterface *);
FirmwareVariant getFirmwareVariant();
FirmwareInterface * getFirmwareVariant();
QCheckBox * voice;
Ui::AppPreferencesDialog *ui;
@ -39,10 +39,8 @@ class AppPreferencesDialog : public QDialog
protected slots:
void shrink();
void firmwareLangChanged();
void baseFirmwareChanged();
void firmwareOptionChanged(bool state);
void firmwareChanged();
void writeValues();
void on_libraryPathButton_clicked();

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>685</width>
<height>818</height>
<height>550</height>
</rect>
</property>
<property name="sizePolicy">
@ -51,22 +51,15 @@
<attribute name="title">
<string>Radio Profile</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<item row="22" column="5">
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,0,1,0,0,0,0,0">
<item row="21" column="7">
<widget class="QPushButton" name="sdPathButton">
<property name="text">
<string>Open Folder</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="downloadVerCB">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="26" column="0">
<item row="25" column="0">
<widget class="QLabel" name="label_13">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
@ -82,7 +75,7 @@
</property>
</widget>
</item>
<item row="10" column="0">
<item row="9" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Build Options</string>
@ -92,7 +85,7 @@
</property>
</widget>
</item>
<item row="8" column="0">
<item row="7" column="0">
<widget class="QLabel" name="langLabel">
<property name="text">
<string>Menu Language</string>
@ -102,7 +95,7 @@
</property>
</widget>
</item>
<item row="24" column="0">
<item row="23" column="0">
<widget class="QLabel" name="label_14">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
@ -115,14 +108,14 @@
</property>
</widget>
</item>
<item row="15" column="5">
<item row="14" column="7">
<widget class="QPushButton" name="SplashSelect">
<property name="text">
<string>Select Image</string>
</property>
</widget>
</item>
<item row="23" column="1">
<item row="22" column="1">
<widget class="QLabel" name="lblGeneralSettings">
<property name="enabled">
<bool>true</bool>
@ -132,37 +125,247 @@
</property>
</widget>
</item>
<item row="15" column="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="11" column="0" colspan="6">
<item row="10" column="0" colspan="8">
<widget class="Line" name="line_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="10" column="1" colspan="5">
<item row="9" column="1" colspan="7">
<layout class="QGridLayout" name="optionsLayout"/>
</item>
<item row="6" column="0">
<widget class="QLabel" name="CPU_ID_LABEL">
<item row="14" column="0">
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Processor ID</string>
<string>Splash Screen</string>
</property>
</widget>
</item>
<item row="24" column="1" colspan="3">
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Profile Name</string>
</property>
</widget>
</item>
<item row="17" column="7">
<widget class="QPushButton" name="clearImageButton">
<property name="text">
<string>Clear Image</string>
</property>
</widget>
</item>
<item row="17" column="1">
<widget class="QLabel" name="imageLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>128</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>212</width>
<height>64</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Sans Serif</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Radio Type</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="19" column="0" colspan="8">
<widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="0" colspan="8">
<widget class="Line" name="line_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="20" column="0">
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Other Settings</string>
</property>
</widget>
</item>
<item row="22" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>General Settings</string>
</property>
</widget>
</item>
<item row="21" column="0">
<widget class="QLabel" name="sdPathLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>SD Structure path</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="7" column="1" colspan="7">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,1,1">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QComboBox" name="langCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="voiceLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Sans Serif</family>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Voice Language</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="voiceCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Set voice language.
May be different from firmware language</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="1" colspan="7">
<widget class="QComboBox" name="downloadVerCB">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="14" column="1" colspan="6">
<widget class="QLineEdit" name="SplashFileName">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="21" column="1" colspan="6">
<widget class="QLineEdit" name="sdPath">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="23" column="1" colspan="6">
<widget class="QComboBox" name="stickmodeCB">
<property name="maximumSize">
<size>
@ -216,26 +419,7 @@ Mode 4:
</item>
</widget>
</item>
<item row="15" column="0">
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Splash Screen</string>
</property>
</widget>
</item>
<item row="26" column="1" colspan="3">
<item row="25" column="1" colspan="6">
<widget class="QComboBox" name="channelorderCB">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
@ -383,20 +567,31 @@ Mode 4:
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<item row="1" column="1" colspan="6">
<widget class="QLineEdit" name="profileNameLE"/>
</item>
<item row="1" column="7">
<widget class="QPushButton" name="removeProfileButton">
<property name="text">
<string>Profile Name</string>
<string>Remove Profile</string>
</property>
</widget>
</item>
<item row="29" column="1">
<item row="26" column="1" colspan="7">
<widget class="QCheckBox" name="renameFirmware">
<property name="text">
<string>Append version number to FW file name</string>
</property>
</widget>
</item>
<item row="27" column="1" colspan="7">
<widget class="QCheckBox" name="burnFirmware">
<property name="text">
<string>Offer to write FW to Tx after download</string>
</property>
</widget>
</item>
<item row="28" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -409,248 +604,6 @@ Mode 4:
</property>
</spacer>
</item>
<item row="28" column="5">
<widget class="QPushButton" name="removeProfileButton">
<property name="text">
<string>Remove Profile</string>
</property>
</widget>
</item>
<item row="15" column="1" colspan="2">
<widget class="QLineEdit" name="SplashFileName">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>350</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>350</width>
<height>16777215</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="18" column="5">
<widget class="QPushButton" name="clearImageButton">
<property name="text">
<string>Clear Image</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="profileNameLE">
<property name="minimumSize">
<size>
<width>350</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>350</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="18" column="1">
<widget class="QLabel" name="imageLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>128</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>212</width>
<height>64</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="27" column="1" colspan="4">
<widget class="QCheckBox" name="renameFirmware">
<property name="text">
<string>Append version number to FW file name</string>
</property>
</widget>
</item>
<item row="28" column="1" colspan="4">
<widget class="QCheckBox" name="burnFirmware">
<property name="text">
<string>Offer to write FW to Tx after download</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QComboBox" name="langCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Sans Serif</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Radio Type</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="22" column="1">
<widget class="QLineEdit" name="sdPath">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>350</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>350</width>
<height>16777215</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="20" column="0" colspan="6">
<widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="0" colspan="6">
<widget class="Line" name="line_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="21" column="0">
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Other Settings</string>
</property>
</widget>
</item>
<item row="23" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>General Settings</string>
</property>
</widget>
</item>
<item row="22" column="0">
<widget class="QLabel" name="sdPathLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>SD Structure path</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QComboBox" name="voiceCombo">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Set voice language.
May be different from firmware language</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="voiceLabel">
<property name="font">
<font>
<family>Sans Serif</family>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Voice Language</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="applicationTab">

View file

@ -555,16 +555,13 @@ void burnDialog::on_BurnFlashButton_clicked()
QMessageBox::critical(this, tr("Warning"), tr("Wrong radio setting data in profile, Settings not patched"));
}
QString fileName;
if (patch) {
QString tempDir = QDir::tempPath();
fileName = tempDir + "/temp.bin";
QString fileName = tempDir + "/temp.bin";
QFile file(fileName);
uint8_t *eeprom = (uint8_t*)malloc(GetEepromInterface()->getEEpromSize());
int eeprom_size = 0;
eeprom_size = GetEepromInterface()->save(eeprom, radioData, GetCurrentFirmwareVariant());
int eeprom_size = GetEepromInterface()->save(eeprom, radioData, GetCurrentFirmware()->getVariantNumber());
if (!eeprom_size) {
QMessageBox::warning(this, tr("Error"),tr("Cannot write file %1:\n%2.").arg(fileName).arg(file.errorString()));
hexfileName->clear();
@ -578,10 +575,10 @@ void burnDialog::on_BurnFlashButton_clicked()
QTextStream outputStream(&file);
long result = file.write((char*)eeprom, eeprom_size);
if (result!=eeprom_size) {
if (result != eeprom_size) {
QMessageBox::warning(this, tr("Error"),tr("Error writing file %1:\n%2.").arg(fileName).arg(file.errorString()));
hexfileName->clear();
}
hexfileName->clear();
hexfileName->append(fileName);
}

View file

@ -97,18 +97,17 @@ int main(int argc, char *argv[])
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
if (g.profile[g.id()].fwType().isEmpty()){
g.profile[g.id()].fwType(default_firmware_variant.id);
g.profile[g.id()].fwType(default_firmware_variant->getId());
g.profile[g.id()].fwName("");
}
QPixmap pixmap = QPixmap(g.profile[g.id()].fwType().contains("taranis") ? ":/images/splasht.png" : ":/images/splash.png");
QSplashScreen *splash = new QSplashScreen(pixmap);
RegisterEepromInterfaces();
registerOpenTxFirmwares();
current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].fwType());
current_firmware_variant = GetFirmware(g.profile[g.id()].fwType());
MainWindow *mainWin = new MainWindow();
if (g.showSplash()) {

View file

@ -333,32 +333,19 @@ void CompareDialog::printPhases()
str.append("</tr>");
}
str.append("</table>");
int gvars=0;
int gvarnum=0;
if (GetCurrentFirmware()->getCapability(HasVariants)) {
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
gvars=1;
}
}
else {
gvars=1;
}
if (gvars==1) {
gvarnum=GetCurrentFirmware()->getCapability(Gvars);
}
if ((gvars==1 && GetCurrentFirmware()->getCapability(GvarsFlightModes)) || GetCurrentFirmware()->getCapability(RotaryEncoders)) {
int gvars = GetCurrentFirmware()->getCapability(Gvars);
if ((gvars && GetCurrentFirmware()->getCapability(GvarsFlightModes)) || 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 (GetCurrentFirmware()->getCapability(GvarsFlightModes)) {
str.append(QString("<td colspan=%1 align=center><b>").arg(gvarnum)+tr("Gvars")+"</td>");
str.append(QString("<td colspan=%1 align=center><b>").arg(gvars)+tr("Gvars")+"</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 (GetCurrentFirmware()->getCapability(GvarsFlightModes)) {
for (i=0; i<gvarnum; i++) {
for (i=0; i<gvars; 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]));
}
}
@ -373,7 +360,7 @@ void CompareDialog::printPhases()
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 (GetCurrentFirmware()->getCapability(GvarsFlightModes)) {
for (k=0; k<gvarnum; k++) {
for (k=0; k<gvars; k++) {
color=getColor1(pd1->gvars[k],pd2->gvars[k]);
if (pd1->gvars[k]<=1024) {
str.append(QString("<td align=\"right\" width=\"40\"><font size=+1 face='Courier New' color=%2>%1").arg(pd1->gvars[k]).arg(color)+"</font></td>");
@ -436,18 +423,18 @@ void CompareDialog::printPhases()
}
str.append("</table>");
if ((gvars==1 && GetCurrentFirmware()->getCapability(GvarsFlightModes)) || GetCurrentFirmware()->getCapability(RotaryEncoders)) {
if ((gvars && GetCurrentFirmware()->getCapability(GvarsFlightModes)) || 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 (GetCurrentFirmware()->getCapability(GvarsFlightModes)) {
str.append(QString("<td colspan=%1 align=center><b>").arg(gvarnum)+tr("Gvars")+"</td>");
str.append(QString("<td colspan=%1 align=center><b>").arg(gvars)+tr("Gvars")+"</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 (GetCurrentFirmware()->getCapability(GvarsFlightModes)) {
for (i=0; i<gvarnum; i++) {
for (i=0; i<gvars; 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]));
}
}
@ -462,7 +449,7 @@ void CompareDialog::printPhases()
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 (GetCurrentFirmware()->getCapability(GvarsFlightModes)) {
for (k=0; k<gvarnum; k++) {
for (k=0; k<gvars; k++) {
color=getColor1(pd1->gvars[k],pd2->gvars[k]);
if (pd2->gvars[k]<=1024) {
str.append(QString("<td align=\"right\" width=\"40\"><font size=+1 face='Courier New' color=%2>%1").arg(pd2->gvars[k]).arg(color)+"</font></td>");
@ -562,28 +549,23 @@ void CompareDialog::printLimits()
void CompareDialog::printGvars()
{
QString color;
int gvars=0;
int gvarnum=0;
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT ) || (!GetCurrentFirmware()->getCapability(HasVariants) && GetCurrentFirmware()->getCapability(Gvars))) {
gvars=1;
gvarnum=GetCurrentFirmware()->getCapability(Gvars);
}
int gvars = GetCurrentFirmware()->getCapability(Gvars);
if (!GetCurrentFirmware()->getCapability(GvarsFlightModes) && (gvars==1 && GetCurrentFirmware()->getCapability(Gvars))) {
if (!GetCurrentFirmware()->getCapability(GvarsFlightModes) && 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%>");
str.append("<table border=1 cellspacing=0 cellpadding=3 width=100>");
FlightModeData *pd1=&g_model1->flightModeData[0];
FlightModeData *pd2=&g_model2->flightModeData[0];
int width=100/gvarnum;
int width = 100 / gvars;
str.append("<tr>");
for(int i=0; i<gvarnum; i++) {
for (int i=0; i<gvars; i++) {
str.append(QString("<td width=\"%1%\" align=\"center\"><b>").arg(width)+tr("GV")+QString("%1</b></td>").arg(i+1));
}
str.append("</tr>");
str.append("<tr>");
for(int i=0; i<gvarnum; i++) {
for (int i=0; i<gvars; i++) {
color=getColor1(pd1->gvars[i],pd2->gvars[i]);
str.append(QString("<td width=\"%1%\" align=\"center\"><font color=%2>").arg(width).arg(color)+QString("%1</font></td>").arg(pd1->gvars[i]));
}
@ -591,12 +573,12 @@ void CompareDialog::printGvars()
str.append("</table></td><td width=50%>");
str.append("<table border=1 cellspacing=0 cellpadding=3 width=100>");
str.append("<tr>");
for(int i=0; i<gvarnum; i++) {
for (int i=0; i<gvars; i++) {
str.append(QString("<td width=\"%1%\" align=\"center\"><b>").arg(width)+tr("GV")+QString("%1</b></td>").arg(i+1));
}
str.append("</tr>");
str.append("<tr>");
for(int i=0; i<gvarnum; i++) {
for (int i=0; i<gvars; i++) {
color=getColor2(pd1->gvars[i],pd2->gvars[i]);
str.append(QString("<td width=\"%1%\" align=\"center\"><font color=%2>").arg(width).arg(color)+QString("%1</font></td>").arg(pd2->gvars[i]));
}

View file

@ -1299,8 +1299,8 @@ void UnregisterEepromInterfaces()
}
QList<FirmwareInterface *> firmwares;
FirmwareVariant default_firmware_variant;
FirmwareVariant current_firmware_variant;
FirmwareInterface * default_firmware_variant;
FirmwareInterface * current_firmware_variant;
void UnregisterFirmwares()
{
@ -1364,15 +1364,11 @@ QString getBoardName(BoardEnum board)
}
}
FirmwareVariant GetFirmwareVariant(QString id)
FirmwareInterface * GetFirmware(QString id)
{
FirmwareVariant result;
foreach(FirmwareInterface * firmware, firmwares) {
if (id.contains(firmware->getId()+"-") || (!id.contains("-") && id.contains(firmware->getId()))) {
result.id = id;
result.firmware = firmware;
result.variant = firmware->getVariant(id);
FirmwareInterface * result = firmware->getFirmwareVariant(id);
if (result) {
return result;
}
}
@ -1386,20 +1382,21 @@ void FirmwareInterface::addOption(const char *option, QString tooltip, uint32_t
addOptions(options);
}
unsigned int FirmwareInterface::getVariant(const QString & variantId)
unsigned int FirmwareInterface::getVariantNumber()
{
unsigned int variant = variantBase;
QStringList options = variantId.mid(id.length()+1).split("-", QString::SkipEmptyParts);
unsigned int result = 0;
const FirmwareInterface * base = getFirmwareBase();
QStringList options = id.mid(base->getId().length()+1).split("-", QString::SkipEmptyParts);
foreach(QString option, options) {
foreach(QList<Option> group, opts) {
foreach(QList<Option> group, base->opts) {
foreach(Option opt, group) {
if (opt.name == option) {
variant += opt.variant;
result += opt.variant;
}
}
}
}
return variant;
return result;
}
void FirmwareInterface::addLanguage(const char *lang)

View file

@ -1113,6 +1113,7 @@ enum Capability {
Telemetry,
TelemetryUnits,
TelemetryBars,
Heli,
Gvars,
GvarsInCS,
GvarsAreNamed,
@ -1126,7 +1127,6 @@ enum Capability {
HasAltitudeSel,
HasVario,
HasVarioSink,
HasVariants,
HasFailsafe,
HasSoundMixer,
NumModules,
@ -1154,6 +1154,7 @@ enum Capability {
MultiposPots,
MultiposPotsPositions,
SimulatorVariant,
MavlinkTelemetry,
};
class SimulatorInterface;
@ -1309,27 +1310,45 @@ struct Option {
class FirmwareInterface {
public:
FirmwareInterface(const QString & id, const QString & name, const BoardEnum board, EEPROMInterface * eepromInterface):
id(id),
name(name),
board(board),
eepromInterface(eepromInterface),
variantBase(0),
base(NULL)
{
}
FirmwareInterface(FirmwareInterface * base, const QString & id, const QString & name, const BoardEnum board, EEPROMInterface * eepromInterface):
id(id),
name(name),
board(board),
eepromInterface(eepromInterface),
variantBase(0),
base(base)
{
}
virtual ~FirmwareInterface()
{
delete eepromInterface;
}
FirmwareInterface(const QString & id, const QString & name, const BoardEnum board, EEPROMInterface * eepromInterface, bool voice = false):
id(id),
name(name),
board(board),
eepromInterface(eepromInterface),
voice(voice),
variantBase(0)
inline const FirmwareInterface * getFirmwareBase() const
{
return base ? base : this;
}
// TODO needed?
inline void setVariantBase(unsigned int variant)
{
variantBase = variant;
}
unsigned int getVariant(const QString & id);
virtual FirmwareInterface * getFirmwareVariant(const QString & id) { return NULL; }
unsigned int getVariantNumber();
virtual void addLanguage(const char *lang);
@ -1348,19 +1367,19 @@ class FirmwareInterface {
virtual QString getReleaseNotesUrl() = 0;
virtual QString getFirmwareUrl(QString & id) = 0;
virtual QString getFirmwareUrl() = 0;
inline BoardEnum getBoard()
inline BoardEnum getBoard() const
{
return board;
}
inline QString getName()
inline QString getName() const
{
return name;
}
inline QString getId()
inline QString getId() const
{
return id;
}
@ -1389,61 +1408,23 @@ class FirmwareInterface {
QString name;
BoardEnum board;
EEPROMInterface * eepromInterface;
public:
bool voice;
protected:
unsigned int variantBase;
FirmwareInterface * base;
private:
FirmwareInterface();
};
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<FirmwareInterface *> firmwares;
extern FirmwareVariant default_firmware_variant;
extern FirmwareVariant current_firmware_variant;
extern FirmwareInterface * default_firmware_variant;
extern FirmwareInterface * current_firmware_variant;
FirmwareVariant GetFirmwareVariant(QString id);
inline FirmwareInterface * GetFirmware(QString id)
{
return GetFirmwareVariant(id).firmware;
}
FirmwareInterface * GetFirmware(QString id);
inline FirmwareInterface * GetCurrentFirmware()
{
return current_firmware_variant.firmware;
return current_firmware_variant;
}
inline EEPROMInterface * GetEepromInterface()
@ -1451,11 +1432,6 @@ inline EEPROMInterface * GetEepromInterface()
return GetCurrentFirmware()->getEepromInterface();
}
inline unsigned int GetCurrentFirmwareVariant()
{
return current_firmware_variant.variant;
}
void UnregisterEepromInterfaces();
inline int divRoundClosest(const int n, const int d)

View file

@ -422,7 +422,7 @@ int OpenTxEepromInterface::getSize(ModelData &model)
uint8_t tmp[EESIZE_RLC_MAX];
efile->EeFsCreate(tmp, EESIZE_RLC_MAX, board);
OpenTxModelData open9xModel(model, board, 255, GetCurrentFirmwareVariant());
OpenTxModelData open9xModel(model, board, 255, GetCurrentFirmware()->getVariantNumber());
QByteArray eeprom;
open9xModel.Export(eeprom);
@ -441,7 +441,7 @@ int OpenTxEepromInterface::getSize(GeneralSettings &settings)
uint8_t tmp[EESIZE_RLC_MAX];
efile->EeFsCreate(tmp, EESIZE_RLC_MAX, board);
OpenTxGeneralData open9xGeneral(settings, board, 255, GetCurrentFirmwareVariant());
OpenTxGeneralData open9xGeneral(settings, board, 255, GetCurrentFirmware()->getVariantNumber());
// open9xGeneral.Dump();
QByteArray eeprom;
@ -453,6 +453,18 @@ int OpenTxEepromInterface::getSize(GeneralSettings &settings)
return efile->size(0);
}
FirmwareInterface * OpenTxFirmware::getFirmwareVariant(const QString & id)
{
if (id.contains(getId()+"-") || (!id.contains("-") && id.contains(getId()))) {
FirmwareInterface * result = new OpenTxFirmware(id, this);
// TODO result.variant = firmware->getVariant(id);
return result;
}
else {
return NULL;
}
}
int OpenTxFirmware::getCapability(const Capability capability)
{
switch (capability) {
@ -491,8 +503,18 @@ int OpenTxFirmware::getCapability(const Capability capability)
return 5;
case FlightModesHaveFades:
return 1;
case Heli:
if (IS_TARANIS(board))
return id.contains("noheli") ? 0 : 1;
else
return id.contains("heli") ? 1 : 0;
case Gvars:
if (IS_TARANIS(board))
return id.contains("nogvars") ? 0 : 9;
else if (id.contains("gvars"))
return IS_ARM(board) ? 9 : 5;
else
return 0;
case FlightModesName:
return (IS_TARANIS(board) ? 10 : 6);
case GvarsName:
@ -563,7 +585,7 @@ int OpenTxFirmware::getCapability(const Capability capability)
case SoundPitch:
return 1;
case Haptic:
return 1;
return (board == BOARD_GRUVIN9X || IS_SKY9X(board) || board == BOARD_TARANIS_PLUS || id.contains("haptic"));
case ModelTrainerEnable:
if (IS_ARM(board))
return 1;
@ -619,11 +641,6 @@ int OpenTxFirmware::getCapability(const Capability capability)
return 1;
case HasVarioSink:
return ((board == BOARD_GRUVIN9X || IS_ARM(board)) ? true : false);
case HasVariants:
if (IS_TARANIS(board))
return 0;
else
return 1;
case HasFailsafe:
return (IS_ARM(board) ? 32 : 0);
case NumModules:
@ -675,6 +692,8 @@ int OpenTxFirmware::getCapability(const Capability capability)
return SIMU_M128_VARIANTS;
else
return 0;
case MavlinkTelemetry:
return id.contains("mavlink") ? 1 : 0;
default:
return 0;
}
@ -912,7 +931,7 @@ bool OpenTxEepromInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, in
return true;
}
QString OpenTxFirmware::getFirmwareUrl(QString & id)
QString OpenTxFirmware::getFirmwareUrl()
{
QString url = OPENTX_FIRMWARE_DOWNLOADS;
switch (board) {
@ -978,7 +997,7 @@ void registerOpenTxFirmwares()
Option fai_options[] = { { "faichoice", QObject::tr("Possibility to enable FAI MODE at field") }, { "faimode", QObject::tr("FAI MODE always enabled") }, { NULL } };
/* 9x board */
openTx = new OpenTxFirmware("opentx-9x", QObject::tr("OpenTX for 9X board"), BOARD_STOCK, false);
openTx = new OpenTxFirmware("opentx-9x", QObject::tr("OpenTX for 9X board"), BOARD_STOCK);
openTx->addOptions(ext_options);
openTx->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
openTx->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
@ -1016,7 +1035,7 @@ void registerOpenTxFirmwares()
firmwares.push_back(openTx);
/* 9x board with M128 chip */
openTx = new OpenTxFirmware("opentx-9x128", QObject::tr("OpenTX for M128 / 9X board"), BOARD_M128, false);
openTx = new OpenTxFirmware("opentx-9x128", QObject::tr("OpenTX for M128 / 9X board"), BOARD_M128);
openTx->addOptions(ext_options);
openTx->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
openTx->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
@ -1048,7 +1067,7 @@ void registerOpenTxFirmwares()
firmwares.push_back(openTx);
/* 9XR board */
openTx = new OpenTxFirmware("opentx-9xr", QObject::tr("OpenTX for 9XR"), BOARD_STOCK, false);
openTx = new OpenTxFirmware("opentx-9xr", QObject::tr("OpenTX for 9XR"), BOARD_STOCK);
openTx->addOptions(extr_options);
openTx->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
openTx->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
@ -1083,7 +1102,7 @@ void registerOpenTxFirmwares()
firmwares.push_back(openTx);
/* 9XR board with M128 chip */
openTx = new OpenTxFirmware("opentx-9xr128", QObject::tr("OpenTX for 9XR with M128 chip"), BOARD_M128, false);
openTx = new OpenTxFirmware("opentx-9xr128", QObject::tr("OpenTX for 9XR with M128 chip"), BOARD_M128);
openTx->addOptions(extr_options);
openTx->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
openTx->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
@ -1113,8 +1132,7 @@ void registerOpenTxFirmwares()
firmwares.push_back(openTx);
/* Gruvin9x board */
openTx = new OpenTxFirmware("opentx-gruvin9x", QObject::tr("OpenTX for Gruvin9x board / 9X"), BOARD_GRUVIN9X, false);
openTx->setVariantBase(FRSKY_VARIANT);
openTx = new OpenTxFirmware("opentx-gruvin9x", QObject::tr("OpenTX for Gruvin9x board / 9X"), BOARD_GRUVIN9X);
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"));
@ -1143,8 +1161,7 @@ void registerOpenTxFirmwares()
#ifndef __APPLE__
/* SKY9X board */
openTx = new OpenTxFirmware("opentx-sky9x", QObject::tr("OpenTX for Sky9x board / 9X"), BOARD_SKY9X, true);
openTx->setVariantBase(FRSKY_VARIANT);
openTx = new OpenTxFirmware("opentx-sky9x", QObject::tr("OpenTX for Sky9x board / 9X"), BOARD_SKY9X);
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"));
@ -1167,8 +1184,7 @@ void registerOpenTxFirmwares()
firmwares.push_back(openTx);
/* 9XR-Pro */
openTx = new OpenTxFirmware("opentx-9xrpro", QObject::tr("OpenTX for 9XR-PRO"), BOARD_9XRPRO, true);
openTx->setVariantBase(FRSKY_VARIANT);
openTx = new OpenTxFirmware("opentx-9xrpro", QObject::tr("OpenTX for 9XR-PRO"), BOARD_9XRPRO);
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"));
@ -1192,7 +1208,7 @@ void registerOpenTxFirmwares()
#endif
/* Taranis board */
openTx = new OpenTxFirmware("opentx-taranis", QObject::tr("OpenTX for FrSky Taranis"), BOARD_TARANIS, true);
openTx = new OpenTxFirmware("opentx-taranis", QObject::tr("OpenTX for FrSky Taranis"), BOARD_TARANIS);
openTx->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support"));
openTx->addOption("nogvars", QObject::tr("Disable Global variables"));
openTx->addOption("haptic", QObject::tr("Haptic module installed"));
@ -1203,7 +1219,7 @@ void registerOpenTxFirmwares()
firmwares.push_back(openTx);
/* Taranis Plus board */
openTx = new OpenTxFirmware("opentx-taranisplus", QObject::tr("OpenTX for FrSky Taranis Plus"), BOARD_TARANIS_PLUS, true);
openTx = new OpenTxFirmware("opentx-taranisplus", QObject::tr("OpenTX for FrSky Taranis Plus"), BOARD_TARANIS_PLUS);
openTx->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support"));
openTx->addOption("nogvars", QObject::tr("Disable Global variables"));
openTx->addOption("lua", QObject::tr("Support for Lua model scripts"));
@ -1212,7 +1228,7 @@ void registerOpenTxFirmwares()
openTx->addOptions(fai_options);
firmwares.push_back(openTx);
default_firmware_variant = GetFirmwareVariant("opentx-9x-heli-templates-en");
default_firmware_variant = GetFirmware("opentx-9x-heli-templates-en");
current_firmware_variant = default_firmware_variant;
}

View file

@ -80,8 +80,13 @@ class OpenTxEepromInterface : public EEPROMInterface
class OpenTxFirmware: public FirmwareInterface {
public:
OpenTxFirmware(const QString & id, const QString & name, const BoardEnum board, bool voice = false):
FirmwareInterface(id, name, board, new OpenTxEepromInterface(board), voice)
OpenTxFirmware(const QString & id, OpenTxFirmware * parent):
FirmwareInterface(parent, id, parent->getName(), parent->getBoard(), parent->eepromInterface)
{
}
OpenTxFirmware(const QString & id, const QString & name, const BoardEnum board):
FirmwareInterface(id, name, board, new OpenTxEepromInterface(board))
{
addLanguage("en");
addLanguage("fr");
@ -106,11 +111,13 @@ class OpenTxFirmware: public FirmwareInterface {
addTTSLanguage("hu");
}
virtual FirmwareInterface * getFirmwareVariant(const QString & id);
virtual QString getStampUrl();
virtual QString getReleaseNotesUrl();
virtual QString getFirmwareUrl(QString & id);
virtual QString getFirmwareUrl();
virtual int getCapability(const Capability);
@ -118,7 +125,6 @@ class OpenTxFirmware: public FirmwareInterface {
virtual SimulatorInterface * getSimulator();
};
void registerOpenTxFirmwares();

View file

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

View file

@ -83,26 +83,26 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
switchDefPosEditLock=true;
populateBacklightCB(ui->backlightswCB, g_eeGeneral.backlightMode);
bool voice = current_firmware_variant.id.contains("voice");
if (!GetCurrentFirmware()->getCapability(MultiLangVoice)) {
ui->VoiceLang_label->hide();
ui->voiceLang_CB->hide();
}
else {
voiceLangEditLock=true;
voiceLangEditLock = true;
populateVoiceLangCB(ui->voiceLang_CB, g_eeGeneral.ttsLanguage);
voiceLangEditLock=false;
voiceLangEditLock = false;
}
bool mavlink = current_firmware_variant.id.contains("mavlink");
if (!mavlink) {
if (!GetCurrentFirmware()->getCapability(MavlinkTelemetry)) {
ui->mavbaud_CB->hide();
ui->mavbaud_label->hide();
}
else {
mavbaudEditLock=true;
mavbaudEditLock = true;
ui->mavbaud_CB->setCurrentIndex(g_eeGeneral.mavbaud);
populateVoiceLangCB(ui->voiceLang_CB, g_eeGeneral.ttsLanguage);
mavbaudEditLock=false;
// TODO why ??? populateVoiceLangCB(ui->voiceLang_CB, g_eeGeneral.ttsLanguage);
mavbaudEditLock = false;
}
if (!GetCurrentFirmware()->getCapability(HasSoundMixer)) {
@ -120,7 +120,8 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->varioPMax_SB->hide();
ui->varioR0_label->hide();
ui->varioR0_SB->hide();
} else {
}
else {
ui->beepVolume_SL->setValue(g_eeGeneral.beepVolume);
ui->varioVolume_SL->setValue(g_eeGeneral.varioVolume);
ui->bgVolume_SL->setValue(g_eeGeneral.backgroundVolume);
@ -167,7 +168,7 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->displayTypeCB->setDisabled(true);
ui->displayTypeCB->hide();
}
if (!GetCurrentFirmware()->getCapability(HasVolume) && !voice) {
if (!GetCurrentFirmware()->getCapability(HasVolume)) {
ui->volume_SB->hide();
ui->volume_SB->setDisabled(true);
ui->label_volume->hide();

View file

@ -140,20 +140,6 @@ void populatePhasesCB(QComboBox *b, int value)
b->setCurrentIndex(value + GetCurrentFirmware()->getCapability(FlightModes));
}
bool gvarsEnabled()
{
int gvars=0;
if (GetCurrentFirmware()->getCapability(HasVariants)) {
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
gvars=1;
}
}
else {
gvars=1;
}
return gvars;
}
GVarGroup::GVarGroup(QCheckBox *weightGV, QSpinBox *weightSB, QComboBox *weightCB, int & weight, const int deflt, const int mini, const int maxi, const unsigned int flags):
QObject(),
weightGV(weightGV),
@ -165,7 +151,7 @@ GVarGroup::GVarGroup(QCheckBox *weightGV, QSpinBox *weightSB, QComboBox *weightC
{
lock = true;
if (gvarsEnabled()) {
if (GetCurrentFirmware()->getCapability(Gvars)) {
populateGVCB(weightCB, weight);
connect(weightGV, SIGNAL(stateChanged(int)), this, SLOT(gvarCBChanged(int)));
connect(weightCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));

View file

@ -37,8 +37,6 @@ class CompanionIcon: public QIcon {
CompanionIcon(QString baseimage);
};
bool gvarsEnabled();
class GVarGroup : public QObject {
Q_OBJECT

View file

@ -230,7 +230,7 @@ void MainWindow::checkForUpdates()
}
else if (checkForUpdatesState & CHECK_FIRMWARE) {
checkForUpdatesState -= CHECK_FIRMWARE;
QString stamp = GetFirmware(current_firmware_variant.id)->getStampUrl();
QString stamp = GetCurrentFirmware()->getStampUrl();
if (!stamp.isEmpty()) {
networkManager = new QNetworkAccessManager(this);
connect(networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(checkForFirmwareUpdateFinished(QNetworkReply*)));
@ -362,7 +362,7 @@ void MainWindow::firmwareDownloadAccepted()
return;
}
file.close();
g.fwRev.set(current_firmware_variant.id, version2index(firmwareVersionString));
g.fwRev.set(current_firmware_variant->getId(), version2index(firmwareVersionString));
if (g.profile[g.id()].burnFirmware()) {
int ret = QMessageBox::question(this, "Companion", tr("Do you want to write the firmware to the radio now ?"), QMessageBox::Yes | QMessageBox::No);
if (ret == QMessageBox::Yes) {
@ -397,7 +397,7 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
download = true;
}
else {
int currentVersion = g.fwRev.get(current_firmware_variant.id);
int currentVersion = g.fwRev.get(current_firmware_variant->getId());
QString currentVersionString = index2version(currentVersion);
QMessageBox msgBox;
@ -406,10 +406,10 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
if (currentVersion == 0) {
QString rn = GetFirmware(current_firmware_variant.id)->getReleaseNotesUrl();
QString rn = GetCurrentFirmware()->getReleaseNotesUrl();
QAbstractButton *rnButton = NULL;
msgBox.setWindowTitle("Companion");
msgBox.setInformativeText(tr("Firmware %1 does not seem to have ever been downloaded.\nRelease %2 is available.\nDo you want to download it now?").arg(current_firmware_variant.id).arg(versionString));
msgBox.setInformativeText(tr("Firmware %1 does not seem to have ever been downloaded.\nRelease %2 is available.\nDo you want to download it now?").arg(current_firmware_variant->getId()).arg(versionString));
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
msgBox.addButton(trUtf8("No"), QMessageBox::NoRole);
if (!rn.isEmpty()) {
@ -435,10 +435,10 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
}
}
else if (version > currentVersion) {
QString rn = GetFirmware(current_firmware_variant.id)->getReleaseNotesUrl();
QString rn = GetCurrentFirmware()->getReleaseNotesUrl();
QAbstractButton *rnButton = NULL;
msgBox.setText("Companion");
msgBox.setInformativeText(tr("A new version of %1 firmware is available:\n - current is %2\n - newer is %3\n\nDo you want to download it now ?").arg(current_firmware_variant.id).arg(currentVersionString).arg(versionString));
msgBox.setInformativeText(tr("A new version of %1 firmware is available:\n - current is %2\n - newer is %3\n\nDo you want to download it now ?").arg(current_firmware_variant->getId()).arg(currentVersionString).arg(versionString));
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
msgBox.addButton(trUtf8("No"), QMessageBox::NoRole);
if (!rn.isEmpty()) {
@ -476,7 +476,7 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
if (ignore) {
int res = QMessageBox::question(this, "Companion", tr("Ignore this release %1?").arg(versionString), QMessageBox::Yes | QMessageBox::No);
if (res==QMessageBox::Yes) {
g.fwRev.set(current_firmware_variant.id, version);
g.fwRev.set(current_firmware_variant->getId(), version);
}
}
else if (download == true) {
@ -493,10 +493,10 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
void MainWindow::startFirmwareDownload()
{
QString url = current_firmware_variant.getFirmwareUrl();
QString url = current_firmware_variant->getFirmwareUrl();
qDebug() << url;
QString ext = url.mid(url.lastIndexOf("."));
QString defaultFilename = g.flashDir() + "/" + current_firmware_variant.id;
QString defaultFilename = g.flashDir() + "/" + current_firmware_variant->getId();
if (g.profile[g.id()].renameFwFiles()) {
defaultFilename += "-" + firmwareVersionString;
}
@ -633,7 +633,7 @@ void MainWindow::loadProfile() //TODO Load all variables - Also HW!
g.id( profnum );
// TODO Get rid of this global variable - The profile.firmware is the real source
current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].fwType());
current_firmware_variant = GetFirmware(g.profile[g.id()].fwType());
foreach (QMdiSubWindow *window, mdiArea->subWindowList()) {
MdiChild *mdiChild = qobject_cast<MdiChild *>(window->widget());

View file

@ -401,7 +401,7 @@ bool MdiChild::saveFile(const QString &fileName, bool setCurrent)
int eeprom_size = 0;
if (fileType != FILE_TYPE_XML) {
eeprom_size = GetEepromInterface()->save(eeprom, radioData, GetCurrentFirmwareVariant(), 0/*last version*/);
eeprom_size = GetEepromInterface()->save(eeprom, radioData, GetCurrentFirmware()->getVariantNumber(), 0/*last version*/);
if (!eeprom_size) {
QMessageBox::warning(this, tr("Error"),tr("Cannot write file %1:\n%2.").arg(myFile).arg(file.errorString()));
return false;

View file

@ -586,24 +586,12 @@ 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 (!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) && !firmware->getCapability(Haptic)) {
QModelIndex index = b->model()->index(i, 0);
QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1);
}
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) && !firmware->getCapability(HasSDLogs)) {
if (((i==FuncVolume || i==FuncBackgroundMusic || i==FuncBackgroundMusicPause) && !firmware->getCapability(HasVolume)) ||
((i==FuncPlayHaptic) && !firmware->getCapability(Haptic)) ||
((i==FuncPlayBoth) && !firmware->getCapability(HasBeeper)) ||
((i==FuncLogs) && !firmware->getCapability(HasSDLogs)) ||
((i>=FuncAdjustGV1 && i<=FuncAdjustGVLast) && !firmware->getCapability(Gvars))
) {
QModelIndex index = b->model()->index(i, 0);
QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1);

View file

@ -11,8 +11,7 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
phaseIdx(phaseIdx),
phase(model.flightModeData[phaseIdx]),
reCount(firmware->getCapability(RotaryEncoders)),
gvCount(((!firmware->getCapability(HasVariants)) || (GetCurrentFirmwareVariant() & GVARS_VARIANT)) ?
firmware->getCapability(Gvars) : 0)
gvCount(firmware->getCapability(Gvars))
{
ui->setupUi(this);

View file

@ -28,6 +28,7 @@ ModelEdit::ModelEdit(QWidget * parent, RadioData & radioData, int modelId, Firmw
ui->pushButton->setIcon(CompanionIcon("simulate.png"));
SetupPanel * setupPanel = new SetupPanel(this, model, generalSettings, firmware);
addTab(setupPanel, tr("Setup"));
if (firmware->getCapability(Heli))
addTab(new HeliPanel(this, model, generalSettings, firmware), tr("Heli"));
addTab(new FlightModesPanel(this, model, generalSettings, firmware), tr("Flight Modes"));
addTab(new InputsPanel(this, model, generalSettings, firmware), tr("Inputs"));

View file

@ -21,13 +21,8 @@ PrintDialog::PrintDialog(QWidget *parent, FirmwareInterface * firmware, GeneralS
g_model(gm),
printfilename(filename),
ui(new Ui::PrintDialog),
gvars(gvarsEnabled()),
gvarnum (0)
gvars(firmware->getCapability(Gvars))
{
if (gvars) {
gvarnum=firmware->getCapability(Gvars);
}
ui->setupUi(this);
this->setWindowIcon(CompanionIcon("print.png"));
te = ui->textEdit;
@ -143,13 +138,13 @@ void PrintDialog::printSetup()
QString PrintDialog::printFlightModes()
{
QString str="";
str.append(QString("<table border=1 cellspacing=0 cellpadding=3 width=\"100%\"><tr><td colspan=%1><h2>").arg(!gvars ? 8+firmware->getCapability(RotaryEncoders) : 8+gvarnum+firmware->getCapability(RotaryEncoders)));
str.append(QString("<table border=1 cellspacing=0 cellpadding=3 width=\"100%\"><tr><td colspan=%1><h2>").arg(!gvars ? 8+firmware->getCapability(RotaryEncoders) : 8+gvars+firmware->getCapability(RotaryEncoders)));
str.append(tr("Flight modes"));
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>");
str.append("<td colspan=4 align=center><b>"+tr("Trims")+"</b></td>");
if (gvars) {
str.append(QString("<td colspan=%1 align=center><b>").arg(gvarnum)+tr("Gvars")+"</b></td>");
str.append(QString("<td colspan=%1 align=center><b>").arg(gvars)+tr("Gvars")+"</b></td>");
}
if (firmware->getCapability(RotaryEncoders)) {
str.append(QString("<td colspan=%1 align=center><b>").arg(firmware->getCapability(RotaryEncoders))+tr("Rot.Enc.")+"</b></td>");
@ -161,11 +156,9 @@ QString PrintDialog::printFlightModes()
GeneralSettings generalSettings = *g_eeGeneral;
str.append(QString("<td align=\"center\" nowrap><b>%1</b></td>").arg(labels[CONVERT_MODE(i+1)-1]));
}
if (gvars) {
for (unsigned int i=0; i<gvarnum; i++) {
for (unsigned int i=0; i<gvars; i++) {
str.append(QString("<td align=\"center\" nowrap><b>GV%1</b><br>%2</td>").arg(i+1).arg(g_model->gvars_names[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')));
}
@ -183,8 +176,7 @@ QString PrintDialog::printFlightModes()
str.append("<td align=\"right\" ><font size=+1 face='Courier New' color=green>"+tr("FM")+QString("%1</font></td>").arg(pd->trimRef[k]));
}
}
if (gvars) {
for (unsigned int k=0; k<gvarnum; k++) {
for (unsigned int k=0; k<gvars; k++) {
if (pd->gvars[k]<=1024) {
str.append(QString("<td align=\"right\"><font size=+1 face='Courier New' color=green>%1").arg(pd->gvars[k])+"</font></td>");
}
@ -194,7 +186,6 @@ QString PrintDialog::printFlightModes()
str.append("<td align=\"right\" ><font size=+1 face='Courier New' color=green>"+tr("FM")+QString("%1</font></td>").arg(num));
}
}
}
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>");
@ -611,19 +602,19 @@ void PrintDialog::printSwitches()
void PrintDialog::printGvars()
{
if (!firmware->getCapability(GvarsFlightModes) && (gvars && firmware->getCapability(Gvars))) {
if (!firmware->getCapability(GvarsFlightModes) && 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>");
FlightModeData *pd=&g_model->flightModeData[0];
int width=100/gvarnum;
int width = 100/gvars;
str.append("<tr>");
for(unsigned int i=0; i<gvarnum; i++) {
for (unsigned int i=0; i<gvars; i++) {
str.append(QString("<td width=\"%1%\" align=\"center\"><b>").arg(width)+tr("GV")+QString("%1</b></td>").arg(i+1));
}
str.append("</tr>");
str.append("<tr>");
for(unsigned int i=0; i<gvarnum; i++) {
for (unsigned int i=0; i<gvars; i++) {
str.append(QString("<td width=\"%1%\" align=\"center\"><font color=green>").arg(width)+QString("%1</font></td>").arg(pd->gvars[i]));
}
str.append("</tr>");

View file

@ -28,8 +28,7 @@ public:
private:
Ui::PrintDialog *ui;
bool gvars;
unsigned int gvarnum;
unsigned int gvars;
void printSetup();
QString printFlightModes();

View file

@ -129,28 +129,28 @@ int main(int argc, char *argv[])
if (msgBox.clickedButton() == exitButton)
return 0;
else if (msgBox.clickedButton() == taranisButton) {
current_firmware_variant = GetFirmwareVariant("opentx-taranis-haptic-en");
current_firmware_variant = GetFirmware("opentx-taranis-haptic-en");
fileName = eedir.filePath("eeprom-taranis.bin");
path = fileName.toAscii();
eepromFileName = path.data();
dialog = new SimulatorDialogTaranis();
}
else if (msgBox.clickedButton() == sky9xButton) {
current_firmware_variant = GetFirmwareVariant("opentx-sky9x-heli-templates-ppmca-gvars-symlimits-autosource-autoswitch-battgraph-bluetooth-en");
current_firmware_variant = GetFirmware("opentx-sky9x-heli-templates-ppmca-gvars-symlimits-autosource-autoswitch-battgraph-bluetooth-en");
fileName = eedir.filePath("eeprom-sky9x.bin");
path = fileName.toAscii();
eepromFileName = path.data();
dialog = new SimulatorDialog9X();
}
else if (msgBox.clickedButton() == gruvinButton) {
current_firmware_variant = GetFirmwareVariant("opentx-gruvin9x-heli-templates-sdcard-voice-DSM2PPM-ppmca-gvars-symlimits-autosource-autoswitch-battgraph-ttsen-en");
current_firmware_variant = GetFirmware("opentx-gruvin9x-heli-templates-sdcard-voice-DSM2PPM-ppmca-gvars-symlimits-autosource-autoswitch-battgraph-ttsen-en");
fileName = eedir.filePath("eeprom-gruvin9x.bin");
path = fileName.toAscii();
eepromFileName = path.data();
dialog = new SimulatorDialog9X();
}
else {
current_firmware_variant = GetFirmwareVariant("opentx-9x128-frsky-heli-templates-audio-voice-haptic-DSM2-ppmca-gvars-symlimits-autosource-autoswitch-battgraph-thrtrace-en");
current_firmware_variant = GetFirmware("opentx-9x128-frsky-heli-templates-audio-voice-haptic-DSM2-ppmca-gvars-symlimits-autosource-autoswitch-battgraph-thrtrace-en");
fileName = eedir.filePath("eeprom-9x128.bin");
path = fileName.toAscii();
eepromFileName = path.data();