Merge remote-tracking branch 'origin/next' into bsongis/9XR-PRO_port

Conflicts:
	companion/src/eeprominterface.cpp
	companion/src/eeprominterface.h
	companion/src/firmwares/opentx/opentxeeprom.cpp
	companion/src/firmwares/opentx/opentxinterface.cpp
	companion/src/firmwares/opentx/opentxinterface.h
	companion/src/mdichild.cpp
	radio/src/Makefile
This commit is contained in:
bsongis
2014-05-11 22:48:48 +02:00
477 changed files with 116230 additions and 71400 deletions
+18 -7
View File
@@ -1,7 +1,7 @@
PROJECT( companion )
SET( C9X_VERSION_MAJOR "1" )
SET( C9X_VERSION_MINOR "52" )
SET( C9X_VERSION_MINOR "99" )
SET( C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR} )
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
@@ -36,7 +36,7 @@ ELSE()
MESSAGE( "SDL not found! Joysticks support will be disabled" )
ENDIF()
FIND_PACKAGE( Qt4 REQUIRED )
FIND_PACKAGE(Qt4 4.8.4 REQUIRED)
SET( QT_USE_QTNETWORK True )
SET( QT_USE_QTXML True )
INCLUDE( ${QT_USE_FILE} )
@@ -90,6 +90,13 @@ add_custom_command(
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
)
add_custom_command(
OUTPUT ${RADIO_SRC_DIRECTORY}/stamp-opentx.h
COMMAND make stamp_header
DEPENDS ${RADIO_SRC_DIRECTORY}/Makefile
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/../..
@@ -128,6 +135,7 @@ set(companion_SRCS
firmwares/opentx/opentxsimulator.cpp
firmwares/ersky9x/ersky9xeeprom.cpp
firmwares/ersky9x/ersky9xinterface.cpp
${RADIO_SRC_DIRECTORY}/stamp-opentx.h
${RADIO_SRC_DIRECTORY}/bitmaps/sticks.lbm
${RADIO_SRC_DIRECTORY}/translations/en.h
appdata.cpp
@@ -151,8 +159,10 @@ set(companion_SRCS
splashlibrary.cpp
mainwindow.cpp
companion.cpp
modelconfigdialog.cpp
taranisnotfound.cpp
qcustomplot.cpp
wizarddata.cpp
wizarddialog.cpp
)
set(companion_MOC_HDRS
@@ -174,9 +184,10 @@ set(companion_MOC_HDRS
modelslist.h
mdichild.h
mainwindow.h
modelconfigdialog.h
taranisnotfound.h
qcustomplot.h
helpers.h
wizarddialog.h
)
set(companion_UIS
@@ -195,7 +206,7 @@ set(companion_UIS
customizesplashdialog.ui
splashlibrary.ui
burndialog.ui
modelconfigdialog.ui
taranisnotfound.ui
)
set(companion_RCS
@@ -248,7 +259,7 @@ ENDIF( )
INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} )
INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR} )
SET( LANGUAGES he pl pt ru de fr it sv cs fi)
SET( LANGUAGES he pl pt ru de fr it sv cs fi nl)
FOREACH( language ${LANGUAGES} )
SET( companion_TS ${companion_TS} translations/companion_${language}.ts )
ENDFOREACH( language )
@@ -387,7 +398,7 @@ IF( WIN32 )
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/companionInstall.exe
COMMAND "${NSIS_EXE}" ARGS companion.nsi
DEPENDS ${PROJECT_NAME} ${PROJECT_BINARY_DIR}/companion.nsi
DEPENDS ${PROJECT_NAME} simulator ${PROJECT_BINARY_DIR}/companion.nsi
COMMENT "Windows NSIS Installer")
ADD_CUSTOM_TARGET( installer
+41 -21
View File
@@ -1,5 +1,16 @@
// Companion Application Data Class Definition.
// Author Kjell Kernen
/*
* Author - Kjell Kernen
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include "appdata.h"
@@ -296,6 +307,7 @@ QString Profile::display() const { return _display; }
QString Profile::haptic() const { return _haptic; }
QString Profile::speaker() const { return _speaker; }
QString Profile::stickPotCalib() const { return _stickPotCalib; }
QString Profile::timeStamp() const { return _timeStamp; }
QString Profile::trainerCalib() const { return _trainerCalib; }
int Profile::currentCalib() const { return _currentCalib; }
int Profile::gsStickMode() const { return _gsStickMode; }
@@ -320,6 +332,7 @@ void Profile::display (const QString x) { store(x, _display, "Displa
void Profile::haptic (const QString x) { store(x, _haptic, "Haptic" ,"Profiles", QString("profile%1").arg(index));}
void Profile::speaker (const QString x) { store(x, _speaker, "Speaker" ,"Profiles", QString("profile%1").arg(index));}
void Profile::stickPotCalib (const QString x) { store(x, _stickPotCalib, "StickPotCalib" ,"Profiles", QString("profile%1").arg(index));}
void Profile::timeStamp (const QString x) { store(x, _timeStamp, "TimeStamp" ,"Profiles", QString("profile%1").arg(index));}
void Profile::trainerCalib (const QString x) { store(x, _trainerCalib, "TrainerCalib" ,"Profiles", QString("profile%1").arg(index));}
void Profile::currentCalib (const int x) { store(x, _currentCalib, "currentCalib" ,"Profiles", QString("profile%1").arg(index));}
void Profile::gsStickMode (const int x) { store(x, _gsStickMode, "GSStickMode" ,"Profiles", QString("profile%1").arg(index));}
@@ -385,6 +398,24 @@ bool Profile::existsOnDisk()
return (keyList.length() > 0);
}
void Profile::initFwVariables()
{
_beeper = "";
_countryCode = "";
_display = "";
_haptic = "";
_speaker = "";
_stickPotCalib = "";
_timeStamp = "";
_trainerCalib = "";
_currentCalib = 0;
_gsStickMode = 0;
_ppmMultiplier = 0;
_vBatCalib = 0;
_vBatWarn = 0;
}
void Profile::init(int newIndex)
{
index = newIndex;
@@ -399,19 +430,7 @@ void Profile::init(int newIndex)
_channelOrder = 0;
_defaultMode = 1;
_beeper = "";
_countryCode = "";
_display = "";
_haptic = "";
_speaker = "";
_stickPotCalib = "";
_trainerCalib = "";
_currentCalib = 0;
_gsStickMode = 0;
_ppmMultiplier = 0;
_vBatCalib = 0;
_vBatWarn = 0;
initFwVariables();
// Do not write empty profiles to disk except the default (0) profile.
if ( index > 0 && !existsOnDisk())
@@ -439,6 +458,7 @@ void Profile::flush()
getset( _haptic, "Haptic" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _speaker, "Speaker" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _stickPotCalib, "StickPotCalib" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _timeStamp, "TimeStamp" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _trainerCalib, "TrainerCalib" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _currentCalib, "currentCalib" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _gsStickMode, "GSStickMode" ,0 ,"Profiles", QString("profile%1").arg(index));
@@ -490,7 +510,7 @@ bool AppData::snapToClpbrd() { return _snapToClpbrd; }
bool AppData::autoCheckApp() { return _autoCheckApp; }
bool AppData::autoCheckFw() { return _autoCheckFw; }
bool AppData::simuSW() { return _simuSW; }
bool AppData::enableWizard() { return _enableWizard; }
bool AppData::useWizard() { return _useWizard; }
int AppData::backLight() { return _backLight; }
int AppData::embedSplashes() { return _embedSplashes; }
@@ -499,7 +519,6 @@ int AppData::generalEditTab() { return _generalEditTab; }
int AppData::iconSize() { return _iconSize; }
int AppData::historySize() { return _historySize; }
int AppData::jsCtrl() { return _jsCtrl; }
int AppData::modelEditTab() { return _modelEditTab; }
int AppData::id() { return _id; }
int AppData::theme() { return _theme; }
int AppData::warningId() { return _warningId; }
@@ -544,7 +563,7 @@ void AppData::snapToClpbrd (const bool x) { store(x, _snapToClpbrd,
void AppData::autoCheckApp (const bool x) { store(x, _autoCheckApp, "startup_check_companion" );}
void AppData::autoCheckFw (const bool x) { store(x, _autoCheckFw, "startup_check_fw" );}
void AppData::simuSW (const bool x) { store(x, _simuSW, "simuSW" );}
void AppData::enableWizard (const bool x) { store(x, _enableWizard, "wizardEnable" );}
void AppData::useWizard (const bool x) { store(x, _useWizard, "useWizard" );}
void AppData::backLight (const int x) { store(x, _backLight, "backLight" );}
void AppData::embedSplashes (const int x) { store(x, _embedSplashes, "embedded_splashes" );}
@@ -553,7 +572,6 @@ void AppData::generalEditTab (const int x) { store(x, _generalEditTab,
void AppData::iconSize (const int x) { store(x, _iconSize, "icon_size" );}
void AppData::historySize (const int x) { store(x, _historySize, "history_size" );}
void AppData::jsCtrl (const int x) { store(x, _jsCtrl, "js_ctrl" );}
void AppData::modelEditTab (const int x) { store(x, _modelEditTab, "modelEditTab" );}
void AppData::id (const int x) { store(x, _id, "profileId" );}
void AppData::theme (const int x) { store(x, _theme, "theme" );}
void AppData::warningId (const int x) { store(x, _warningId, "warningId" );}
@@ -583,6 +601,7 @@ AppData::AppData()
// Store old values in new locations
autoCheckApp(settings.value("startup_check_companion9x", true).toBool());
useWizard(settings.value("wizardEnable", true).toBool());
// Convert and store the firmware type
QString fwType = settings.value("firmware", "").toString();
@@ -611,12 +630,14 @@ AppData::AppData()
settings.remove("default_mode");
settings.remove("firmware");
settings.remove("lastFw");
settings.remove("modelEditTab");
settings.remove("Name");
settings.remove("patchImage");
settings.remove("rename_firmware_files");
settings.remove("sdPath");
settings.remove("SplashFileName");
settings.remove("startup_check_companion9x");
settings.remove("wizardEnable");
// Select the new default profile as current profile
id( 0 );
@@ -662,7 +683,7 @@ AppData::AppData()
getset( _autoCheckApp, "startup_check_companion" ,true );
getset( _autoCheckFw, "startup_check_fw" ,true );
getset( _simuSW, "simuSW" ,false );
getset( _enableWizard, "wizardEnable" ,true );
getset( _useWizard, "useWizard" ,true );
getset( _backLight, "backLight" ,0 );
getset( _embedSplashes, "embedded_splashes" ,0 );
@@ -671,7 +692,6 @@ AppData::AppData()
getset( _iconSize, "icon_size" ,2 );
getset( _jsCtrl, "js_ctrl" ,0 );
getset( _historySize, "history_size" ,10 );
getset( _modelEditTab, "modelEditTab" ,0 );
getset( _id, "profileId" ,0 );
getset( _theme, "theme" ,1 );
getset( _warningId, "warningId" ,0 );
+20 -7
View File
@@ -1,5 +1,16 @@
// Companion Application Data Class Declaration.
// Author Kjell Kernen
/*
* Author - Kjell Kernen
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
// All temporary and permanent global variables are defined here to make
// initialization and storage safe and visible.
@@ -109,6 +120,7 @@ class Profile: protected CompStoreObj
QString _haptic;
QString _speaker;
QString _stickPotCalib;
QString _timeStamp;
QString _trainerCalib;
int _currentCalib;
int _gsStickMode;
@@ -134,6 +146,7 @@ class Profile: protected CompStoreObj
QString haptic() const;
QString speaker() const;
QString stickPotCalib() const;
QString timeStamp() const;
QString trainerCalib() const;
int currentCalib() const;
int gsStickMode() const;
@@ -158,6 +171,7 @@ class Profile: protected CompStoreObj
void haptic (const QString);
void speaker (const QString);
void stickPotCalib (const QString);
void timeStamp (const QString);
void trainerCalib (const QString);
void currentCalib (const int);
void gsStickMode (const int);
@@ -170,6 +184,7 @@ class Profile: protected CompStoreObj
void remove();
bool existsOnDisk();
void init(int newIndex);
void initFwVariables();
void flush();
};
@@ -221,7 +236,7 @@ class AppData: protected CompStoreObj
bool _autoCheckApp;
bool _autoCheckFw;
bool _simuSW;
bool _enableWizard;
bool _useWizard;
int _backLight;
int _embedSplashes;
@@ -230,7 +245,6 @@ class AppData: protected CompStoreObj
int _iconSize;
int _jsCtrl;
int _historySize;
int _modelEditTab;
int _id;
int _theme;
int _warningId;
@@ -277,7 +291,7 @@ class AppData: protected CompStoreObj
bool autoCheckApp();
bool autoCheckFw();
bool simuSW();
bool enableWizard();
bool useWizard();
int backLight();
int embedSplashes();
@@ -286,7 +300,6 @@ class AppData: protected CompStoreObj
int iconSize();
int historySize();
int jsCtrl();
int modelEditTab(); // This variable is unused an can be removed
int id();
int theme();
int warningId();
@@ -332,7 +345,7 @@ class AppData: protected CompStoreObj
void autoCheckApp (const bool);
void autoCheckFw (const bool);
void simuSW (const bool);
void enableWizard (const bool);
void useWizard (const bool);
void backLight (const int);
void embedSplashes (const int);
+267 -32
View File
@@ -11,14 +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"));
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()));
#ifndef JOYSTICKS
ui->joystickCB->hide();
ui->joystickCB->setDisabled(true);
@@ -26,21 +34,22 @@ appPreferencesDialog::appPreferencesDialog(QWidget *parent) :
ui->joystickChkB->hide();
ui->label_11->hide();
#endif
resize(0,0);
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());
g.enableWizard(ui->wizardEnable_ChkB->isChecked());
g.showSplash(ui->showSplash->isChecked());
g.simuSW(ui->simuSW->isChecked());
g.useWizard(ui->modelWizard_CB->isChecked());
g.historySize(ui->historySize->value());
g.backLight(ui->backLightColor->currentIndex());
g.libDir(ui->libraryPath->text());
@@ -69,16 +78,17 @@ void appPreferencesDialog::writeValues()
else
g.profile[g.id()].name(ui->profileNameLE->text());
// If a new radio type has been choosen, several things need to change
if ( initialRadioType != ui->radioCB->currentIndex())
{
// 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) {
g.profile[g.id()].fwName("");
g.profile[g.id()].fwType(getDefaultFwType(ui->radioCB->currentIndex()));
current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].fwType());
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()) {
@@ -88,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());
@@ -101,11 +111,15 @@ void appPreferencesDialog::initSettings()
}
ui->startupCheck_companion9x->setChecked(g.autoCheckApp());
ui->startupCheck_fw->setChecked(g.autoCheckFw());
ui->wizardEnable_ChkB->setChecked(g.enableWizard());
ui->showSplash->setChecked(g.showSplash());
ui->historySize->setValue(g.historySize());
ui->backLightColor->setCurrentIndex(g.backLight());
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());
ui->ge_lineedit->setText(g.gePath());
@@ -157,13 +171,37 @@ void appPreferencesDialog::initSettings()
ui->profileNameLE->setText(g.profile[g.id()].name());
ui->SplashFileName->setText(g.profile[g.id()].splashFile());
initialRadioType = getRadioType(g.profile[g.id()].fwType());
ui->radioCB->setCurrentIndex(initialRadioType);
displayImage( g.profile[g.id()].splashFile() );
QString hwSettings;
if (g.profile[g.id()].stickPotCalib() == "" ) {
hwSettings = QString(tr("EMPTY: No radio settings stored in profile"));
}
else {
QString str = g.profile[g.id()].timeStamp();
if (str.isEmpty())
hwSettings = QString(tr("AVAILABLE: Radio settings of unknown age"));
else
hwSettings = QString(tr("AVAILABLE: Radio settings stored %1").arg(str));
}
ui->lblGeneralSettings->setText(hwSettings);
ui->CPU_ID_LE->setText(g.cpuId());
FirmwareInterface * current_firmware = GetCurrentFirmware();
foreach(FirmwareInterface * firmware, firmwares) {
ui->downloadVerCB->addItem(firmware->name, firmware->id);
if (current_firmware == firmware) {
ui->downloadVerCB->setCurrentIndex(ui->downloadVerCB->count() - 1);
}
}
baseFirmwareChanged();
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()) {
@@ -172,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);
@@ -186,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()) {
@@ -196,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()) {
@@ -205,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");
@@ -231,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();
}
@@ -239,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()) {
@@ -247,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();
@@ -260,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());
@@ -279,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++) {
@@ -297,11 +336,207 @@ 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)
{
if (show)
showVoice();
else
hideVoice();
}
void AppPreferencesDialog::showVoice()
{
ui->voiceLabel->show();
ui->voiceCombo->show();
}
void AppPreferencesDialog::hideVoice()
{
ui->voiceLabel->hide();
ui->voiceCombo->hide();
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->id == selected_firmware) {
showVoice(firmware->voice);
populateFirmwareOptions(firmware);
break;
}
}
firmwareChanged();
}
FirmwareVariant AppPreferencesDialog::getFirmwareVariant()
{
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
bool voice=false;
foreach(FirmwareInterface * firmware, firmwares) {
if (firmware->id == selected_firmware) {
QString id = firmware->id;
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))
id += QString("-tts") + ui->voiceCombo->currentText();
}
else {
hideVoice();
}
if (ui->langCombo->count())
id += QString("-") + ui->langCombo->currentText();
return GetFirmwareVariant(id);
}
}
// Should never occur...
return default_firmware_variant;
}
void AppPreferencesDialog::firmwareOptionChanged(bool state)
{
QCheckBox *cb = qobject_cast<QCheckBox*>(sender());
FirmwareInterface * firmware=NULL;
if (cb && state) {
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
foreach(firmware, firmwares) {
if (firmware->id == selected_firmware) {
foreach(QList<Option> opts, firmware->opts) {
foreach(Option opt, opts) {
if (cb->text() == opt.name) {
foreach(Option other, opts) {
if (other.name != opt.name) {
foreach(QCheckBox *ocb, optionsCheckBoxes) {
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();
// B-Plan
if (false) {
ui->CPU_ID_LE->show();
ui->CPU_ID_LABEL->show();
} else {
ui->CPU_ID_LE->hide();
ui->CPU_ID_LABEL->hide();
}
}
void AppPreferencesDialog::populateFirmwareOptions(const FirmwareInterface * firmware)
{
const FirmwareInterface * parent = /*firmware->parent ? firmware->parent : */ firmware;
updateLock = true;
ui->langCombo->clear();
foreach(const char *lang, parent->languages) {
ui->langCombo->addItem(lang);
if (current_firmware_variant.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);
int index = 0;
foreach(QList<Option> opts, parent->opts) {
foreach(Option opt, opts) {
if (index >= optionsCheckBoxes.size()) {
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)));
}
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);
}
}
}
}
for (; index<optionsCheckBoxes.size(); index++) {
QCheckBox *cb = optionsCheckBoxes.at(index);
cb->hide();
cb->setCheckState(Qt::Unchecked);
}
updateLock = false;
QTimer::singleShot(0, this, SLOT(shrink()));
}
void AppPreferencesDialog::shrink()
{
resize(0,0);
}
+24 -9
View File
@@ -6,29 +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:
int initialRadioType;
Ui::appPreferencesDialog *ui;
private:
QList<QCheckBox *> optionsCheckBoxes;
bool updateLock;
void showVoice(bool);
void showVoice();
void hideVoice();
void populateLocale();
void populateFirmwareOptions(const FirmwareInterface *);
FirmwareVariant getFirmwareVariant();
QCheckBox * voice;
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();
File diff suppressed because it is too large Load Diff
+15 -14
View File
@@ -51,18 +51,20 @@ avrOutputDialog::avrOutputDialog(QWidget *parent, QString prog, QStringList arg,
ui->progressBar->setMaximum(127);
QTimer::singleShot(500, this, SLOT(doCopy()));
}
} else {
if(wTitle.isEmpty())
setWindowTitle(getProgrammer() + " " + tr("result"));
}
else {
if (wTitle.isEmpty())
setWindowTitle(getProgrammer() + " " + tr("result"));
else
setWindowTitle(getProgrammer() + " - " + wTitle);
setWindowTitle(getProgrammer() + " - " + wTitle);
QFile exec;
winTitle=wTitle;
if (!(exec.exists(prog))) {
QMessageBox::critical(this, "Companion", getProgrammer() + " " + tr("executable not found"));
closeOpt = AVR_DIALOG_FORCE_CLOSE;
QTimer::singleShot(0, this, SLOT(forceClose()));
} else {
}
else {
foreach(QString str, arg) cmdLine.append(" " + str);
lfuse = 0;
hfuse = 0;
@@ -70,10 +72,11 @@ avrOutputDialog::avrOutputDialog(QWidget *parent, QString prog, QStringList arg,
phase=0;
currLine.clear();
if (!displayDetails) {
ui->plainTextEdit->hide();
QTimer::singleShot(0, this, SLOT(shrink()));
} else {
ui->checkBox->setChecked(true);
ui->plainTextEdit->hide();
QTimer::singleShot(0, this, SLOT(shrink()));
}
else {
ui->checkBox->setChecked(true);
}
process = new QProcess(this);
connect(process,SIGNAL(readyReadStandardError()), this, SLOT(doAddTextStdErr()));
@@ -241,10 +244,8 @@ void avrOutputDialog::doAddTextStdOut()
if (text.contains("Complete ")) {
#if !__GNUC__
if (kill_timer) {
delete kill_timer;
kill_timer = NULL;
}
delete kill_timer;
kill_timer = NULL;
#endif
int start = text.indexOf("Complete ");
int end = text.indexOf("%");
@@ -326,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
View File
@@ -15,6 +15,7 @@ burnConfigDialog::burnConfigDialog(QWidget *parent) :
ui(new Ui::burnConfigDialog)
{
ui->setupUi(this);
setWindowIcon(CompanionIcon("configure.png"));
ui->avrdude_programmer->model()->sort(0);
getSettings();
+55
View File
@@ -501,6 +501,61 @@ Please only use this if you know what you are doing. There are no error checks
<string notr="true">com4</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">com5</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">com6</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">com7</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">com8</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">com9</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">com10</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">com11</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">com12</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">com13</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">com14</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">com15</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">lpt1</string>
+23 -19
View File
@@ -18,12 +18,13 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
hexType(Type)
{
ui->setupUi(this);
setWindowIcon(CompanionIcon("write_flash.png"));
if(!g.profile[g.id()].splashFile().isEmpty()){
if (!g.profile[g.id()].splashFile().isEmpty()){
imageSource=PROFILE;
imageFile=g.profile[g.id()].splashFile();
}
else{
else {
ui->useProfileImageCB->setDisabled(true);
imageSource=FIRMWARE;
imageFile="";
@@ -37,7 +38,7 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
ui->profile_label->hide();
ui->patchcalib_CB->hide();
ui->patchhw_CB->hide();
setWindowTitle(tr("Write firmware to TX"));
setWindowTitle(tr("Write firmware to Radio"));
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
ui->EEbackupCB->hide();
}
@@ -51,17 +52,17 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
ui->BurnFlashButton->setDisabled(true);
ui->FWFileName->clear();
ui->DateField->clear();
ui->SVNField->clear();
ui->versionField->clear();
ui->ModField->clear();
ui->FramFWInfo->hide();
ui->SplashFrame->hide();
ui->BurnFlashButton->setDisabled(true);
ui->EEbackupCB->hide();
if (DocName.isEmpty()) {
setWindowTitle(tr("Write Models and Settings to TX"));
setWindowTitle(tr("Write Backup to Radio"));
}
else {
setWindowTitle(tr("Write Models and Settings in %1 to TX").arg(DocName));
setWindowTitle(tr("Write Backup from %1 to Radio").arg(DocName));
}
ui->profile_label->setText(tr("Current profile")+QString(": ")+g.profile[g.id()].name());
}
@@ -131,7 +132,7 @@ void burnDialog::on_FlashLoadButton_clicked()
ui->BurnFlashButton->setDisabled(true);
ui->FWFileName->clear();
ui->DateField->clear();
ui->SVNField->clear();
ui->versionField->clear();
ui->ModField->clear();
ui->FramFWInfo->hide();
ui->SplashFrame->hide();
@@ -145,7 +146,7 @@ void burnDialog::on_FlashLoadButton_clicked()
checkFw(fileName);
}
else {
QString fileName = QFileDialog::getOpenFileName(this,tr("Choose file to load Models and Settings from"), g.eepromDir(), tr(EXTERNAL_EEPROM_FILES_FILTER));
QString fileName = QFileDialog::getOpenFileName(this,tr("Choose Radio Backup file"), g.eepromDir(), tr(EXTERNAL_EEPROM_FILES_FILTER));
if (checkeEprom(fileName)) {
if (burnraw==false) {
ui->BurnFlashButton->setEnabled(true);
@@ -191,8 +192,8 @@ void burnDialog::checkFw(QString fileName)
if (flash.isValid()) {
ui->FramFWInfo->show();
ui->DateField->setText(flash.getDate() + " " + flash.getTime());
ui->SVNField->setText(flash.getSvn());
ui->ModField->setText(flash.getBuild());
ui->versionField->setText(flash.getVersion().isEmpty() ? flash.getSvn() : flash.getVersion());
ui->ModField->setText(flash.getEEprom());
ui->SplashFrame->hide();
if (flash.hasSplash()) {
@@ -305,7 +306,7 @@ void burnDialog::displaySplash()
FlashInterface flash(ui->FWFileName->text());
image = flash.getSplash();
}
else{
else {
image.load(imageFile);
}
if (image.isNull()) {
@@ -352,7 +353,7 @@ void burnDialog::on_useProfileImageCB_clicked()
if (!fileName.isEmpty()){
QImage image(fileName);
if (image.isNull()) {
QMessageBox::critical(this, tr("Error"), tr("The profile image %1 does not contain an image.").arg(fileName));
QMessageBox::critical(this, tr("Error"), tr("Profile image %1 is invalid.").arg(fileName));
}
else {
imageSource = PROFILE;
@@ -368,7 +369,7 @@ void burnDialog::on_useAnotherImageCB_clicked()
for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) {
supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex];
}
QString fileName = QFileDialog::getOpenFileName(this, tr("Open image file to use as Tx start screen"), g.imagesDir(), tr("Images (%1)").arg(supportedImageFormats));
QString fileName = QFileDialog::getOpenFileName(this, tr("Open image file to use as radio start screen"), g.imagesDir(), tr("Images (%1)").arg(supportedImageFormats));
if (!fileName.isEmpty()){
g.imagesDir( QFileInfo(fileName).dir().absolutePath() );
QImage image(fileName);
@@ -425,15 +426,18 @@ void burnDialog::on_BurnFlashButton_clicked()
hexfileName->clear();
QMessageBox::critical(this, tr("Warning"), tr("Cannot save customized firmware"));
}
} else {
}
else {
hexfileName->clear();
QMessageBox::critical(this, tr("Warning"), tr("Custom image not found"));
}
} else {
hexfileName->clear();
hexfileName->append(fileName);
}
} else {
else {
hexfileName->clear();
hexfileName->append(fileName);
}
}
else {
QMessageBox::critical(this, tr("Warning"), tr("No firmware selected"));
hexfileName->clear();
}
@@ -441,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
View File
@@ -7,12 +7,9 @@
#include "flashinterface.h"
#include "xmlinterface.h"
#define XML_FILES_FILTER "XML files (*.xml);;"
#define HEX_FILES_FILTER "HEX files (*.hex);;"
#define BIN_FILES_FILTER "BIN files (*.bin);;"
#define EEPE_FILES_FILTER "EEPE EEPROM files (*.eepe);;"
#define EEPM_FILES_FILTER "EEPE MODEL files (*.eepm);;"
// #define EEPROM_FILES_FILTER "EEPE files (*.xml *.eepe *.eepm *.bin *.hex);;" XML_FILES_FILTER EEPE_FILES_FILTER EEPM_FILES_FILTER BIN_FILES_FILTER HEX_FILES_FILTER
#define EEPROM_FILES_FILTER "EEPE files (*.eepe *.bin *.hex);;" EEPE_FILES_FILTER BIN_FILES_FILTER HEX_FILES_FILTER
#define FLASH_FILES_FILTER "FLASH files (*.bin *.hex);;" BIN_FILES_FILTER HEX_FILES_FILTER
#define EXTERNAL_EEPROM_FILES_FILTER "EEPROM files (*.bin *.hex);;" BIN_FILES_FILTER HEX_FILES_FILTER
+28 -46
View File
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>440</width>
<height>423</height>
<width>399</width>
<height>564</height>
</rect>
</property>
<property name="sizePolicy">
@@ -18,7 +18,7 @@
</property>
<property name="minimumSize">
<size>
<width>440</width>
<width>0</width>
<height>0</height>
</size>
</property>
@@ -113,8 +113,15 @@
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="3" column="0">
<widget class="QLabel" name="dateLabel">
<property name="text">
<string>Date &amp; Time</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="SVNField">
<widget class="QLineEdit" name="versionField">
<property name="readOnly">
<bool>true</bool>
</property>
@@ -135,20 +142,13 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="svnLabel">
<widget class="QLabel" name="versionLabel">
<property name="text">
<string>SVN</string>
<string>Version</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="dateLabel">
<property name="text">
<string>Date &amp; Time</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item row="3" column="1">
<widget class="QLineEdit" name="DateField">
<property name="readOnly">
<bool>true</bool>
@@ -171,6 +171,12 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>250</width>
<height>0</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
@@ -254,8 +260,8 @@
<item row="0" column="0">
<layout class="QGridLayout" name="SplashLayout" rowstretch="0,0,0,0,0,0,0">
<item row="0" column="1" rowspan="7">
<layout class="QGridLayout" name="gridLayout_2" rowstretch="1">
<item row="0" column="1">
<layout class="QGridLayout" name="gridLayout_2" rowstretch="0">
<item row="0" column="0">
<widget class="QLabel" name="imageLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
@@ -271,8 +277,8 @@
</property>
<property name="maximumSize">
<size>
<width>212</width>
<height>64</height>
<width>214</width>
<height>66</height>
</size>
</property>
<property name="frameShape">
@@ -281,6 +287,9 @@
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="text">
<string/>
</property>
@@ -289,32 +298,6 @@
</property>
</widget>
</item>
<item row="0" column="2">
<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="0" column="0">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="0">
@@ -377,8 +360,7 @@
<tabstop>BurnFlashButton</tabstop>
<tabstop>FWFileName</tabstop>
<tabstop>FlashLoadButton</tabstop>
<tabstop>DateField</tabstop>
<tabstop>SVNField</tabstop>
<tabstop>versionField</tabstop>
<tabstop>ModField</tabstop>
<tabstop>useProfileImageCB</tabstop>
<tabstop>useFwImageCB</tabstop>
+6 -1
View File
@@ -81,6 +81,7 @@ int main(int argc, char *argv[])
app.setApplicationName("OpenTX Companion");
app.setOrganizationName("OpenTX");
app.setOrganizationDomain("open-tx.org");
app.setAttribute(Qt::AA_DontShowIconsInMenus, false);
#ifdef __APPLE__
app.setStyle(new MyProxyStyle);
@@ -104,7 +105,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());
@@ -123,5 +125,8 @@ int main(int argc, char *argv[])
delete splash;
delete mainWin;
UnregisterFirmwares();
UnregisterEepromInterfaces();
return result;
}
+21 -100
View File
@@ -57,106 +57,27 @@
<file>images/x9r3.png</file>
<file>images/x9s0.png</file>
<file>images/x9t0.png</file>
<file>images/mcw/aicon.png</file>
<file>images/mcw/dicon.png</file>
<file>images/mcw/gicon.png</file>
<file>images/mcw/hicon.png</file>
<file>images/mcw/at1e1r.png</file>
<file>images/mcw/at2e1r.png</file>
<file>images/mcw/atailv.png</file>
<file>images/mcw/aw0a0f.png</file>
<file>images/mcw/aw1a0f.png</file>
<file>images/mcw/aw1a1f.png</file>
<file>images/mcw/aw1a2f.png</file>
<file>images/mcw/aw2a0f.png</file>
<file>images/mcw/aw2a1f.png</file>
<file>images/mcw/aw2a2f.png</file>
<file>images/mcw/h90.png</file>
<file>images/mcw/h120.png</file>
<file>images/mcw/h120x.png</file>
<file>images/mcw/h140.png</file>
<file>images/mcw/hfbl.png</file>
<file>images/mcw/htailg.png</file>
<file>images/mcw/htailng.png</file>
<file>images/mcw/htailfblg.png</file>
<file>images/mcw/htailfblng.png</file>
<file>images/mcw/gt1e1r.png</file>
<file>images/mcw/gt2e1r.png</file>
<file>images/mcw/gtailv.png</file>
<file>images/mcw/gw0t0a0f0s.png</file>
<file>images/mcw/gw0t1a0f0s.png</file>
<file>images/mcw/gw0t1a0f1s.png</file>
<file>images/mcw/gw0t1a0f2s.png</file>
<file>images/mcw/gw0t1a1f0s.png</file>
<file>images/mcw/gw0t1a1f1s.png</file>
<file>images/mcw/gw0t1a1f2s.png</file>
<file>images/mcw/gw0t1a2f0s.png</file>
<file>images/mcw/gw0t1a2f1s.png</file>
<file>images/mcw/gw0t1a2f2s.png</file>
<file>images/mcw/gw0t2a0f0s.png</file>
<file>images/mcw/gw0t2a0f1s.png</file>
<file>images/mcw/gw0t2a0f2s.png</file>
<file>images/mcw/gw0t2a1f0s.png</file>
<file>images/mcw/gw0t2a1f1s.png</file>
<file>images/mcw/gw0t2a1f2s.png</file>
<file>images/mcw/gw0t2a2f0s.png</file>
<file>images/mcw/gw0t2a2f1s.png</file>
<file>images/mcw/gw0t2a2f2s.png</file>
<file>images/mcw/gw1t0a0f0s.png</file>
<file>images/mcw/gw1t1a0f0s.png</file>
<file>images/mcw/gw1t1a0f1s.png</file>
<file>images/mcw/gw1t1a0f2s.png</file>
<file>images/mcw/gw1t1a1f0s.png</file>
<file>images/mcw/gw1t1a1f1s.png</file>
<file>images/mcw/gw1t1a1f2s.png</file>
<file>images/mcw/gw1t1a2f0s.png</file>
<file>images/mcw/gw1t1a2f1s.png</file>
<file>images/mcw/gw1t1a2f2s.png</file>
<file>images/mcw/gw1t2a0f0s.png</file>
<file>images/mcw/gw1t2a0f1s.png</file>
<file>images/mcw/gw1t2a0f2s.png</file>
<file>images/mcw/gw1t2a1f0s.png</file>
<file>images/mcw/gw1t2a1f1s.png</file>
<file>images/mcw/gw1t2a1f2s.png</file>
<file>images/mcw/gw1t2a2f0s.png</file>
<file>images/mcw/gw1t2a2f1s.png</file>
<file>images/mcw/gw1t2a2f2s.png</file>
<file>images/mcw/db0t2e0f0r.png</file>
<file>images/mcw/db0t2e0f1r.png</file>
<file>images/mcw/db0t2e0f2r.png</file>
<file>images/mcw/db0t2e1f0r.png</file>
<file>images/mcw/db0t2e1f1r.png</file>
<file>images/mcw/db0t2e1f2r.png</file>
<file>images/mcw/db0t2e2f0r.png</file>
<file>images/mcw/db0t2e2f1r.png</file>
<file>images/mcw/db0t2e2f2r.png</file>
<file>images/mcw/db1t2e0f0r.png</file>
<file>images/mcw/db1t2e0f1r.png</file>
<file>images/mcw/db1t2e0f2r.png</file>
<file>images/mcw/db1t2e1f0r.png</file>
<file>images/mcw/db1t2e1f1r.png</file>
<file>images/mcw/db1t2e1f2r.png</file>
<file>images/mcw/db1t2e2f0r.png</file>
<file>images/mcw/db1t2e2f1r.png</file>
<file>images/mcw/db1t2e2f2r.png</file>
<file>images/mcw/dt0t2e0f0r.png</file>
<file>images/mcw/dt0t2e0f1r.png</file>
<file>images/mcw/dt0t2e0f2r.png</file>
<file>images/mcw/dt0t2e1f0r.png</file>
<file>images/mcw/dt0t2e1f1r.png</file>
<file>images/mcw/dt0t2e1f2r.png</file>
<file>images/mcw/dt0t2e2f0r.png</file>
<file>images/mcw/dt0t2e2f1r.png</file>
<file>images/mcw/dt0t2e2f2r.png</file>
<file>images/mcw/dt1t2e0f0r.png</file>
<file>images/mcw/dt1t2e0f1r.png</file>
<file>images/mcw/dt1t2e0f2r.png</file>
<file>images/mcw/dt1t2e1f0r.png</file>
<file>images/mcw/dt1t2e1f1r.png</file>
<file>images/mcw/dt1t2e1f2r.png</file>
<file>images/mcw/dt1t2e2f0r.png</file>
<file>images/mcw/dt1t2e2f1r.png</file>
<file>images/mcw/dt1t2e2f2r.png</file>
<file>images/taranison.png</file>
<file>images/wizard/ailerons.png</file>
<file>images/wizard/airbrakes.png</file>
<file>images/wizard/bank.png</file>
<file>images/wizard/conclusion.png</file>
<file>images/wizard/cyclic.png</file>
<file>images/wizard/fblheli.png</file>
<file>images/wizard/flaps.png</file>
<file>images/wizard/flybar.png</file>
<file>images/wizard/gyro.png</file>
<file>images/wizard/helictrl.png</file>
<file>images/wizard/models.png</file>
<file>images/wizard/multirotor.png</file>
<file>images/wizard/rudder.png</file>
<file>images/wizard/options.png</file>
<file>images/wizard/simpletail.png</file>
<file>images/wizard/tail.png</file>
<file>images/wizard/tails.png</file>
<file>images/wizard/throttle.png</file>
<file>images/wizard/vtail.png</file>
<file>images/wizard/wingtype.png</file>
<file>images/library/00001.png</file>
<file>images/library/00002.png</file>
<file>images/library/00003.png</file>
+114 -112
View File
@@ -24,58 +24,59 @@ 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")) {
event->acceptProposedAction();
} else {
}
else {
event->ignore();
}
}
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(FlightModes)) {
printPhases();
}
printExpos();
@@ -89,7 +90,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();
@@ -120,7 +121,7 @@ void compareDialog::dropEvent(QDropEvent *event)
}
}
else if (child->objectName().contains("label_2")) {
if(mimeData->hasFormat("application/x-companion")) {
if (mimeData->hasFormat("application/x-companion")) {
QByteArray gmData = mimeData->data("application/x-companion");
DragDropHeader *header = (DragDropHeader *)gmData.data();
if (!header->general_settings) {
@@ -153,7 +154,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 +164,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 +177,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 +185,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 +193,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 +210,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 +220,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 +230,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 +240,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 +248,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 +271,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 +294,7 @@ void compareDialog::printSetup()
te->append(str);
}
void compareDialog::printPhases()
void CompareDialog::printPhases()
{
QString color;
int i,k;
@@ -308,7 +309,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(FlightModes); 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,43 +335,44 @@ 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;
}
} else {
}
else {
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(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 (GetEepromInterface()->getCapability(GvarsFlightPhases)) {
if (GetCurrentFirmware()->getCapability(GvarsFlightModes)) {
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(GvarsFlightModes)) {
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(FlightModes); 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(GvarsFlightModes)) {
for (k=0; k<gvarnum; k++) {
color=getColor1(pd1->gvars[k],pd2->gvars[k]);
if (pd1->gvars[k]<=1024) {
@@ -383,7 +385,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 +411,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(FlightModes); 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 +436,32 @@ void compareDialog::printPhases()
}
str.append("</table>");
if ((gvars==1 && GetEepromInterface()->getCapability(GvarsFlightPhases)) || GetEepromInterface()->getCapability(RotaryEncoders)) {
if ((gvars==1 && 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 (GetEepromInterface()->getCapability(GvarsFlightPhases)) {
if (GetCurrentFirmware()->getCapability(GvarsFlightModes)) {
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(GvarsFlightModes)) {
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(FlightModes); 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(GvarsFlightModes)) {
for (k=0; k<gvarnum; k++) {
color=getColor1(pd1->gvars[k],pd2->gvars[k]);
if (pd2->gvars[k]<=1024) {
@@ -472,7 +474,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 +493,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 +531,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 +559,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(GvarsFlightModes) && (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 +607,7 @@ void compareDialog::printGvars()
}
}
void compareDialog::printExpos()
void CompareDialog::printExpos()
{
QString color;
bool expoused[C9X_MAX_EXPOS]={false};
@@ -614,7 +616,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 +653,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(FlightModes)) {
if(ed->phases) {
if (ed->phases!=(unsigned int)(1<<GetEepromInterface()->getCapability(FlightPhases))-1) {
if (ed->phases!=(unsigned int)(1<<GetCurrentFirmware()->getCapability(FlightModes))-1) {
int mask=1;
int first=0;
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases);i++) {
for (int i=0; i<GetCurrentFirmware()->getCapability(FlightModes);i++) {
if (!(ed->phases & mask)) {
first++;
}
@@ -669,7 +671,7 @@ void compareDialog::printExpos()
}
mask=1;
first=1;
for (int j=0; j<GetEepromInterface()->getCapability(FlightPhases);j++) {
for (int j=0; j<GetCurrentFirmware()->getCapability(FlightModes);j++) {
if (!(ed->phases & mask)) {
PhaseData *pd = &g_model1->phaseData[j];
if (!first) {
@@ -729,12 +731,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(FlightModes)) {
if(ed->phases) {
if (ed->phases!=(unsigned int)(1<<GetEepromInterface()->getCapability(FlightPhases))-1) {
if (ed->phases!=(unsigned int)(1<<GetCurrentFirmware()->getCapability(FlightModes))-1) {
int mask=1;
int first=0;
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases);i++) {
for (int i=0; i<GetCurrentFirmware()->getCapability(FlightModes);i++) {
if (!(ed->phases & mask)) {
first++;
}
@@ -747,7 +749,7 @@ void compareDialog::printExpos()
}
mask=1;
first=1;
for (int j=0; j<GetEepromInterface()->getCapability(FlightPhases);j++) {
for (int j=0; j<GetCurrentFirmware()->getCapability(FlightModes);j++) {
if (!(ed->phases & mask)) {
PhaseData *pd = &g_model2->phaseData[j];
if (!first) {
@@ -778,21 +780,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 +829,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(FlightModes)) {
if(md->phases) {
if (md->phases!=(unsigned int)(1<<GetEepromInterface()->getCapability(FlightPhases))-1) {
if (md->phases!=(unsigned int)(1<<GetCurrentFirmware()->getCapability(FlightModes))-1) {
int mask=1;
int first=0;
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases);i++) {
for (int i=0; i<GetCurrentFirmware()->getCapability(FlightModes);i++) {
if (!(md->phases & mask)) {
first++;
}
@@ -845,7 +847,7 @@ void compareDialog::printMixers()
}
mask=1;
first=1;
for (int j=0; j<GetEepromInterface()->getCapability(FlightPhases);j++) {
for (int j=0; j<GetCurrentFirmware()->getCapability(FlightModes);j++) {
if (!(md->phases & mask)) {
PhaseData *pd = &g_model1->phaseData[j];
if (!first) {
@@ -870,7 +872,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 +908,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(FlightModes)) {
if(md->phases) {
if (md->phases!=(unsigned int)(1<<GetEepromInterface()->getCapability(FlightPhases))-1) {
if (md->phases!=(unsigned int)(1<<GetCurrentFirmware()->getCapability(FlightModes))-1) {
int mask=1;
int first=0;
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases);i++) {
for (int i=0; i<GetCurrentFirmware()->getCapability(FlightModes);i++) {
if (!(md->phases & mask)) {
first++;
}
@@ -924,7 +926,7 @@ void compareDialog::printMixers()
}
mask=1;
first=1;
for (int j=0; j<GetEepromInterface()->getCapability(FlightPhases);j++) {
for (int j=0; j<GetCurrentFirmware()->getCapability(FlightModes);j++) {
if (!(md->phases & mask)) {
PhaseData *pd = &g_model2->phaseData[j];
if (!first) {
@@ -953,7 +955,7 @@ void compareDialog::printMixers()
te->append(str);
}
void compareDialog::printCurves()
void CompareDialog::printCurves()
{
#if 0
int i,r,g,b,c;
@@ -971,7 +973,7 @@ void compareDialog::printCurves()
QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-after:always;\" width=\"100%\"><tr><td><h2>";
str.append(tr("Curves"));
str.append("</h2></td></tr><tr><td>");
str.append("<table border=1 cellspacing=0 cellpadding=3 width=\"100%\"><tr><td colspan=11><b>"+tr("5 Points Curves")+"</b></td></tr><tr>");
str.append("<table border=1 cellspacing=0 cellpadding=3 width=\"100%\"><tr><td colspan=11><b>"+tr("5 Point Curves")+"</b></td></tr><tr>");
for(i=0; i<5; i++)
str.append(doTC(tr("pt %1").arg(i+1), "", true));
str.append("<td></td>");
@@ -1001,7 +1003,7 @@ void compareDialog::printCurves()
}
str.append("</table></td></tr><tr><td>");
str.append("<table border=1 cellspacing=0 cellpadding=3 width=\"100%\"><tr><td colspan=19><b>"+tr("9 Points Curves")+"</b></td></tr><tr>");
str.append("<table border=1 cellspacing=0 cellpadding=3 width=\"100%\"><tr><td colspan=19><b>"+tr("9 Point Curves")+"</b></td></tr><tr>");
for(i=0; i<9; i++)
str.append(doTC(tr("pt %1").arg(i+1), "", true));
str.append("<td></td>");
@@ -1033,14 +1035,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,13 +1065,13 @@ void compareDialog::printSwitches()
te->append(str);
}
void compareDialog::printFSwitches()
void CompareDialog::printFSwitches()
{
QString color1;
QString color2;
int sc=0;
QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-before:always;\" width=\"100%\">";
str.append("<tr><td><h2>"+tr("Switch Assignment")+"</h2></td></tr>");
str.append("<tr><td><h2>"+tr("Special Functions")+"</h2></td></tr>");
str.append("<tr><td><table border=1 cellspacing=0 cellpadding=1 width=\"100%\"><tr>");
str.append("<td width=\"7%\" align=\"center\"><b>"+tr("Switch")+"</b></td>");
str.append("<td width=\"12%\" align=\"center\"><b>"+tr("Function")+"</b></td>");
@@ -1083,7 +1085,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)) {
@@ -1112,7 +1114,7 @@ void compareDialog::printFSwitches()
} else {
str.append("<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>");
}
str.append(doTC(tr("CF")+QString("%1").arg(i+1),"",true));
str.append(doTC(tr("SF")+QString("%1").arg(i+1),"",true));
if (g_model2->funcSw[i].swtch.type) {
str.append(doTC(g_model2->funcSw[i].swtch.toString(),color2));
str.append(doTC(g_model2->funcSw[i].funcToString(),color2));
@@ -1142,7 +1144,7 @@ void compareDialog::printFSwitches()
te->append(str);
}
void compareDialog::printFrSky()
void CompareDialog::printFrSky()
{
QString color;
float value1,value2;
@@ -1212,10 +1214,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 +1333,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 +1393,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 +1404,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);
+3 -3
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>
@@ -131,7 +131,7 @@
<connection>
<sender>closeButton</sender>
<signal>clicked()</signal>
<receiver>compareDialog</receiver>
<receiver>CompareDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
+1 -1
View File
@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string/>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
+2 -2
View File
@@ -142,7 +142,7 @@ customizeSplashDialog::customizeSplashDialog(QWidget *parent) :
ui(new Ui::customizeSplashDialog)
{
ui->setupUi(this);
this->setWindowIcon(CompanionIcon("paint.png"));
setWindowIcon(CompanionIcon("paintbrush.png"));
ui->leftLibraryButton->setIcon(CompanionIcon("library.png"));
ui->rightLibraryButton->setIcon(CompanionIcon("library.png"));
@@ -225,7 +225,7 @@ void customizeSplashDialog::loadProfile(Side side)
if (!fileName.isEmpty()) {
if (!side.displayImage( fileName, PROFILE ))
QMessageBox::critical(this, tr("Error"), tr("Cannot load the profile image %1.").arg(fileName));
QMessageBox::critical(this, tr("Error"), tr("Cannot load profile image %1.").arg(fileName));
}
side.markSourceButton();
}
+7 -1
View File
@@ -10,7 +10,7 @@
<x>0</x>
<y>0</y>
<width>1087</width>
<height>285</height>
<height>298</height>
</rect>
</property>
<property name="sizePolicy">
@@ -165,6 +165,9 @@
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="text">
<string/>
</property>
@@ -470,6 +473,9 @@
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="text">
<string/>
</property>
+12
View File
@@ -2,6 +2,7 @@
#include "ui_downloaddialog.h"
#include <QMessageBox>
#include <QtGui>
#include <QTime>
#include "helpers.h"
downloadDialog::downloadDialog(QWidget *parent, QString src, QString tgt) :
@@ -87,3 +88,14 @@ void downloadDialog::fileError()
file = 0;
reject();
}
void downloadDialog::closeEvent( QCloseEvent * event)
{
// Delay closing 2 seconds to avoid unpleasant flashing download dialogs
QTime closeTime= QTime::currentTime().addSecs(2);
while( QTime::currentTime() < closeTime )
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
event->accept();
}
+1
View File
@@ -27,6 +27,7 @@ private slots:
void updateDataReadProgress(qint64 bytesRead, qint64 totalBytes);
private:
void closeEvent( QCloseEvent * event);
Ui::downloadDialog *ui;
QNetworkAccessManager qnam;
+14 -10
View File
@@ -638,41 +638,45 @@ class ConversionField: public TransformedField {
virtual void beforeExport()
{
int val = field;
_field = field;
if (scale) {
val /= scale;
_field /= scale;
}
if (table) {
if (table->exportValue(val, _field))
if (table->exportValue(_field, _field))
return;
if (!error.isEmpty())
EEPROMWarnings += error + "\n";
}
if (shift) {
if (val < min) _field = min + shift;
else if (val > max) _field = max + shift;
else _field = val + shift;
if (_field < min) _field = min + shift;
else if (_field > max) _field = max + shift;
else _field += shift;
}
if (exportFunc) {
_field = exportFunc(val);
_field = exportFunc(_field);
}
}
virtual void afterImport()
{
field = _field;
if (table) {
if (table->importValue(_field, field))
if (table->importValue(field, field))
return;
}
field = _field - shift;
if (shift) {
field -= shift;
}
if (importFunc) {
field = importFunc(_field);
field = importFunc(field);
}
if (scale) {
+320 -179
View File
@@ -5,14 +5,27 @@
#include "firmwares/th9x/th9xinterface.h"
#include "firmwares/gruvin9x/gruvin9xinterface.h"
#include "firmwares/opentx/opentxinterface.h"
#include "firmwares/opentx/opentxeeprom.h"
#include "firmwares/ersky9x/ersky9xinterface.h"
#include "appdata.h"
#include "helpers.h"
#include "wizarddata.h"
QString EEPROMWarnings;
const char * switches9X[] = { "3POS", "THR", "RUD", "ELE", "AIL", "GEA", "TRN" };
const char * switchesX9D[] = { "SA", "SB", "SC", "SD", "SE", "SF", "SG", "SH" };
const char leftArrow[] = {(char)0xE2, (char)0x86, (char)0x90, 0};
const char rightArrow[] = {(char)0xE2, (char)0x86, (char)0x92, 0};
const char upArrow[] = {(char)0xE2, (char)0x86, (char)0x91, 0};
const char downArrow[] = {(char)0xE2, (char)0x86, (char)0x93, 0};
const uint8_t chout_ar[] = { // First number is 0..23 -> template setup, Second is relevant channel out
1,2,3,4 , 1,2,4,3 , 1,3,2,4 , 1,3,4,2 , 1,4,2,3 , 1,4,3,2,
2,1,3,4 , 2,1,4,3 , 2,3,1,4 , 2,3,4,1 , 2,4,1,3 , 2,4,3,1,
3,1,2,4 , 3,1,4,2 , 3,2,1,4 , 3,2,4,1 , 3,4,1,2 , 3,4,2,1,
4,1,2,3 , 4,1,3,2 , 4,2,1,3 , 4,2,3,1 , 4,3,1,2 , 4,3,2,1
};
void setEEPROMString(char *dst, const char *src, int size)
{
@@ -84,7 +97,7 @@ RawSourceRange RawSource::getRange(bool singleprec)
int board = GetEepromInterface()->getBoard();
if (!singleprec && !IS_TARANIS(board)) {
if (!singleprec && !IS_ARM(board)) {
singleprec = true;
}
@@ -96,6 +109,10 @@ RawSourceRange RawSource::getRange(bool singleprec)
result.decimals = 1;
result.max = 25.5;
break;
case TELEMETRY_SOURCE_TX_TIME:
result.step = 1;
result.max = 24*60 - 1;
break;
case TELEMETRY_SOURCE_TIMER1:
case TELEMETRY_SOURCE_TIMER2:
result.step = singleprec ? 5 : 1;
@@ -104,6 +121,7 @@ RawSourceRange RawSource::getRange(bool singleprec)
case TELEMETRY_SOURCE_RSSI_TX:
case TELEMETRY_SOURCE_RSSI_RX:
result.max = 100;
if (singleprec) result.offset = 128;
break;
case TELEMETRY_SOURCE_A1:
case TELEMETRY_SOURCE_A2:
@@ -126,11 +144,19 @@ RawSourceRange RawSource::getRange(bool singleprec)
result.max = singleprec ? 1540 : 3000;
break;
case TELEMETRY_SOURCE_T1:
case TELEMETRY_SOURCE_T1_MAX:
case TELEMETRY_SOURCE_T2:
case TELEMETRY_SOURCE_T2_MAX:
result.min = -30;
result.max = 225;
break;
case TELEMETRY_SOURCE_HDG:
result.step = singleprec ? 2 : 1;
result.max = 360;
if (singleprec) result.offset = 256;
break;
case TELEMETRY_SOURCE_RPM:
case TELEMETRY_SOURCE_RPM_MAX:
result.step = singleprec ? 50 : 1;
result.max = singleprec ? 12750 : 20000;
break;
@@ -138,46 +164,66 @@ RawSourceRange RawSource::getRange(bool singleprec)
result.max = 100;
break;
case TELEMETRY_SOURCE_SPEED:
case TELEMETRY_SOURCE_SPEED_MAX:
result.step = singleprec ? 4 : 1;
result.max = singleprec ? 944 : 2000;
result.max = singleprec ? (4*236) : 2000;
if (model && !model->frsky.imperial) {
result.step *= 1.852;
result.max *= 1.852;
}
break;
case TELEMETRY_SOURCE_VERTICAL_SPEED:
result.step = 0.1;
result.min = -12.5;
result.max = 13.0;
result.decimals = 1;
break;
case TELEMETRY_SOURCE_DIST:
case TELEMETRY_SOURCE_DIST_MAX:
result.step = singleprec ? 8 : 1;
result.max = singleprec ? 2040 : 10000;
break;
case TELEMETRY_SOURCE_CELL:
case TELEMETRY_SOURCE_CELL_MIN:
result.step = singleprec ? 0.02 : 0.01;
result.max = 5.1;
result.decimals = 2;
break;
case TELEMETRY_SOURCE_CELLS_SUM:
case TELEMETRY_SOURCE_CELLS_MIN:
case TELEMETRY_SOURCE_VFAS:
case TELEMETRY_SOURCE_VFAS_MIN:
result.step = 0.1;
result.max = 25.5;
result.decimals = 1;
break;
case TELEMETRY_SOURCE_CURRENT:
case TELEMETRY_SOURCE_CURRENT_MAX:
result.step = singleprec ? 0.5 : 0.1;
result.max = singleprec ? 127.5 : 200.0;
result.decimals = 1;
break;
case TELEMETRY_SOURCE_CONSUMPTION:
result.step = singleprec ? 20 : 1;
result.max = singleprec ? 5100 : 10000;
result.step = singleprec ? 100 : 1;
result.max = singleprec ? 25500 : 10000;
break;
case TELEMETRY_SOURCE_POWER:
case TELEMETRY_SOURCE_POWER_MAX:
result.step = singleprec ? 5 : 1;
result.max = singleprec ? 1275 : 2000;
break;
case TELEMETRY_SOURCE_ACCX:
case TELEMETRY_SOURCE_ACCY:
case TELEMETRY_SOURCE_ACCZ:
result.step = 0.01;
result.decimals = 2;
result.max = 2.55;
break;
default:
result.max = 125;
break;
}
if (singleprec) {
if (singleprec && !result.offset) {
result.offset = result.max - (127*result.step);
}
break;
@@ -216,25 +262,25 @@ QString RawSource::toString()
};
static const QString telemetry[] = {
QObject::tr("Batt"), QObject::tr("Timer1"), QObject::tr("Timer2"),
QObject::tr("Batt"), QObject::tr("Time"), QObject::tr("Timer1"), QObject::tr("Timer2"),
QObject::tr("SWR"), QObject::tr("RSSI Tx"), QObject::tr("RSSI Rx"), QObject::tr("Rx Batt"),
QObject::tr("A1"), QObject::tr("A2"), QObject::tr("A3"), QObject::tr("A4"),
QObject::tr("Alt"), QObject::tr("Rpm"), QObject::tr("Fuel"), QObject::tr("T1"), QObject::tr("T2"),
QObject::tr("Speed"), QObject::tr("Dist"), QObject::tr("GPS Alt"),
QObject::tr("Cell"), QObject::tr("Cels"), QObject::tr("Vfas"), QObject::tr("Curr"), QObject::tr("Cnsp"), QObject::tr("Powr"),
QObject::tr("Cell"), QObject::tr("Cells"), QObject::tr("Vfas"), QObject::tr("Curr"), QObject::tr("Cnsp"), QObject::tr("Powr"),
QObject::tr("AccX"), QObject::tr("AccY"), QObject::tr("AccZ"),
QObject::tr("HDG "), QObject::tr("VSpd"), QObject::tr("ASpd"), QObject::tr("dTE"),
QObject::tr("Hdg "), QObject::tr("VSpd"), QObject::tr("AirSpeed"), QObject::tr("dTE"),
QObject::tr("A1-"), QObject::tr("A2-"), QObject::tr("A3-"), QObject::tr("A4-"),
QObject::tr("Alt-"), QObject::tr("Alt+"), QObject::tr("Rpm+"), QObject::tr("T1+"), QObject::tr("T2+"), QObject::tr("Spd+"), QObject::tr("Dst+"),
QObject::tr("Cel-"), QObject::tr("Cels-"), QObject::tr("Vfs-"), QObject::tr("Cur+"), QObject::tr("Pwr+"),
QObject::tr("ACC"), QObject::tr("Time"),
QObject::tr("Alt-"), QObject::tr("Alt+"), QObject::tr("Rpm+"), QObject::tr("T1+"), QObject::tr("T2+"), QObject::tr("Speed+"), QObject::tr("Dist+"), QObject::tr("AirSpeed+"),
QObject::tr("Cell-"), QObject::tr("Cells-"), QObject::tr("Vfas-"), QObject::tr("Curr+"), QObject::tr("Powr+"),
QObject::tr("ACC"), QObject::tr("GPS Time"),
};
static const QString virtualSwitches[] = {
QObject::tr("LS1"), QObject::tr("LS2"), QObject::tr("LS3"), QObject::tr("LS4"), QObject::tr("LS5"), QObject::tr("LS6"), QObject::tr("LS7"), QObject::tr("LS8"), QObject::tr("LS9"), QObject::tr("LSA"),
QObject::tr("LSB"), QObject::tr("LSC"), QObject::tr("LSD"), QObject::tr("LSE"), QObject::tr("LSF"), QObject::tr("LSG"), QObject::tr("LSH"), QObject::tr("LSI"), QObject::tr("LSJ"), QObject::tr("LSK"),
QObject::tr("LSL"), QObject::tr("LSM"), QObject::tr("LSN"), QObject::tr("LSO"), QObject::tr("LSP"), QObject::tr("LSQ"), QObject::tr("LSR"), QObject::tr("LSS"), QObject::tr("LST"), QObject::tr("LSU"),
QObject::tr("LSV"), QObject::tr("LSW")
static const QString logicalSwitches[] = {
QObject::tr("L1"), QObject::tr("L2"), QObject::tr("L3"), QObject::tr("L4"), QObject::tr("L5"), QObject::tr("L6"), QObject::tr("L7"), QObject::tr("L8"), QObject::tr("L9"), QObject::tr("L10"),
QObject::tr("L11"), QObject::tr("L12"), QObject::tr("L13"), QObject::tr("L14"), QObject::tr("L15"), QObject::tr("L16"), QObject::tr("L17"), QObject::tr("L18"), QObject::tr("L19"), QObject::tr("L20"),
QObject::tr("L21"), QObject::tr("L22"), QObject::tr("L23"), QObject::tr("L24"), QObject::tr("L25"), QObject::tr("L26"), QObject::tr("L27"), QObject::tr("L28"), QObject::tr("L29"), QObject::tr("L30"),
QObject::tr("L31"), QObject::tr("L32")
};
if (index<0) {
@@ -260,16 +306,13 @@ QString RawSource::toString()
case SOURCE_TYPE_SWITCH:
return (IS_TARANIS(GetEepromInterface()->getBoard()) ? CHECK_IN_ARRAY(switchesX9D, index) : CHECK_IN_ARRAY(switches9X, index));
case SOURCE_TYPE_CUSTOM_SWITCH:
return virtualSwitches[index];
return logicalSwitches[index];
case SOURCE_TYPE_CYC:
return QObject::tr("CYC%1").arg(index+1);
case SOURCE_TYPE_PPM:
return QObject::tr("PPM%1").arg(index+1);
return QObject::tr("TR%1").arg(index+1);
case SOURCE_TYPE_CH:
if (index < GetEepromInterface()->getCapability(Outputs))
return QObject::tr("CH%1%2").arg((index+1)/10).arg((index+1)%10);
else
return QObject::tr("X%1").arg(index-GetEepromInterface()->getCapability(Outputs)+1);
return QObject::tr("CH%1").arg(index+1);
case SOURCE_TYPE_TELEMETRY:
return CHECK_IN_ARRAY(telemetry, index);
case SOURCE_TYPE_GVAR:
@@ -281,13 +324,13 @@ QString RawSource::toString()
QString SwitchUp(const char sw)
{
const char result[] = {'S', sw, (char)0xE2, (char)0x86, (char)0x91, 0};
const char result[] = {'S', sw, upArrow[0], upArrow[1], upArrow[2], 0};
return QString::fromUtf8(result);
}
QString SwitchDn(const char sw)
{
const char result[] = {'S', sw, (char)0xE2, (char)0x86, (char)0x93, 0};
const char result[] = {'S', sw, downArrow[0], downArrow[1], downArrow[2], 0};
return QString::fromUtf8(result);
}
@@ -310,11 +353,15 @@ QString RawSwitch::toString()
SwitchUp('H'), SwitchDn('H'),
};
static const QString virtualSwitches[] = {
QObject::tr("LS1"), QObject::tr("LS2"), QObject::tr("LS3"), QObject::tr("LS4"), QObject::tr("LS5"), QObject::tr("LS6"), QObject::tr("LS7"), QObject::tr("LS8"), QObject::tr("LS9"), QObject::tr("LSA"),
QObject::tr("LSB"), QObject::tr("LSC"), QObject::tr("LSD"), QObject::tr("LSE"), QObject::tr("LSF"), QObject::tr("LSG"), QObject::tr("LSH"), QObject::tr("LSI"), QObject::tr("LSJ"), QObject::tr("LSK"),
QObject::tr("LSL"), QObject::tr("LSM"), QObject::tr("LSN"), QObject::tr("LSO"), QObject::tr("LSP"), QObject::tr("LSQ"), QObject::tr("LSR"), QObject::tr("LSS"), QObject::tr("LST"), QObject::tr("LSU"),
QObject::tr("LSV"), QObject::tr("LSW")
static const QString logicalSwitches[] = {
QObject::tr("L1"), QObject::tr("L2"), QObject::tr("L3"), QObject::tr("L4"), QObject::tr("L5"), QObject::tr("L6"), QObject::tr("L7"), QObject::tr("L8"), QObject::tr("L9"), QObject::tr("L10"),
QObject::tr("L11"), QObject::tr("L12"), QObject::tr("L13"), QObject::tr("L14"), QObject::tr("L15"), QObject::tr("L16"), QObject::tr("L17"), QObject::tr("L18"), QObject::tr("L19"), QObject::tr("L20"),
QObject::tr("L21"), QObject::tr("L22"), QObject::tr("L23"), QObject::tr("L24"), QObject::tr("L25"), QObject::tr("L26"), QObject::tr("L27"), QObject::tr("L28"), QObject::tr("L29"), QObject::tr("L30"),
QObject::tr("L31"), QObject::tr("L32")
};
static const QString flightModes[] = {
QObject::tr("FM0"), QObject::tr("FM1"), QObject::tr("FM2"), QObject::tr("FM3"), QObject::tr("FM4"), QObject::tr("FM5"), QObject::tr("FM6"), QObject::tr("FM7"), QObject::tr("FM8")
};
static const QString multiposPots[] = {
@@ -350,7 +397,7 @@ QString RawSwitch::toString()
else
return CHECK_IN_ARRAY(switches9X, index-1);
case SWITCH_TYPE_VIRTUAL:
return CHECK_IN_ARRAY(virtualSwitches, index-1);
return CHECK_IN_ARRAY(logicalSwitches, index-1);
case SWITCH_TYPE_MULTIPOS_POT:
return CHECK_IN_ARRAY(multiposPots, index-1);
case SWITCH_TYPE_TRIM:
@@ -361,6 +408,8 @@ QString RawSwitch::toString()
return QObject::tr("ON");
case SWITCH_TYPE_OFF:
return QObject::tr("OFF");
case SWITCH_TYPE_FLIGHT_MODE:
return CHECK_IN_ARRAY(flightModes, index-1);
case SWITCH_TYPE_NONE:
return QObject::tr("----");
case SWITCH_TYPE_TIMER_MODE:
@@ -450,7 +499,7 @@ QString LogicalSwitchData::funcToString()
case LS_FN_STICKY:
return QObject::tr("Sticky");
case LS_FN_STAY:
return QObject::tr("Stay");
return QObject::tr("Edge");
default:
return QObject::tr("Unknown");
}
@@ -468,36 +517,43 @@ QString LogicalSwitchData::toString(const ModelData & model)
}
switch (getFunctionFamily()) {
case LS_FAMILY_STAY:
result = QObject::tr("STAY(%1, [%2:%3])").arg(RawSwitch(val1).toString()).arg(ValToTim(val2)).arg(ValToTim(val2+val3));
result += QObject::tr("Edge(%1, [%2:%3])").arg(RawSwitch(val1).toString()).arg(ValToTim(val2)).arg(ValToTim(val2+val3));
break;
case LS_FAMILY_STICKY:
result = QObject::tr("STICKY(%1, %2)").arg(RawSwitch(val1).toString()).arg(RawSwitch(val2).toString());
result += QObject::tr("Sticky(%1, %2)").arg(RawSwitch(val1).toString()).arg(RawSwitch(val2).toString());
break;
case LS_FAMILY_TIMER:
result = QObject::tr("TIMER(%1, %2)").arg(ValToTim(val1)).arg(ValToTim(val2));
result += QObject::tr("Timer(%1, %2)").arg(ValToTim(val1)).arg(ValToTim(val2));
break;
case LS_FAMILY_VOFS: {
RawSource source = RawSource(val1, &model);
RawSourceRange range = source.getRange();
QString res;
if (val1)
result += source.toString();
res += source.toString();
else
result += "0";
result.remove(" ");
res += "0";
res.remove(" ");
if (func == LS_FN_APOS || func == LS_FN_ANEG)
result = "|" + result + "|";
res = "|" + res + "|";
else if (func == LS_FN_DAPOS)
result = "|d(" + result + ")|";
else if (func == LS_FN_DPOS) result = "d(" + result + ")";
res = "|d(" + res + ")|";
else if (func == LS_FN_DPOS) result = "d(" + res + ")";
result += res;
if (func == LS_FN_APOS || func == LS_FN_VPOS || func == LS_FN_DAPOS || func == LS_FN_DPOS)
result += " &gt; ";
else if (func == LS_FN_ANEG || func == LS_FN_VNEG)
result += " &lt; ";
else if (func == LS_FN_VALMOSTEQUAL)
result += " ~ ";
else
result += " missing";
result += QString::number(range.step * (val2 /*TODO+ source.getRawOffset(model)*/) + range.offset);
break;
}
case LS_FAMILY_VBOOL:
result = RawSwitch(val1).toString();
result += RawSwitch(val1).toString();
switch (func) {
case LS_FN_AND:
result += " AND ";
@@ -508,7 +564,8 @@ QString LogicalSwitchData::toString(const ModelData & model)
case LS_FN_XOR:
result += " XOR ";
break;
default:
default:
result += " bar ";
break;
}
result += RawSwitch(val2).toString();
@@ -521,6 +578,7 @@ QString LogicalSwitchData::toString(const ModelData & model)
result += "0";
switch (func) {
case LS_FN_EQUAL:
case LS_FN_VEQUAL:
result += " = ";
break;
case LS_FN_NEQUAL:
@@ -539,6 +597,7 @@ QString LogicalSwitchData::toString(const ModelData & model)
result += " &lt;= ";
break;
default:
result += " foo ";
break;
}
if (val2)
@@ -553,11 +612,11 @@ QString LogicalSwitchData::toString(const ModelData & model)
result += RawSwitch(andsw).toString();
}
if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) {
if (delay)
result += QObject::tr(" Delay %1 sec").arg(delay/10.0);
if (GetCurrentFirmware()->getCapability(LogicalSwitchesExt)) {
if (duration)
result += QObject::tr(" Duration %1 sec").arg(duration/10.0);
result += QObject::tr(" Duration (%1s)").arg(duration/10.0);
if (delay)
result += QObject::tr(" Delay (%1s)").arg(delay/10.0);
}
return result;
@@ -605,7 +664,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;
@@ -735,7 +794,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;
@@ -781,121 +840,157 @@ QString FuncSwData::repeatToString()
GeneralSettings::GeneralSettings()
{
memset(this, 0, sizeof(GeneralSettings));
contrast = 25;
vBatWarn = 90;
for (int i=0; i<(NUM_STICKS+C9X_NUM_POTS ); ++i) {
for (int i=0; i<NUM_STICKS+C9X_NUM_POTS; ++i) {
calibMid[i] = 0x200;
calibSpanNeg[i] = 0x180;
calibSpanPos[i] = 0x180;
}
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
potsType[0] = 1;
potsType[1] = 1;
}
templateSetup = g.profile[g.id()].channelOrder();
stickMode = g.profile[g.id()].defaultMode();
QString t_calib=g.profile[g.id()].stickPotCalib();
int potsnum=GetEepromInterface()->getCapability(Pots);
if (t_calib.isEmpty()) {
return;
}
else {
QString t_trainercalib=g.profile[g.id()].trainerCalib();
int8_t t_vBatCalib=(int8_t)g.profile[g.id()].vBatCalib();
int8_t t_currentCalib=(int8_t)g.profile[g.id()].currentCalib();
int8_t t_PPM_Multiplier=(int8_t)g.profile[g.id()].ppmMultiplier();
uint8_t t_stickMode=(uint8_t)g.profile[g.id()].gsStickMode();
uint8_t t_vBatWarn=(uint8_t)g.profile[g.id()].vBatWarn();
QString t_DisplaySet=g.profile[g.id()].display();
QString t_BeeperSet=g.profile[g.id()].beeper();
QString t_HapticSet=g.profile[g.id()].haptic();
QString t_SpeakerSet=g.profile[g.id()].speaker();
QString t_CountrySet=g.profile[g.id()].countryCode();
QString t_calib=g.profile[g.id()].stickPotCalib();
int potsnum=GetCurrentFirmware()->getCapability(Pots);
if (t_calib.isEmpty()) {
return;
}
else {
QString t_trainercalib=g.profile[g.id()].trainerCalib();
int8_t t_vBatCalib=(int8_t)g.profile[g.id()].vBatCalib();
int8_t t_currentCalib=(int8_t)g.profile[g.id()].currentCalib();
int8_t t_PPM_Multiplier=(int8_t)g.profile[g.id()].ppmMultiplier();
uint8_t t_stickMode=(uint8_t)g.profile[g.id()].gsStickMode();
uint8_t t_vBatWarn=(uint8_t)g.profile[g.id()].vBatWarn();
QString t_DisplaySet=g.profile[g.id()].display();
QString t_BeeperSet=g.profile[g.id()].beeper();
QString t_HapticSet=g.profile[g.id()].haptic();
QString t_SpeakerSet=g.profile[g.id()].speaker();
QString t_CountrySet=g.profile[g.id()].countryCode();
if ((t_calib.length()==(NUM_STICKS+potsnum)*12) && (t_trainercalib.length()==16)) {
QString Byte;
int16_t byte16;
bool ok;
for (int i=0; i<(NUM_STICKS+potsnum); i++) {
Byte=t_calib.mid(i*12,4);
byte16=(int16_t)Byte.toInt(&ok,16);
if (ok)
calibMid[i]=byte16;
Byte=t_calib.mid(4+i*12,4);
byte16=(int16_t)Byte.toInt(&ok,16);
if (ok)
calibSpanNeg[i]=byte16;
Byte=t_calib.mid(8+i*12,4);
byte16=(int16_t)Byte.toInt(&ok,16);
if (ok)
calibSpanPos[i]=byte16;
}
for (int i=0; i<4; i++) {
Byte=t_trainercalib.mid(i*4,4);
byte16=(int16_t)Byte.toInt(&ok,16);
if (ok)
trainer.calib[i]=byte16;
}
currentCalib=t_currentCalib;
vBatCalib=t_vBatCalib;
vBatWarn=t_vBatWarn;
PPM_Multiplier=t_PPM_Multiplier;
stickMode = t_stickMode;
if ((t_calib.length()==(NUM_STICKS+potsnum)*12) && (t_trainercalib.length()==16)) {
QString Byte;
int16_t byte16;
bool ok;
for (int i=0; i<(NUM_STICKS+potsnum); i++) {
Byte=t_calib.mid(i*12,4);
byte16=(int16_t)Byte.toInt(&ok,16);
if (ok)
calibMid[i]=byte16;
Byte=t_calib.mid(4+i*12,4);
byte16=(int16_t)Byte.toInt(&ok,16);
if (ok)
calibSpanNeg[i]=byte16;
Byte=t_calib.mid(8+i*12,4);
byte16=(int16_t)Byte.toInt(&ok,16);
if (ok)
calibSpanPos[i]=byte16;
}
if ((t_DisplaySet.length()==6) && (t_BeeperSet.length()==4) && (t_HapticSet.length()==6) && (t_SpeakerSet.length()==6)) {
uint8_t byte8u;
int8_t byte8;
bool ok;
byte8=(int8_t)t_DisplaySet.mid(0,2).toInt(&ok,16);
for (int i=0; i<4; i++) {
Byte=t_trainercalib.mid(i*4,4);
byte16=(int16_t)Byte.toInt(&ok,16);
if (ok)
optrexDisplay=(byte8==1 ? true : false);
byte8u=(uint8_t)t_DisplaySet.mid(2,2).toUInt(&ok,16);
trainer.calib[i]=byte16;
}
currentCalib=t_currentCalib;
vBatCalib=t_vBatCalib;
vBatWarn=t_vBatWarn;
PPM_Multiplier=t_PPM_Multiplier;
stickMode = t_stickMode;
}
if ((t_DisplaySet.length()==6) && (t_BeeperSet.length()==4) && (t_HapticSet.length()==6) && (t_SpeakerSet.length()==6)) {
uint8_t byte8u;
int8_t byte8;
bool ok;
byte8=(int8_t)t_DisplaySet.mid(0,2).toInt(&ok,16);
if (ok)
optrexDisplay=(byte8==1 ? true : false);
byte8u=(uint8_t)t_DisplaySet.mid(2,2).toUInt(&ok,16);
if (ok)
contrast=byte8u;
byte8u=(uint8_t)t_DisplaySet.mid(4,2).toUInt(&ok,16);
if (ok)
backlightBright=byte8u;
byte8=(int8_t)t_BeeperSet.mid(0,2).toUInt(&ok,16);
if (ok)
beeperMode=(BeeperMode)byte8;
byte8=(int8_t)t_BeeperSet.mid(2,2).toInt(&ok,16);
if (ok)
beeperLength=byte8;
byte8=(int8_t)t_HapticSet.mid(0,2).toUInt(&ok,16);
if (ok)
hapticMode=(BeeperMode)byte8;
byte8u=(uint8_t)t_HapticSet.mid(2,2).toUInt(&ok,16);
if (ok)
hapticStrength=byte8u;
byte8=(int8_t)t_HapticSet.mid(4,2).toInt(&ok,16);
if (ok)
hapticLength=byte8;
byte8u=(uint8_t)t_SpeakerSet.mid(0,2).toUInt(&ok,16);
if (ok)
speakerMode=byte8u;
byte8u=(uint8_t)t_SpeakerSet.mid(2,2).toUInt(&ok,16);
if (ok)
speakerPitch=byte8u;
byte8u=(uint8_t)t_SpeakerSet.mid(4,2).toUInt(&ok,16);
if (ok)
speakerVolume=byte8u;
if (t_CountrySet.length()==6) {
byte8u=(uint8_t)t_CountrySet.mid(0,2).toUInt(&ok,16);
if (ok)
contrast=byte8u;
byte8u=(uint8_t)t_DisplaySet.mid(4,2).toUInt(&ok,16);
countryCode=byte8u;
byte8u=(uint8_t)t_CountrySet.mid(2,2).toUInt(&ok,16);
if (ok)
backlightBright=byte8u;
byte8=(int8_t)t_BeeperSet.mid(0,2).toUInt(&ok,16);
if (ok)
beeperMode=(BeeperMode)byte8;
byte8=(int8_t)t_BeeperSet.mid(2,2).toInt(&ok,16);
if (ok)
beeperLength=byte8;
byte8=(int8_t)t_HapticSet.mid(0,2).toUInt(&ok,16);
if (ok)
hapticMode=(BeeperMode)byte8;
byte8u=(uint8_t)t_HapticSet.mid(2,2).toUInt(&ok,16);
if (ok)
hapticStrength=byte8u;
byte8=(int8_t)t_HapticSet.mid(4,2).toInt(&ok,16);
if (ok)
hapticLength=byte8;
byte8u=(uint8_t)t_SpeakerSet.mid(0,2).toUInt(&ok,16);
if (ok)
speakerMode=byte8u;
byte8u=(uint8_t)t_SpeakerSet.mid(2,2).toUInt(&ok,16);
if (ok)
speakerPitch=byte8u;
byte8u=(uint8_t)t_SpeakerSet.mid(4,2).toUInt(&ok,16);
if (ok)
speakerVolume=byte8u;
if (t_CountrySet.length()==6) {
byte8u=(uint8_t)t_CountrySet.mid(0,2).toUInt(&ok,16);
if (ok)
countryCode=byte8u;
byte8u=(uint8_t)t_CountrySet.mid(2,2).toUInt(&ok,16);
if (ok)
imperial=byte8u;
QString chars=t_CountrySet.mid(4,2);
ttsLanguage[0]=chars[0].toAscii();
ttsLanguage[1]=chars[1].toAscii();
}
imperial=byte8u;
QString chars=t_CountrySet.mid(4,2);
ttsLanguage[0]=chars[0].toAscii();
ttsLanguage[1]=chars[1].toAscii();
}
}
}
}
RawSource GeneralSettings::getDefaultSource(unsigned int channel)
int GeneralSettings::getDefaultStick(unsigned int channel) const
{
unsigned int stick_index = chout_ar[4*templateSetup + channel] - 1;
return RawSource(SOURCE_TYPE_STICK, stick_index);
if (channel >= NUM_STICKS)
return -1;
else
return chout_ar[4*templateSetup + channel] - 1;
}
RawSource GeneralSettings::getDefaultSource(unsigned int channel) const
{
int stick = getDefaultStick(channel);
if (stick >= 0)
return RawSource(SOURCE_TYPE_STICK, stick);
else
return RawSource(SOURCE_TYPE_NONE);
}
int GeneralSettings::getDefaultChannel(unsigned int stick) const
{
for (int i=0; i<4; i++){
if (getDefaultStick(i) == (int)stick)
return i;
}
return -1;
}
void FrSkyData::clear()
{
memset(this, 0, sizeof(FrSkyData));
rssiAlarms[0].clear(2, 45);
rssiAlarms[1].clear(3, 42);
varioSource = 2/*VARIO*/;
blades = 2;
}
ModelData::ModelData()
@@ -903,6 +998,24 @@ ModelData::ModelData()
clear();
}
ModelData::ModelData(const ModelData & src)
{
*this = src;
}
ModelData & ModelData::operator = (const ModelData & src)
{
memcpy(this, &src, sizeof(ModelData));
for (int i=0; i<C9X_MAX_MIXERS; i++)
mixData[i].srcRaw.model = this;
for (int i=0; i<C9X_MAX_EXPOS; i++)
expoData[i].srcRaw.model = this;
swashRingData.collectiveSource.model = this;
return *this;
}
ExpoData * ModelData::insertInput(const int idx)
{
memmove(&expoData[idx+1], &expoData[idx], (C9X_MAX_EXPOS-(idx+1))*sizeof(ExpoData));
@@ -910,6 +1023,17 @@ ExpoData * ModelData::insertInput(const int idx)
return &expoData[idx];
}
bool ModelData::isInputValid(const unsigned int idx) const
{
for (int i=0; i<C9X_MAX_EXPOS; i++) {
const ExpoData * expo = &expoData[i];
if (expo->mode == 0) break;
if (expo->chn == idx)
return true;
}
return false;
}
void ModelData::removeInput(const int idx)
{
memmove(&expoData[idx], &expoData[idx+1], (C9X_MAX_EXPOS-(idx+1))*sizeof(ExpoData));
@@ -946,7 +1070,7 @@ void ModelData::clear()
moduleData[0].protocol=PPM;
moduleData[1].protocol=OFF;
}
for (int i=0; i<C9X_MAX_PHASES; i++)
for (int i=0; i<C9X_MAX_FLIGHT_MODES; i++)
phaseData[i].clear();
clearInputs();
clearMixes();
@@ -971,7 +1095,7 @@ bool ModelData::isempty()
return !used;
}
void ModelData::setDefaultMixes(GeneralSettings & settings)
void ModelData::setDefaultInputs(const GeneralSettings & settings)
{
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
for (int i=0; i<NUM_STICKS; i++) {
@@ -981,22 +1105,30 @@ void ModelData::setDefaultMixes(GeneralSettings & settings)
expo->srcRaw = settings.getDefaultSource(i);
expo->weight = 100;
strncpy(inputNames[i], expo->srcRaw.toString().toLatin1().constData(), sizeof(inputNames[i])-1);
MixData * mix = &mixData[i];
mix->destCh = i+1;
mix->weight = 100;
mix->srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i, this);
}
}
else {
for (int i=0; i<NUM_STICKS; i++) {
mixData[i].destCh = i+1;
mixData[i].srcRaw = RawSource(SOURCE_TYPE_STICK, i);
mixData[i].weight = 100;
}
}
}
void ModelData::setDefaultValues(unsigned int id, GeneralSettings & settings)
void ModelData::setDefaultMixes(const GeneralSettings & settings)
{
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
setDefaultInputs(settings);
}
for (int i=0; i<NUM_STICKS; i++) {
MixData * mix = &mixData[i];
mix->destCh = i+1;
mix->weight = 100;
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
mix->srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i, this);
}
else {
mix->srcRaw = RawSource(SOURCE_TYPE_STICK, i);
}
}
}
void ModelData::setDefaultValues(unsigned int id, const GeneralSettings & settings)
{
clear();
used = true;
@@ -1008,7 +1140,7 @@ void ModelData::setDefaultValues(unsigned int id, GeneralSettings & settings)
int ModelData::getTrimValue(int phaseIdx, int trimIdx)
{
int result = 0;
for (int i=0; i<C9X_MAX_PHASES; i++) {
for (int i=0; i<C9X_MAX_FLIGHT_MODES; i++) {
PhaseData & phase = phaseData[phaseIdx];
if (phase.trimMode[trimIdx] < 0) {
return result;
@@ -1031,7 +1163,7 @@ int ModelData::getTrimValue(int phaseIdx, int trimIdx)
void ModelData::setTrimValue(int phaseIdx, int trimIdx, int value)
{
for (uint8_t i=0; i<C9X_MAX_PHASES; i++) {
for (uint8_t i=0; i<C9X_MAX_FLIGHT_MODES; i++) {
PhaseData & phase = phaseData[phaseIdx];
int mode = phase.trimMode[trimIdx];
int p = phase.trimRef[trimIdx];
@@ -1085,14 +1217,15 @@ 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_9XRPRO));
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_9XRPRO));
eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_TARANIS));
eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_TARANIS_PLUS));
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());
@@ -1100,16 +1233,24 @@ void RegisterEepromInterfaces()
eepromInterfaces.push_back(new Er9xInterface());
}
QList<FirmwareInfo *> firmwares;
void UnregisterEepromInterfaces()
{
foreach(EEPROMInterface * intf, eepromInterfaces) {
// qDebug() << "UnregisterEepromInterfaces(): deleting " << QString::number( reinterpret_cast<uint64_t>(intf), 16 );
delete intf;
}
OpenTxEepromCleanup();
}
QList<FirmwareInterface *> firmwares;
FirmwareVariant default_firmware_variant;
FirmwareVariant current_firmware_variant;
void RegisterFirmwares()
void UnregisterFirmwares()
{
RegisterOpen9xFirmwares();
default_firmware_variant = GetFirmwareVariant("opentx-9x-heli-templates-en");
current_firmware_variant = default_firmware_variant;
RegisterEepromInterfaces();
foreach (FirmwareInterface * f, firmwares) {
delete f;
}
}
bool LoadEeprom(RadioData &radioData, const uint8_t *eeprom, const int size)
@@ -1148,7 +1289,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;
@@ -1160,13 +1301,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);
@@ -1182,17 +1323,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++) {
+179 -129
View File
@@ -50,15 +50,17 @@ enum BoardEnum {
BOARD_SKY9X,
BOARD_9XRPRO,
BOARD_TARANIS,
BOARD_TARANIS_PLUS,
BOARD_TARANIS_REV4a
};
#define IS_9X(board) (board==BOARD_STOCK || board==BOARD_M128)
#define IS_STOCK(board) (board==BOARD_STOCK)
#define IS_2560(board) (board==BOARD_GRUVIN9X || board==BOARD_MEGA2560)
#define IS_ARM(board) (board==BOARD_SKY9X || board==BOARD_9XRPRO || board==BOARD_TARANIS || board==BOARD_TARANIS_REV4a)
#define IS_SKY9X(board) (board==BOARD_SKY9X || board==BOARD_9XRPRO)
#define IS_TARANIS(board) (board==BOARD_TARANIS || board==BOARD_TARANIS_REV4a)
#define IS_9X(board) (board==BOARD_STOCK || board==BOARD_M128)
#define IS_STOCK(board) (board==BOARD_STOCK)
#define IS_2560(board) (board==BOARD_GRUVIN9X || board==BOARD_MEGA2560)
#define IS_SKY9X(board) (board==BOARD_SKY9X || board==BOARD_9XRPRO)
#define IS_TARANIS(board) (board==BOARD_TARANIS || board==BOARD_TARANIS_REV4a || board==BOARD_TARANIS_PLUS)
#define IS_TARANIS_PLUS(board) (board==BOARD_TARANIS_PLUS)
#define IS_ARM(board) (IS_TARANIS(board) || IS_SKY9X(board))
const uint8_t modn12x3[4][4]= {
{1, 2, 3, 4},
@@ -67,7 +69,7 @@ const uint8_t modn12x3[4][4]= {
{4, 3, 2, 1} };
#define C9X_MAX_MODELS 60
#define C9X_MAX_PHASES 9
#define C9X_MAX_FLIGHT_MODES 9
#define C9X_MAX_MIXERS 64
#define C9X_MAX_INPUTS 32
#define C9X_MAX_EXPOS 64
@@ -88,33 +90,52 @@ const uint8_t modn12x3[4][4]= {
#define STK_P2 6
#define STK_P3 7
#define DSW_THR 1 //DSW_SA ^
#define DSW_RUD 2 //DSW_SA -
#define DSW_ELE 3 //DSW_SA _
#define DSW_ID0 4 //DSW_SB ^
#define DSW_ID1 5 //DSW_SB -
#define DSW_ID2 6 //DSW_SB _
#define DSW_AIL 7 //DSW_SC ^
#define DSW_GEA 8 //DSW_SC -
#define DSW_TRN 9 //DSW_SC _
#define DSW_SD0 10
#define DSW_SD1 11
#define DSW_SD2 12
#define DSW_SE0 13
#define DSW_SE1 14
#define DSW_SE2 15
#define DSW_SF0 16
#define DSW_SF1 17
#define DSW_SG0 18
#define DSW_SG1 19
#define DSW_SG2 20
enum Switches {
SWITCH_NONE,
const uint8_t chout_ar[] = { //First number is 0..23 -> template setup, Second is relevant channel out
1,2,3,4 , 1,2,4,3 , 1,3,2,4 , 1,3,4,2 , 1,4,2,3 , 1,4,3,2,
2,1,3,4 , 2,1,4,3 , 2,3,1,4 , 2,3,4,1 , 2,4,1,3 , 2,4,3,1,
3,1,2,4 , 3,1,4,2 , 3,2,1,4 , 3,2,4,1 , 3,4,1,2 , 3,4,2,1,
4,1,2,3 , 4,1,3,2 , 4,2,1,3 , 4,2,3,1 , 4,3,1,2 , 4,3,2,1
}; // TODO delete it?
SWITCH_THR = SWITCH_NONE+1,
SWITCH_RUD,
SWITCH_ELE,
SWITCH_ID0,
SWITCH_ID1,
SWITCH_ID2,
SWITCH_AIL,
SWITCH_GEA,
SWITCH_TRN,
SWITCH_SA0 = SWITCH_NONE+1,
SWITCH_SA1,
SWITCH_SA2,
SWITCH_SB0,
SWITCH_SB1,
SWITCH_SB2,
SWITCH_SC0,
SWITCH_SC1,
SWITCH_SC2,
SWITCH_SD0,
SWITCH_SD1,
SWITCH_SD2,
SWITCH_SE0,
SWITCH_SE1,
SWITCH_SE2,
SWITCH_SF0,
SWITCH_SF1,
SWITCH_SG0,
SWITCH_SG1,
SWITCH_SG2,
SWITCH_SH0,
SWITCH_SH1
};
#define TRIM_LH_L 0
#define TRIM_LH_R 1
#define TRIM_LV_DN 2
#define TRIM_LV_UP 3
#define TRIM_RV_DN 4
#define TRIM_RV_UP 5
#define TRIM_RH_L 6
#define TRIM_RH_R 7
#define TRIM_NONE 8
// Beep center bits
#define BC_BIT_RUD (0x01)
@@ -172,9 +193,27 @@ enum HeliSwashTypes {
extern const char * switches9X[];
extern const char * switchesX9D[];
extern const char leftArrow[];
extern const char rightArrow[];
extern const char upArrow[];
extern const char downArrow[];
enum ThrottleSource {
THROTTLE_SOURCE_THR,
THROTTLE_SOURCE_P1,
THROTTLE_SOURCE_P2,
THROTTLE_SOURCE_P3,
THROTTLE_SOURCE_S1 = THROTTLE_SOURCE_P1,
THROTTLE_SOURCE_S2,
THROTTLE_SOURCE_S3,
THROTTLE_SOURCE_LS,
THROTTLE_SOURCE_RS,
THROTTLE_SOURCE_FIRST_CHANNEL,
};
enum TelemetrySource {
TELEMETRY_SOURCE_TX_BATT,
TELEMETRY_SOURCE_TX_TIME,
TELEMETRY_SOURCE_TIMER1,
TELEMETRY_SOURCE_TIMER2,
TELEMETRY_SOURCE_SWR,
@@ -217,15 +256,17 @@ enum TelemetrySource {
TELEMETRY_SOURCE_T2_MAX,
TELEMETRY_SOURCE_SPEED_MAX,
TELEMETRY_SOURCE_DIST_MAX,
TELEMETRY_SOURCE_ASPEED_MAX,
TELEMETRY_SOURCE_CELL_MIN,
TELEMETRY_SOURCE_CELLS_MIN,
TELEMETRY_SOURCE_VFAS_MIN,
TELEMETRY_SOURCE_CURRENT_MAX,
TELEMETRY_SOURCE_POWER_MAX,
TELEMETRY_SOURCE_ACC,
TELEMETRY_SOURCE_GPS_TIME,
TELEMETRY_SOURCES_STATUS_COUNT = TELEMETRY_SOURCE_GPS_TIME+1,
TELEMETRY_SOURCES_DISPLAY_COUNT = TELEMETRY_SOURCE_POWER_MAX+1,
TELEMETRY_SOURCES_COUNT = TELEMETRY_SOURCE_DTE+1,
TELEMETRY_SOURCES_COUNT = TELEMETRY_SOURCE_POWER_MAX+1,
TELEMETRY_SOURCE_RESERVE = -1
};
@@ -334,6 +375,7 @@ enum RawSwitchType {
SWITCH_TYPE_ROTARY_ENCODER,
SWITCH_TYPE_ON,
SWITCH_TYPE_OFF,
SWITCH_TYPE_FLIGHT_MODE,
SWITCH_TYPE_TIMER_MODE
};
@@ -405,7 +447,9 @@ class GeneralSettings {
public:
GeneralSettings();
RawSource getDefaultSource(unsigned int channel);
int getDefaultStick(unsigned int channel) const;
RawSource getDefaultSource(unsigned int channel) const;
int getDefaultChannel(unsigned int stick) const;
unsigned int version;
unsigned int variant;
@@ -440,6 +484,7 @@ class GeneralSettings {
bool frskyinternalalarm;
bool disableBG;
unsigned int splashMode;
int splashDuration;
uint8_t filterInput; // TODO enum
unsigned int backlightDelay;
bool blightinv;
@@ -448,6 +493,7 @@ class GeneralSettings {
int PPM_Multiplier;
int hapticLength;
unsigned int reNavigation;
unsigned int stickReverse;
bool hideNameOnSplash;
bool enablePpmsim;
unsigned int speakerPitch;
@@ -482,6 +528,7 @@ class GeneralSettings {
unsigned int switchUnlockStates;
unsigned int hw_uartMode;
unsigned int potsType[8];
unsigned int backlightColor;
};
class CurveReference {
@@ -582,7 +629,6 @@ class MixData {
MixData() { clear(); }
unsigned int destCh; // 1..C9X_NUM_CHNOUT
RawSource srcRaw;
unsigned int srcVariant;
int weight;
RawSwitch swtch;
CurveReference curve; //0=symmetrisch
@@ -636,7 +682,7 @@ enum CSFunctionFamily {
LS_FAMILY_STAY,
};
class LogicalSwitchData { // Custom Switches data
class LogicalSwitchData { // Logical Switches data
public:
LogicalSwitchData(unsigned int func=0)
{
@@ -807,7 +853,7 @@ class FrSkyData {
FrSkyChannelData channels[2];
unsigned int usrProto;
unsigned int imperial;
unsigned int blades;
int blades;
unsigned int voltsSource;
bool altitudeDisplayed;
unsigned int currentSource;
@@ -823,7 +869,7 @@ class FrSkyData {
unsigned int storedMah;
int fasOffset;
void clear() { memset(this, 0, sizeof(FrSkyData)); rssiAlarms[0].clear(2, 45); rssiAlarms[1].clear(3, 42); varioSource = 2/*VARIO*/; }
void clear();
};
class MavlinkData {
@@ -894,10 +940,14 @@ class ScriptData {
class ModelData {
public:
ModelData();
ModelData(const ModelData & src);
ModelData & operator = (const ModelData & src);
ExpoData * insertInput(const int idx);
void removeInput(const int idx);
bool isInputValid(const unsigned int idx) const;
bool used;
char name[12+1];
uint8_t modelVoice;
@@ -912,7 +962,7 @@ class ModelData {
bool extendedLimits; // TODO xml
bool extendedTrims;
bool throttleReversed;
PhaseData phaseData[C9X_MAX_PHASES];
PhaseData phaseData[C9X_MAX_FLIGHT_MODES];
MixData mixData[C9X_MAX_MIXERS];
LimitData limitData[C9X_NUM_CHNOUT];
@@ -953,8 +1003,9 @@ class ModelData {
void clear();
bool isempty();
void setDefaultMixes(GeneralSettings & settings);
void setDefaultValues(unsigned int id, GeneralSettings & settings);
void setDefaultInputs(const GeneralSettings & settings);
void setDefaultMixes(const GeneralSettings & settings);
void setDefaultValues(unsigned int id, const GeneralSettings & settings);
int getTrimValue(int phaseIdx, int trimIdx);
void setTrimValue(int phaseIdx, int trimIdx, int value);
@@ -975,10 +1026,9 @@ class RadioData {
// TODO rename FlightPhase to FlightMode
enum Capability {
OwnerName,
FlightPhases,
FlightModes,
FlightModesName,
FlightPhasesHaveFades,
FlightModesHaveFades,
Mixes,
MixesWithoutExpo,
Timers,
@@ -999,10 +1049,8 @@ enum Capability {
RotaryEncoders,
Outputs,
ChannelsName,
ExtraChannels,
ExtraInputs,
ExtendedTrims,
HasInputFilter,
NumCurves,
NumCurvePoints,
OffsetWeight,
@@ -1013,13 +1061,7 @@ enum Capability {
Beeperlen,
EepromBackup,
Haptic,
HapticLength,
HapticMode,
HasBlInvert,
HasBeeper,
BandgapMeasure,
PotScrolling,
TrainerSwitch,
ModelTrainerEnable,
Timer2ThrTrig,
HasExpoNames,
@@ -1034,8 +1076,6 @@ enum Capability {
OptrexDisplay,
PPMExtCtrl,
PPMFrameLength,
gsSwitchMask,
BLonStickMove,
DSM2Indexes,
Telemetry,
TelemetryUnits,
@@ -1044,14 +1084,12 @@ enum Capability {
Gvars,
GvarsInCS,
GvarsAreNamed,
GvarsFlightPhases,
GvarsFlightModes,
GvarsName,
NoTelemetryProtocol,
TelemetryCustomScreens,
TelemetryCustomScreensFieldsPerLine,
TelemetryRSSIModel,
TelemetryAlarm,
TelemetryInternalAlarm,
TelemetryTimeshift,
TelemetryMaxMultiplier,
HasAltitudeSel,
@@ -1059,9 +1097,6 @@ enum Capability {
HasVarioSink,
HasVariants,
HasFailsafe,
HasPPMSim,
HasCrossTrims,
HasStickScroll,
HasSoundMixer,
NumModules,
PPMCenter,
@@ -1084,7 +1119,6 @@ enum Capability {
LuaInputs,
LimitsPer1000,
EnhancedCurves,
TelemetryInternalAlarms,
HasFasOffset,
HasMahPersistent,
MultiposPots,
@@ -1120,12 +1154,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;
@@ -1176,7 +1206,7 @@ inline void applyStickModeToModel(ModelData &model, unsigned int mode)
ModelData model_copy = model;
// trims
for (int p=0; p<C9X_MAX_PHASES; p++) {
for (int p=0; p<C9X_MAX_FLIGHT_MODES; p++) {
for (int i=0; i<NUM_STICKS/2; i++) {
int converted_stick = applyStickMode(i+1, mode) - 1;
int tmp = model.phaseData[p].trim[i];
@@ -1234,7 +1264,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);
@@ -1246,49 +1278,27 @@ struct Option {
uint32_t variant;
};
class FirmwareInfo {
class FirmwareInterface {
public:
FirmwareInfo():
parent(NULL),
id(QString::null),
eepromInterface(NULL),
voice(false),
variantBase(0)
virtual ~FirmwareInterface()
{
delete eepromInterface;
}
virtual ~FirmwareInfo()
{
}
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);
@@ -1301,71 +1311,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()
@@ -1373,6 +1416,13 @@ 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);
}
#define CHECK_IN_ARRAY(T, index) ((unsigned int)index < (unsigned int)(sizeof(T)/sizeof(T[0])) ? T[(unsigned int)index] : "???")
#endif
@@ -200,94 +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 TrainerSwitch:
return 1;
case OffsetWeight:
return 125;
case BandgapMeasure:
return 1;
case PotScrolling:
return 1;
case SoundMod:
return 1;
case SoundPitch:
return 1;
case Haptic:
return 1;
case OwnerName:
return 10;
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 ExtraChannels:
return 0;
case Simulation:
return 1;
case gsSwitchMask:
return 1;
case BLonStickMove:
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 TelemetryInternalAlarm:
case HasPPMSim:
case HasCrossTrims:
case HasStickScroll:
case HasAltitudeSel:
case HasContrast:
case HasVolume:
case HasBlInvert:
case ModelVoice:
case Gvars:
return 7;
case GetThrSwitch:
return DSW_THR;
default:
return 0;
}
}
int Er9xInterface::isAvailable(Protocol prot, int port)
{
switch (prot) {
@@ -301,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;
@@ -48,6 +48,8 @@ class Er9xSimulator : public SimulatorInterface {
virtual unsigned int getPhase() { return 0; }
virtual const char * getPhaseName(unsigned int phase) { return 0; }
virtual void wheelEvent(uint8_t steps) { }
virtual const char * getError();
@@ -244,90 +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 TrainerSwitch:
return 1;
case BandgapMeasure:
return 1;
case PotScrolling:
return 1;
case SoundMod:
return 1;
case SoundPitch:
return 1;
case Haptic:
return 1;
case OwnerName:
return 10;
case HasInputFilter:
return 0;
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 ExtraChannels:
return 0;
case Simulation:
return 1;
case gsSwitchMask:
return 1;
case BLonStickMove:
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) {
@@ -341,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;
@@ -48,6 +48,8 @@ class Ersky9xSimulator : public SimulatorInterface {
virtual unsigned int getPhase() { return 0; }
virtual const char * getPhaseName(unsigned int phase) { return 0; }
virtual void wheelEvent(uint8_t steps) { }
virtual const char * getError();
@@ -455,7 +455,7 @@ t_Gruvin9xModelData_v102::operator ModelData ()
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
for (int i=0; i<G9X_MAX_PHASES; i++)
for (int i=0; i<G9X_MAX_FLIGHT_MODES; i++)
c9x.phaseData[i] = phaseData[i];
for (int i=0; i<G9X_MAX_MIXERS; i++)
c9x.mixData[i] = mixData[i];
@@ -526,7 +526,7 @@ t_Gruvin9xModelData_v103::operator ModelData ()
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
for (int i=0; i<G9X_MAX_PHASES; i++)
for (int i=0; i<G9X_MAX_FLIGHT_MODES; i++)
c9x.phaseData[i] = phaseData[i];
for (int i=0; i<G9X_MAX_MIXERS; i++)
c9x.mixData[i] = mixData[i];
@@ -598,7 +598,7 @@ t_Gruvin9xModelData_v105::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<G9X_MAX_PHASES; i++) {
for (int i=0; i<G9X_MAX_FLIGHT_MODES; i++) {
c9x.phaseData[i] = phaseData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (phaseData[i].trim[j] > 125) {
@@ -689,7 +689,7 @@ t_Gruvin9xModelData_v106::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<G9X_MAX_PHASES; i++) {
for (int i=0; i<G9X_MAX_FLIGHT_MODES; i++) {
c9x.phaseData[i] = phaseData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.phaseData[i].trim[j] > 500) {
@@ -277,7 +277,7 @@ PACK(typedef struct t_Gruvin9xTimerData {
t_Gruvin9xTimerData() { memset(this, 0, sizeof(t_Gruvin9xTimerData)); }
}) Gruvin9xTimerData;
#define G9X_MAX_PHASES 5
#define G9X_MAX_FLIGHT_MODES 5
#define G9X_MAX_MIXERS 32
#define G9X_MAX_EXPOS 14
#define G9X_MAX_CURVE5 8
@@ -312,7 +312,7 @@ PACK(typedef struct t_Gruvin9xModelData_v102 {
Gruvin9xLogicalSwitchData customSw[G9X_NUM_CSW];
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
Gruvin9xSwashRingData swashR;
Gruvin9xPhaseData_v102 phaseData[G9X_MAX_PHASES];
Gruvin9xPhaseData_v102 phaseData[G9X_MAX_FLIGHT_MODES];
Gruvin9xFrSkyData frsky;
operator ModelData();
@@ -344,7 +344,7 @@ PACK(typedef struct t_Gruvin9xModelData_v103 {
Gruvin9xLogicalSwitchData customSw[G9X_NUM_CSW];
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
Gruvin9xSwashRingData swashR;
Gruvin9xPhaseData_v102 phaseData[G9X_MAX_PHASES];
Gruvin9xPhaseData_v102 phaseData[G9X_MAX_FLIGHT_MODES];
Gruvin9xFrSkyData frsky;
operator ModelData();
@@ -377,7 +377,7 @@ PACK(typedef struct t_Gruvin9xModelData_v105 {
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
Gruvin9xFuncSwData funcSw[G9X_NUM_FSW];
Gruvin9xSwashRingData swashR;
Gruvin9xPhaseData_v102 phaseData[G9X_MAX_PHASES];
Gruvin9xPhaseData_v102 phaseData[G9X_MAX_FLIGHT_MODES];
int16_t subtrim[NUM_STICKS];
Gruvin9xFrSkyData frsky;
@@ -409,7 +409,7 @@ PACK(typedef struct t_Gruvin9xModelData_v106 {
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
Gruvin9xFuncSwData funcSw[G9X_NUM_FSW];
Gruvin9xSwashRingData swashR;
Gruvin9xPhaseData_v106 phaseData[G9X_MAX_PHASES];
Gruvin9xPhaseData_v106 phaseData[G9X_MAX_FLIGHT_MODES];
Gruvin9xFrSkyData frsky;
operator ModelData();
@@ -216,63 +216,6 @@ int Gruvin9xInterface::getSize(GeneralSettings &settings)
return 0;
}
int Gruvin9xInterface::getCapability(const Capability capability)
{
switch (capability) {
case OwnerName:
return 0;
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 ExtraChannels:
return 0;
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) {
@@ -287,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>
@@ -460,7 +460,7 @@ t_Open9xGruvin9xModelData_v207::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_PHASES; i++) {
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
c9x.phaseData[i] = phaseData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.phaseData[i].trim[j] > 500) {
@@ -545,7 +545,7 @@ t_Open9xGruvin9xModelData_v208::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_PHASES; i++) {
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
c9x.phaseData[i] = phaseData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.phaseData[i].trim[j] > 500) {
@@ -634,7 +634,7 @@ t_Open9xGruvin9xModelData_v209::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_PHASES; i++) {
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
c9x.phaseData[i] = phaseData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.phaseData[i].trim[j] > 500) {
@@ -724,7 +724,7 @@ t_Open9xGruvin9xModelData_v210::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_PHASES; i++) {
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
c9x.phaseData[i] = phaseData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.phaseData[i].trim[j] > 500) {
@@ -811,7 +811,7 @@ t_Open9xGruvin9xModelData_v211::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_PHASES; i++) {
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
c9x.phaseData[i] = phaseData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.phaseData[i].trim[j] > 500) {
@@ -197,7 +197,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v207 {
Open9xGruvin9xLogicalSwitchData_v207 customSw[O9X_NUM_CSW];
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
Open9xGruvin9xSwashRingData_v208 swashR;
Open9xGruvin9xPhaseData_v207 phaseData[O9X_MAX_PHASES];
Open9xGruvin9xPhaseData_v207 phaseData[O9X_MAX_FLIGHT_MODES];
Open9xFrSkyData_v205 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
@@ -231,7 +231,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v208 {
Open9xGruvin9xLogicalSwitchData_v207 customSw[O9X_NUM_CSW];
Open9xGruvin9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
Open9xGruvin9xSwashRingData_v208 swashR;
Open9xGruvin9xPhaseData_v208 phaseData[O9X_MAX_PHASES];
Open9xGruvin9xPhaseData_v208 phaseData[O9X_MAX_FLIGHT_MODES];
Open9xFrSkyData_v208 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
@@ -270,7 +270,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v209 {
Open9xGruvin9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
Open9xGruvin9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
Open9xGruvin9xSwashRingData_v209 swashR;
Open9xGruvin9xPhaseData_v208 phaseData[O9X_MAX_PHASES];
Open9xGruvin9xPhaseData_v208 phaseData[O9X_MAX_FLIGHT_MODES];
Open9xFrSkyData_v208 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
@@ -310,7 +310,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v210 {
Open9xGruvin9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
Open9xGruvin9xFuncSwData_v210 funcSw[O9X_NUM_FSW];
Open9xGruvin9xSwashRingData_v209 swashR;
Open9xGruvin9xPhaseData_v208 phaseData[O9X_MAX_PHASES];
Open9xGruvin9xPhaseData_v208 phaseData[O9X_MAX_FLIGHT_MODES];
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
@@ -348,7 +348,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v211 {
Open9xGruvin9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
Open9xGruvin9xFuncSwData_v210 funcSw[O9X_NUM_FSW];
Open9xGruvin9xSwashRingData_v209 swashR;
Open9xGruvin9xPhaseData_v208 phaseData[O9X_MAX_PHASES];
Open9xGruvin9xPhaseData_v208 phaseData[O9X_MAX_FLIGHT_MODES];
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
@@ -681,7 +681,7 @@ t_Open9xArmFrSkyData_v210::operator FrSkyData ()
c9x.channels[1] = channels[1];
c9x.usrProto = usrProto;
c9x.voltsSource = voltsSource;
c9x.blades = blades;
c9x.blades = blades+2;
c9x.currentSource=currentSource;
c9x.screens[0].type = 1;
for (int i=0; i<4; i++) {
@@ -709,7 +709,7 @@ t_Open9xArmFrSkyData_v211::operator FrSkyData ()
c9x.channels[1] = channels[1];
c9x.usrProto = usrProto;
c9x.voltsSource = voltsSource;
c9x.blades = blades;
c9x.blades = blades+2;
c9x.currentSource=currentSource;
c9x.screens[0].type = 1;
for (int i=0; i<4; i++) {
@@ -767,7 +767,7 @@ t_Open9xArmModelData_v208::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_ARM_MAX_PHASES; i++) {
for (int i=0; i<O9X_ARM_MAX_FLIGHT_MODES; i++) {
c9x.phaseData[i] = phaseData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.phaseData[i].trim[j] > 500) {
@@ -856,7 +856,7 @@ t_Open9xArmModelData_v209::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_ARM_MAX_PHASES; i++) {
for (int i=0; i<O9X_ARM_MAX_FLIGHT_MODES; i++) {
c9x.phaseData[i] = phaseData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.phaseData[i].trim[j] > 500) {
@@ -946,7 +946,7 @@ t_Open9xArmModelData_v210::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_ARM_MAX_PHASES; i++) {
for (int i=0; i<O9X_ARM_MAX_FLIGHT_MODES; i++) {
c9x.phaseData[i] = phaseData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.phaseData[i].trim[j] > 500) {
@@ -1030,7 +1030,7 @@ t_Open9xArmModelData_v211::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_ARM_MAX_PHASES; i++) {
for (int i=0; i<O9X_ARM_MAX_FLIGHT_MODES; i++) {
c9x.phaseData[i] = phaseData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.phaseData[i].trim[j] > 500) {
@@ -1117,7 +1117,7 @@ t_Open9xArmModelData_v212::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_ARM_MAX_PHASES; i++) {
for (int i=0; i<O9X_ARM_MAX_FLIGHT_MODES; i++) {
c9x.phaseData[i] = phaseData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.phaseData[i].trim[j] > 500) {
@@ -19,7 +19,7 @@
#include "open9xStockeeprom.h"
#define O9X_ARM_MAX_PHASES 9
#define O9X_ARM_MAX_FLIGHT_MODES 9
#define O9X_ARM_MAX_MIXERS 64
#define O9X_ARM_MAX_EXPOS 32
#define O9X_ARM_NUM_CHNOUT 32 // number of real output channels CH1-CH16
@@ -346,7 +346,7 @@ PACK(typedef struct t_Open9xArmModelData_v208 {
Open9xArmLogicalSwitchData_v208 customSw[O9X_ARM_NUM_CSW];
Open9xArmFuncSwData_v208 funcSw[O9X_ARM_NUM_FSW];
Open9xArmSwashRingData_v208 swashR;
Open9xArmPhaseData_v208 phaseData[O9X_ARM_MAX_PHASES];
Open9xArmPhaseData_v208 phaseData[O9X_ARM_MAX_FLIGHT_MODES];
Open9xFrSkyData_v208 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
@@ -385,7 +385,7 @@ PACK(typedef struct t_Open9xArmModelData_v209 {
Open9xArmLogicalSwitchData_v209 customSw[O9X_ARM_NUM_CSW];
Open9xArmFuncSwData_v208 funcSw[O9X_ARM_NUM_FSW];
Open9xArmSwashRingData_v209 swashR;
Open9xArmPhaseData_v208 phaseData[O9X_ARM_MAX_PHASES];
Open9xArmPhaseData_v208 phaseData[O9X_ARM_MAX_FLIGHT_MODES];
Open9xFrSkyData_v208 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
@@ -425,7 +425,7 @@ PACK(typedef struct t_Open9xArmModelData_v210 {
Open9xArmLogicalSwitchData_v210 customSw[O9X_ARM_NUM_CSW];
Open9xArmFuncSwData_v210 funcSw[O9X_ARM_NUM_FSW];
Open9xArmSwashRingData_v209 swashR;
Open9xArmPhaseData_v208 phaseData[O9X_ARM_MAX_PHASES];
Open9xArmPhaseData_v208 phaseData[O9X_ARM_MAX_FLIGHT_MODES];
Open9xArmFrSkyData_v210 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
@@ -464,7 +464,7 @@ PACK(typedef struct t_Open9xArmModelData_v211 {
Open9xArmLogicalSwitchData_v210 customSw[O9X_ARM_NUM_CSW];
Open9xArmFuncSwData_v211 funcSw[O9X_ARM_NUM_FSW];
Open9xArmSwashRingData_v209 swashR;
Open9xArmPhaseData_v208 phaseData[O9X_ARM_MAX_PHASES];
Open9xArmPhaseData_v208 phaseData[O9X_ARM_MAX_FLIGHT_MODES];
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
@@ -502,7 +502,7 @@ PACK(typedef struct t_Open9xArmModelData_v212 {
Open9xArmLogicalSwitchData_v210 customSw[O9X_ARM_NUM_CSW];
Open9xArmFuncSwData_v211 funcSw[O9X_ARM_NUM_FSW];
Open9xArmSwashRingData_v210 swashR;
Open9xArmPhaseData_v212 phaseData[O9X_ARM_MAX_PHASES];
Open9xArmPhaseData_v212 phaseData[O9X_ARM_MAX_FLIGHT_MODES];
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
@@ -89,7 +89,7 @@ t_Open9xExpoData_v201::operator ExpoData ()
c9x.mode = mode;
c9x.chn = chn;
if (expo!=0 && curve!=0) {
EEPROMWarnings += ::QObject::tr("Simultaneous usage of expo and curves is no longer supported in open9x") + "\n";
EEPROMWarnings += ::QObject::tr("Simultaneous usage of expo and curves is no longer supported in OpenTX") + "\n";
}
else {
if (curve == 0) {
@@ -843,7 +843,7 @@ t_Open9xFrSkyData_v204::operator FrSkyData ()
c9x.channels[1] = channels[1];
c9x.usrProto = usrProto;
c9x.imperial = imperial;
c9x.blades = blades;
c9x.blades = blades+2;
c9x.screens[0].type = 1;
for (int i=0; i<4; i++)
c9x.screens[0].body.bars[i] = bars[i];
@@ -857,7 +857,7 @@ t_Open9xFrSkyData_v205::operator FrSkyData ()
c9x.channels[1] = channels[1];
c9x.usrProto = usrProto;
c9x.imperial = imperial;
c9x.blades = blades;
c9x.blades = blades+2;
c9x.screens[0].type = 1;
for (int i=0; i<4; i++)
c9x.screens[0].body.bars[i] = bars[i];
@@ -873,7 +873,7 @@ t_Open9xFrSkyData_v208::operator FrSkyData ()
c9x.channels[1] = channels[1];
c9x.usrProto = usrProto;
c9x.voltsSource = voltsSource;
c9x.blades = blades;
c9x.blades = blades+2;
c9x.currentSource=currentSource;
c9x.screens[0].type = 1;
for (int i=0; i<4; i++)
@@ -890,7 +890,7 @@ t_Open9xFrSkyData_v210::operator FrSkyData ()
c9x.channels[1] = channels[1];
c9x.usrProto = usrProto;
c9x.voltsSource = voltsSource;
c9x.blades = blades;
c9x.blades = blades+2;
c9x.currentSource=currentSource;
int lines_screen_index = 0;
@@ -948,7 +948,7 @@ t_Open9xModelData_v201::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_PHASES; i++) {
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
c9x.phaseData[i] = phaseData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.phaseData[i].trim[j] > 500) {
@@ -1022,7 +1022,7 @@ t_Open9xModelData_v202::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_PHASES; i++) {
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
c9x.phaseData[i] = phaseData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.phaseData[i].trim[j] > 500) {
@@ -1098,7 +1098,7 @@ t_Open9xModelData_v203::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_PHASES; i++) {
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
c9x.phaseData[i] = phaseData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.phaseData[i].trim[j] > 500) {
@@ -1172,7 +1172,7 @@ t_Open9xModelData_v204::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_PHASES; i++) {
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
c9x.phaseData[i] = phaseData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.phaseData[i].trim[j] > 500) {
@@ -1251,7 +1251,7 @@ t_Open9xModelData_v205::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_PHASES; i++) {
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
c9x.phaseData[i] = phaseData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.phaseData[i].trim[j] > 500) {
@@ -1337,7 +1337,7 @@ t_Open9xModelData_v208::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_PHASES; i++) {
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
c9x.phaseData[i] = phaseData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.phaseData[i].trim[j] > 500) {
@@ -1430,7 +1430,7 @@ t_Open9xModelData_v209::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_PHASES; i++) {
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
c9x.phaseData[i] = phaseData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.phaseData[i].trim[j] > 500) {
@@ -1524,7 +1524,7 @@ t_Open9xModelData_v210::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_PHASES; i++) {
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
c9x.phaseData[i] = phaseData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.phaseData[i].trim[j] > 500) {
@@ -1612,7 +1612,7 @@ t_Open9xModelData_v211::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_PHASES; i++) {
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
c9x.phaseData[i] = phaseData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.phaseData[i].trim[j] > 500) {
@@ -482,7 +482,7 @@ PACK(typedef struct t_Open9xTimerDataExtra {
}) Open9xTimerDataExtra;
#define O9X_MAX_TIMERS 2
#define O9X_MAX_PHASES 5
#define O9X_MAX_FLIGHT_MODES 5
#define O9X_MAX_MIXERS 32
#define O9X_MAX_EXPOS 14
#define O9X_NUM_CHNOUT 16 // number of real output channels CH1-CH16
@@ -520,7 +520,7 @@ PACK(typedef struct t_Open9xModelData_v201 {
Open9xSafetySwData safetySw[O9X_NUM_CHNOUT];
Open9xFuncSwData_v201 funcSw[12];
Open9xSwashRingData_v208 swashR;
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
Open9xPhaseData_v201 phaseData[O9X_MAX_FLIGHT_MODES];
Open9xFrSkyData_v201 frsky;
operator ModelData();
@@ -551,7 +551,7 @@ PACK(typedef struct t_Open9xModelData_v202 {
Open9xSafetySwData safetySw[O9X_NUM_CHNOUT];
Open9xFuncSwData_v201 funcSw[12];
Open9xSwashRingData_v208 swashR;
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
Open9xPhaseData_v201 phaseData[O9X_MAX_FLIGHT_MODES];
Open9xFrSkyData_v202 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
@@ -584,7 +584,7 @@ PACK(typedef struct t_Open9xModelData_v203 {
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
Open9xSwashRingData_v208 swashR;
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
Open9xPhaseData_v201 phaseData[O9X_MAX_FLIGHT_MODES];
Open9xFrSkyData_v202 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
@@ -617,7 +617,7 @@ PACK(typedef struct t_Open9xModelData_v204 {
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
Open9xSwashRingData_v208 swashR;
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
Open9xPhaseData_v201 phaseData[O9X_MAX_FLIGHT_MODES];
Open9xFrSkyData_v204 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
@@ -650,7 +650,7 @@ PACK(typedef struct t_Open9xModelData_v205 {
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
Open9xSwashRingData_v208 swashR;
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
Open9xPhaseData_v201 phaseData[O9X_MAX_FLIGHT_MODES];
Open9xFrSkyData_v205 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
@@ -685,7 +685,7 @@ PACK(typedef struct t_Open9xModelData_v208 {
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
Open9xSwashRingData_v208 swashR;
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
Open9xPhaseData_v201 phaseData[O9X_MAX_FLIGHT_MODES];
Open9xFrSkyData_v208 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
@@ -724,7 +724,7 @@ PACK(typedef struct t_Open9xModelData_v209 {
Open9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
Open9xSwashRingData_v209 swashR;
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
Open9xPhaseData_v201 phaseData[O9X_MAX_FLIGHT_MODES];
Open9xFrSkyData_v208 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
@@ -764,7 +764,7 @@ PACK(typedef struct t_Open9xModelData_v210 {
Open9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
Open9xFuncSwData_v210 funcSw[O9X_NUM_FSW];
Open9xSwashRingData_v209 swashR;
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
Open9xPhaseData_v201 phaseData[O9X_MAX_FLIGHT_MODES];
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
@@ -802,7 +802,7 @@ PACK(typedef struct t_Open9xModelData_v211 {
Open9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
Open9xFuncSwData_v210 funcSw[O9X_NUM_FSW];
Open9xSwashRingData_v209 swashR;
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
Open9xPhaseData_v201 phaseData[O9X_MAX_FLIGHT_MODES];
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
@@ -47,6 +47,7 @@
#define GAUGES
#define GPS
#define FAI_CHOICE
#define FRSKY_STICKS
#define EEPROM_VARIANT 3
@@ -74,6 +75,7 @@ namespace Open9xGruvin9x {
#include "radio/src/simpgmspace.cpp"
#include "radio/src/templates.cpp"
#include "radio/src/translations.cpp"
#include "radio/src/fonts.cpp"
#include "radio/src/audio_avr.cpp"
#include "radio/src/buzzer.cpp"
#include "radio/src/targets/gruvin9x/somo14d.cpp"
@@ -105,8 +107,7 @@ uint8_t getStickMode()
using namespace Open9xGruvin9x;
Open9xGruvin9xSimulator::Open9xGruvin9xSimulator(OpenTxInterface * open9xInterface):
open9xInterface(open9xInterface)
Open9xGruvin9xSimulator::Open9xGruvin9xSimulator()
{
}
@@ -199,6 +200,13 @@ unsigned int Open9xGruvin9xSimulator::getPhase()
return getFlightPhase();
}
const char * Open9xGruvin9xSimulator::getPhaseName(unsigned int phase)
{
static char buff[sizeof(g_model.phaseData[0].name)+1];
zchar2str(buff, g_model.phaseData[phase].name, sizeof(g_model.phaseData[0].name));
return buff;
}
const char * Open9xGruvin9xSimulator::getError()
{
#define GETERROR_IMPORT
@@ -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);
@@ -50,13 +50,12 @@ class Open9xGruvin9xSimulator : public SimulatorInterface {
virtual unsigned int getPhase();
virtual const char * getPhaseName(unsigned int phase);
virtual void wheelEvent(uint8_t steps);
virtual const char * getError();
protected:
OpenTxInterface * open9xInterface;
};
#endif
@@ -45,6 +45,7 @@
#define GAUGES
#define GPS
#define FAI_CHOICE
#define FRSKY_STICKS
#define EEPROM_VARIANT SIMU_M128_VARIANTS
#define GAUGES
@@ -73,6 +74,7 @@ namespace Open9xM128 {
#include "radio/src/simpgmspace.cpp"
#include "radio/src/templates.cpp"
#include "radio/src/translations.cpp"
#include "radio/src/fonts.cpp"
#include "radio/src/audio_avr.cpp"
#include "radio/src/targets/stock/voice.cpp"
#include "radio/src/telemetry/frsky.cpp"
@@ -103,8 +105,7 @@ uint8_t getStickMode()
using namespace Open9xM128;
Open9xM128Simulator::Open9xM128Simulator(OpenTxInterface * open9xInterface):
open9xInterface(open9xInterface)
Open9xM128Simulator::Open9xM128Simulator()
{
}
@@ -190,6 +191,13 @@ unsigned int Open9xM128Simulator::getPhase()
return getFlightPhase();
}
const char * Open9xM128Simulator::getPhaseName(unsigned int phase)
{
static char buff[sizeof(g_model.phaseData[0].name)+1];
zchar2str(buff, g_model.phaseData[phase].name, sizeof(g_model.phaseData[0].name));
return buff;
}
const char * Open9xM128Simulator::getError()
{
#define GETERROR_IMPORT
@@ -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);
@@ -50,13 +50,12 @@ class Open9xM128Simulator : public SimulatorInterface {
virtual unsigned int getPhase();
virtual const char * getPhaseName(unsigned int phase);
virtual void wheelEvent(uint8_t steps);
virtual const char * getError();
protected:
OpenTxInterface * open9xInterface;
};
#endif
@@ -53,7 +53,9 @@
#define GAUGES
#define GPS
#define FAI_CHOICE
#define FRSKY_STICKS
#define NUM_POTS 3
#define EEPROM_VARIANT 3
#undef min
@@ -90,6 +92,7 @@ namespace Open9xSky9x {
#include "radio/src/simpgmspace.cpp"
#include "radio/src/templates.cpp"
#include "radio/src/translations.cpp"
#include "radio/src/fonts.cpp"
#include "radio/src/telemetry/frsky.cpp"
#include "radio/src/targets/sky9x/audio_driver.cpp"
#include "radio/src/audio_arm.cpp"
@@ -133,8 +136,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;
@@ -231,6 +233,13 @@ unsigned int Open9xSky9xSimulator::getPhase()
return getFlightPhase();
}
const char * Open9xSky9xSimulator::getPhaseName(unsigned int phase)
{
static char buff[sizeof(g_model.phaseData[0].name)+1];
zchar2str(buff, g_model.phaseData[phase].name, sizeof(g_model.phaseData[0].name));
return buff;
}
const char * Open9xSky9xSimulator::getError()
{
#define GETERROR_IMPORT
@@ -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);
@@ -50,13 +50,12 @@ class Open9xSky9xSimulator : public SimulatorInterface {
virtual unsigned int getPhase();
virtual const char * getPhaseName(unsigned int phase);
virtual void wheelEvent(uint8_t steps);
virtual const char * getError();
protected:
OpenTxInterface * open9xInterface;
};
#endif
@@ -23,7 +23,6 @@
#define PCBTARANIS
#define CPUARM
#define HELI
#define TEMPLATES
#define SPLASH
#define FLIGHT_MODES
#define FRSKY
@@ -53,6 +52,10 @@
#define LUA
#define LUA_MODEL_SCRIPTS
#define EEPROM_VARIANT 3
#define HAPTIC
#define REVPLUS
#define NUM_POTS 5
#undef min
#undef max
@@ -71,7 +74,6 @@ inline int geteepromsize() {
#include "radio/src/protocols/ppm_arm.cpp"
#include "radio/src/protocols/pxx_arm.cpp"
#include "radio/src/protocols/dsm2_arm.cpp"
#include "radio/src/targets/taranis/pwr_driver.cpp"
#include "radio/src/eeprom_common.cpp"
#include "radio/src/eeprom_conversions.cpp"
#include "radio/src/eeprom_rlc.cpp"
@@ -93,17 +95,20 @@ inline int geteepromsize() {
#include "radio/src/gui/view_text.cpp"
#include "radio/src/gui/view_about.cpp"
#include "radio/src/lcd.cpp"
#include "radio/src/strhelpers.cpp"
#include "radio/src/logs.cpp"
#include "radio/src/rtc.cpp"
#include "radio/src/targets/taranis/keys_driver.cpp"
#include "radio/src/keys.cpp"
#include "radio/src/bmp.cpp"
#include "radio/src/haptic.cpp"
#include "radio/src/targets/taranis/haptic_driver.cpp"
// TODO Because FatFS in not C++ there cannot be namespaces there and the functions are defined several times!
#undef SDCARD
#include "radio/src/simpgmspace.cpp"
#define SDCARD
#include "radio/src/templates.cpp"
#include "radio/src/translations.cpp"
#include "radio/src/fonts.cpp"
#include "radio/src/telemetry/frsky_sport.cpp"
#include "radio/src/targets/taranis/audio_driver.cpp"
#include "radio/src/audio_arm.cpp"
@@ -152,9 +157,6 @@ int16_t g_anas[NUM_STICKS+5];
uint16_t anaIn(uint8_t chan)
{
if (chan == 8)
return 1800;
else
return g_anas[chan];
}
@@ -178,8 +180,7 @@ void resetTrims()
using namespace Open9xX9D;
OpentxTaranisSimulator::OpentxTaranisSimulator(OpenTxInterface * open9xInterface):
open9xInterface(open9xInterface)
OpentxTaranisSimulator::OpentxTaranisSimulator()
{
taranisSimulatorBoard = GetEepromInterface()->getBoard();
QString path=g.profile[g.id()].sdPath()+"/";
@@ -273,6 +274,13 @@ unsigned int OpentxTaranisSimulator::getPhase()
return getFlightPhase();
}
const char * OpentxTaranisSimulator::getPhaseName(unsigned int phase)
{
static char buff[sizeof(g_model.phaseData[0].name)+1];
zchar2str(buff, g_model.phaseData[phase].name, sizeof(g_model.phaseData[0].name));
return buff;
}
const char * OpentxTaranisSimulator::getError()
{
#define GETERROR_IMPORT
@@ -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);
@@ -50,13 +50,12 @@ class OpentxTaranisSimulator : public SimulatorInterface {
virtual unsigned int getPhase();
virtual const char * getPhaseName(unsigned int phase);
virtual void wheelEvent(uint8_t steps);
virtual const char * getError();
protected:
OpenTxInterface * open9xInterface;
};
#endif
+410 -242
View File
@@ -11,11 +11,11 @@
#define HAS_PERSISTENT_TIMERS(board) (IS_ARM(board) || board == BOARD_GRUVIN9X)
#define HAS_LARGE_LCD(board) IS_TARANIS(board)
#define MAX_VIEWS(board) (HAS_LARGE_LCD(board) ? 2 : 256)
#define MAX_POTS(board, version) (IS_TARANIS(board) ? (version>=216 ? 5 : 4) : 3)
#define MAX_POTS(board) (IS_TARANIS(board) ? 5 : 3)
#define MAX_SWITCHES(board) (IS_TARANIS(board) ? 8 : 7)
#define MAX_SWITCHES_POSITION(board) (IS_TARANIS(board) ? 22 : 9)
#define MAX_ROTARY_ENCODERS(board) (board==BOARD_GRUVIN9X ? 2 : (IS_SKY9X(board) ? 1 : 0))
#define MAX_PHASES(board, version) (IS_ARM(board) ? 9 : (IS_DBLRAM(board, version) ? 6 : 5))
#define MAX_FLIGHT_MODES(board, version) (IS_ARM(board) ? 9 : (IS_DBLRAM(board, version) ? 6 : 5))
#define MAX_MIXERS(board, version) (IS_ARM(board) ? 64 : 32)
#define MAX_CHANNELS(board, version) (IS_ARM(board) ? 32 : 16)
#define MAX_EXPOS(board, version) (IS_ARM(board) ? ((IS_TARANIS(board) && version >= 216) ? 64 : 32) : (IS_DBLRAM(board, version) ? 16 : 14))
@@ -86,8 +86,17 @@ class SwitchesConversionTable: public ConversionTable {
addConversion(RawSwitch(SWITCH_TYPE_VIRTUAL, i), val++);
}
addConversion(RawSwitch(SWITCH_TYPE_OFF), -val+offset);
addConversion(RawSwitch(SWITCH_TYPE_ON), val++);
if (!(flags & POPULATE_TIMER_MODES)) {
addConversion(RawSwitch(SWITCH_TYPE_OFF), -val+offset);
addConversion(RawSwitch(SWITCH_TYPE_ON), val++);
}
if (IS_ARM(board)) {
for (int i=1; i<=MAX_FLIGHT_MODES(board, version); i++) {
addConversion(RawSwitch(SWITCH_TYPE_FLIGHT_MODE, -i), -val+offset);
addConversion(RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i), val++);
}
}
if (version < 216) {
// previous "moment" switches
@@ -127,12 +136,12 @@ class SwitchesConversionTable: public ConversionTable {
SwitchesConversionTable * table;
};
static std::list<Cache> internalCache;
public:
static SwitchesConversionTable * getInstance(BoardEnum board, unsigned int version, unsigned long flags=0)
{
static std::list<Cache> internalCache;
for (std::list<Cache>::iterator it=internalCache.begin(); it!=internalCache.end(); it++) {
Cache element = *it;
if (element.board == board && element.version == version && element.flags == flags)
@@ -143,8 +152,18 @@ class SwitchesConversionTable: public ConversionTable {
internalCache.push_back(element);
return element.table;
}
static void Cleanup()
{
for (std::list<Cache>::iterator it=internalCache.begin(); it!=internalCache.end(); it++) {
Cache element = *it;
delete element.table;
}
internalCache.clear();
}
};
std::list<SwitchesConversionTable::Cache> SwitchesConversionTable::internalCache;
#define FLAG_NONONE 0x01
#define FLAG_NOSWITCHES 0x02
#define FLAG_NOTELEMETRY 0x04
@@ -172,8 +191,11 @@ class SourcesConversionTable: public ConversionTable {
}
}
for (int i=0; i<4+MAX_POTS(board, version); i++)
for (int i=0; i<4+MAX_POTS(board); i++) {
if (IS_TARANIS(board) && version < 216 && i==6)
continue;
addConversion(RawSource(SOURCE_TYPE_STICK, i), val++);
}
for (int i=0; i<MAX_ROTARY_ENCODERS(board); i++)
addConversion(RawSource(SOURCE_TYPE_ROTARY_ENCODER, 0), val++);
@@ -235,11 +257,17 @@ class SourcesConversionTable: public ConversionTable {
for (int i=0; i<TELEMETRY_SOURCE_ACC; i++) {
if (version < 216) {
if (i==TELEMETRY_SOURCE_SWR || i==TELEMETRY_SOURCE_RX_BATT || i==TELEMETRY_SOURCE_A3 || i==TELEMETRY_SOURCE_A4 || i==TELEMETRY_SOURCE_ASPD || i==TELEMETRY_SOURCE_DTE || i==TELEMETRY_SOURCE_CELL_MIN || i==TELEMETRY_SOURCE_CELLS_MIN || i==TELEMETRY_SOURCE_VFAS_MIN)
if (i==TELEMETRY_SOURCE_TX_TIME || i==TELEMETRY_SOURCE_SWR || i==TELEMETRY_SOURCE_RX_BATT || i==TELEMETRY_SOURCE_A3 || i==TELEMETRY_SOURCE_A4 || i==TELEMETRY_SOURCE_ASPD || i==TELEMETRY_SOURCE_DTE || i==TELEMETRY_SOURCE_CELL_MIN || i==TELEMETRY_SOURCE_CELLS_MIN || i==TELEMETRY_SOURCE_VFAS_MIN)
continue;
}
if (!IS_ARM(board)) {
if (i==TELEMETRY_SOURCE_TX_TIME || i==TELEMETRY_SOURCE_SWR|| i==TELEMETRY_SOURCE_RX_BATT || i==TELEMETRY_SOURCE_A3 || i==TELEMETRY_SOURCE_A4 || i==TELEMETRY_SOURCE_A3_MIN || i==TELEMETRY_SOURCE_A4_MIN)
continue;
}
addConversion(RawSource(SOURCE_TYPE_TELEMETRY, i), val++);
if (version >= 216 && IS_ARM(board)) {
if (i==TELEMETRY_SOURCE_TX_TIME)
val += 5;
if (i==TELEMETRY_SOURCE_DTE)
val += 5;
if (i==TELEMETRY_SOURCE_POWER_MAX)
@@ -272,13 +300,12 @@ class SourcesConversionTable: public ConversionTable {
unsigned long flags;
SourcesConversionTable * table;
};
static std::list<Cache> internalCache;
public:
static SourcesConversionTable * getInstance(BoardEnum board, unsigned int version, unsigned int variant, unsigned long flags=0)
{
static std::list<Cache> internalCache;
for (std::list<Cache>::iterator it=internalCache.begin(); it!=internalCache.end(); it++) {
Cache element = *it;
if (element.board == board && element.version == version && element.variant == variant && element.flags == flags)
@@ -289,8 +316,50 @@ class SourcesConversionTable: public ConversionTable {
internalCache.push_back(element);
return element.table;
}
static void Cleanup()
{
for (std::list<Cache>::iterator it=internalCache.begin(); it!=internalCache.end(); it++) {
Cache element = *it;
delete element.table;
}
internalCache.clear();
}
};
std::list<SourcesConversionTable::Cache> SourcesConversionTable::internalCache;
void OpenTxEepromCleanup(void)
{
SourcesConversionTable::Cleanup();
SwitchesConversionTable::Cleanup();
}
ThrottleSourceConversionTable::ThrottleSourceConversionTable(BoardEnum board, unsigned int version)
{
int val=0;
addConversion(THROTTLE_SOURCE_THR, val++);
if (IS_TARANIS(board)) {
addConversion(THROTTLE_SOURCE_S1, val++);
addConversion(THROTTLE_SOURCE_S2, val++);
if (version >= 216)
addConversion(THROTTLE_SOURCE_S3, val++);
addConversion(THROTTLE_SOURCE_LS, val++);
addConversion(THROTTLE_SOURCE_RS, val++);
}
else {
addConversion(THROTTLE_SOURCE_P1, val++);
addConversion(THROTTLE_SOURCE_P2, val++);
addConversion(THROTTLE_SOURCE_P3, val++);
}
for (int i=0; i<MAX_CHANNELS(board, version); i++) {
addConversion(THROTTLE_SOURCE_FIRST_CHANNEL+i, val++);
}
}
template <int N>
class SwitchField: public ConversionField< SignedField<N> > {
public:
@@ -384,8 +453,13 @@ class TelemetrySourcesConversionTable: public ConversionTable {
addConversion(1+TELEMETRY_SOURCE_T2_MAX, val++);
addConversion(1+TELEMETRY_SOURCE_SPEED_MAX, val++);
addConversion(1+TELEMETRY_SOURCE_DIST_MAX, val++);
addConversion(1+TELEMETRY_SOURCE_CELL_MIN, val++);
addConversion(1+TELEMETRY_SOURCE_VFAS_MIN, val++);
if (version >= 216) {
addConversion(1+TELEMETRY_SOURCE_ASPEED_MAX, val++);
addConversion(1+TELEMETRY_SOURCE_CELL_MIN, val++);
addConversion(1+TELEMETRY_SOURCE_CELLS_MIN, val++);
addConversion(1+TELEMETRY_SOURCE_VFAS_MIN, val++);
}
addConversion(1+TELEMETRY_SOURCE_CURRENT_MAX, val++);
addConversion(1+TELEMETRY_SOURCE_POWER_MAX, val++);
if (IS_ARM(board) && version >= 216) {
for (int i=0; i<5; i++)
@@ -442,176 +516,6 @@ class SourceField: public ConversionField< UnsignedField<N> > {
unsigned int _source;
};
class CurveReferenceField: public TransformedField {
public:
CurveReferenceField(CurveReference & curve, BoardEnum board, unsigned int version):
TransformedField(internalField),
curve(curve),
_curve_type(0)
{
internalField.Append(new UnsignedField<8>(_curve_type));
internalField.Append(new SignedField<8>(curve.value));
}
virtual void beforeExport()
{
if (curve.value != 0)
_curve_type = (unsigned int)curve.type;
else
_curve_type = 0;
}
virtual void afterImport()
{
curve.type = (CurveReference::CurveRefType)_curve_type;
}
protected:
StructField internalField;
CurveReference & curve;
unsigned int _curve_type;
};
class HeliField: public StructField {
public:
HeliField(SwashRingData & heli, BoardEnum board, unsigned int version, unsigned int variant)
{
Append(new BoolField<1>(heli.invertELE));
Append(new BoolField<1>(heli.invertAIL));
Append(new BoolField<1>(heli.invertCOL));
Append(new UnsignedField<5>(heli.type));
Append(new SourceField<8>(heli.collectiveSource, board, version, variant));
//, FLAG_NOSWITCHES)); Fix shift in collective
Append(new UnsignedField<8>(heli.value));
}
};
class PhaseField: public TransformedField {
public:
PhaseField(PhaseData & phase, int index, BoardEnum board, unsigned int version):
TransformedField(internalField),
internalField("Phase"),
phase(phase),
index(index),
board(board),
version(version),
rotencCount(IS_ARM(board) ? 1 : (board == BOARD_GRUVIN9X ? 2 : 0))
{
if (board == BOARD_STOCK || (board==BOARD_M128 && version>=215)) {
// On stock we use 10bits per trim
for (int i=0; i<NUM_STICKS; i++)
internalField.Append(new SignedField<8>(trimBase[i]));
for (int i=0; i<NUM_STICKS; i++)
internalField.Append(new SignedField<2>(trimExt[i]));
}
else if (board == BOARD_TARANIS && version >= 216) {
for (int i=0; i<NUM_STICKS; i++) {
internalField.Append(new SignedField<11>(phase.trim[i]));
internalField.Append(new UnsignedField<5>(trimMode[i]));
}
}
else {
for (int i=0; i<NUM_STICKS; i++)
internalField.Append(new SignedField<16>(trimBase[i]));
}
internalField.Append(new SwitchField<8>(phase.swtch, board, version));
if (HAS_LARGE_LCD(board))
internalField.Append(new ZCharField<10>(phase.name));
else
internalField.Append(new ZCharField<6>(phase.name));
if (IS_ARM(board) && version >= 214) {
internalField.Append(new UnsignedField<8>(phase.fadeIn));
internalField.Append(new UnsignedField<8>(phase.fadeOut));
}
else {
internalField.Append(new UnsignedField<4>(phase.fadeIn));
internalField.Append(new UnsignedField<4>(phase.fadeOut));
}
for (int i=0; i<rotencCount; i++) {
internalField.Append(new SignedField<16>(phase.rotaryEncoders[i]));
}
if (board != BOARD_STOCK && (board != BOARD_M128 || version < 215)) {
for (int i=0; i<MAX_GVARS(board, version); i++) {
internalField.Append(new SignedField<16>(phase.gvars[i]));
}
}
}
virtual void beforeExport()
{
for (int i=0; i<NUM_STICKS; i++) {
if (board == BOARD_TARANIS && version >= 216) {
if (phase.trimMode[i] < 0)
trimMode[i] = TRIM_MODE_NONE;
else
trimMode[i] = 2*phase.trimRef[i] + phase.trimMode[i];
}
else {
int trim;
if (phase.trimMode[i] < 0)
trim = 0;
else if (phase.trimRef[i] != index)
trim = 501 + phase.trimRef[i] - (phase.trimRef[i] > index ? 1 : 0);
else
trim = std::max(-500, std::min(500, phase.trim[i]));
if (board == BOARD_STOCK || (board == BOARD_M128 && version >= 215)) {
trimBase[i] = trim >> 2;
trimExt[i] = (trim & 0x03);
}
else {
trimBase[i] = trim;
}
}
}
}
virtual void afterImport()
{
for (int i=0; i<NUM_STICKS; i++) {
if (board == BOARD_TARANIS && version >= 216) {
if (trimMode[i] == TRIM_MODE_NONE) {
phase.trimMode[i] = -1;
}
else {
phase.trimMode[i] = trimMode[i] % 2;
phase.trimRef[i] = trimMode[i] / 2;
}
}
else {
int trim;
if (board == BOARD_STOCK || (board == BOARD_M128 && version >= 215))
trim = ((trimBase[i]) << 2) + (trimExt[i] & 0x03);
else
trim = trimBase[i];
if (trim > 500) {
phase.trimRef[i] = trim - 501;
if (phase.trimRef[i] >= index)
phase.trimRef[i] += 1;
phase.trim[i] = 0;
}
else {
phase.trim[i] = trim;
}
}
}
}
protected:
StructField internalField;
PhaseData & phase;
int index;
BoardEnum board;
unsigned int version;
int rotencCount;
int trimBase[NUM_STICKS];
int trimExt[NUM_STICKS];
unsigned int trimMode[NUM_STICKS];
};
int smallGvarToEEPROM(int gvar)
{
@@ -635,7 +539,6 @@ int smallGvarToC9x(int gvar)
return gvar;
}
void splitGvarParam(const int gvar, int & _gvar, unsigned int & _gvarParam, const BoardEnum board, const int version)
{
if (version >= 214 || (!IS_ARM(board) && version >= 213)) {
@@ -672,11 +575,11 @@ void splitGvarParam(const int gvar, int & _gvar, unsigned int & _gvarParam, cons
void concatGvarParam(int & gvar, const int _gvar, const unsigned int _gvarParam, const BoardEnum board, const int version)
{
if (version >= 214 || (!IS_ARM(board) && version >= 213)) {
gvar = _gvar;
gvar = _gvar;
if (gvar<0) gvar+=256; // remove 2er complement, because 8bit part is in this case unsigned
if (_gvarParam) { // here is the real sign bit
gvar|=-256; // set all higher bits to simulate negative value
}
if (_gvarParam) { // here is the real sign bit
gvar|=-256; // set all higher bits to simulate negative value
}
if (gvar>245) {
gvar = gvar-256 - 10000;
@@ -697,32 +600,36 @@ void concatGvarParam(int & gvar, const int _gvar, const unsigned int _gvarParam,
}
}
void exportGvarParam(const int gvar, int & _gvar)
void exportGvarParam(const int gvar, int & _gvar, int version)
{
int GV1 = (version >= 216 ? 4096 : 512);
if (gvar < -10000) {
_gvar = 512 + gvar + 10000;
_gvar = GV1 + gvar + 10000;
}
else if (gvar > 10000) {
_gvar = 512 + gvar - 10001;
_gvar = GV1 + gvar - 10001;
}
else {
_gvar = gvar;
}
}
void importGvarParam(int & gvar, const int _gvar)
void importGvarParam(int & gvar, const int _gvar, int version)
{
if (_gvar >= 512) {
gvar = 10001 + _gvar - 512;
int GV1 = (version >= 216 ? 4096 : 512);
if (_gvar >= GV1) {
gvar = 10001 + _gvar - GV1;
}
else if (_gvar >= 512-5) {
gvar = -10000 + _gvar - 512;
else if (_gvar >= GV1-9) {
gvar = -10000 + _gvar - GV1;
}
else if (_gvar < -512) {
gvar = -10000 + _gvar + 513;
else if (_gvar < -GV1) {
gvar = -10000 + _gvar + GV1 + 1;
}
else if (_gvar < -512+5) {
gvar = 10000 + _gvar + 513;
else if (_gvar < -GV1+9) {
gvar = 10000 + _gvar + GV1 + 1;
}
else {
gvar = _gvar;
@@ -731,6 +638,194 @@ void importGvarParam(int & gvar, const int _gvar)
// qDebug() << QString("import") << _gvar << gvar;
}
class CurveReferenceField: public TransformedField {
public:
CurveReferenceField(CurveReference & curve, BoardEnum board, unsigned int version):
TransformedField(internalField),
curve(curve),
_curve_type(0),
_curve_value(0)
{
internalField.Append(new UnsignedField<8>(_curve_type));
internalField.Append(new SignedField<8>(_curve_value));
}
virtual void beforeExport()
{
if (curve.value != 0) {
_curve_type = (unsigned int)curve.type;
_curve_value = smallGvarToEEPROM(curve.value);
}
else {
_curve_type = 0;
_curve_value = 0;
}
}
virtual void afterImport()
{
curve.type = (CurveReference::CurveRefType)_curve_type;
curve.value = smallGvarToC9x(_curve_value);
}
protected:
StructField internalField;
CurveReference & curve;
unsigned int _curve_type;
int _curve_value;
};
class HeliField: public StructField {
public:
HeliField(SwashRingData & heli, BoardEnum board, unsigned int version, unsigned int variant)
{
Append(new BoolField<1>(heli.invertELE));
Append(new BoolField<1>(heli.invertAIL));
Append(new BoolField<1>(heli.invertCOL));
Append(new UnsignedField<5>(heli.type));
Append(new SourceField<8>(heli.collectiveSource, board, version, variant));
//, FLAG_NOSWITCHES)); Fix shift in collective
Append(new UnsignedField<8>(heli.value));
}
};
class FlightModeField: public TransformedField {
public:
FlightModeField(PhaseData & phase, int index, BoardEnum board, unsigned int version):
TransformedField(internalField),
internalField("Phase"),
phase(phase),
index(index),
board(board),
version(version),
rotencCount(IS_ARM(board) ? 1 : (board == BOARD_GRUVIN9X ? 2 : 0))
{
if (board == BOARD_STOCK || (board==BOARD_M128 && version>=215)) {
// On stock we use 10bits per trim
for (int i=0; i<NUM_STICKS; i++)
internalField.Append(new SignedField<8>(trimBase[i]));
for (int i=0; i<NUM_STICKS; i++)
internalField.Append(new SignedField<2>(trimExt[i]));
}
else if (IS_TARANIS(board) && version >= 216) {
for (int i=0; i<NUM_STICKS; i++) {
internalField.Append(new SignedField<11>(phase.trim[i]));
internalField.Append(new UnsignedField<5>(trimMode[i]));
}
}
else {
for (int i=0; i<NUM_STICKS; i++) {
internalField.Append(new SignedField<16>(trimBase[i]));
}
}
internalField.Append(new SwitchField<8>(phase.swtch, board, version));
if (HAS_LARGE_LCD(board))
internalField.Append(new ZCharField<10>(phase.name));
else
internalField.Append(new ZCharField<6>(phase.name));
if (IS_ARM(board) && version >= 214) {
internalField.Append(new UnsignedField<8>(phase.fadeIn));
internalField.Append(new UnsignedField<8>(phase.fadeOut));
}
else {
internalField.Append(new UnsignedField<4>(phase.fadeIn));
internalField.Append(new UnsignedField<4>(phase.fadeOut));
}
for (int i=0; i<rotencCount; i++) {
internalField.Append(new SignedField<16>(phase.rotaryEncoders[i]));
}
if (board != BOARD_STOCK && (board != BOARD_M128 || version < 215)) {
for (int i=0; i<MAX_GVARS(board, version); i++) {
internalField.Append(new SignedField<16>(phase.gvars[i]));
}
}
}
virtual void beforeExport()
{
for (int i=0; i<NUM_STICKS; i++) {
if (IS_TARANIS(board) && version >= 216) {
if (phase.trimMode[i] < 0)
trimMode[i] = TRIM_MODE_NONE;
else
trimMode[i] = 2*phase.trimRef[i] + phase.trimMode[i];
}
else {
int trim;
if (phase.trimMode[i] < 0)
trim = 0;
else if (phase.trimRef[i] != index)
trim = 501 + phase.trimRef[i] - (phase.trimRef[i] > index ? 1 : 0);
else
trim = std::max(-500, std::min(500, phase.trim[i]));
if (board == BOARD_STOCK || (board == BOARD_M128 && version >= 215)) {
trimBase[i] = trim >> 2;
trimExt[i] = (trim & 0x03);
}
else {
trimBase[i] = trim;
}
}
}
}
virtual void afterImport()
{
for (int i=0; i<NUM_STICKS; i++) {
if (IS_TARANIS(board) && version >= 216) {
if (trimMode[i] == TRIM_MODE_NONE) {
phase.trimMode[i] = -1;
}
else {
phase.trimMode[i] = trimMode[i] % 2;
phase.trimRef[i] = trimMode[i] / 2;
}
}
else {
if (phase.swtch == RawSwitch(SWITCH_TYPE_NONE) && index > 0) {
phase.trimRef[i] = 0;
phase.trimMode[i] = 0;
phase.trim[i] = 0;
}
else {
int trim;
if (board == BOARD_STOCK || (board == BOARD_M128 && version >= 215))
trim = ((trimBase[i]) << 2) + (trimExt[i] & 0x03);
else
trim = trimBase[i];
if (trim > 500) {
phase.trimRef[i] = trim - 501;
if (phase.trimRef[i] >= index)
phase.trimRef[i] += 1;
phase.trimMode[i] = 0;
phase.trim[i] = 0;
}
else {
phase.trimRef[i] = index/*own trim*/;
phase.trimMode[i] = 0;
phase.trim[i] = trim;
}
}
}
}
}
protected:
StructField internalField;
PhaseData & phase;
int index;
BoardEnum board;
unsigned int version;
int rotencCount;
int trimBase[NUM_STICKS];
int trimExt[NUM_STICKS];
unsigned int trimMode[NUM_STICKS];
};
class MixField: public TransformedField {
public:
MixField(MixData & mix, BoardEnum board, unsigned int version, ModelData * model):
@@ -744,12 +839,14 @@ class MixField: public TransformedField {
if (IS_TARANIS(board) && version >= 216) {
internalField.Append(new UnsignedField<8>(_destCh));
internalField.Append(new UnsignedField<16>(mix.phases));
internalField.Append(new UnsignedField<8>((unsigned int &)mix.mltpx));
internalField.Append(new UnsignedField<2>((unsigned int &)mix.mltpx));
internalField.Append(new UnsignedField<1>((unsigned int &)mix.carryTrim));
internalField.Append(new SpareBitsField<5>());
internalField.Append(new SignedField<16>(_weight));
internalField.Append(new SwitchField<8>(mix.swtch, board, version));
internalField.Append(new CurveReferenceField(mix.curve, board, version));
internalField.Append(new UnsignedField<4>(mix.mixWarn));
internalField.Append(new UnsignedField<4>(mix.srcVariant));
internalField.Append(new SpareBitsField<4>());
internalField.Append(new UnsignedField<8>(mix.delayUp));
internalField.Append(new UnsignedField<8>(mix.delayDown));
internalField.Append(new UnsignedField<8>(mix.speedUp));
@@ -759,6 +856,26 @@ class MixField: public TransformedField {
internalField.Append(new ZCharField<8>(mix.name));
internalField.Append(new SpareBitsField<8>());
}
else if (IS_ARM(board) && version >= 216) {
internalField.Append(new UnsignedField<4>(_destCh));
internalField.Append(new UnsignedField<4>(mix.mixWarn));
internalField.Append(new UnsignedField<16>(mix.phases));
internalField.Append(new BoolField<1>(_curveMode));
internalField.Append(new BoolField<1>(mix.noExpo));
internalField.Append(new SignedField<3>(mix.carryTrim));
internalField.Append(new UnsignedField<2>((unsigned int &)mix.mltpx));
internalField.Append(new SpareBitsField<1>());
internalField.Append(new SignedField<16>(_weight));
internalField.Append(new SwitchField<8>(mix.swtch, board, version));
internalField.Append(new SignedField<8>(_curveParam));
internalField.Append(new UnsignedField<8>(mix.delayUp));
internalField.Append(new UnsignedField<8>(mix.delayDown));
internalField.Append(new UnsignedField<8>(mix.speedUp));
internalField.Append(new UnsignedField<8>(mix.speedDown));
internalField.Append(new SourceField<8>(mix.srcRaw, board, version, FLAG_NOTELEMETRY));
internalField.Append(new SignedField<16>(_offset));
internalField.Append(new ZCharField<6>(mix.name));
}
else if (IS_ARM(board)) {
internalField.Append(new UnsignedField<8>(_destCh));
internalField.Append(new UnsignedField<16>(mix.phases));
@@ -775,7 +892,7 @@ class MixField: public TransformedField {
internalField.Append(new SignedField<8>(_curveParam));
if (version >= 214) {
internalField.Append(new UnsignedField<4>(mix.mixWarn));
internalField.Append(new UnsignedField<4>(mix.srcVariant));
internalField.Append(new SpareBitsField<4>());
}
else {
internalField.Append(new UnsignedField<8>(mix.mixWarn));
@@ -865,9 +982,9 @@ class MixField: public TransformedField {
}
if (IS_ARM(board)) {
exportGvarParam(mix.weight, _weight);
exportGvarParam(mix.weight, _weight, version);
if (version >= 214)
exportGvarParam(mix.sOffset, _offset);
exportGvarParam(mix.sOffset, _offset, version);
else
splitGvarParam(mix.sOffset, _offset, _offsetMode, board, version);
}
@@ -879,7 +996,7 @@ class MixField: public TransformedField {
virtual void afterImport()
{
if (IS_TARANIS(board) || version < 216) {
if (IS_TARANIS(board) && version < 216) {
if (mix.srcRaw.type == SOURCE_TYPE_STICK && mix.srcRaw.index < NUM_STICKS) {
if (!mix.noExpo) {
mix.srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, mix.srcRaw.index, model);
@@ -900,9 +1017,9 @@ class MixField: public TransformedField {
}
if (IS_ARM(board)) {
importGvarParam(mix.weight, _weight);
importGvarParam(mix.weight, _weight, version);
if (version >= 214)
importGvarParam(mix.sOffset, _offset);
importGvarParam(mix.sOffset, _offset, version);
else
concatGvarParam(mix.sOffset, _offset, _offsetMode, board, version);
}
@@ -910,6 +1027,13 @@ class MixField: public TransformedField {
concatGvarParam(mix.weight, _weight, _weightMode, board, version);
concatGvarParam(mix.sOffset, _offset, _offsetMode, board, version);
}
if (IS_TARANIS(board) && version < 216) {
if (mix.sOffset >= -500 && mix.sOffset <= 500 && mix.weight >= -500 && mix.weight <= 500) {
mix.sOffset = divRoundClosest(mix.sOffset * mix.weight, 100);
}
if (mix.carryTrim < 0) mix.carryTrim = 0;
}
}
protected:
@@ -938,17 +1062,28 @@ class InputField: public TransformedField {
{
if (IS_TARANIS(board) && version >= 216) {
internalField.Append(new SourceField<8>(expo.srcRaw, board, version, 0));
internalField.Append(new UnsignedField<16>(expo.scale));
internalField.Append(new UnsignedField<16>(expo.scale, "Scale"));
internalField.Append(new UnsignedField<8>(expo.chn, "Channel"));
internalField.Append(new SwitchField<8>(expo.swtch, board, version));
internalField.Append(new UnsignedField<16>(expo.phases));
internalField.Append(new SignedField<8>(_weight, "Weight"));
internalField.Append(new SignedField<8>(expo.carryTrim));
internalField.Append(new SignedField<6>(expo.carryTrim, "CarryTrim"));
internalField.Append(new UnsignedField<2>(expo.mode, "Mode"));
internalField.Append(new ZCharField<8>(expo.name));
internalField.Append(new SignedField<8>(expo.offset, "Offset"));
internalField.Append(new CurveReferenceField(expo.curve, board, version));
internalField.Append(new SpareBitsField<8>());
}
else if (IS_ARM(board) && version >= 216) {
internalField.Append(new UnsignedField<2>(expo.mode, "Mode"));
internalField.Append(new UnsignedField<4>(expo.chn, "Channel"));
internalField.Append(new BoolField<2>(_curveMode));
internalField.Append(new SwitchField<8>(expo.swtch, board, version));
internalField.Append(new UnsignedField<16>(expo.phases, "Phases"));
internalField.Append(new SignedField<8>(_weight, "Weight"));
internalField.Append(new ZCharField<6>(expo.name));
internalField.Append(new SignedField<8>(_curveParam));
}
else if (IS_ARM(board)) {
internalField.Append(new UnsignedField<8>(expo.mode, "Mode"));
internalField.Append(new UnsignedField<8>(expo.chn, "Channel"));
@@ -1008,9 +1143,11 @@ class InputField: public TransformedField {
virtual void afterImport()
{
if (IS_TARANIS(board) && version < 216) {
if (expo.mode) {
expo.srcRaw = RawSource(SOURCE_TYPE_STICK, expo.chn);
if (IS_TARANIS(board)) {
if (version < 216) {
if (expo.mode) {
expo.srcRaw = RawSource(SOURCE_TYPE_STICK, expo.chn);
}
}
}
@@ -1041,7 +1178,7 @@ class LimitField: public StructField {
LimitField(LimitData & limit, BoardEnum board, unsigned int version):
StructField("Limit")
{
if (IS_ARM(board) && version >= 216) {
if (IS_TARANIS(board) && version >= 216) {
Append(new ConversionField< SignedField<16> >(limit.min, +1000));
Append(new ConversionField< SignedField<16> >(limit.max, -1000));
}
@@ -1341,6 +1478,10 @@ class LogicalSwitchField: public TransformedField {
}
}
~LogicalSwitchField()
{
delete andswitchesConversionTable;
}
virtual void beforeExport()
{
if (csw.func == LS_FN_TIMER) {
@@ -1458,7 +1599,7 @@ class CustomFunctionsConversionTable: public ConversionTable {
int val=0;
if (version >= 216) {
for (int i=0; i<32; i++) {
for (int i=0; i<MAX_CHANNELS(board, version); i++) {
addConversion(i, val);
}
val++;
@@ -1618,11 +1759,11 @@ class ArmCustomFunctionField: public TransformedField {
internalField.Append(new CharField<6>(_param, false));
if (version >= 216) {
internalField.Append(new UnsignedField<8>(_active));
internalField.Append(new SignedField<8>(_active));
}
else if (version >= 214) {
internalField.Append(new UnsignedField<2>(_mode));
internalField.Append(new UnsignedField<6>(_active));
internalField.Append(new UnsignedField<6>((unsigned int &)_active));
}
else {
internalField.Append(new UnsignedField<8>((unsigned int &)_active));
@@ -1723,7 +1864,7 @@ class ArmCustomFunctionField: public TransformedField {
if (fn.func >= FuncSafetyCh1 && fn.func <= FuncSafetyCh32) {
fn.func = AssignFunc(fn.func + index);
fn.param = (int)value;
fn.param = (int8_t)value;
}
else if (fn.func >= FuncSetTimer1 && fn.func <= FuncSetTimer2) {
fn.func = AssignFunc(fn.func + index);
@@ -1783,7 +1924,7 @@ class ArmCustomFunctionField: public TransformedField {
CustomFunctionsConversionTable functionsConversionTable;
SourcesConversionTable * sourcesConversionTable;
char _param[10];
unsigned int _active;
int _active;
unsigned int _mode;
};
@@ -1808,7 +1949,7 @@ class AvrCustomFunctionField: public TransformedField {
internalField.Append(new UnsignedField<5>(_union_param));
internalField.Append(new UnsignedField<1>(_active));
}
if (version >= 213) {
else if (version >= 213) {
internalField.Append(new SwitchField<8>(fn.swtch, board, version));
internalField.Append(new UnsignedField<3>(_union_param));
internalField.Append(new ConversionField< UnsignedField<5> >((unsigned int &)fn.func, &functionsConversionTable, "Function", ::QObject::tr("OpenTX on this board doesn't accept this function")));
@@ -2048,7 +2189,7 @@ class FrskyField: public StructField {
rssiConversionTable[1] = RSSIConversionTable(1);
if (IS_ARM(board)) {
for (int i=0; i<2; i++) {
for (int i=0; i < ((version >= 216) ? 4 : 2); i++) {
Append(new UnsignedField<8>(frsky.channels[i].ratio, "Ratio"));
Append(new SignedField<12>(frsky.channels[i].offset, "Offset"));
Append(new UnsignedField<4>(frsky.channels[i].type, "Type"));
@@ -2069,7 +2210,7 @@ class FrskyField: public StructField {
else {
Append(new UnsignedField<8>(frsky.voltsSource));
}
Append(new UnsignedField<8>(frsky.blades));
Append(new ConversionField< SignedField<8> >(frsky.blades, -2));
Append(new UnsignedField<8>(frsky.currentSource));
Append(new UnsignedField<1>(frsky.screens[0].type));
@@ -2111,12 +2252,12 @@ class FrskyField: public StructField {
Append(new UnsignedField<1>(frsky.channels[i].alarms[j].greater));
Append(new UnsignedField<2>(frsky.channels[i].multiplier, 0, 3, "Multiplier"));
}
Append(new UnsignedField<2>(frsky.usrProto));
Append(new UnsignedField<2>(frsky.blades));
Append(new UnsignedField<2>(frsky.usrProto, "USR Proto"));
Append(new ConversionField< UnsignedField<2> >((unsigned int &)frsky.blades, -2));
Append(new UnsignedField<1>(frsky.screens[0].type));
Append(new UnsignedField<1>(frsky.screens[1].type));
Append(new UnsignedField<2>(frsky.voltsSource));
Append(new SignedField<4>(frsky.varioMin));
Append(new UnsignedField<2>(frsky.voltsSource, "Volts Source"));
Append(new SignedField<4>(frsky.varioMin, "Vario Min"));
Append(new SignedField<4>(frsky.varioMax));
for (int i=0; i<2; i++) {
Append(new ConversionField< UnsignedField<2> >(frsky.rssiAlarms[i].level, &rssiConversionTable[i], "RSSI level"));
@@ -2165,7 +2306,8 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
board(board),
version(version),
variant(variant),
protocolsConversionTable(board)
protocolsConversionTable(board),
throttleSourceConversionTable(board, version)
{
sprintf(name, "Model %s", modelData.name);
@@ -2268,14 +2410,14 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
internalField.Append(new AvrCustomFunctionField(modelData.funcSw[i], board, version, variant));
}
internalField.Append(new HeliField(modelData.swashRingData, board, version, variant));
for (int i=0; i<MAX_PHASES(board, version); i++)
internalField.Append(new PhaseField(modelData.phaseData[i], i, board, version));
for (int i=0; i<MAX_FLIGHT_MODES(board, version); i++)
internalField.Append(new FlightModeField(modelData.phaseData[i], i, board, version));
if (!IS_ARM(board) || version < 216) {
internalField.Append(new SignedField<8>(modelData.moduleData[0].ppmFrameLength));
}
internalField.Append(new UnsignedField<8>(modelData.thrTraceSrc));
internalField.Append(new ConversionField< UnsignedField<8> >(modelData.thrTraceSrc, &throttleSourceConversionTable, "Throttle Source"));
if (!afterrelease21March2013) {
internalField.Append(new UnsignedField<8>(modelData.modelId));
@@ -2342,7 +2484,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]));
}
}
@@ -2366,7 +2508,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]));
}
}
@@ -2425,7 +2567,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
generalData(generalData),
board(board),
version(version),
inputsCount(4 + MAX_POTS(board, version))
inputsCount(4 + MAX_POTS(board))
{
generalData.version = version;
generalData.variant = variant;
@@ -2442,12 +2584,18 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
}
}
else {
for (int i=0; i<inputsCount; i++)
internalField.Append(new SignedField<16>(generalData.calibMid[i]));
for (int i=0; i<inputsCount; i++)
internalField.Append(new SignedField<16>(generalData.calibSpanNeg[i]));
for (int i=0; i<inputsCount; i++)
internalField.Append(new SignedField<16>(generalData.calibSpanPos[i]));
for (int i=0; i<inputsCount; i++) {
if (!IS_TARANIS(board) || i!=6)
internalField.Append(new SignedField<16>(generalData.calibMid[i]));
}
for (int i=0; i<inputsCount; i++) {
if (!IS_TARANIS(board) || i!=6)
internalField.Append(new SignedField<16>(generalData.calibSpanNeg[i]));
}
for (int i=0; i<inputsCount; i++) {
if (!IS_TARANIS(board) || i!=6)
internalField.Append(new SignedField<16>(generalData.calibSpanPos[i]));
}
}
internalField.Append(new UnsignedField<16>(chkSum));
@@ -2487,7 +2635,9 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
internalField.Append(new BoolField<1>(generalData.minuteBeep));
internalField.Append(new BoolField<1>(generalData.preBeep));
}
if (version >= 213 || (!IS_ARM(board) && version >= 212))
if (version >= 216 && IS_TARANIS(board))
internalField.Append(new SignedField<3>(generalData.splashDuration));
else if (version >= 213 || (!IS_ARM(board) && version >= 212))
internalField.Append(new UnsignedField<3>(generalData.splashMode)); // TODO
else
internalField.Append(new SpareBitsField<3>());
@@ -2498,7 +2648,15 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
internalField.Append(new UnsignedField<8>(generalData.templateSetup));
internalField.Append(new SignedField<8>(generalData.PPM_Multiplier));
internalField.Append(new SignedField<8>(generalData.hapticLength));
internalField.Append(new UnsignedField<8>(generalData.reNavigation));
if (version < 216 || !IS_9X(board)) {
internalField.Append(new UnsignedField<8>(generalData.reNavigation));
}
if (version >= 216 && !IS_TARANIS(board)) {
internalField.Append(new UnsignedField<4>(generalData.stickReverse));
internalField.Append(new SpareBitsField<4>());
}
internalField.Append(new SignedField<3>(generalData.beeperLength));
internalField.Append(new UnsignedField<3>(generalData.hapticStrength));
@@ -2549,9 +2707,10 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
}
if (IS_TARANIS(board) && version >= 216) {
internalField.Append(new UnsignedField<8>(generalData.hw_uartMode));
for (int i=0; i<8; i++) {
internalField.Append(new UnsignedField<1>(generalData.potsType[i]));
for (int i=0; i<4; i++) {
internalField.Append(new UnsignedField<2>(potsType[i]));
}
internalField.Append(new UnsignedField<8>(generalData.backlightColor));
}
}
}
@@ -2569,6 +2728,11 @@ void OpenTxGeneralData::beforeExport()
sum += generalData.calibSpanPos[i];
if (++count == 12) break;
}
for (int i=0; i<4; i++) {
potsType[i] = generalData.potsType[i];
if (i<2 && potsType[i] == 1)
potsType[i] = 0;
}
}
else {
for (int i=0; i<inputsCount; i++)
@@ -2581,4 +2745,8 @@ void OpenTxGeneralData::beforeExport()
void OpenTxGeneralData::afterImport()
{
for (int i=0; i<4; i++) {
if (i<2 && generalData.potsType[i] == 0)
generalData.potsType[i] = 1;
}
}
+11 -2
View File
@@ -32,7 +32,7 @@
#define SIMU_M128_VARIANTS (M128_VARIANT|SIMU_STOCK_VARIANTS)
#define O9X_MAX_TIMERS 2
#define O9X_MAX_PHASES 5
#define O9X_MAX_FLIGHT_MODES 5
#define O9X_MAX_MIXERS 32
#define O9X_MAX_EXPOS 14
#define O9X_NUM_CHNOUT 16 // number of real output channels CH1-CH16
@@ -41,7 +41,7 @@
#define O9X_MAX_CURVES 8
#define O9X_NUM_POINTS (112-O9X_MAX_CURVES)
#define O9X_ARM_MAX_PHASES 9
#define O9X_ARM_MAX_FLIGHT_MODES 9
#define O9X_ARM_MAX_MIXERS 64
#define O9X_ARM_MAX_EXPOS 32
#define O9X_ARM_NUM_CHNOUT 32 // number of real output channels CH1-CH16
@@ -65,6 +65,7 @@ class OpenTxGeneralData: public TransformedField {
unsigned int version;
int inputsCount;
unsigned int chkSum;
unsigned int potsType[4];
};
class ProtocolsConversionTable: public ConversionTable
@@ -102,6 +103,12 @@ class ProtocolsConversionTable: public ConversionTable
}
};
class ThrottleSourceConversionTable: public ConversionTable {
public:
ThrottleSourceConversionTable(BoardEnum board, unsigned int version);
};
class ChannelsConversionTable: public ConversionTable
{
public:
@@ -133,7 +140,9 @@ class OpenTxModelData: public TransformedField {
char name[256];
int subprotocols[C9X_NUM_MODULES+1/*trainer*/];
ProtocolsConversionTable protocolsConversionTable;
ThrottleSourceConversionTable throttleSourceConversionTable;
ChannelsConversionTable channelsConversionTable;
};
void OpenTxEepromCleanup(void);
#endif
+364 -332
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:
@@ -65,6 +65,8 @@ const char * OpenTxInterface::getName()
return "OpenTX for Gruvin9x board / 9X";
case BOARD_TARANIS:
return "OpenTX for FrSky Taranis";
case BOARD_TARANIS_PLUS:
return "OpenTX for FrSky Taranis Plus";
case BOARD_TARANIS_REV4a:
return "OpenTX for FrSky Taranis Rev4a";
case BOARD_SKY9X:
@@ -76,7 +78,7 @@ const char * OpenTxInterface::getName()
}
}
const int OpenTxInterface::getEEpromSize()
const int OpenTxEepromInterface::getEEpromSize()
{
switch (board) {
case BOARD_STOCK:
@@ -90,6 +92,7 @@ const int OpenTxInterface::getEEpromSize()
case BOARD_9XRPRO:
return EESIZE_9XRPRO;
case BOARD_TARANIS:
case BOARD_TARANIS_PLUS:
return EESIZE_TARANIS;
case BOARD_TARANIS_REV4a:
return EESIZE_TARANIS_REV4a;
@@ -98,7 +101,7 @@ const int OpenTxInterface::getEEpromSize()
}
}
const int OpenTxInterface::getMaxModels()
const int OpenTxEepromInterface::getMaxModels()
{
if (IS_ARM(board))
return 60;
@@ -111,7 +114,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;
@@ -144,7 +147,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);
@@ -171,7 +174,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);
@@ -252,7 +255,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);
@@ -268,7 +271,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();
@@ -279,7 +282,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();
@@ -289,12 +292,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...";
@@ -356,21 +359,21 @@ 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();
if (!version) {
switch(board) {
case BOARD_TARANIS:
case BOARD_TARANIS_PLUS:
case BOARD_TARANIS_REV4a:
case BOARD_SKY9X:
version = 216;
break;
case BOARD_9XRPRO:
version = 216;
break;
case BOARD_GRUVIN9X:
case BOARD_MEGA2560:
version = 216;
break;
case BOARD_M128:
@@ -412,7 +415,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 (IS_SKY9X(board))
return 0;
@@ -435,7 +438,7 @@ int OpenTxInterface::getSize(ModelData &model)
return efile->size(0);
}
int OpenTxInterface::getSize(GeneralSettings &settings)
int OpenTxEepromInterface::getSize(GeneralSettings &settings)
{
if (IS_SKY9X(board))
return 0;
@@ -455,11 +458,9 @@ int OpenTxInterface::getSize(GeneralSettings &settings)
return efile->size(0);
}
int OpenTxInterface::getCapability(const Capability capability)
int OpenTxFirmware::getCapability(const Capability capability)
{
switch (capability) {
case OwnerName:
return 0;
case ModelImage:
if (IS_TARANIS(board))
return 1;
@@ -486,25 +487,28 @@ int OpenTxInterface::getCapability(const Capability capability)
return 1;
case PPMFrameLength:
return 40;
case FlightPhases:
case FlightModes:
if (IS_ARM(board))
return 9;
else if (board==BOARD_GRUVIN9X)
return 6;
else
return 5;
case FlightPhasesHaveFades:
case FlightModesHaveFades:
return 1;
case Gvars:
return IS_ARM(board) ? 9 : 5;
case FlightModesName:
case GvarsName:
return (IS_TARANIS(board) ? 10 : 6);
case GvarsName:
return 6;
case HasChNames:
return (IS_TARANIS(board) ? 1 : 0);
case GvarsInCS:
case HasFAIMode:
return 1;
case GvarsAreNamed:
case GvarsFlightPhases:
case GvarsFlightModes:
return ((IS_ARM(board)||(board==BOARD_GRUVIN9X)) ? 1 : 0);
case Mixes:
return (IS_ARM(board) ? O9X_ARM_MAX_MIXERS : O9X_MAX_MIXERS);
@@ -564,10 +568,7 @@ int OpenTxInterface::getCapability(const Capability capability)
case SoundPitch:
return 1;
case Haptic:
if (IS_TARANIS(board))
return 0;
else
return 1;
return 1;
case ModelTrainerEnable:
if (IS_TARANIS(board))
return 1;
@@ -576,20 +577,12 @@ int OpenTxInterface::getCapability(const Capability capability)
case HasFuncRepeat:
case HasContrast:
return 1;
case HapticLength:
case HapticMode:
if (IS_TARANIS(board))
return 0;
else
return 1;
case Beeperlen:
return 1;
case MaxVolume:
return (IS_ARM(board) ? 23 : 7);
case HasSoundMixer:
return (IS_ARM(board) ? 1 : 0);
case ExtraChannels:
return 0;
case ExtraInputs:
return 1;
case ExtendedTrims:
@@ -601,7 +594,7 @@ int OpenTxInterface::getCapability(const Capability capability)
case MixesWithoutExpo:
return 1;
case NumCurves:
return (IS_ARM(board) ? 16 : 8);
return (IS_TARANIS(board) ? 32 : (IS_ARM(board) ? 16 : 8));
case HasMixerNames:
return (IS_ARM(board) ? (IS_TARANIS(board) ? 8 : 6) : false);
case HasExpoNames:
@@ -626,8 +619,6 @@ int OpenTxInterface::getCapability(const Capability capability)
return 1;
case TelemetryRSSIModel:
return 1;
case TelemetryAlarm:
return 0;
case TelemetryTimeshift:
return 1;
case TelemetryMaxMultiplier:
@@ -674,7 +665,7 @@ int OpenTxInterface::getCapability(const Capability capability)
case LCDWidth:
return (IS_TARANIS(board) ? 212 : 128) ;
case GetThrSwitch:
return (IS_TARANIS(board) ? DSW_SF1 : DSW_THR) ;
return (IS_TARANIS(board) ? SWITCH_SF1 : SWITCH_THR) ;
case HasDisplayText:
case VirtualInputs:
return IS_TARANIS(board) ? 32 : 0;
@@ -683,8 +674,6 @@ int OpenTxInterface::getCapability(const Capability capability)
case LuaInputs:
case LimitsPer1000:
case EnhancedCurves:
case TelemetryInternalAlarms:
return IS_TARANIS(board);
case HasFasOffset:
return (IS_STOCK(board) ? false : true);
case HasMahPersistent:
@@ -705,7 +694,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) {
@@ -727,7 +716,7 @@ int OpenTxInterface::isAvailable(Protocol proto, int port)
case PXX_XJT_X16:
case PXX_XJT_D8:
case PXX_XJT_LR12:
case PXX_DJT:
//case PXX_DJT: // Unavailable for now
case LP45:
case DSM2:
case DSMX:
@@ -790,33 +779,12 @@ 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_9XRPRO:
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:
@@ -841,7 +809,7 @@ bool OpenTxInterface::checkVersion(unsigned int version)
break;
// case 206:
case 207:
// V4: Rotary Encoders position in FlightPhases
// V4: Rotary Encoders position in FlightModes
break;
case 208:
// Trim value in 16bits
@@ -882,7 +850,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) {
@@ -904,7 +872,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...";
@@ -945,33 +913,61 @@ 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_9XRPRO:
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_PLUS:
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("/releasenotes-");
switch(board) {
case BOARD_STOCK:
case BOARD_M128:
case BOARD_GRUVIN9X:
case BOARD_SKY9X:
case BOARD_9XRPRO:
url.append("9x.txt");
break;
case BOARD_TARANIS:
case BOARD_TARANIS_PLUS:
case BOARD_TARANIS_REV4a:
url.append("taranis.txt");
break;
default:
url.clear();
break;
}
return url;
}
QString OpenTxFirmware::getStampUrl()
{
QString url = g.compileServer();
if (url.isEmpty()){
@@ -989,11 +985,12 @@ QString getstamp( int board)
case BOARD_GRUVIN9X:
url.append("gruvin9x.txt");
break;
case BOARD_9XRPRO:
case BOARD_SKY9X:
case BOARD_9XRPRO:
url.append("sky9x.txt");
break;
case BOARD_TARANIS:
case BOARD_TARANIS_PLUS:
case BOARD_TARANIS_REV4a:
url.append("taranis.txt");
break;
@@ -1004,272 +1001,307 @@ QString getstamp( int board)
return url;
}
QString getrnurl( int board)
SimulatorInterface * OpenTxFirmware::getSimulator()
{
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_9XRPRO:
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;
switch (board) {
case BOARD_STOCK:
return new Open9xSimulator();
case BOARD_M128:
return new Open9xM128Simulator();
case BOARD_GRUVIN9X:
return new Open9xGruvin9xSimulator();
case BOARD_SKY9X:
case BOARD_9XRPRO:
return new Open9xSky9xSimulator();
case BOARD_TARANIS:
case BOARD_TARANIS_PLUS:
case BOARD_TARANIS_REV4a:
return new OpentxTaranisSimulator();
default:
return NULL;
}
}
void RegisterOpen9xFirmwares()
void registerOpenTxFirmwares()
{
Open9xFirmware * open9x;
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("PPM 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 some of them"));
open9x->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving some of them"));
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->addOption("stickrev", QObject::tr("Add support for reversing stick inputs (e.g. needed for FrSky gimbals)"));
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("PPM 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 some of them"));
open9x->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving some of them"));
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("PPM 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 some of them"));
open9x->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving some of them"));
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->addOption("stickrev", QObject::tr("Add support for reversing stick inputs (e.g. needed for FrSky gimbals)"));
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("PPM 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 some of them"));
open9x->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving some of them"));
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("PPM 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 some of them"));
open9x->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving some of them"));
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("PPM 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 some of them"));
open9x->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving some of them"));
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);
/* SKY9X board */
open9x = new Open9xFirmware("opentx-9xrpro", QObject::tr("openTx for 9XR-PRO"), new Open9xInterface(BOARD_9XRPRO), geturl(BOARD_9XRPRO), getstamp(BOARD_9XRPRO),getrnurl(BOARD_9XRPRO), 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("PPM 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 some of them"));
open9x->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving some of them"));
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-9xrpro", QObject::tr("OpenTX for 9XR-PRO"), BOARD_9XRPRO, 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("PPM 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 some of them"));
openTx->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving some of them"));
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);
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("PPM 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("haptic", QObject::tr("Haptic module installed"));
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);
/* Taranis Plus board */
openTx = new OpenTxFirmware("opentx-taranisplus", QObject::tr("OpenTX for FrSky Taranis Plus"), BOARD_TARANIS_PLUS, 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("PPM 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("haptic", QObject::tr("Haptic module installed"));
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;
}
@@ -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_9XRPRO:
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 registerOpenTxFirmwares();
#endif
@@ -49,10 +49,13 @@
#define GAUGES
#define GPS
#define FAI_CHOICE
#define FRSKY_STICKS
#define EEPROM_VARIANT SIMU_STOCK_VARIANTS
#define GAUGES
#define NUM_POTS 3
#undef min
#undef max
@@ -78,6 +81,7 @@ namespace Open9x {
#include "radio/src/telemetry/frsky.cpp"
#include "radio/src/templates.cpp"
#include "radio/src/translations.cpp"
#include "radio/src/fonts.cpp"
#include "radio/src/targets/stock/voice.cpp"
#include "radio/src/buzzer.cpp"
#include "radio/src/translations/tts_en.cpp"
@@ -107,8 +111,7 @@ uint8_t getStickMode()
using namespace Open9x;
Open9xSimulator::Open9xSimulator(OpenTxInterface * open9xInterface):
open9xInterface(open9xInterface)
Open9xSimulator::Open9xSimulator()
{
#define INIT_IMPORT
#include "simulatorimport.h"
@@ -141,7 +144,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);
}
@@ -195,6 +197,13 @@ unsigned int Open9xSimulator::getPhase()
return getFlightPhase();
}
const char * Open9xSimulator::getPhaseName(unsigned int phase)
{
static char buff[sizeof(g_model.phaseData[0].name)+1];
zchar2str(buff, g_model.phaseData[phase].name, sizeof(g_model.phaseData[0].name));
return buff;
}
const char * Open9xSimulator::getError()
{
#define GETERROR_IMPORT
@@ -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);
@@ -49,14 +49,12 @@ class Open9xSimulator : public SimulatorInterface {
virtual unsigned int getPhase();
virtual const char * getPhaseName(unsigned int phase);
virtual void wheelEvent(uint8_t steps) { }
virtual const char * getError();
protected:
OpenTxInterface * open9xInterface;
};
#endif
@@ -140,51 +140,6 @@ int Th9xInterface::getSize(GeneralSettings &settings)
return 0;
}
int Th9xInterface::getCapability(const Capability capability)
{
switch (capability) {
case Mixes:
return TH9X_MAX_MIXERS;
case OwnerName:
return 0;
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 ExtraChannels:
return 4;
case OffsetWeight:
return 125;
case Simulation:
return 1;
case HasContrast:
case HasInputFilter:
return 1;
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) {
@@ -198,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;
+187 -358
View File
@@ -13,404 +13,235 @@
* GNU General Public License for more details.
*
*/
#include <QtGui>
#include "hexinterface.h"
#include "splash.h"
#include "flashinterface.h"
#define VERS_MARK "VERS"
#define SVN_MARK "SVN"
#define DATE_MARK "DATE"
#define TIME_MARK "TIME"
#define BLD_MARK "BLD"
#define EEPR_MARK "EEPR"
int getFileType(const QString &fullFileName)
{
if(QFileInfo(fullFileName).suffix().toUpper()=="HEX") return FILE_TYPE_HEX;
if(QFileInfo(fullFileName).suffix().toUpper()=="BIN") return FILE_TYPE_BIN;
if(QFileInfo(fullFileName).suffix().toUpper()=="EEPM") return FILE_TYPE_EEPM;
if(QFileInfo(fullFileName).suffix().toUpper()=="EEPE") return FILE_TYPE_EEPE;
if(QFileInfo(fullFileName).suffix().toUpper()=="XML") return FILE_TYPE_XML;
return 0;
QString suffix = QFileInfo(fullFileName).suffix().toUpper();
if (suffix == "HEX")
return FILE_TYPE_HEX;
else if (suffix == "BIN")
return FILE_TYPE_BIN;
else if (suffix == "EEPM")
return FILE_TYPE_EEPM;
else if (suffix == "EEPE")
return FILE_TYPE_EEPE;
else if (suffix == "XML")
return FILE_TYPE_XML;
else
return 0;
}
FlashInterface::FlashInterface(QString fileName)
FlashInterface::FlashInterface(QString fileName):
flash(MAX_FSIZE, 0),
flash_size(0),
splash_offset(0),
splash_size(0),
splash_width(0),
splash_height(0),
isValidFlag(false)
{
char * temp = (char *)malloc(MAX_FSIZE);
date = "";
time = "";
svn = "";
build = "";
isValidFlag = true;
QFile file(fileName);
flash_size=0;
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //reading HEX TEXT file
isValidFlag = false;
if (!fileName.isEmpty()) {
QFile file(fileName);
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { // reading HEX TEXT file
QTextStream inputStream(&file);
flash_size = HexInterface(inputStream).load((uint8_t *)flash.data(), MAX_FSIZE);
file.close();
if (flash_size == 0) {
file.open(QIODevice::ReadOnly);
flash_size = file.read((char *)flash.data(), MAX_FSIZE);
}
}
}
if (flash_size > 0) {
svn = seekLabel(SVN_MARK);
version = seekLabel(VERS_MARK);
date = seekLabel(DATE_MARK);
time = seekLabel(TIME_MARK);
eeprom = seekLabel(EEPR_MARK);
SeekSplash();
isValidFlag = true;
}
}
QString FlashInterface::seekString(const QString & string)
{
QString result = "";
int start = flash.indexOf(string);
if (start > 0) {
start += string.length();
int end = -1;
for (int i=start; i<start+20; i++) {
char c = flash.at(i);
if (c == '\0' || c == '\036') {
end = i;
break;
}
}
if (end > 0) {
result = flash.mid(start, (end - start)).trimmed();
}
}
return result;
}
QString FlashInterface::seekLabel(const QString & label)
{
QString result = seekString(label + "\037\033:");
if (!result.isEmpty())
return result;
return seekString(label + ":");
}
bool FlashInterface::SeekSplash(QByteArray splash)
{
int start = flash.indexOf(splash);
if (start>0) {
splash_offset = start;
splash_size = splash.size();
return true;
}
else {
QTextStream inputStream(&file);
flash_size = HexInterface(inputStream).load((uint8_t *)temp, MAX_FSIZE);
file.close();
inputStream.reset();
if (flash_size == 0) {
QFile file(fileName);
file.open(QIODevice::ReadOnly);
char * bin_flash = (char *)malloc(MAX_FSIZE);
flash_size = file.read(bin_flash, MAX_FSIZE);
flash = QByteArray(bin_flash, flash_size);
free(bin_flash);
}
else {
flash = QByteArray(temp, flash_size);
}
if (flash_size > 0) {
SeekSvn();
SeekDate();
SeekTime();
SeekBuild();
SeekSplash();
}
else {
isValidFlag = false;
}
}
free(temp);
}
QString FlashInterface::getDate(void)
{
return date;
}
QString FlashInterface::getTime(void)
{
return time;
}
QString FlashInterface::getSvn(void)
{
return svn;
}
QString FlashInterface::getBuild(void)
{
return build;
}
int FlashInterface::getSize()
{
return flash_size;
}
void FlashInterface::SeekSvn(void)
{
int i, start = -1, end = -1;
start = flash.indexOf(QString(SVN_MARK));
if (start > 0) {
start += QString(SVN_MARK).length();
for (i = start; i < (start + 20); i++) {
if (flash.at(i) == 0) {
end = i;
break;
}
}
if (end > 0) {
svn = QString(flash.mid(start, (end - start))).trimmed();
}
else {
svn = QString("");
}
return false;
}
}
void FlashInterface::SeekDate(void)
bool FlashInterface::SeekSplash(QByteArray sps, QByteArray spe, int size)
{
int i, start = -1, end = -1, startsvn=0;
startsvn = flash.indexOf(QString(SVN_MARK));
if (startsvn>0) {
start = flash.indexOf(QString(DATE_MARK),startsvn);
} else {
start = flash.indexOf(QString(DATE_MARK));
}
if (start > 0) {
start += QString(DATE_MARK).length();
for (i = start; i < (start + 20); i++) {
if (flash.at(i) == 0) {
end = i;
break;
}
}
if (end > 0) {
date = QString(flash.mid(start, (end - start))).trimmed();
}
else {
date = QString("");
}
}
}
void FlashInterface::SeekTime(void)
{
int i, start = -1, end = -1, startsvn=0;
startsvn = flash.indexOf(QString(SVN_MARK));
if (startsvn>0) {
start = flash.indexOf(QString(TIME_MARK),startsvn);
} else {
start = flash.indexOf(QString(TIME_MARK));
}
if (start > 0) {
start += QString(TIME_MARK).length();
for (i = start; i < (start + 20); i++) {
if (flash.at(i) == 0) {
end = i;
break;
}
}
if (end > 0) {
time = QString(flash.mid(start, (end - start))).trimmed();
}
else {
time = QString("");
}
}
}
void FlashInterface::SeekBuild(void)
{
int i, start = -1, end = -1;
start = flash.indexOf(QString(BLD_MARK));
if (start > 0) {
start += QString(BLD_MARK).length();
for (i = start; i < (start + 20); i++) {
if (flash.at(i) == 0) {
end = i;
break;
}
}
if (end > 0) {
build = QString(flash.mid(start, (end - start))).trimmed();
}
else {
build = QString("");
}
}
else {
start = flash.indexOf(QString(VAR_MARK));
if (start > 0) {
start += QString(VAR_MARK).length();
for (i = start; i < (start + 20); i++) {
if (flash.at(i) == 0) {
end = i;
break;
}
}
if (end > 0) {
build = QString(flash.mid(start, (end - start))).trimmed();
qDebug() << "Seek";
int start = 0;
while (start>=0) {
start = flash.indexOf(sps, start+1);
if (start>0) {
int end = start + sps.size() + size;
if (end == flash.indexOf(spe, end)) {
splash_offset = start + sps.size();
splash_size = end - start - sps.size();
return true;
}
else {
build = QString("");
qDebug() << flash.indexOf(spe, start) << end << sps.size() << spe;
}
}
}
return false;
}
#define OTX_SPS_9X "SPS\0\200\100"
#define OTX_SPS_TARANIS "SPS\0\324\100"
#define OTX_SPS_SIZE 6
#define OTX_SPE "SPE"
#define OTX_SPE_SIZE 4
void FlashInterface::SeekSplash(void)
{
QByteArray splash,spe;
splash_offset=0;
splash.clear();
splash.append((char *)gr9x_splash, sizeof(gr9x_splash));
int start = flash.indexOf(splash);
if (start>0) {
splash_offset=start;
splash_type=1;
splash_size=sizeof(gr9x_splash);
}
if (start==-1) {
splash.clear();
splash.append((char *)er9x_splash, sizeof(er9x_splash));
start = flash.indexOf(splash);
if (start>0) {
splash_offset=start;
splash_type=2;
splash_size=sizeof(er9x_splash);
}
splash_size = 0;
splash_offset = 0;
splash_width = SPLASH_WIDTH;
splash_height = SPLASH_HEIGHT;
splash_format = QImage::Format_Mono;
if (SeekSplash(QByteArray((const char *)gr9x_splash, sizeof(gr9x_splash))) || SeekSplash(QByteArray((const char *)gr9xv4_splash, sizeof(gr9xv4_splash)))) {
return;
}
if (start==-1) {
splash.clear();
splash.append((char *)opentx_splash, sizeof(opentx_splash));
start = flash.indexOf(splash);
if (start>0) {
splash_offset=start;
splash_type=3;
splash_size=sizeof(opentx_splash);
}
if (SeekSplash(QByteArray((const char *)er9x_splash, sizeof(er9x_splash)))) {
return;
}
if (start==-1) {
splash.clear();
splash.append((char *)opentxtaranis_splash, sizeof(opentxtaranis_splash));
start = flash.indexOf(splash);
if (start>0) {
splash_offset=start;
splash_type=5;
splash_size=sizeof(opentxtaranis_splash);
}
if (SeekSplash(QByteArray((const char *)opentx_splash, sizeof(opentx_splash)))) {
return;
}
if (start==-1) {
splash.clear();
splash.append((char *)gr9xv4_splash, sizeof(gr9xv4_splash));
start = flash.indexOf(splash);
if (start>0) {
splash_offset=start;
splash_type=1;
splash_size=sizeof(gr9xv4_splash);
}
if (SeekSplash(QByteArray((const char *)opentxtaranis_splash, sizeof(opentxtaranis_splash)))) {
splash_width = SPLASHX9D_WIDTH;
splash_height = SPLASHX9D_HEIGHT;
splash_format = QImage::Format_Indexed8;
return;
}
if (start==-1) {
splash.clear();
splash.append((char *)ersky9x_splash, sizeof(ersky9x_splash));
start = flash.indexOf(splash);
if (start>0) {
splash_offset=start;
splash_type=4;
splash_size=sizeof(ersky9x_splash);
}
if (SeekSplash(QByteArray((const char *)ersky9x_splash, sizeof(ersky9x_splash)))) {
return;
}
if (start==-1) {
start=0;
splash.clear();
splash.append(OTX_SPS);
splash.append('\0');
spe.clear();
spe.append(OTX_SPE);
spe.append('\0');
int diff=0;
int end=0;
while (start>=0) {
start = flash.indexOf(splash,start+1);
if (start>0) {
end=flash.indexOf(spe,start+1);
if (end>0) {
diff=end-start;
while (diff<1030 && end>0) {
end=flash.indexOf(spe,end+1);
diff=end-start;
}
if (end>0) {
diff=end-start;
if (diff==1030) {
splash_offset=start+OTX_OFFSET;
splash_type=2;
splash_size=sizeof(opentx_splash);
break;
}
if (diff==6790) {
splash_offset=start+OTX_OFFSET;
splash_type=5;
splash_size=sizeof(opentxtaranis_splash);
break;
}
}
}
}
}
if (SeekSplash(QByteArray(OTX_SPS_9X, OTX_SPS_SIZE), QByteArray(OTX_SPE, OTX_SPE_SIZE), 1024)) {
return;
}
if (start==-1) {
start=0;
splash.clear();
splash.append(ERSKY9X_SPS);
splash.append('\0');
spe.clear();
spe.append(ERSKY9X_SPE);
spe.append('\0');
int diff=0;
int end=0;
while (start>=0) {
start = flash.indexOf(splash,start+1);
if (start>0) {
end=flash.indexOf(spe,start+1);
if (end>0) {
diff=end-start;
while (diff<1031 && end>0) {
end=flash.indexOf(spe,end+1);
diff=end-start;
}
if (end>0) {
diff=end-start;
if (diff==1031) {
splash_offset=start+ERSKY9X_OFFSET;
splash_type=4;
splash_size=sizeof(ersky9x_splash);
break;
}
}
}
}
}
if (SeekSplash(QByteArray(OTX_SPS_TARANIS, sizeof(OTX_SPS_TARANIS)), QByteArray(OTX_SPE, sizeof(OTX_SPE)), 6790)) {
splash_width = SPLASHX9D_WIDTH;
splash_height = SPLASHX9D_HEIGHT;
splash_format = QImage::Format_Indexed8;
return;
}
if (start==-1) {
splash.clear();
splash.append(ERSPLASH_MARKER);
splash.append('\0');
start = flash.indexOf(splash);
if (start>0) {
splash_offset=start+ERSPLASH_OFFSET;
splash_type=2;
splash_size=sizeof(er9x_splash);
}
if (SeekSplash(QByteArray(ERSKY9X_SPS, sizeof(ERSKY9X_SPS)), QByteArray(ERSKY9X_SPE, sizeof(ERSKY9X_SPE)), 1030)) {
return;
}
if (splash_offset>0) {
if (splash_type==5) {
splash_width=SPLASHX9D_WIDTH;
splash_height=SPLASHX9D_HEIGHT;
splash_colors=16;
splash_format=QImage::Format_Indexed8;
} else {
splash_width=SPLASH_WIDTH;
splash_height=SPLASH_HEIGHT;
splash_colors=1;
splash_format=QImage::Format_Mono;
}
if (SeekSplash(QByteArray(ERSPLASH_MARKER, sizeof(ERSPLASH_MARKER)))) {
splash_offset += sizeof(ERSPLASH_MARKER);
splash_size = sizeof(er9x_splash);
}
}
bool FlashInterface::setSplash(const QImage & newsplash)
{
if (splash_offset == 0 || splash_size == 0) {
return false;
}
char b[SPLASH_SIZE_MAX] = {0};
QColor color;
QByteArray splash;
if (splash_offset == 0) {
return false;
}
else {
if (splash_colors == 16) {
unsigned int idx = 0;
for (unsigned int y=0; y<splash_height; y+=8) {
for (unsigned int x=0; x<splash_width; x++) {
unsigned int values[] = { 255, 255, 255, 255 };
for (unsigned int z=0; z<8; z++) {
if (y+z < splash_height) {
QRgb gray = qGray(newsplash.pixel(x, y+z));
for (unsigned int i=0; i<4; i++) {
if (gray & (1<<(4+i)))
values[i] -= 1 << z;
}
if (splash_format == QImage::Format_Indexed8) {
unsigned int idx = 0;
for (unsigned int y=0; y<splash_height; y+=8) {
for (unsigned int x=0; x<splash_width; x++) {
unsigned int values[] = { 255, 255, 255, 255 };
for (unsigned int z=0; z<8; z++) {
if (y+z < splash_height) {
QRgb gray = qGray(newsplash.pixel(x, y+z));
for (unsigned int i=0; i<4; i++) {
if (gray & (1<<(4+i)))
values[i] -= 1 << z;
}
}
for (int i=0; i<4; i++)
b[idx++] = values[i];
}
for (int i=0; i<4; i++)
b[idx++] = values[i];
}
}
else {
QColor black = QColor(0,0,0);
QImage blackNwhite = newsplash.convertToFormat(QImage::Format_MonoLSB);
for (uint y=0; y<splash_height; y++) {
for (uint x=0; x<splash_width; x++) {
color = QColor(blackNwhite.pixel(x,y));
b[splash_width*(y/8) + x] |=((color==black ? 1: 0)<<(y % 8));
}
}
}
splash.clear();
splash.append(b, splash_size);
flash.replace(splash_offset, splash_size, splash);
return true;
}
else {
QColor black = QColor(0,0,0);
QImage blackNwhite = newsplash.convertToFormat(QImage::Format_MonoLSB);
for (uint y=0; y<splash_height; y++) {
for (uint x=0; x<splash_width; x++) {
color = QColor(blackNwhite.pixel(x,y));
b[splash_width*(y/8) + x] |=((color==black ? 1: 0)<<(y % 8));
}
}
}
splash.clear();
splash.append(b, splash_size);
flash.replace(splash_offset, splash_size, splash);
return true;
}
int FlashInterface::getSplashWidth()
@@ -423,11 +254,6 @@ uint FlashInterface::getSplashHeight()
return splash_height;
}
uint FlashInterface::getSplashColors()
{
return splash_colors;
}
QImage::Format FlashInterface::getSplashFormat()
{
return splash_format;
@@ -435,7 +261,11 @@ QImage::Format FlashInterface::getSplashFormat()
QImage FlashInterface::getSplash()
{
if (splash_colors == 16) {
if (splash_offset == 0 || splash_size == 0) {
return QImage(); // empty image
}
if (splash_format == QImage::Format_Indexed8) {
QImage image(splash_width, splash_height, QImage::Format_RGB888);
if (splash_offset > 0) {
for (unsigned int y=0; y<splash_height; y++) {
@@ -472,7 +302,6 @@ bool FlashInterface::isValid()
return isValidFlag;
}
uint FlashInterface::saveFlash(QString fileName)
{
uint8_t binflash[MAX_FSIZE];
+40 -50
View File
@@ -14,10 +14,12 @@
#ifndef FLASHINTERFACE_H
#define FLASHINTERFACE_H
#include <QDialog>
#include <QtGui>
#include <inttypes.h>
#include "file.h"
#define MAX_FSIZE (512*1024)
#define SPLASH_WIDTH (128)
#define SPLASH_HEIGHT (64)
@@ -26,18 +28,9 @@
#define SPLASH_SIZE_MAX (SPLASHX9D_WIDTH*SPLASHX9D_HEIGHT/2)
#define ERSPLASH_MARKER "Splash"
#define ERSPLASH_OFFSET (10)
#define OTX_SPS "SPS"
#define OTX_SPE "SPE"
#define OTX_OFFSET (6)
#define ERSKY9X_SPS "SPS"
#define ERSKY9X_SPE "SPE"
#define ERSKY9X_OFFSET (7)
#define VERS_MARK "VERS:"
#define SVN_MARK "SVN:"
#define DATE_MARK "DATE:"
#define TIME_MARK "TIME:"
#define BLD_MARK "BLD:"
#define VAR_MARK "EEPR:"
#define FILE_TYPE_BIN 1
#define FILE_TYPE_HEX 2
@@ -49,48 +42,45 @@ int getFileType(const QString &fullFileName);
class FlashInterface
{
public:
FlashInterface(QString filename);
QString getDate();
QString getTime();
QString getSvn();
int getSize();
QString getBuild();
QImage getSplash();
bool setSplash(const QImage & newsplash);
bool hasSplash();
int getSplashWidth();
uint getSplashHeight();
uint getSplashColors();
QImage::Format getSplashFormat();
uint saveFlash(QString fileName);
bool isValid();
public:
FlashInterface(QString filename);
inline QString getDate() { return date; }
inline QString getTime() { return time; }
inline QString getSvn() { return svn; }
int getSize() { return flash_size; }
inline QString getVersion() { return version; }
inline QString getEEprom() { return eeprom; }
QImage getSplash();
bool setSplash(const QImage & newsplash);
bool hasSplash();
int getSplashWidth();
uint getSplashHeight();
QImage::Format getSplashFormat();
uint saveFlash(QString fileName);
bool isValid();
private:
QByteArray flash;
void SeekVer();
void SeekSvn();
void SeekDate();
void SeekTime();
void SeekBuild();
void SeekSplash();
QString filename;
QString date;
QString time;
QString svn;
QString build;
QByteArray splash;
uint splash_offset;
uint splash_type;
uint splash_size;
uint splash_width;
uint splash_height;
uint splash_colors;
QImage::Format splash_format;
uint flash_size;
protected:
bool isValidFlag;
private:
QByteArray flash;
uint flash_size;
QString seekString(const QString & string);
QString seekLabel(const QString & label);
void SeekSplash();
bool SeekSplash(QByteArray sps, QByteArray spe, int size);
bool SeekSplash(QByteArray splash);
QString filename;
QString date;
QString time;
QString svn;
QString version;
QString eeprom;
QByteArray splash;
uint splash_offset;
uint splash_size;
uint splash_width;
uint splash_height;
QImage::Format splash_format;
bool isValidFlag;
};
#endif /* FLASHINTERFACE_H */
+24 -290
View File
@@ -7,316 +7,50 @@
#include <QDesktopServices>
#include <QtGui>
fwPreferencesDialog::fwPreferencesDialog(QWidget *parent) :
FirmwarePreferencesDialog::FirmwarePreferencesDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::fwPreferencesDialog),
updateLock(false)
ui(new Ui::FirmwarePreferencesDialog)
{
ui->setupUi(this);
setWindowIcon(CompanionIcon("fwpreferences.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()));
shrink();
}
fwPreferencesDialog::~fwPreferencesDialog()
FirmwarePreferencesDialog::~FirmwarePreferencesDialog()
{
delete ui;
}
void fwPreferencesDialog::showVoice(bool show)
void FirmwarePreferencesDialog::initSettings()
{
if (show)
showVoice();
else
hideVoice();
ui->fwTypeLbl->setText(g.profile[g.id()].fwType());
int revision = g.fwRev.get(g.profile[g.id()].fwType());
if (revision > 0)
ui->lastRevisionLbl->setText(QString("%1").arg(revision));
}
void fwPreferencesDialog::showVoice()
{
ui->voiceLine->show();
ui->voiceLabel->show();
ui->voiceCombo->show();
ui->voice_dnld->show();
}
void fwPreferencesDialog::hideVoice()
{
ui->voiceLine->hide();
ui->voiceLabel->hide();
ui->voiceCombo->hide();
ui->voice_dnld->hide();
QTimer::singleShot(0, this, SLOT(shrink()));
}
void fwPreferencesDialog::shrink()
{
resize(0,0);
}
void fwPreferencesDialog::baseFirmwareChanged()
{
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
voice=NULL;
foreach(FirmwareInfo * firmware, firmwares) {
if (firmware->id == selected_firmware) {
showVoice(firmware->voice);
populateFirmwareOptions(firmware);
break;
}
}
firmwareChanged();
}
FirmwareVariant fwPreferencesDialog::getFirmwareVariant()
{
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
bool voice=false;
foreach(FirmwareInfo * firmware, firmwares) {
if (firmware->id == selected_firmware) {
QString id = firmware->id;
foreach(QCheckBox *cb, optionsCheckBoxes) {
if (cb->isChecked()) {
if (cb->text()=="voice" && cb->isChecked())
voice=true;
id += QString("-") + cb->text();
}
}
if (! firmware->eepromInterface->getCapability(MultiLangVoice)) {
if (ui->voiceCombo->count() && (voice || firmware->voice))
id += QString("-tts") + ui->voiceCombo->currentText();
}
if (ui->langCombo->count())
id += QString("-") + ui->langCombo->currentText();
return GetFirmwareVariant(id);
}
}
// Should never occur...
return default_firmware_variant;
}
void fwPreferencesDialog::firmwareOptionChanged(bool state)
{
QCheckBox *cb = qobject_cast<QCheckBox*>(sender());
FirmwareInfo * firmware=NULL;
if (cb && state) {
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
foreach(firmware, firmwares) {
if (firmware->id == selected_firmware) {
foreach(QList<Option> opts, firmware->opts) {
foreach(Option opt, opts) {
if (cb->text() == opt.name) {
foreach(Option other, opts) {
if (other.name != opt.name) {
foreach(QCheckBox *ocb, optionsCheckBoxes) {
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 fwPreferencesDialog::firmwareLangChanged()
{
firmwareChanged();
}
void fwPreferencesDialog::firmwareChanged()
{
if (updateLock)
return;
FirmwareVariant variant = getFirmwareVariant();
QString stamp;
stamp.append(variant.firmware->stamp);
ui->fw_dnld->setEnabled(!variant.firmware->getUrl(variant.id).isNull());
QString url=variant.firmware->getUrl(variant.id);
// B-Plan
if (false) {
ui->CPU_ID_LE->show();
ui->CPU_ID_LABEL->show();
} else {
ui->CPU_ID_LE->hide();
ui->CPU_ID_LABEL->hide();
}
int fwrev = g.fwRev.get(variant.id);
if (fwrev != 0) {
ui->FwInfo->setText(tr("Last downloaded release: %1").arg(fwrev));
if (!stamp.isEmpty()) {
ui->checkFWUpdates->show();
} else {
ui->checkFWUpdates->hide();
}
}
else {
if (ui->fw_dnld->isEnabled()) {
ui->FwInfo->setText(tr("The selected firmware has never been downloaded by Companion."));
ui->checkFWUpdates->hide();
}
else {
ui->FwInfo->setText(tr("The selected firmware cannot be downloaded by Companion."));
ui->checkFWUpdates->hide();
}
}
}
void fwPreferencesDialog::writeValues()
{
g.cpuId( ui->CPU_ID_LE->text() );
current_firmware_variant = getFirmwareVariant();
g.profile[g.id()].fwType( current_firmware_variant.id );
}
void fwPreferencesDialog::populateFirmwareOptions(const FirmwareInfo * firmware)
{
const FirmwareInfo * parent = firmware->parent ? firmware->parent : firmware;
updateLock = true;
ui->langCombo->clear();
foreach(const char *lang, parent->languages) {
ui->langCombo->addItem(lang);
if (current_firmware_variant.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);
int index = 0;
foreach(QList<Option> opts, parent->opts) {
foreach(Option opt, opts) {
if (index >= optionsCheckBoxes.size()) {
qDebug() << "This firmware needs more options checkboxes!";
}
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);
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);
}
updateLock = false;
QTimer::singleShot(0, this, SLOT(shrink()));
}
void fwPreferencesDialog::initSettings()
{
ui->CPU_ID_LE->setText(g.cpuId());
FirmwareInfo * current_firmware = GetCurrentFirmware();
foreach(FirmwareInfo * firmware, firmwares) {
ui->downloadVerCB->addItem(firmware->name, firmware->id);
if (current_firmware == firmware) {
ui->downloadVerCB->setCurrentIndex(ui->downloadVerCB->count() - 1);
}
}
baseFirmwareChanged();
firmwareChanged();
}
void fwPreferencesDialog::on_checkFWUpdates_clicked()
{
FirmwareVariant variant = getFirmwareVariant();
if (g.profile[g.id()].burnFirmware()) {
current_firmware_variant = variant;
g.profile[g.id()].fwType( variant.id );
}
MainWindow * mw = (MainWindow *)this->parent();
mw->checkForUpdates(true, variant.id);
firmwareChanged();
}
void fwPreferencesDialog::on_fw_dnld_clicked()
void FirmwarePreferencesDialog::on_checkFWUpdates_clicked()
{
MainWindow * mw = (MainWindow *)this->parent();
FirmwareVariant variant = getFirmwareVariant();
writeValues();
if (!variant.firmware->getUrl(variant.id).isNull()) {
if (g.profile[g.id()].burnFirmware()) {
current_firmware_variant = getFirmwareVariant();
g.profile[g.id()].fwType( current_firmware_variant.id );
}
mw->downloadLatestFW(current_firmware_variant.firmware, current_firmware_variant.id);
}
firmwareChanged();
QString fwType = g.profile[g.id()].fwType();
mw->checkForUpdates(true, fwType);
initSettings();
}
void fwPreferencesDialog::on_voice_dnld_clicked()
void FirmwarePreferencesDialog::on_fw_dnld_clicked()
{
MainWindow * mw = (MainWindow *)this->parent();
mw->downloadLatestFW(current_firmware_variant);
initSettings();
}
void FirmwarePreferencesDialog::on_voice_dnld_clicked()
{
QString url="http://fw.opentx.it/voices/";
FirmwareVariant variant = getFirmwareVariant();
url.append(QString("%1/%2/").arg(variant.firmware->id).arg(ui->voiceCombo->currentText()));
QString fwType = g.profile[g.id()].fwType();
QStringList list = fwType.split("-");
QString firmware = QString("%1-%2").arg(list[0]).arg(list[1]);
url.append(QString("%1/%2/").arg(firmware).arg(ui->voiceCombo->currentText()));
QDesktopServices::openUrl(url);
}
+8 -24
View File
@@ -6,40 +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;
QList<QCheckBox *> optionsCheckBoxes;
bool updateLock;
void showVoice(bool);
void showVoice();
void hideVoice();
void populateLocale();
void populateFirmwareOptions(const FirmwareInfo *);
FirmwareVariant getFirmwareVariant();
private:
Ui::FirmwarePreferencesDialog *ui;
void initSettings();
QCheckBox * voice;
private slots:
void shrink();
void writeValues();
void firmwareLangChanged();
void baseFirmwareChanged();
void firmwareOptionChanged(bool state);
void firmwareChanged();
private slots:
void on_fw_dnld_clicked();
void on_voice_dnld_clicked();
void on_checkFWUpdates_clicked();
+111 -696
View File
@@ -1,13 +1,13 @@
<?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>
<y>0</y>
<width>620</width>
<height>437</height>
<width>416</width>
<height>153</height>
</rect>
</property>
<property name="sizePolicy">
@@ -32,488 +32,13 @@
<property name="margin">
<number>6</number>
</property>
<item row="38" column="5">
<item row="24" column="5">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="11" 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>CheckBox</string>
</property>
</widget>
</item>
<item row="15" column="5">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="11" column="5">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="QLabel" name="langLabel">
<property name="text">
<string>Menu Language</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="8" column="2">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="17" column="2">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="15" column="2">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="8" column="3">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="10" column="5">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="3" column="2" colspan="3">
<widget class="QComboBox" name="downloadVerCB">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="7" column="2">
<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="2" colspan="3">
<widget class="QLineEdit" name="CPU_ID_LE"/>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="label_6">
<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>Firmware Type</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="8" column="5">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="14" column="5">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="18" column="3">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="9" column="2">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="12" column="2">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="16" 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>CheckBox</string>
</property>
</widget>
</item>
<item row="16" column="5">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="11" 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>CheckBox</string>
</property>
</widget>
</item>
<item row="14" column="3">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="18" column="2">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="12" column="3">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="10" column="4">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="13" column="2">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="12" column="5">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="16" 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>CheckBox</string>
</property>
</widget>
</item>
<item row="13" column="5">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="13" column="4">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="13" column="3">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="9" column="3">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="17" column="3">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="16" 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>CheckBox</string>
</property>
</widget>
</item>
<item row="15" column="4">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="15" column="3">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="14" column="4">
<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>CheckBox</string>
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
@@ -530,7 +55,7 @@
</property>
</widget>
</item>
<item row="21" column="0">
<item row="7" column="0">
<widget class="QLabel" name="voiceLabel">
<property name="font">
<font>
@@ -540,11 +65,11 @@
</font>
</property>
<property name="text">
<string>Voice Language</string>
<string>Voice</string>
</property>
</widget>
</item>
<item row="21" column="2">
<item row="7" column="2">
<widget class="QComboBox" name="voiceCombo">
<property name="maximumSize">
<size>
@@ -553,158 +78,122 @@
</size>
</property>
<property name="toolTip">
<string>Set language of voice.
<string>Set voice language.
May be different from firmware language</string>
</property>
<item>
<property name="text">
<string>en</string>
</property>
</item>
<item>
<property name="text">
<string>cz</string>
</property>
</item>
<item>
<property name="text">
<string>de</string>
</property>
</item>
<item>
<property name="text">
<string>es</string>
</property>
</item>
<item>
<property name="text">
<string>fr</string>
</property>
</item>
<item>
<property name="text">
<string>it</string>
</property>
</item>
<item>
<property name="text">
<string>pl</string>
</property>
</item>
<item>
<property name="text">
<string>pt</string>
</property>
</item>
<item>
<property name="text">
<string>se</string>
</property>
</item>
</widget>
</item>
<item row="21" column="5">
<item row="7" column="5">
<widget class="QPushButton" name="voice_dnld">
<property name="text">
<string>Download Voice</string>
</property>
</widget>
</item>
<item row="10" column="2">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="10" column="3">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="18" column="5">
<item row="5" column="5">
<widget class="QPushButton" name="fw_dnld">
<property name="text">
<string>Download FW</string>
</property>
</widget>
</item>
<item row="8" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Options</string>
<item row="7" column="3">
<spacer name="horizontalSpacer_2">
<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="6" column="0" colspan="6">
<widget class="Line" name="voiceLine">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="12" column="4">
<widget class="QCheckBox" name="optionCheckBox_19">
<item row="23" column="0" colspan="6">
<widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<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>CheckBox</string>
<string>Firmware</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="9" column="5">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="14" column="2">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="9" column="4">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="11" 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>CheckBox</string>
</property>
</widget>
</item>
<item row="8" column="4">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="CPU_ID_LABEL">
<property name="text">
<string>Processor ID</string>
</property>
</widget>
</item>
<item row="17" column="4">
<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>CheckBox</string>
</property>
</widget>
</item>
<item row="4" column="2" colspan="4">
<widget class="QLabel" name="FwInfo">
<item row="0" column="2" colspan="4">
<widget class="QLabel" name="fwTypeLbl">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -712,34 +201,21 @@ May be different from firmware language</string>
</sizepolicy>
</property>
<property name="text">
<string>FwInfo</string>
<string notr="true">FwType</string>
</property>
</widget>
</item>
<item row="17" column="5">
<widget class="QCheckBox" name="optionCheckBox_40">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item row="3" column="2" colspan="2">
<widget class="QLabel" name="lastRevisionLbl">
<property name="text">
<string>CheckBox</string>
<string notr="true">-</string>
</property>
</widget>
</item>
<item row="20" column="1" colspan="5">
<widget class="Line" name="voiceLine">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="37" column="1" colspan="5">
<widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="3" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Latest Download</string>
</property>
</widget>
</item>
@@ -747,51 +223,6 @@ May be different from firmware language</string>
</widget>
<tabstops>
<tabstop>buttonBox</tabstop>
<tabstop>downloadVerCB</tabstop>
<tabstop>CPU_ID_LE</tabstop>
<tabstop>langCombo</tabstop>
<tabstop>optionCheckBox_2</tabstop>
<tabstop>optionCheckBox_1</tabstop>
<tabstop>optionCheckBox_3</tabstop>
<tabstop>optionCheckBox_4</tabstop>
<tabstop>optionCheckBox_5</tabstop>
<tabstop>optionCheckBox_6</tabstop>
<tabstop>optionCheckBox_7</tabstop>
<tabstop>optionCheckBox_8</tabstop>
<tabstop>optionCheckBox_9</tabstop>
<tabstop>optionCheckBox_10</tabstop>
<tabstop>optionCheckBox_11</tabstop>
<tabstop>optionCheckBox_12</tabstop>
<tabstop>optionCheckBox_13</tabstop>
<tabstop>optionCheckBox_14</tabstop>
<tabstop>optionCheckBox_15</tabstop>
<tabstop>optionCheckBox_16</tabstop>
<tabstop>optionCheckBox_17</tabstop>
<tabstop>optionCheckBox_18</tabstop>
<tabstop>optionCheckBox_19</tabstop>
<tabstop>optionCheckBox_20</tabstop>
<tabstop>optionCheckBox_21</tabstop>
<tabstop>optionCheckBox_22</tabstop>
<tabstop>optionCheckBox_23</tabstop>
<tabstop>optionCheckBox_24</tabstop>
<tabstop>optionCheckBox_25</tabstop>
<tabstop>optionCheckBox_26</tabstop>
<tabstop>optionCheckBox_27</tabstop>
<tabstop>optionCheckBox_28</tabstop>
<tabstop>optionCheckBox_29</tabstop>
<tabstop>optionCheckBox_30</tabstop>
<tabstop>optionCheckBox_31</tabstop>
<tabstop>optionCheckBox_32</tabstop>
<tabstop>optionCheckBox_33</tabstop>
<tabstop>optionCheckBox_34</tabstop>
<tabstop>optionCheckBox_35</tabstop>
<tabstop>optionCheckBox_36</tabstop>
<tabstop>optionCheckBox_37</tabstop>
<tabstop>optionCheckBox_38</tabstop>
<tabstop>optionCheckBox_39</tabstop>
<tabstop>optionCheckBox_40</tabstop>
<tabstop>optionCheckBox_41</tabstop>
<tabstop>optionCheckBox_42</tabstop>
</tabstops>
<resources>
<include location="companion.qrc"/>
@@ -800,32 +231,16 @@ May be different from firmware language</string>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>fwPreferencesDialog</receiver>
<slot>accept()</slot>
<receiver>FirmwarePreferencesDialog</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>370</x>
<y>49</y>
<x>345</x>
<y>133</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>fwPreferencesDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>390</x>
<y>55</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
<x>207</x>
<y>76</y>
</hint>
</hints>
</connection>
+143 -403
View File
@@ -2,6 +2,7 @@
#include "ui_generaledit.h"
#include "helpers.h"
#include "appdata.h"
#include <QDateTime>
#include <QtGui>
#define BIT_WARN_THR ( 0x01 )
@@ -78,13 +79,11 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
}
}
}
QRegExp rx(CHAR_FOR_NAMES_REGEX);
ui->ownerNameLE->setValidator(new QRegExpValidator(rx, this));
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 {
@@ -103,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();
@@ -116,70 +115,44 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->bgVolume_label->hide();
ui->wavVolume_SL->hide();
ui->wavVolume_label->hide();
ui->varioP0_label->hide();
ui->varioP0_SB->hide();
ui->varioPMax_label->hide();
ui->varioPMax_SB->hide();
ui->varioR0_label->hide();
ui->varioR0_SB->hide();
} else {
ui->beepVolume_SL->setValue(g_eeGeneral.beepVolume);
ui->varioVolume_SL->setValue(g_eeGeneral.varioVolume);
ui->bgVolume_SL->setValue(g_eeGeneral.backgroundVolume);
ui->wavVolume_SL->setValue(g_eeGeneral.wavVolume);
ui->varioP0_SB->setValue(700+(g_eeGeneral.varioPitch*10));
updateVarioPitchRange();
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(HasBlInvert)) {
ui->blinvert_cb->hide();
ui->blinvert_label->hide();
} else {
ui->blinvert_cb->setChecked(g_eeGeneral.blightinv);
}
if (!GetEepromInterface()->getCapability(HasFAIMode)) {
if (!GetCurrentFirmware()->getCapability(HasFAIMode)) {
ui->faimode_CB->hide();
ui->label_faimode->hide();
}
else {
ui->faimode_CB->setChecked(g_eeGeneral.fai);
}
ui->ownerNameLE->setText(g_eeGeneral.ownerName);
if (!GetEepromInterface()->getCapability(OwnerName)) {
ui->ownerNameLE->setDisabled(true);
ui->label_ownerName->hide();
ui->ownerNameLE->hide();
ui->hideNameOnSplashChkB->setDisabled(true);
ui->hideNameOnSplashChkB->hide();
ui->label_hideOwnerName->hide();
}
if (!GetEepromInterface()->getCapability(HasInputFilter)) {
ui->inputfilterCB->hide();
ui->inputfilterLabel->hide();
}
if (!GetEepromInterface()->getCapability(HasStickScroll)) {
ui->StickScrollChkB->hide();
ui->StickScrollLB->hide();
}
if (!GetEepromInterface()->getCapability(TelemetryInternalAlarm)) {
ui->frskyintalarmChkB->hide();
ui->label_frskyintalarm->hide();
}
if (!GetEepromInterface()->getCapability(HasCrossTrims)) {
ui->crosstrimChkB->hide();
ui->crosstrimLB->hide();
}
if (!GetEepromInterface()->getCapability(HasPPMSim)) {
ui->PPMSimLB->hide();
ui->PPMSimChkB->hide();
}
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);
@@ -189,155 +162,73 @@ 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();
}
if (GetEepromInterface()->getCapability(TelemetryRSSIModel) ) {
ui->tabWidget->removeTab(2);
}
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(PerModelTimers)) {
ui->beepCountDownChkB->hide();
ui->beepFlashChkB->hide();
ui->beepMinuteChkB->hide();
ui->label_timers->hide();
}
if (!GetEepromInterface()->getCapability(HapticMode)) {
ui->hapticmodeCB->setDisabled(true);
ui->hapticmodeCB->hide();
ui->label_hapticmode->hide();
}
if (!GetEepromInterface()->getCapability(BandgapMeasure)) {
ui->BandGapEnableChkB->setDisabled(true);
ui->BandGapEnableChkB->hide();
ui->label_BandGapEnable->hide();
}
if (!GetEepromInterface()->getCapability(PotScrolling)) {
ui->PotScrollEnableChkB->setDisabled(true);
ui->PotScrollEnableChkB->hide();
ui->label_PotScrollEnable->hide();
}
if (!GetEepromInterface()->getCapability(TrainerSwitch)) {
ui->label_switch->hide();
ui->swtchCB_1->setDisabled(true);
ui->swtchCB_2->setDisabled(true);
ui->swtchCB_3->setDisabled(true);
ui->swtchCB_4->setDisabled(true);
ui->swtchCB_1->hide();
ui->swtchCB_2->hide();
ui->swtchCB_3->hide();
ui->swtchCB_4->hide();
} else {
populateSwitchCB(ui->swtchCB_1,g_eeGeneral.trainer.mix[0].swtch);
populateSwitchCB(ui->swtchCB_2,g_eeGeneral.trainer.mix[1].swtch);
populateSwitchCB(ui->swtchCB_3,g_eeGeneral.trainer.mix[2].swtch);
populateSwitchCB(ui->swtchCB_4,g_eeGeneral.trainer.mix[3].swtch);
}
if (!GetEepromInterface()->getCapability(BLonStickMove)) {
ui->blOnStickMoveSB->setDisabled(true);
ui->blOnStickMoveSB->hide();
ui->label_blOnStickMove->hide();
} else {
ui->blOnStickMoveSB->setValue(g_eeGeneral.lightOnStickMove*5);
}
if (!GetEepromInterface()->getCapability(gsSwitchMask)) {
ui->swAILChkB->setDisabled(true);
ui->swELEChkB->setDisabled(true);
ui->swTHRChkB->setDisabled(true);
ui->swRUDChkB->setDisabled(true);
ui->swGEAChkB->setDisabled(true);
ui->swID0ChkB->setDisabled(true);
ui->swID1ChkB->setDisabled(true);
ui->swID2ChkB->setDisabled(true);
ui->swAILChkB->hide();
ui->swELEChkB->hide();
ui->swTHRChkB->hide();
ui->swRUDChkB->hide();
ui->swGEAChkB->hide();
ui->swID0ChkB->hide();
ui->swID1ChkB->hide();
ui->swID2ChkB->hide();
this->layout()->removeItem(ui->switchMaskLayout);
} else {
setSwitchDefPos();
}
if (!GetEepromInterface()->getCapability(TelemetryAlarm)) {
ui->telalarmsChkB->hide();
ui->label_telalarms->hide();
}
int renumber=GetEepromInterface()->getCapability(RotaryEncoders);
int renumber=GetCurrentFirmware()->getCapability(RotaryEncoders);
if (renumber==0) {
ui->re_label->hide();
ui->re_CB->hide();
} else {
}
else {
populateRotEncCB(ui->re_CB, g_eeGeneral.reNavigation, renumber);
}
ui->telalarmsChkB->setChecked(g_eeGeneral.enableTelemetryAlarm);
ui->PotScrollEnableChkB->setChecked(!g_eeGeneral.disablePotScroll);
ui->BandGapEnableChkB->setChecked(!g_eeGeneral.disableBG);
ui->contrastSB->setValue(g_eeGeneral.contrast);
ui->battwarningDSB->setValue((double)g_eeGeneral.vBatWarn/10);
ui->backlightautoSB->setValue(g_eeGeneral.backlightDelay*5);
ui->inactimerSB->setValue(g_eeGeneral.inactivityTimer);
ui->crosstrimChkB->setChecked(g_eeGeneral.crosstrim);
ui->frskyintalarmChkB->setChecked(g_eeGeneral.frskyinternalalarm);
ui->StickScrollChkB->setChecked(g_eeGeneral.stickScroll);
ui->PPMSimChkB->setChecked(g_eeGeneral.enablePpmsim);
ui->inputfilterCB->setCurrentIndex(g_eeGeneral.filterInput);
ui->memwarnChkB->setChecked(!g_eeGeneral.disableMemoryWarning); //Default is zero=checked
ui->alarmwarnChkB->setChecked(!g_eeGeneral.disableAlarmWarning);//Default is zero=checked
ui->enableTelemetryAlarmChkB->setChecked(g_eeGeneral.enableTelemetryAlarm);
ui->beepMinuteChkB->setChecked(g_eeGeneral.minuteBeep);
ui->beepCountDownChkB->setChecked(g_eeGeneral.preBeep);
ui->beepFlashChkB->setChecked(g_eeGeneral.flashBeep);
ui->splashScreenChkB->setChecked(!g_eeGeneral.splashMode);
ui->hideNameOnSplashChkB->setChecked(!g_eeGeneral.hideNameOnSplash);
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
ui->splashScreenChkB->hide();
ui->splashScreenDuration->setCurrentIndex(3-g_eeGeneral.splashDuration);
}
else {
ui->splashScreenDuration->hide();
ui->splashScreenChkB->setChecked(!g_eeGeneral.splashMode);
}
ui->trnMode_1->setCurrentIndex(g_eeGeneral.trainer.mix[0].mode);
ui->trnChn_1->setCurrentIndex(g_eeGeneral.trainer.mix[0].src);
@@ -351,7 +242,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();
@@ -365,9 +256,10 @@ 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]);
}
else {
ui->potsTypeSeparator->hide();
@@ -375,6 +267,44 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->pot1TypeLabel->hide();
ui->pot2Type->hide();
ui->pot2TypeLabel->hide();
ui->pot3Type->hide();
ui->pot3TypeLabel->hide();
}
if (IS_TARANIS(eepromInterface->getBoard())) {
ui->serialPortMode->setCurrentIndex(g_eeGeneral.hw_uartMode);
}
else {
ui->serialPortMode->hide();
ui->serialPortLabel->hide();
}
if (!IS_TARANIS(eepromInterface->getBoard())) {
ui->stickReverse1->setChecked(g_eeGeneral.stickReverse & (1 << 0));
ui->stickReverse2->setChecked(g_eeGeneral.stickReverse & (1 << 1));
ui->stickReverse3->setChecked(g_eeGeneral.stickReverse & (1 << 2));
ui->stickReverse4->setChecked(g_eeGeneral.stickReverse & (1 << 3));
connect(ui->stickReverse1, SIGNAL(toggled(bool)), this, SLOT(stickReverseEdited()));
connect(ui->stickReverse2, SIGNAL(toggled(bool)), this, SLOT(stickReverseEdited()));
connect(ui->stickReverse3, SIGNAL(toggled(bool)), this, SLOT(stickReverseEdited()));
connect(ui->stickReverse4, SIGNAL(toggled(bool)), this, SLOT(stickReverseEdited()));
}
else {
ui->stickReverseLB->hide();
ui->stickReverse1->hide();
ui->stickReverse2->hide();
ui->stickReverse3->hide();
ui->stickReverse4->hide();
}
if (IS_TARANIS_PLUS(eepromInterface->getBoard())) {
ui->backlightColor_SL->setValue(g_eeGeneral.backlightColor);
}
else {
ui->backlightColor_label->hide();
ui->backlightColor_SL->hide();
ui->backlightColor1_label->hide();
ui->backlightColor2_label->hide();
}
}
@@ -383,6 +313,12 @@ GeneralEdit::~GeneralEdit()
delete ui;
}
void GeneralEdit::stickReverseEdited()
{
g_eeGeneral.stickReverse = ((int)ui->stickReverse1->isChecked()) | ((int)ui->stickReverse2->isChecked()<<1) | ((int)ui->stickReverse3->isChecked()<<2) | ((int)ui->stickReverse4->isChecked()<<3);
updateSettings();
}
void GeneralEdit::on_pot1Type_currentIndexChanged(int index)
{
g_eeGeneral.potsType[0] = index;
@@ -395,6 +331,18 @@ void GeneralEdit::on_pot2Type_currentIndexChanged(int index)
updateSettings();
}
void GeneralEdit::on_pot3Type_currentIndexChanged(int index)
{
g_eeGeneral.potsType[2] = index;
updateSettings();
}
void GeneralEdit::on_serialPortMode_currentIndexChanged(int index)
{
g_eeGeneral.hw_uartMode = index;
updateSettings();
}
void GeneralEdit::unlockSwitchEdited()
{
int i=0;
@@ -415,11 +363,12 @@ 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(Haptic)) {
ui->hapticLengthCB->setCurrentIndex(g_eeGeneral.hapticLength+2);
}
else {
ui->label_HL->hide();
ui->hapticLengthCB->hide();
} else {
ui->hapticLengthCB->setCurrentIndex(g_eeGeneral.hapticLength+2);
}
ui->BLBright_SB->setValue(100-g_eeGeneral.backlightBright);
ui->soundModeCB->setCurrentIndex(g_eeGeneral.speakerMode);
@@ -428,9 +377,8 @@ void GeneralEdit::setValues()
ui->speakerPitchSB->setValue(g_eeGeneral.speakerPitch);
ui->hapticStrengthSB->setValue(g_eeGeneral.hapticStrength);
ui->hapticmodeCB->setCurrentIndex(g_eeGeneral.hapticMode+2);
ui->battcalibDSB->setValue((double)g_eeGeneral.vBatCalib/10);
ui->battCalibDSB->setValue((double)g_eeGeneral.vBatCalib/10);
ui->CurrentCalib_SB->setValue((double)g_eeGeneral.currentCalib);
ui->battCalib->setValue((double)g_eeGeneral.vBatCalib/10);
ui->ana1Neg->setValue(g_eeGeneral.calibSpanNeg[0]);
ui->ana2Neg->setValue(g_eeGeneral.calibSpanNeg[1]);
@@ -466,27 +414,6 @@ void GeneralEdit::setValues()
ui->PPM_MultiplierDSB->setValue((qreal)(g_eeGeneral.PPM_Multiplier+10)/10);
}
void GeneralEdit::setSwitchDefPos()
{
quint8 x = g_eeGeneral.switchWarningStates & 0x38;
if(x==0x00 || x==0x18 || x== 0x28 || x==0x38 || x==0x30) //illegal states for ID0/1/2
{
g_eeGeneral.switchWarningStates &= ~0x38; // turn all off, make sure only one is on
g_eeGeneral.switchWarningStates |= 0x08;
}
switchDefPosEditLock = true;
ui->swTHRChkB->setChecked(g_eeGeneral.switchWarningStates & 0x01);
ui->swRUDChkB->setChecked(g_eeGeneral.switchWarningStates & 0x02);
ui->swELEChkB->setChecked(g_eeGeneral.switchWarningStates & 0x04);
ui->swID0ChkB->setChecked(g_eeGeneral.switchWarningStates & 0x08);
ui->swID1ChkB->setChecked(g_eeGeneral.switchWarningStates & 0x10);
ui->swID2ChkB->setChecked(g_eeGeneral.switchWarningStates & 0x20);
ui->swAILChkB->setChecked(g_eeGeneral.switchWarningStates & 0x40);
ui->swGEAChkB->setChecked(g_eeGeneral.switchWarningStates & 0x80);
switchDefPosEditLock = false;
}
void GeneralEdit::updateSettings()
{
radioData.generalSettings = g_eeGeneral;
@@ -505,10 +432,9 @@ void GeneralEdit::on_battwarningDSB_editingFinished()
updateSettings();
}
void GeneralEdit::on_battcalibDSB_editingFinished()
void GeneralEdit::on_battCalibDSB_editingFinished()
{
g_eeGeneral.vBatCalib = ui->battcalibDSB->value()*10;
ui->battCalib->setValue(ui->battcalibDSB->value());
g_eeGeneral.vBatCalib = ui->battCalibDSB->value()*10;
updateSettings();
}
@@ -590,35 +516,24 @@ void GeneralEdit::on_backlightautoSB_editingFinished()
}
}
void GeneralEdit::on_backlightColor_SL_valueChanged()
{
g_eeGeneral.backlightColor = ui->backlightColor_SL->value();
updateSettings();
}
void GeneralEdit::on_timezoneSB_editingFinished()
{
g_eeGeneral.timezone = ui->timezoneSB->value();
updateSettings();
}
void GeneralEdit::on_blOnStickMoveSB_editingFinished()
{
int i = ui->blOnStickMoveSB->value()/5;
if((i*5)!=ui->blOnStickMoveSB->value())
ui->blOnStickMoveSB->setValue(i*5);
g_eeGeneral.lightOnStickMove = i;
updateSettings();
}
void GeneralEdit::on_inactimerSB_editingFinished()
{
g_eeGeneral.inactivityTimer = ui->inactimerSB->value();
updateSettings();
}
void GeneralEdit::on_inputfilterCB_currentIndexChanged(int index)
{
g_eeGeneral.filterInput = index;
updateSettings();
}
void GeneralEdit::on_memwarnChkB_stateChanged(int )
{
g_eeGeneral.disableMemoryWarning = ui->memwarnChkB->isChecked() ? 0 : 1;
@@ -631,12 +546,6 @@ void GeneralEdit::on_alarmwarnChkB_stateChanged(int )
updateSettings();
}
void GeneralEdit::on_enableTelemetryAlarmChkB_stateChanged(int )
{
g_eeGeneral.enableTelemetryAlarm = ui->enableTelemetryAlarmChkB->isChecked();
updateSettings();
}
void GeneralEdit::on_beeperCB_currentIndexChanged(int index)
{
g_eeGeneral.beeperMode = (BeeperMode)(index-2);
@@ -885,13 +794,6 @@ void GeneralEdit::on_ana8Pos_editingFinished()
updateSettings();
}
void GeneralEdit::on_battCalib_editingFinished()
{
g_eeGeneral.vBatCalib = ui->battCalib->value()*10;
ui->battcalibDSB->setValue(ui->battCalib->value());
updateSettings();
}
void GeneralEdit::on_volume_SB_editingFinished()
{
g_eeGeneral.speakerVolume = ui->volume_SB->value();
@@ -934,6 +836,31 @@ void GeneralEdit::on_bgVolume_SL_valueChanged()
updateSettings();
}
void GeneralEdit::on_varioP0_SB_editingFinished()
{
g_eeGeneral.varioPitch = (ui->varioP0_SB->value()-700)/10;
updateVarioPitchRange();
updateSettings();
}
void GeneralEdit::updateVarioPitchRange()
{
ui->varioPMax_SB->setMaximum(700+(g_eeGeneral.varioPitch*10)+1000+800);
ui->varioPMax_SB->setMinimum(700+(g_eeGeneral.varioPitch*10)+1000-800);
}
void GeneralEdit::on_varioPMax_SB_editingFinished()
{
g_eeGeneral.varioRange = (ui->varioPMax_SB->value()-(700+(g_eeGeneral.varioPitch*10))-1000)/10;
updateSettings();
}
void GeneralEdit::on_varioR0_SB_editingFinished()
{
g_eeGeneral.varioRepeat = (ui->varioR0_SB->value()-500)/10;
updateSettings();
}
void GeneralEdit::on_PPM1_editingFinished()
{
g_eeGeneral.trainer.calib[0] = ui->PPM1->value();
@@ -963,34 +890,15 @@ void GeneralEdit::on_tabWidget_currentChanged(int index)
g.generalEditTab(index);
}
void GeneralEdit::on_beepMinuteChkB_stateChanged(int )
{
g_eeGeneral.minuteBeep = ui->beepMinuteChkB->isChecked() ? 1 : 0;
updateSettings();
}
void GeneralEdit::on_beepCountDownChkB_stateChanged(int )
{
g_eeGeneral.preBeep = ui->beepCountDownChkB->isChecked() ? 1 : 0;
updateSettings();
}
void GeneralEdit::on_beepFlashChkB_stateChanged(int )
{
g_eeGeneral.flashBeep = ui->beepFlashChkB->isChecked() ? 1 : 0;
updateSettings();
}
void GeneralEdit::on_splashScreenChkB_stateChanged(int )
{
g_eeGeneral.splashMode = ui->splashScreenChkB->isChecked() ? 0 : 1;
updateSettings();
}
void GeneralEdit::on_hideNameOnSplashChkB_stateChanged(int )
void GeneralEdit::on_splashScreenDuration_currentIndexChanged(int index)
{
g_eeGeneral.hideNameOnSplash = ui->hideNameOnSplashChkB->isChecked() ? 0 : 1;
g_eeGeneral.splashDuration = 3-index;
updateSettings();
}
@@ -1000,12 +908,6 @@ void GeneralEdit::on_PPM_MultiplierDSB_editingFinished()
updateSettings();
}
void GeneralEdit::on_ownerNameLE_editingFinished()
{
strncpy(g_eeGeneral.ownerName, ui->ownerNameLE->text().toAscii(), 10);
updateSettings();
}
void GeneralEdit::on_speakerPitchSB_editingFinished()
{
g_eeGeneral.speakerPitch = ui->speakerPitchSB->value();
@@ -1024,18 +926,6 @@ void GeneralEdit::on_soundModeCB_currentIndexChanged(int index)
updateSettings();
}
void GeneralEdit::on_PotScrollEnableChkB_stateChanged(int )
{
g_eeGeneral.disablePotScroll = ui->PotScrollEnableChkB->isChecked() ? false : true;
updateSettings();
}
void GeneralEdit::on_blinvert_cb_stateChanged(int )
{
g_eeGeneral.blightinv = ui->blinvert_cb->isChecked();
updateSettings();
}
void GeneralEdit::on_faimode_CB_stateChanged(int )
{
if (ui->faimode_CB->isChecked()) {
@@ -1053,164 +943,11 @@ void GeneralEdit::on_faimode_CB_stateChanged(int )
updateSettings();
}
void GeneralEdit::on_BandGapEnableChkB_stateChanged(int )
{
g_eeGeneral.disableBG = ui->BandGapEnableChkB->isChecked() ? false : true;
updateSettings();
}
void GeneralEdit::on_crosstrimChkB_stateChanged(int )
{
g_eeGeneral.crosstrim = ui->crosstrimChkB->isChecked() ? true : false;
updateSettings();
}
void GeneralEdit::on_frskyintalarmChkB_stateChanged(int )
{
g_eeGeneral.frskyinternalalarm = ui->frskyintalarmChkB->isChecked() ? true : false ;
updateSettings();
}
void GeneralEdit::on_StickScrollChkB_stateChanged(int )
{
g_eeGeneral.stickScroll = ui->StickScrollChkB->isChecked() ? true : false;
updateSettings();
}
void GeneralEdit::on_PPMSimChkB_stateChanged(int )
{
g_eeGeneral.enablePpmsim = ui->PPMSimChkB->isChecked() ? true : false;
updateSettings();
}
void GeneralEdit::on_swtchCB_1_currentIndexChanged(int index)
{
g_eeGeneral.trainer.mix[0].swtch = RawSwitch(ui->swtchCB_1->itemData(ui->swtchCB_1->currentIndex()).toInt());
updateSettings();
}
void GeneralEdit::on_swtchCB_2_currentIndexChanged(int index)
{
g_eeGeneral.trainer.mix[1].swtch = RawSwitch(ui->swtchCB_2->itemData(ui->swtchCB_2->currentIndex()).toInt());
updateSettings();
}
void GeneralEdit::on_swtchCB_3_currentIndexChanged(int index)
{
g_eeGeneral.trainer.mix[2].swtch = RawSwitch(ui->swtchCB_3->itemData(ui->swtchCB_3->currentIndex()).toInt());
updateSettings();
}
void GeneralEdit::on_swtchCB_4_currentIndexChanged(int index)
{
g_eeGeneral.trainer.mix[3].swtch = RawSwitch(ui->swtchCB_4->itemData(ui->swtchCB_4->currentIndex()).toInt());
updateSettings();
}
void GeneralEdit::getGeneralSwitchDefPos(int i, bool val)
{
if(val)
g_eeGeneral.switchWarningStates |= (1<<(i-1));
else
g_eeGeneral.switchWarningStates &= ~(1<<(i-1));
}
void GeneralEdit::on_swTHRChkB_stateChanged(int )
{
if(switchDefPosEditLock) return;
getGeneralSwitchDefPos(1,ui->swTHRChkB->isChecked());
updateSettings();
}
void GeneralEdit::on_telalarmsChkB_stateChanged(int )
{
g_eeGeneral.enableTelemetryAlarm=ui->telalarmsChkB->isChecked();
updateSettings();
}
void GeneralEdit::on_swRUDChkB_stateChanged(int )
{
if(switchDefPosEditLock) return;
getGeneralSwitchDefPos(2,ui->swRUDChkB->isChecked());
updateSettings();
}
void GeneralEdit::on_swELEChkB_stateChanged(int )
{
getGeneralSwitchDefPos(3,ui->swELEChkB->isChecked());
updateSettings();
}
void GeneralEdit::on_swID0ChkB_stateChanged(int )
{
if(switchDefPosEditLock) return;
if(ui->swID0ChkB->isChecked())
{
switchDefPosEditLock = true;
ui->swID1ChkB->setChecked(false);
ui->swID2ChkB->setChecked(false);
switchDefPosEditLock = false;
}
else
return;
g_eeGeneral.switchWarningStates &= ~0x30; //turn off ID1/2
getGeneralSwitchDefPos(4,ui->swID0ChkB->isChecked());
updateSettings();
}
void GeneralEdit::on_swID1ChkB_stateChanged(int )
{
if(switchDefPosEditLock) return;
if(ui->swID1ChkB->isChecked())
{
switchDefPosEditLock = true;
ui->swID0ChkB->setChecked(false);
ui->swID2ChkB->setChecked(false);
switchDefPosEditLock = false;
}
else
return;
g_eeGeneral.switchWarningStates &= ~0x28; //turn off ID0/2
getGeneralSwitchDefPos(5,ui->swID1ChkB->isChecked());
updateSettings();
}
void GeneralEdit::on_swID2ChkB_stateChanged(int )
{
if(switchDefPosEditLock) return;
if(ui->swID2ChkB->isChecked())
{
switchDefPosEditLock = true;
ui->swID0ChkB->setChecked(false);
ui->swID1ChkB->setChecked(false);
switchDefPosEditLock = false;
}
else
return;
g_eeGeneral.switchWarningStates &= ~0x18; //turn off ID1/2
getGeneralSwitchDefPos(6,ui->swID2ChkB->isChecked());
updateSettings();
}
void GeneralEdit::on_swAILChkB_stateChanged(int )
{
if(switchDefPosEditLock) return;
getGeneralSwitchDefPos(7,ui->swAILChkB->isChecked());
updateSettings();
}
void GeneralEdit::on_swGEAChkB_stateChanged(int )
{
if(switchDefPosEditLock) return;
getGeneralSwitchDefPos(8,ui->swGEAChkB->isChecked());
updateSettings();
}
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 {
@@ -1320,7 +1057,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;
@@ -1356,6 +1093,9 @@ void GeneralEdit::on_calstore_PB_clicked()
g.profile[profile_id].haptic( QString("%1%2%3").arg(((uint8_t)g_eeGeneral.hapticMode), 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.hapticStrength, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.hapticLength, 2, 16, QChar('0')));
g.profile[profile_id].speaker( QString("%1%2%3").arg((uint8_t)g_eeGeneral.speakerMode, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.speakerPitch, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.speakerVolume, 2, 16, QChar('0')));
g.profile[profile_id].countryCode( QString("%1%2%3").arg((uint8_t)g_eeGeneral.countryCode, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.imperial, 2, 16, QChar('0')).arg(g_eeGeneral.ttsLanguage));
QDateTime dateTime = QDateTime::currentDateTime();
g.profile[profile_id].timeStamp(dateTime.toString("yyyy-MM-dd hh:mm"));
QMessageBox::information(this, "Companion", tr("Calibration and HW parameters saved."));
}
}
+12 -31
View File
@@ -27,20 +27,13 @@ private:
bool mavbaudEditLock;
void getGeneralSwitchDefPos(int i, bool val);
void setSwitchDefPos();
void updateVarioPitchRange();
signals:
void modelValuesChanged();
private slots:
void on_ownerNameLE_editingFinished();
void on_PotScrollEnableChkB_stateChanged(int);
void on_blinvert_cb_stateChanged(int);
void on_faimode_CB_stateChanged(int );
void on_BandGapEnableChkB_stateChanged(int);
void on_crosstrimChkB_stateChanged(int );
void on_frskyintalarmChkB_stateChanged(int );
void on_StickScrollChkB_stateChanged(int );
void on_PPMSimChkB_stateChanged(int );
void on_speakerPitchSB_editingFinished();
void on_timezoneSB_editingFinished();
void on_hapticStrengthSB_editingFinished();
@@ -50,37 +43,30 @@ private slots:
void on_hapticmodeCB_currentIndexChanged(int index);
void on_hapticLengthCB_currentIndexChanged(int index);
void on_PPM_MultiplierDSB_editingFinished();
void on_splashScreenChkB_stateChanged(int );
void on_hideNameOnSplashChkB_stateChanged(int);
void on_beepCountDownChkB_stateChanged(int );
void on_beepMinuteChkB_stateChanged(int );
void on_splashScreenChkB_stateChanged(int);
void on_splashScreenDuration_currentIndexChanged(int index);
void on_alarmwarnChkB_stateChanged(int );
void on_enableTelemetryAlarmChkB_stateChanged(int );
void on_gpsFormatCB_currentIndexChanged(int index);
void on_tabWidget_currentChanged(int index);
void on_displayTypeCB_currentIndexChanged(int index);
void on_BLBright_SB_editingFinished();
void on_backlightColor_SL_valueChanged();
void on_re_CB_currentIndexChanged(int index);
void on_countrycode_CB_currentIndexChanged(int index);
void on_units_CB_currentIndexChanged(int index);
void on_trnMode_1_currentIndexChanged(int index);
void on_trnChn_1_currentIndexChanged(int index);
void on_swtchCB_1_currentIndexChanged(int index);
void on_trnWeight_1_editingFinished();
void on_trnMode_2_currentIndexChanged(int index);
void on_trnChn_2_currentIndexChanged(int index);
void on_swtchCB_2_currentIndexChanged(int index);
void on_trnWeight_2_editingFinished();
void on_trnMode_3_currentIndexChanged(int index);
void on_trnChn_3_currentIndexChanged(int index);
void on_swtchCB_3_currentIndexChanged(int index);
void on_trnWeight_3_editingFinished();
void on_trnMode_4_currentIndexChanged(int index);
void on_swtchCB_4_currentIndexChanged(int index);
void on_trnChn_4_currentIndexChanged(int index);
void on_trnWeight_4_editingFinished();
void on_battCalib_editingFinished();
void on_CurrentCalib_SB_editingFinished();
void on_ana1Neg_editingFinished();
@@ -119,38 +105,33 @@ private slots:
void on_varioVolume_SL_valueChanged();
void on_wavVolume_SL_valueChanged();
void on_varioP0_SB_editingFinished();
void on_varioPMax_SB_editingFinished();
void on_varioR0_SB_editingFinished();
void on_pot1Type_currentIndexChanged(int index);
void on_pot2Type_currentIndexChanged(int index);
void on_pot3Type_currentIndexChanged(int index);
void on_serialPortMode_currentIndexChanged(int index);
void on_stickmodeCB_currentIndexChanged(int index);
void on_channelorderCB_currentIndexChanged(int index);
void on_beeperCB_currentIndexChanged(int index);
void on_memwarnChkB_stateChanged(int );
void on_telalarmsChkB_stateChanged(int );
void on_inputfilterCB_currentIndexChanged(int index);
void on_inactimerSB_editingFinished();
void on_backlightautoSB_editingFinished();
void on_backlightswCB_currentIndexChanged(int index);
void on_mavbaud_CB_currentIndexChanged(int index);
void on_voiceLang_CB_currentIndexChanged(int index);
void on_blOnStickMoveSB_editingFinished();
void on_battcalibDSB_editingFinished();
void on_battCalibDSB_editingFinished();
void on_battwarningDSB_editingFinished();
void on_contrastSB_editingFinished();
void on_beepFlashChkB_stateChanged(int );
void on_swTHRChkB_stateChanged(int );
void on_swRUDChkB_stateChanged(int );
void on_swELEChkB_stateChanged(int );
void on_swID0ChkB_stateChanged(int );
void on_swID1ChkB_stateChanged(int );
void on_swID2ChkB_stateChanged(int );
void on_swAILChkB_stateChanged(int );
void on_swGEAChkB_stateChanged(int );
void on_calretrieve_PB_clicked();
void on_calstore_PB_clicked();
void unlockSwitchEdited();
void setValues();
void shrink();
void stickReverseEdited();
};
#endif // GENERALEDIT_H
+1112 -1436
View File
File diff suppressed because it is too large Load Diff
+116 -132
View File
@@ -2,9 +2,45 @@
#include "appdata.h"
#include "helpers.h"
#include "simulatordialog.h"
#include "simulatorinterface.h"
#include "flashinterface.h"
QString getPhaseName(int val, char * phasename)
const QColor colors[C9X_MAX_CURVES] = {
QColor(0,0,127),
QColor(0,127,0),
QColor(127,0,0),
QColor(0,127,127),
QColor(127,0,127),
QColor(127,127,0),
QColor(127,127,127),
QColor(0,0,255),
QColor(0,127,255),
QColor(127,0,255),
QColor(0,255,0),
QColor(0,255,127),
QColor(127,255,0),
QColor(255,0,0),
QColor(255,0,127),
QColor(255,127,0),
QColor(0,0,127),
QColor(0,127,0),
QColor(127,0,0),
QColor(0,127,127),
QColor(127,0,127),
QColor(127,127,0),
QColor(127,127,127),
QColor(0,0,255),
QColor(0,127,255),
QColor(127,0,255),
QColor(0,255,0),
QColor(0,255,127),
QColor(127,255,0),
QColor(255,0,0),
QColor(255,0,127),
QColor(255,127,0),
};
QString getPhaseName(int val, const char * phasename)
{
if (!val) return "---";
if (!phasename) {
@@ -26,9 +62,12 @@ QString getInputStr(ModelData & model, int index)
{
QString result;
if (GetEepromInterface()->getCapability(VirtualInputs)) {
result = model.inputNames[index];
if (result.isEmpty()) {
if (GetCurrentFirmware()->getCapability(VirtualInputs)) {
if (strlen(model.inputNames[index]) > 0) {
result = QObject::tr("[I%1]").arg(index+1);
result += QString(model.inputNames[index]);
}
else {
result = QObject::tr("Input%1").arg(index+1, 2, 10, QChar('0'));
}
}
@@ -63,27 +102,6 @@ void populateVoiceLangCB(QComboBox *b, QString language)
}
}
void populateTTraceCB(QComboBox *b, int value)
{
const QString strings9x[] = { QObject::tr("THR"), QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3")};
const QString stringstaranis[] = { QObject::tr("THR"), QObject::tr("S1"), QObject::tr("S2"), QObject::tr("LS"), QObject::tr("RS")};
b->clear();
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
for (int i=0; i< 5; i++) {
b->addItem(stringstaranis[i]);
}
} else {
for (int i=0; i< 4; i++) {
b->addItem(strings9x[i]);
}
}
int channels=(IS_ARM(GetEepromInterface()->getBoard()) ? 32 : 16);
for (int i=1; i<= channels; i++) {
b->addItem(QObject::tr("CH%1").arg(i, 2, 10, QChar('0')));
}
b->setCurrentIndex(value);
}
void populateRotEncCB(QComboBox *b, int value, int renumber)
{
QString strings[] = { QObject::tr("No"), QObject::tr("RotEnc A"), QObject::tr("Rot Enc B"), QObject::tr("Rot Enc C"), QObject::tr("Rot Enc D"), QObject::tr("Rot Enc E")};
@@ -95,31 +113,6 @@ void populateRotEncCB(QComboBox *b, int value, int renumber)
b->setCurrentIndex(value);
}
void populateCustomScreenFieldCB(QComboBox *b, unsigned int value, bool last=false, int hubproto=0)
{
int telem_hub[] = {0,0,0,0,0,0,0,0,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,0,0,2,2,1,1,1,1,1,1};
b->clear();
b->addItem(RawSource(SOURCE_TYPE_NONE, 0).toString());
for (unsigned int i = 0; i <= (last ? TELEMETRY_SOURCES_DISPLAY_COUNT : TELEMETRY_SOURCES_STATUS_COUNT); i++) {
b->addItem(RawSource(SOURCE_TYPE_TELEMETRY, i).toString());
if (!(i>=sizeof(telem_hub)/sizeof(int) || telem_hub[i]==0 || ((telem_hub[i]>=hubproto) && hubproto!=0))) {
QModelIndex index = b->model()->index(i, 0);
QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1);
}
}
if (value>=sizeof(telem_hub)/sizeof(int))
b->setCurrentIndex(0);
else if (telem_hub[value]==0 || ((telem_hub[value]>=hubproto) && hubproto!=0)) {
b->setCurrentIndex(value);
}
b->setMaxVisibleItems(10);
}
QString getProtocolStr(const int proto)
{
static const char *strings[] = { "OFF",
@@ -136,7 +129,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(FlightModes); i<=GetCurrentFirmware()->getCapability(FlightModes); i++) {
if (i < 0)
b->addItem(QObject::tr("!Flight mode %1").arg(-i-1), i);
else if (i > 0)
@@ -144,13 +137,13 @@ void populatePhasesCB(QComboBox *b, int value)
else
b->addItem(QObject::tr("----"), 0);
}
b->setCurrentIndex(value + GetEepromInterface()->getCapability(FlightPhases));
b->setCurrentIndex(value + GetCurrentFirmware()->getCapability(FlightModes));
}
bool gvarsEnabled()
{
int gvars=0;
if (GetEepromInterface()->getCapability(HasVariants)) {
if (GetCurrentFirmware()->getCapability(HasVariants)) {
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
gvars=1;
}
@@ -288,11 +281,11 @@ 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();
for (int i=-numcurves; i<numcurves; i++) {
for (int i=-numcurves; i<=numcurves; i++) {
curveValueCB->addItem(CurveReference(CurveReference::CURVE_REF_CUSTOM, i).toString());
}
}
@@ -340,7 +333,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;
}
@@ -351,7 +344,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(FlightModes); i++) {
if (i != (int)phase) {
b->addItem(QObject::tr("Flight mode %1 value").arg(i));
}
@@ -372,8 +365,10 @@ void populateBacklightCB(QComboBox *b, const uint8_t value)
void populateAndSwitchCB(QComboBox *b, const RawSwitch & value)
{
GeneralSettings fakeSettings;
if (IS_ARM(GetEepromInterface()->getBoard())) {
populateSwitchCB(b, value);
populateSwitchCB(b, value, fakeSettings);
}
else {
RawSwitch item;
@@ -384,7 +379,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);
@@ -398,25 +393,32 @@ void populateAndSwitchCB(QComboBox *b, const RawSwitch & value)
}
}
void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr)
void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettings & generalSettings, unsigned long attr)
{
RawSwitch item;
b->clear();
if (attr & POPULATE_ONOFF) {
if (IS_ARM(GetCurrentFirmware()->getBoard())) {
for (int i=-GetCurrentFirmware()->getCapability(FlightModes); i<0; i++) {
item = RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
}
}
item = RawSwitch(SWITCH_TYPE_OFF);
b->addItem(item.toString(), item.toValue());
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);
@@ -428,13 +430,17 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr)
if (item == value) b->setCurrentIndex(b->count()-1);
}
for (int i=-GetEepromInterface()->getCapability(MultiposPots) * GetEepromInterface()->getCapability(MultiposPotsPositions); i<0; i++) {
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
for (int i=GetCurrentFirmware()->getCapability(MultiposPots)-1; i>=0; i--) {
if (generalSettings.potsType[i] == 2/* TODO constant*/) {
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);
@@ -453,16 +459,20 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr)
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=1; i<=GetEepromInterface()->getCapability(MultiposPots) * GetEepromInterface()->getCapability(MultiposPotsPositions); i++) {
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
for (int i=0; i<GetCurrentFirmware()->getCapability(MultiposPots); i++) {
if (generalSettings.potsType[i] == 2/* TODO constant*/) {
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);
}
}
}
for (int i=1; i<=8; i++) {
@@ -471,13 +481,13 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr)
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);
@@ -487,6 +497,13 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr)
item = RawSwitch(SWITCH_TYPE_ON);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
if (IS_ARM(GetCurrentFirmware()->getBoard())) {
for (int i=1; i<=GetCurrentFirmware()->getCapability(FlightModes); i++) {
item = RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
}
}
}
b->setMaxVisibleItems(10);
@@ -499,7 +516,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,21 +560,23 @@ 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());
if (item == source) b->setCurrentIndex(b->count()-1);
if (model.isInputValid(i)) {
item = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i, &model);
b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
}
}
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 +598,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 +618,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)+GetEepromInterface()->getCapability(ExtraChannels); 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 +647,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);
@@ -668,11 +687,11 @@ void populateCSWCB(QComboBox *b, int value)
b->clear();
for (int i=0; i<LS_FN_MAX; i++) {
int func = order[i];
if (!IS_ARM(GetEepromInterface()->getBoard())) {
if (func == LS_FN_VEQUAL || func == LS_FN_STAY)
continue;
}
b->addItem(LogicalSwitchData(func).funcToString(), func);
// if (i>GetEepromInterface()->getCapability(CSFunc)) {
// QModelIndex index = b->model()->index(i, 0);
// QVariant v(0);
// }
if (value == func) {
b->setCurrentIndex(b->count()-1);
}
@@ -761,19 +780,6 @@ QString getFrSkyAlarmType(int alarm)
}
}
QString getFrSkyBlades(int blades)
{
switch (blades) {
case 1:
return "3";
case 2:
return "4";
default:
return "2";
}
}
QString getFrSkyUnits(int units)
{
switch(units) {
@@ -788,7 +794,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)");
@@ -843,7 +849,7 @@ QString getProtocol(ModelData * g_model)
QString getPhasesStr(unsigned int phases, ModelData & model)
{
int numphases = GetEepromInterface()->getCapability(FlightPhases);
int numphases = GetCurrentFirmware()->getCapability(FlightModes);
if (numphases && phases) {
QString str;
@@ -919,7 +925,9 @@ CompanionIcon::CompanionIcon(QString baseimage)
void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
{
if (GetEepromInterface()->getSimulator()) {
SimulatorInterface * si = GetCurrentFirmware()->getSimulator();
if (si) {
delete si;
RadioData * simuData = new RadioData(radioData);
unsigned int flags = 0;
if (modelIdx >= 0) {
@@ -929,14 +937,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();
@@ -969,27 +977,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";
}
}
+8 -15
View File
@@ -4,17 +4,17 @@
#include <QtGui>
#include "eeprominterface.h"
#define TMR_NUM_OPTION (TMR_VAROFS+2*9+2*GetEepromInterface()->getCapability(LogicalSwitches)-1)
extern const QColor colors[C9X_MAX_CURVES];
#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
#define CONVERT_MODE(x) (((x)<=4) ? modn12x3[generalSettings.stickMode][((x)-1)] : (x))
#define CHANNEL_ORDER(x) (chout_ar[generalSettings.templateSetup*4 + (x)-1])
#define CONVERT_MODE(x) (((x)<=4) ? modn12x3[generalSettings.stickMode][((x)-1)] : (x))
#define CURVE_BASE 7
#define CH(x) (SRC_CH1+(x)-1-(SRC_SWC-SRC_3POS))
#define CV(x) (CURVE_BASE+(x)-1)
#define CC(x) (CHANNEL_ORDER(x)) //need to invert this to work with dest
#define CURVE5(x) ((x)-1)
#define CURVE9(x) (MAX_CURVE5+(x)-1)
@@ -27,7 +27,6 @@
void populateGvSourceCB(QComboBox *b, int value);
void populateVoiceLangCB(QComboBox *b, QString language);
void populateTTraceCB(QComboBox *b, int value);
void populateRotEncCB(QComboBox *b, int value, int renumber);
void populateBacklightCB(QComboBox *b, const uint8_t value);
@@ -38,6 +37,8 @@ class CompanionIcon: public QIcon {
CompanionIcon(QString baseimage);
};
bool gvarsEnabled();
class GVarGroup : public QObject {
Q_OBJECT
@@ -84,11 +85,10 @@ class CurveGroup : public QObject {
#define POPULATE_ONOFF 0x01
#define POPULATE_TIMER_MODES 0x02
void populateAndSwitchCB(QComboBox *b, const RawSwitch & value);
void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr=0);
void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettings & generalSettings, unsigned long attr=0);
void populatePhasesCB(QComboBox *b, int value);
void populateGvarUseCB(QComboBox *b, unsigned int phase);
void populateCustomScreenFieldCB(QComboBox *b, unsigned int value, bool last, int hubproto);
QString getProtocolStr(const int proto);
QString getPhasesStr(unsigned int phases, ModelData & model);
@@ -107,7 +107,7 @@ QString getPhasesStr(unsigned int phases, ModelData & model);
void populateGVCB(QComboBox *b, int value);
void populateSourceCB(QComboBox *b, const RawSource &source, const ModelData & model, unsigned int flags);
void populateCSWCB(QComboBox *b, int value);
QString getPhaseName(int val, char * phasename=NULL);
QString getPhaseName(int val, const char * phasename=NULL);
QString getInputStr(ModelData & model, int index);
QString image2qstring(QImage image);
QImage qstring2image(QString imagestr);
@@ -120,7 +120,6 @@ QString getCenterBeep(ModelData * g_model);
/* FrSky helpers */
QString getFrSkyAlarmType(int alarm);
QString getFrSkyBlades(int blades);
QString getFrSkyUnits(int units);
QString getFrSkyProtocol(int protocol);
QString getFrSkyMeasure(int units);
@@ -131,10 +130,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
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Some files were not shown because too many files have changed in this diff Show More