Merge branch 'origin/next'

Conflicts:
	companion/src/CMakeLists.txt
	companion/src/apppreferencesdialog.ui
	companion/src/companion.qrc
	companion/src/mdichild.cpp
This commit is contained in:
Kjell Kernen
2014-03-31 10:22:23 +02:00
236 changed files with 25514 additions and 16461 deletions
+3
View File
@@ -1,3 +1,6 @@
/.*project /.*project
/.settings /.settings
/.autotools /.autotools
radio/src/bootloader/.dep/
radio/src/bootloader/bootloader_ramBoot*
*.lbm
+28
View File
@@ -332,3 +332,31 @@ Steve Coley
Sean Cull Sean Cull
Roberto Orsello Roberto Orsello
David Finger David Finger
FrSky - www.frsky-rc.com
Jean-Marie Oddo
Mike Matheny
Glen Roe (Showmaster)
Arron Bates
Tim Spurr
Daniel Morgan
Trent Ready
Mark Maskiell
Robert Crockford
Mark Illum
David McGuire
Martyn Coles
Jose Sobral
Heung Jin Choi
Tomasz Janiak
Fabien Gagné
Joe Street
Micha Ronen
Albert Blondin
Klaus Schuebel
Evening Shade Pottery
Thomas Kilduff
Sven Assmus
Markus Eberl
Dietmar Drees
Nicholas Field
Harald Wilczak
+7
View File
@@ -1,3 +1,10 @@
<h2>Version 1.52</h2>
<ul>
<li>Fix crash when writing certain EEPROMS</li>
<li>Google Earth export of logs containing GPS positions</li>
<li>DSM2 added for Taranis</li>
</ul>
<h2>Version 1.51</h2> <h2>Version 1.51</h2>
<ul> <ul>
<li>Wrong DFU-Util default path (MAC)</li> <li>Wrong DFU-Util default path (MAC)</li>
+17 -3
View File
@@ -1,7 +1,7 @@
PROJECT( companion ) PROJECT( companion )
SET( C9X_VERSION_MAJOR "1" ) SET( C9X_VERSION_MAJOR "1" )
SET( C9X_VERSION_MINOR "52" ) SET( C9X_VERSION_MINOR "99" )
SET( C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR} ) SET( C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR} )
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 ) CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
@@ -36,7 +36,7 @@ ELSE()
MESSAGE( "SDL not found! Joysticks support will be disabled" ) MESSAGE( "SDL not found! Joysticks support will be disabled" )
ENDIF() ENDIF()
FIND_PACKAGE( Qt4 REQUIRED ) FIND_PACKAGE(Qt4 4.8.4 REQUIRED)
SET( QT_USE_QTNETWORK True ) SET( QT_USE_QTNETWORK True )
SET( QT_USE_QTXML True ) SET( QT_USE_QTXML True )
INCLUDE( ${QT_USE_FILE} ) INCLUDE( ${QT_USE_FILE} )
@@ -90,6 +90,13 @@ add_custom_command(
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY} 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( include_directories(
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/../.. ${PROJECT_SOURCE_DIR}/../..
@@ -128,6 +135,7 @@ set(companion_SRCS
firmwares/opentx/opentxsimulator.cpp firmwares/opentx/opentxsimulator.cpp
firmwares/ersky9x/ersky9xeeprom.cpp firmwares/ersky9x/ersky9xeeprom.cpp
firmwares/ersky9x/ersky9xinterface.cpp firmwares/ersky9x/ersky9xinterface.cpp
${RADIO_SRC_DIRECTORY}/stamp-opentx.h
${RADIO_SRC_DIRECTORY}/bitmaps/sticks.lbm ${RADIO_SRC_DIRECTORY}/bitmaps/sticks.lbm
${RADIO_SRC_DIRECTORY}/translations/en.h ${RADIO_SRC_DIRECTORY}/translations/en.h
appdata.cpp appdata.cpp
@@ -151,6 +159,8 @@ set(companion_SRCS
splashlibrary.cpp splashlibrary.cpp
mainwindow.cpp mainwindow.cpp
companion.cpp companion.cpp
modelconfigdialog.cpp
taranisnotfound.cpp
qcustomplot.cpp qcustomplot.cpp
wizarddata.cpp wizarddata.cpp
wizarddialog.cpp wizarddialog.cpp
@@ -175,6 +185,8 @@ set(companion_MOC_HDRS
modelslist.h modelslist.h
mdichild.h mdichild.h
mainwindow.h mainwindow.h
modelconfigdialog.h
taranisnotfound.h
qcustomplot.h qcustomplot.h
helpers.h helpers.h
wizarddialog.h wizarddialog.h
@@ -196,6 +208,8 @@ set(companion_UIS
customizesplashdialog.ui customizesplashdialog.ui
splashlibrary.ui splashlibrary.ui
burndialog.ui burndialog.ui
modelconfigdialog.ui
taranisnotfound.ui
) )
set(companion_RCS set(companion_RCS
@@ -387,7 +401,7 @@ IF( WIN32 )
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/companionInstall.exe ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/companionInstall.exe
COMMAND "${NSIS_EXE}" ARGS companion.nsi 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") COMMENT "Windows NSIS Installer")
ADD_CUSTOM_TARGET( installer ADD_CUSTOM_TARGET( installer
+22 -13
View File
@@ -307,6 +307,7 @@ QString Profile::display() const { return _display; }
QString Profile::haptic() const { return _haptic; } QString Profile::haptic() const { return _haptic; }
QString Profile::speaker() const { return _speaker; } QString Profile::speaker() const { return _speaker; }
QString Profile::stickPotCalib() const { return _stickPotCalib; } QString Profile::stickPotCalib() const { return _stickPotCalib; }
QString Profile::timeStamp() const { return _timeStamp; }
QString Profile::trainerCalib() const { return _trainerCalib; } QString Profile::trainerCalib() const { return _trainerCalib; }
int Profile::currentCalib() const { return _currentCalib; } int Profile::currentCalib() const { return _currentCalib; }
int Profile::gsStickMode() const { return _gsStickMode; } int Profile::gsStickMode() const { return _gsStickMode; }
@@ -331,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::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::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::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::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::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));} void Profile::gsStickMode (const int x) { store(x, _gsStickMode, "GSStickMode" ,"Profiles", QString("profile%1").arg(index));}
@@ -396,6 +398,24 @@ bool Profile::existsOnDisk()
return (keyList.length() > 0); 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) void Profile::init(int newIndex)
{ {
index = newIndex; index = newIndex;
@@ -410,19 +430,7 @@ void Profile::init(int newIndex)
_channelOrder = 0; _channelOrder = 0;
_defaultMode = 1; _defaultMode = 1;
_beeper = ""; initFwVariables();
_countryCode = "";
_display = "";
_haptic = "";
_speaker = "";
_stickPotCalib = "";
_trainerCalib = "";
_currentCalib = 0;
_gsStickMode = 0;
_ppmMultiplier = 0;
_vBatCalib = 0;
_vBatWarn = 0;
// Do not write empty profiles to disk except the default (0) profile. // Do not write empty profiles to disk except the default (0) profile.
if ( index > 0 && !existsOnDisk()) if ( index > 0 && !existsOnDisk())
@@ -450,6 +458,7 @@ void Profile::flush()
getset( _haptic, "Haptic" ,"" ,"Profiles", QString("profile%1").arg(index)); getset( _haptic, "Haptic" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _speaker, "Speaker" ,"" ,"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( _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( _trainerCalib, "TrainerCalib" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _currentCalib, "currentCalib" ,0 ,"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)); getset( _gsStickMode, "GSStickMode" ,0 ,"Profiles", QString("profile%1").arg(index));
+4
View File
@@ -120,6 +120,7 @@ class Profile: protected CompStoreObj
QString _haptic; QString _haptic;
QString _speaker; QString _speaker;
QString _stickPotCalib; QString _stickPotCalib;
QString _timeStamp;
QString _trainerCalib; QString _trainerCalib;
int _currentCalib; int _currentCalib;
int _gsStickMode; int _gsStickMode;
@@ -145,6 +146,7 @@ class Profile: protected CompStoreObj
QString haptic() const; QString haptic() const;
QString speaker() const; QString speaker() const;
QString stickPotCalib() const; QString stickPotCalib() const;
QString timeStamp() const;
QString trainerCalib() const; QString trainerCalib() const;
int currentCalib() const; int currentCalib() const;
int gsStickMode() const; int gsStickMode() const;
@@ -169,6 +171,7 @@ class Profile: protected CompStoreObj
void haptic (const QString); void haptic (const QString);
void speaker (const QString); void speaker (const QString);
void stickPotCalib (const QString); void stickPotCalib (const QString);
void timeStamp (const QString);
void trainerCalib (const QString); void trainerCalib (const QString);
void currentCalib (const int); void currentCalib (const int);
void gsStickMode (const int); void gsStickMode (const int);
@@ -181,6 +184,7 @@ class Profile: protected CompStoreObj
void remove(); void remove();
bool existsOnDisk(); bool existsOnDisk();
void init(int newIndex); void init(int newIndex);
void initFwVariables();
void flush(); void flush();
}; };
+16 -3
View File
@@ -68,12 +68,13 @@ void appPreferencesDialog::writeValues()
else else
g.profile[g.id()].name(ui->profileNameLE->text()); g.profile[g.id()].name(ui->profileNameLE->text());
// If a new radio type has been choosen, several things need to change // If a new radio type has been choosen, several things need to reset
if ( initialRadioType != ui->radioCB->currentIndex()) if ( initialRadioType != ui->radioCB->currentIndex())
{ {
g.profile[g.id()].fwName(""); g.profile[g.id()].fwName("");
g.profile[g.id()].fwType(getDefaultFwType(ui->radioCB->currentIndex())); g.profile[g.id()].fwType(getDefaultFwType(ui->radioCB->currentIndex()));
current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].fwType()); current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].fwType());
g.profile[g.id()].initFwVariables();
} }
} }
@@ -154,11 +155,23 @@ void appPreferencesDialog::initSettings()
ui->sdPath->setText(g.profile[g.id()].sdPath()); ui->sdPath->setText(g.profile[g.id()].sdPath());
ui->profileNameLE->setText(g.profile[g.id()].name()); ui->profileNameLE->setText(g.profile[g.id()].name());
ui->SplashFileName->setText(g.profile[g.id()].splashFile()); ui->SplashFileName->setText(g.profile[g.id()].splashFile());
initialRadioType = getRadioType(g.profile[g.id()].fwType()); initialRadioType = getRadioType(g.profile[g.id()].fwType());
ui->radioCB->setCurrentIndex(initialRadioType); ui->radioCB->setCurrentIndex(initialRadioType);
displayImage( g.profile[g.id()].splashFile() ); 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);
} }
void appPreferencesDialog::on_libraryPathButton_clicked() void appPreferencesDialog::on_libraryPathButton_clicked()
+14 -13
View File
@@ -51,18 +51,20 @@ avrOutputDialog::avrOutputDialog(QWidget *parent, QString prog, QStringList arg,
ui->progressBar->setMaximum(127); ui->progressBar->setMaximum(127);
QTimer::singleShot(500, this, SLOT(doCopy())); QTimer::singleShot(500, this, SLOT(doCopy()));
} }
} else { }
if(wTitle.isEmpty()) else {
setWindowTitle(getProgrammer() + " " + tr("result")); if (wTitle.isEmpty())
setWindowTitle(getProgrammer() + " " + tr("result"));
else else
setWindowTitle(getProgrammer() + " - " + wTitle); setWindowTitle(getProgrammer() + " - " + wTitle);
QFile exec; QFile exec;
winTitle=wTitle; winTitle=wTitle;
if (!(exec.exists(prog))) { if (!(exec.exists(prog))) {
QMessageBox::critical(this, "Companion", getProgrammer() + " " + tr("executable not found")); QMessageBox::critical(this, "Companion", getProgrammer() + " " + tr("executable not found"));
closeOpt = AVR_DIALOG_FORCE_CLOSE; closeOpt = AVR_DIALOG_FORCE_CLOSE;
QTimer::singleShot(0, this, SLOT(forceClose())); QTimer::singleShot(0, this, SLOT(forceClose()));
} else { }
else {
foreach(QString str, arg) cmdLine.append(" " + str); foreach(QString str, arg) cmdLine.append(" " + str);
lfuse = 0; lfuse = 0;
hfuse = 0; hfuse = 0;
@@ -70,10 +72,11 @@ avrOutputDialog::avrOutputDialog(QWidget *parent, QString prog, QStringList arg,
phase=0; phase=0;
currLine.clear(); currLine.clear();
if (!displayDetails) { if (!displayDetails) {
ui->plainTextEdit->hide(); ui->plainTextEdit->hide();
QTimer::singleShot(0, this, SLOT(shrink())); QTimer::singleShot(0, this, SLOT(shrink()));
} else { }
ui->checkBox->setChecked(true); else {
ui->checkBox->setChecked(true);
} }
process = new QProcess(this); process = new QProcess(this);
connect(process,SIGNAL(readyReadStandardError()), this, SLOT(doAddTextStdErr())); connect(process,SIGNAL(readyReadStandardError()), this, SLOT(doAddTextStdErr()));
@@ -241,10 +244,8 @@ void avrOutputDialog::doAddTextStdOut()
if (text.contains("Complete ")) { if (text.contains("Complete ")) {
#if !__GNUC__ #if !__GNUC__
if (kill_timer) { delete kill_timer;
delete kill_timer; kill_timer = NULL;
kill_timer = NULL;
}
#endif #endif
int start = text.indexOf("Complete "); int start = text.indexOf("Complete ");
int end = text.indexOf("%"); int end = text.indexOf("%");
+1
View File
@@ -15,6 +15,7 @@ burnConfigDialog::burnConfigDialog(QWidget *parent) :
ui(new Ui::burnConfigDialog) ui(new Ui::burnConfigDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
setWindowIcon(CompanionIcon("configure.png"));
ui->avrdude_programmer->model()->sort(0); ui->avrdude_programmer->model()->sort(0);
getSettings(); 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> <string notr="true">com4</string>
</property> </property>
</item> </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> <item>
<property name="text"> <property name="text">
<string notr="true">lpt1</string> <string notr="true">lpt1</string>
+17 -13
View File
@@ -18,12 +18,13 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
hexType(Type) hexType(Type)
{ {
ui->setupUi(this); ui->setupUi(this);
setWindowIcon(CompanionIcon("write_flash.png"));
if(!g.profile[g.id()].splashFile().isEmpty()){ if (!g.profile[g.id()].splashFile().isEmpty()){
imageSource=PROFILE; imageSource=PROFILE;
imageFile=g.profile[g.id()].splashFile(); imageFile=g.profile[g.id()].splashFile();
} }
else{ else {
ui->useProfileImageCB->setDisabled(true); ui->useProfileImageCB->setDisabled(true);
imageSource=FIRMWARE; imageSource=FIRMWARE;
imageFile=""; imageFile="";
@@ -51,7 +52,7 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
ui->BurnFlashButton->setDisabled(true); ui->BurnFlashButton->setDisabled(true);
ui->FWFileName->clear(); ui->FWFileName->clear();
ui->DateField->clear(); ui->DateField->clear();
ui->SVNField->clear(); ui->versionField->clear();
ui->ModField->clear(); ui->ModField->clear();
ui->FramFWInfo->hide(); ui->FramFWInfo->hide();
ui->SplashFrame->hide(); ui->SplashFrame->hide();
@@ -131,7 +132,7 @@ void burnDialog::on_FlashLoadButton_clicked()
ui->BurnFlashButton->setDisabled(true); ui->BurnFlashButton->setDisabled(true);
ui->FWFileName->clear(); ui->FWFileName->clear();
ui->DateField->clear(); ui->DateField->clear();
ui->SVNField->clear(); ui->versionField->clear();
ui->ModField->clear(); ui->ModField->clear();
ui->FramFWInfo->hide(); ui->FramFWInfo->hide();
ui->SplashFrame->hide(); ui->SplashFrame->hide();
@@ -145,7 +146,7 @@ void burnDialog::on_FlashLoadButton_clicked()
checkFw(fileName); checkFw(fileName);
} }
else { 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 file to load Models and Settings from"), g.eepromDir(), tr(EEPE_FILES_FILTER));
if (checkeEprom(fileName)) { if (checkeEprom(fileName)) {
if (burnraw==false) { if (burnraw==false) {
ui->BurnFlashButton->setEnabled(true); ui->BurnFlashButton->setEnabled(true);
@@ -191,8 +192,8 @@ void burnDialog::checkFw(QString fileName)
if (flash.isValid()) { if (flash.isValid()) {
ui->FramFWInfo->show(); ui->FramFWInfo->show();
ui->DateField->setText(flash.getDate() + " " + flash.getTime()); ui->DateField->setText(flash.getDate() + " " + flash.getTime());
ui->SVNField->setText(flash.getSvn()); ui->versionField->setText(flash.getVersion().isEmpty() ? flash.getSvn() : flash.getVersion());
ui->ModField->setText(flash.getBuild()); ui->ModField->setText(flash.getEEprom());
ui->SplashFrame->hide(); ui->SplashFrame->hide();
if (flash.hasSplash()) { if (flash.hasSplash()) {
@@ -305,7 +306,7 @@ void burnDialog::displaySplash()
FlashInterface flash(ui->FWFileName->text()); FlashInterface flash(ui->FWFileName->text());
image = flash.getSplash(); image = flash.getSplash();
} }
else{ else {
image.load(imageFile); image.load(imageFile);
} }
if (image.isNull()) { if (image.isNull()) {
@@ -425,15 +426,18 @@ void burnDialog::on_BurnFlashButton_clicked()
hexfileName->clear(); hexfileName->clear();
QMessageBox::critical(this, tr("Warning"), tr("Cannot save customized firmware")); QMessageBox::critical(this, tr("Warning"), tr("Cannot save customized firmware"));
} }
} else { }
else {
hexfileName->clear(); hexfileName->clear();
QMessageBox::critical(this, tr("Warning"), tr("Custom image not found")); 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")); QMessageBox::critical(this, tr("Warning"), tr("No firmware selected"));
hexfileName->clear(); hexfileName->clear();
} }
-3
View File
@@ -7,12 +7,9 @@
#include "flashinterface.h" #include "flashinterface.h"
#include "xmlinterface.h" #include "xmlinterface.h"
#define XML_FILES_FILTER "XML files (*.xml);;"
#define HEX_FILES_FILTER "HEX files (*.hex);;" #define HEX_FILES_FILTER "HEX files (*.hex);;"
#define BIN_FILES_FILTER "BIN files (*.bin);;" #define BIN_FILES_FILTER "BIN files (*.bin);;"
#define EEPE_FILES_FILTER "EEPE EEPROM files (*.eepe);;" #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 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 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 #define EXTERNAL_EEPROM_FILES_FILTER "EEPROM files (*.bin *.hex);;" BIN_FILES_FILTER HEX_FILES_FILTER
+28 -46
View File
@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>440</width> <width>399</width>
<height>423</height> <height>564</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@@ -18,7 +18,7 @@
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>440</width> <width>0</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
@@ -113,8 +113,15 @@
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QGridLayout" name="gridLayout_5"> <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"> <item row="1" column="1">
<widget class="QLineEdit" name="SVNField"> <widget class="QLineEdit" name="versionField">
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
@@ -135,20 +142,13 @@
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="svnLabel"> <widget class="QLabel" name="versionLabel">
<property name="text"> <property name="text">
<string>SVN</string> <string>Version</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="3" column="1">
<widget class="QLabel" name="dateLabel">
<property name="text">
<string>Date &amp; Time</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="DateField"> <widget class="QLineEdit" name="DateField">
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
@@ -171,6 +171,12 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize">
<size>
<width>250</width>
<height>0</height>
</size>
</property>
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
@@ -254,8 +260,8 @@
<item row="0" column="0"> <item row="0" column="0">
<layout class="QGridLayout" name="SplashLayout" rowstretch="0,0,0,0,0,0,0"> <layout class="QGridLayout" name="SplashLayout" rowstretch="0,0,0,0,0,0,0">
<item row="0" column="1" rowspan="7"> <item row="0" column="1" rowspan="7">
<layout class="QGridLayout" name="gridLayout_2" rowstretch="1"> <layout class="QGridLayout" name="gridLayout_2" rowstretch="0">
<item row="0" column="1"> <item row="0" column="0">
<widget class="QLabel" name="imageLabel"> <widget class="QLabel" name="imageLabel">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum"> <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
@@ -271,8 +277,8 @@
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>212</width> <width>214</width>
<height>64</height> <height>66</height>
</size> </size>
</property> </property>
<property name="frameShape"> <property name="frameShape">
@@ -281,6 +287,9 @@
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Plain</enum> <enum>QFrame::Plain</enum>
</property> </property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
@@ -289,32 +298,6 @@
</property> </property>
</widget> </widget>
</item> </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> </layout>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
@@ -377,8 +360,7 @@
<tabstop>BurnFlashButton</tabstop> <tabstop>BurnFlashButton</tabstop>
<tabstop>FWFileName</tabstop> <tabstop>FWFileName</tabstop>
<tabstop>FlashLoadButton</tabstop> <tabstop>FlashLoadButton</tabstop>
<tabstop>DateField</tabstop> <tabstop>versionField</tabstop>
<tabstop>SVNField</tabstop>
<tabstop>ModField</tabstop> <tabstop>ModField</tabstop>
<tabstop>useProfileImageCB</tabstop> <tabstop>useProfileImageCB</tabstop>
<tabstop>useFwImageCB</tabstop> <tabstop>useFwImageCB</tabstop>
+1
View File
@@ -57,6 +57,7 @@
<file>images/x9r3.png</file> <file>images/x9r3.png</file>
<file>images/x9s0.png</file> <file>images/x9s0.png</file>
<file>images/x9t0.png</file> <file>images/x9t0.png</file>
<file>images/taranison.png</file>
<file>images/wizard/ailerons.png</file> <file>images/wizard/ailerons.png</file>
<file>images/wizard/airbrakes.png</file> <file>images/wizard/airbrakes.png</file>
<file>images/wizard/bank.png</file> <file>images/wizard/bank.png</file>
+2 -2
View File
@@ -1069,7 +1069,7 @@ void compareDialog::printFSwitches()
QString color2; QString color2;
int sc=0; int sc=0;
QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-before:always;\" width=\"100%\">"; 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("<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=\"7%\" align=\"center\"><b>"+tr("Switch")+"</b></td>");
str.append("<td width=\"12%\" align=\"center\"><b>"+tr("Function")+"</b></td>"); str.append("<td width=\"12%\" align=\"center\"><b>"+tr("Function")+"</b></td>");
@@ -1112,7 +1112,7 @@ void compareDialog::printFSwitches()
} else { } else {
str.append("<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>"); 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) { if (g_model2->funcSw[i].swtch.type) {
str.append(doTC(g_model2->funcSw[i].swtch.toString(),color2)); str.append(doTC(g_model2->funcSw[i].swtch.toString(),color2));
str.append(doTC(g_model2->funcSw[i].funcToString(),color2)); str.append(doTC(g_model2->funcSw[i].funcToString(),color2));
+1 -1
View File
@@ -142,7 +142,7 @@ customizeSplashDialog::customizeSplashDialog(QWidget *parent) :
ui(new Ui::customizeSplashDialog) ui(new Ui::customizeSplashDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
this->setWindowIcon(CompanionIcon("paint.png")); setWindowIcon(CompanionIcon("paintbrush.png"));
ui->leftLibraryButton->setIcon(CompanionIcon("library.png")); ui->leftLibraryButton->setIcon(CompanionIcon("library.png"));
ui->rightLibraryButton->setIcon(CompanionIcon("library.png")); ui->rightLibraryButton->setIcon(CompanionIcon("library.png"));
+7 -1
View File
@@ -10,7 +10,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1087</width> <width>1087</width>
<height>285</height> <height>298</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@@ -165,6 +165,9 @@
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Plain</enum> <enum>QFrame::Plain</enum>
</property> </property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
@@ -470,6 +473,9 @@
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Plain</enum> <enum>QFrame::Plain</enum>
</property> </property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
+12
View File
@@ -2,6 +2,7 @@
#include "ui_downloaddialog.h" #include "ui_downloaddialog.h"
#include <QMessageBox> #include <QMessageBox>
#include <QtGui> #include <QtGui>
#include <QTime>
#include "helpers.h" #include "helpers.h"
downloadDialog::downloadDialog(QWidget *parent, QString src, QString tgt) : downloadDialog::downloadDialog(QWidget *parent, QString src, QString tgt) :
@@ -87,3 +88,14 @@ void downloadDialog::fileError()
file = 0; file = 0;
reject(); 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); void updateDataReadProgress(qint64 bytesRead, qint64 totalBytes);
private: private:
void closeEvent( QCloseEvent * event);
Ui::downloadDialog *ui; Ui::downloadDialog *ui;
QNetworkAccessManager qnam; QNetworkAccessManager qnam;
+14 -10
View File
@@ -638,41 +638,45 @@ class ConversionField: public TransformedField {
virtual void beforeExport() virtual void beforeExport()
{ {
int val = field; _field = field;
if (scale) { if (scale) {
val /= scale; _field /= scale;
} }
if (table) { if (table) {
if (table->exportValue(val, _field)) if (table->exportValue(_field, _field))
return; return;
if (!error.isEmpty()) if (!error.isEmpty())
EEPROMWarnings += error + "\n"; EEPROMWarnings += error + "\n";
} }
if (shift) { if (shift) {
if (val < min) _field = min + shift; if (_field < min) _field = min + shift;
else if (val > max) _field = max + shift; else if (_field > max) _field = max + shift;
else _field = val + shift; else _field += shift;
} }
if (exportFunc) { if (exportFunc) {
_field = exportFunc(val); _field = exportFunc(_field);
} }
} }
virtual void afterImport() virtual void afterImport()
{ {
field = _field;
if (table) { if (table) {
if (table->importValue(_field, field)) if (table->importValue(field, field))
return; return;
} }
field = _field - shift; if (shift) {
field -= shift;
}
if (importFunc) { if (importFunc) {
field = importFunc(_field); field = importFunc(field);
} }
if (scale) { if (scale) {
+132 -106
View File
@@ -127,11 +127,14 @@ RawSourceRange RawSource::getRange(bool singleprec)
result.max = singleprec ? 1540 : 3000; result.max = singleprec ? 1540 : 3000;
break; break;
case TELEMETRY_SOURCE_T1: case TELEMETRY_SOURCE_T1:
case TELEMETRY_SOURCE_T1_MAX:
case TELEMETRY_SOURCE_T2: case TELEMETRY_SOURCE_T2:
case TELEMETRY_SOURCE_T2_MAX:
result.min = -30; result.min = -30;
result.max = 225; result.max = 225;
break; break;
case TELEMETRY_SOURCE_RPM: case TELEMETRY_SOURCE_RPM:
case TELEMETRY_SOURCE_RPM_MAX:
result.step = singleprec ? 50 : 1; result.step = singleprec ? 50 : 1;
result.max = singleprec ? 12750 : 20000; result.max = singleprec ? 12750 : 20000;
break; break;
@@ -139,6 +142,7 @@ RawSourceRange RawSource::getRange(bool singleprec)
result.max = 100; result.max = 100;
break; break;
case TELEMETRY_SOURCE_SPEED: case TELEMETRY_SOURCE_SPEED:
case TELEMETRY_SOURCE_SPEED_MAX:
result.step = singleprec ? 4 : 1; result.step = singleprec ? 4 : 1;
result.max = singleprec ? 944 : 2000; result.max = singleprec ? 944 : 2000;
if (model && !model->frsky.imperial) { if (model && !model->frsky.imperial) {
@@ -147,21 +151,26 @@ RawSourceRange RawSource::getRange(bool singleprec)
} }
break; break;
case TELEMETRY_SOURCE_DIST: case TELEMETRY_SOURCE_DIST:
case TELEMETRY_SOURCE_DIST_MAX:
result.step = singleprec ? 8 : 1; result.step = singleprec ? 8 : 1;
result.max = singleprec ? 2040 : 10000; result.max = singleprec ? 2040 : 10000;
break; break;
case TELEMETRY_SOURCE_CELL: case TELEMETRY_SOURCE_CELL:
case TELEMETRY_SOURCE_CELL_MIN:
result.step = singleprec ? 0.02 : 0.01; result.step = singleprec ? 0.02 : 0.01;
result.max = 5.1; result.max = 5.1;
result.decimals = 2; result.decimals = 2;
break; break;
case TELEMETRY_SOURCE_CELLS_SUM: case TELEMETRY_SOURCE_CELLS_SUM:
case TELEMETRY_SOURCE_CELLS_MIN:
case TELEMETRY_SOURCE_VFAS: case TELEMETRY_SOURCE_VFAS:
case TELEMETRY_SOURCE_VFAS_MIN:
result.step = 0.1; result.step = 0.1;
result.max = 25.5; result.max = 25.5;
result.decimals = 1; result.decimals = 1;
break; break;
case TELEMETRY_SOURCE_CURRENT: case TELEMETRY_SOURCE_CURRENT:
case TELEMETRY_SOURCE_CURRENT_MAX:
result.step = singleprec ? 0.5 : 0.1; result.step = singleprec ? 0.5 : 0.1;
result.max = singleprec ? 127.5 : 200.0; result.max = singleprec ? 127.5 : 200.0;
result.decimals = 1; result.decimals = 1;
@@ -171,6 +180,7 @@ RawSourceRange RawSource::getRange(bool singleprec)
result.max = singleprec ? 5100 : 10000; result.max = singleprec ? 5100 : 10000;
break; break;
case TELEMETRY_SOURCE_POWER: case TELEMETRY_SOURCE_POWER:
case TELEMETRY_SOURCE_POWER_MAX:
result.step = singleprec ? 5 : 1; result.step = singleprec ? 5 : 1;
result.max = singleprec ? 1275 : 2000; result.max = singleprec ? 1275 : 2000;
break; break;
@@ -222,20 +232,20 @@ QString RawSource::toString()
QObject::tr("A1"), QObject::tr("A2"), QObject::tr("A3"), QObject::tr("A4"), 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("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("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("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("ASpd"), QObject::tr("dTE"),
QObject::tr("A1-"), QObject::tr("A2-"), QObject::tr("A3-"), QObject::tr("A4-"), 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("Alt-"), QObject::tr("Alt+"), QObject::tr("Rpm+"), QObject::tr("T1+"), QObject::tr("T2+"), QObject::tr("Speed+"), QObject::tr("Dist+"),
QObject::tr("Cel-"), QObject::tr("Cels-"), QObject::tr("Vfs-"), QObject::tr("Cur+"), QObject::tr("Pwr+"), QObject::tr("Cell-"), QObject::tr("Cells-"), QObject::tr("Vfas-"), QObject::tr("Curr+"), QObject::tr("Powr+"),
QObject::tr("ACC"), QObject::tr("Time"), QObject::tr("ACC"), QObject::tr("Time"),
}; };
static const QString virtualSwitches[] = { 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("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("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("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("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("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("LSV"), QObject::tr("LSW") QObject::tr("L31"), QObject::tr("L32")
}; };
if (index<0) { if (index<0) {
@@ -265,7 +275,7 @@ QString RawSource::toString()
case SOURCE_TYPE_CYC: case SOURCE_TYPE_CYC:
return QObject::tr("CYC%1").arg(index+1); return QObject::tr("CYC%1").arg(index+1);
case SOURCE_TYPE_PPM: case SOURCE_TYPE_PPM:
return QObject::tr("PPM%1").arg(index+1); return QObject::tr("TR%1").arg(index+1);
case SOURCE_TYPE_CH: case SOURCE_TYPE_CH:
if (index < GetEepromInterface()->getCapability(Outputs)) if (index < GetEepromInterface()->getCapability(Outputs))
return QObject::tr("CH%1%2").arg((index+1)/10).arg((index+1)%10); return QObject::tr("CH%1%2").arg((index+1)/10).arg((index+1)%10);
@@ -312,10 +322,10 @@ QString RawSwitch::toString()
}; };
static const QString virtualSwitches[] = { 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("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("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("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("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("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("LSV"), QObject::tr("LSW") QObject::tr("L31"), QObject::tr("L32")
}; };
static const QString multiposPots[] = { static const QString multiposPots[] = {
@@ -451,7 +461,7 @@ QString LogicalSwitchData::funcToString()
case LS_FN_STICKY: case LS_FN_STICKY:
return QObject::tr("Sticky"); return QObject::tr("Sticky");
case LS_FN_STAY: case LS_FN_STAY:
return QObject::tr("Stay"); return QObject::tr("Edge");
default: default:
return QObject::tr("Unknown"); return QObject::tr("Unknown");
} }
@@ -782,115 +792,122 @@ QString FuncSwData::repeatToString()
GeneralSettings::GeneralSettings() GeneralSettings::GeneralSettings()
{ {
memset(this, 0, sizeof(GeneralSettings)); memset(this, 0, sizeof(GeneralSettings));
contrast = 25; contrast = 25;
vBatWarn = 90; 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; calibMid[i] = 0x200;
calibSpanNeg[i] = 0x180; calibSpanNeg[i] = 0x180;
calibSpanPos[i] = 0x180; calibSpanPos[i] = 0x180;
} }
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
potsType[0] = 1;
potsType[1] = 1;
}
templateSetup = g.profile[g.id()].channelOrder(); templateSetup = g.profile[g.id()].channelOrder();
stickMode = g.profile[g.id()].defaultMode(); stickMode = g.profile[g.id()].defaultMode();
QString t_calib=g.profile[g.id()].stickPotCalib(); QString t_calib=g.profile[g.id()].stickPotCalib();
int potsnum=GetEepromInterface()->getCapability(Pots); int potsnum=GetEepromInterface()->getCapability(Pots);
if (t_calib.isEmpty()) { if (t_calib.isEmpty()) {
return; return;
} }
else { else {
QString t_trainercalib=g.profile[g.id()].trainerCalib(); QString t_trainercalib=g.profile[g.id()].trainerCalib();
int8_t t_vBatCalib=(int8_t)g.profile[g.id()].vBatCalib(); 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_currentCalib=(int8_t)g.profile[g.id()].currentCalib();
int8_t t_PPM_Multiplier=(int8_t)g.profile[g.id()].ppmMultiplier(); 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_stickMode=(uint8_t)g.profile[g.id()].gsStickMode();
uint8_t t_vBatWarn=(uint8_t)g.profile[g.id()].vBatWarn(); uint8_t t_vBatWarn=(uint8_t)g.profile[g.id()].vBatWarn();
QString t_DisplaySet=g.profile[g.id()].display(); QString t_DisplaySet=g.profile[g.id()].display();
QString t_BeeperSet=g.profile[g.id()].beeper(); QString t_BeeperSet=g.profile[g.id()].beeper();
QString t_HapticSet=g.profile[g.id()].haptic(); QString t_HapticSet=g.profile[g.id()].haptic();
QString t_SpeakerSet=g.profile[g.id()].speaker(); QString t_SpeakerSet=g.profile[g.id()].speaker();
QString t_CountrySet=g.profile[g.id()].countryCode(); QString t_CountrySet=g.profile[g.id()].countryCode();
if ((t_calib.length()==(NUM_STICKS+potsnum)*12) && (t_trainercalib.length()==16)) { if ((t_calib.length()==(NUM_STICKS+potsnum)*12) && (t_trainercalib.length()==16)) {
QString Byte; QString Byte;
int16_t byte16; int16_t byte16;
bool ok; bool ok;
for (int i=0; i<(NUM_STICKS+potsnum); i++) { for (int i=0; i<(NUM_STICKS+potsnum); i++) {
Byte=t_calib.mid(i*12,4); Byte=t_calib.mid(i*12,4);
byte16=(int16_t)Byte.toInt(&ok,16); byte16=(int16_t)Byte.toInt(&ok,16);
if (ok) if (ok)
calibMid[i]=byte16; calibMid[i]=byte16;
Byte=t_calib.mid(4+i*12,4); Byte=t_calib.mid(4+i*12,4);
byte16=(int16_t)Byte.toInt(&ok,16); byte16=(int16_t)Byte.toInt(&ok,16);
if (ok) if (ok)
calibSpanNeg[i]=byte16; calibSpanNeg[i]=byte16;
Byte=t_calib.mid(8+i*12,4); Byte=t_calib.mid(8+i*12,4);
byte16=(int16_t)Byte.toInt(&ok,16); byte16=(int16_t)Byte.toInt(&ok,16);
if (ok) if (ok)
calibSpanPos[i]=byte16; 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_DisplaySet.length()==6) && (t_BeeperSet.length()==4) && (t_HapticSet.length()==6) && (t_SpeakerSet.length()==6)) { for (int i=0; i<4; i++) {
uint8_t byte8u; Byte=t_trainercalib.mid(i*4,4);
int8_t byte8; byte16=(int16_t)Byte.toInt(&ok,16);
bool ok;
byte8=(int8_t)t_DisplaySet.mid(0,2).toInt(&ok,16);
if (ok) if (ok)
optrexDisplay=(byte8==1 ? true : false); trainer.calib[i]=byte16;
byte8u=(uint8_t)t_DisplaySet.mid(2,2).toUInt(&ok,16); }
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) if (ok)
contrast=byte8u; countryCode=byte8u;
byte8u=(uint8_t)t_DisplaySet.mid(4,2).toUInt(&ok,16); byte8u=(uint8_t)t_CountrySet.mid(2,2).toUInt(&ok,16);
if (ok) if (ok)
backlightBright=byte8u; imperial=byte8u;
byte8=(int8_t)t_BeeperSet.mid(0,2).toUInt(&ok,16); QString chars=t_CountrySet.mid(4,2);
if (ok) ttsLanguage[0]=chars[0].toAscii();
beeperMode=(BeeperMode)byte8; ttsLanguage[1]=chars[1].toAscii();
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();
}
} }
} }
}
} }
RawSource GeneralSettings::getDefaultSource(unsigned int channel) const RawSource GeneralSettings::getDefaultSource(unsigned int channel) const
@@ -899,6 +916,15 @@ RawSource GeneralSettings::getDefaultSource(unsigned int channel) const
return RawSource(SOURCE_TYPE_STICK, stick_index); return RawSource(SOURCE_TYPE_STICK, stick_index);
} }
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() ModelData::ModelData()
{ {
clear(); clear();
+21 -17
View File
@@ -170,6 +170,19 @@ enum HeliSwashTypes {
extern const char * switches9X[]; extern const char * switches9X[];
extern const char * switchesX9D[]; extern const char * switchesX9D[];
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 { enum TelemetrySource {
TELEMETRY_SOURCE_TX_BATT, TELEMETRY_SOURCE_TX_BATT,
TELEMETRY_SOURCE_TIMER1, TELEMETRY_SOURCE_TIMER1,
@@ -217,6 +230,7 @@ enum TelemetrySource {
TELEMETRY_SOURCE_CELL_MIN, TELEMETRY_SOURCE_CELL_MIN,
TELEMETRY_SOURCE_CELLS_MIN, TELEMETRY_SOURCE_CELLS_MIN,
TELEMETRY_SOURCE_VFAS_MIN, TELEMETRY_SOURCE_VFAS_MIN,
TELEMETRY_SOURCE_CURRENT_MAX,
TELEMETRY_SOURCE_POWER_MAX, TELEMETRY_SOURCE_POWER_MAX,
TELEMETRY_SOURCE_ACC, TELEMETRY_SOURCE_ACC,
TELEMETRY_SOURCE_GPS_TIME, TELEMETRY_SOURCE_GPS_TIME,
@@ -579,7 +593,6 @@ class MixData {
MixData() { clear(); } MixData() { clear(); }
unsigned int destCh; // 1..C9X_NUM_CHNOUT unsigned int destCh; // 1..C9X_NUM_CHNOUT
RawSource srcRaw; RawSource srcRaw;
unsigned int srcVariant;
int weight; int weight;
RawSwitch swtch; RawSwitch swtch;
CurveReference curve; //0=symmetrisch CurveReference curve; //0=symmetrisch
@@ -804,7 +817,7 @@ class FrSkyData {
FrSkyChannelData channels[2]; FrSkyChannelData channels[2];
unsigned int usrProto; unsigned int usrProto;
unsigned int imperial; unsigned int imperial;
unsigned int blades; int blades;
unsigned int voltsSource; unsigned int voltsSource;
bool altitudeDisplayed; bool altitudeDisplayed;
unsigned int currentSource; unsigned int currentSource;
@@ -820,7 +833,7 @@ class FrSkyData {
unsigned int storedMah; unsigned int storedMah;
int fasOffset; 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 { class MavlinkData {
@@ -975,7 +988,6 @@ class RadioData {
// TODO rename FlightPhase to FlightMode // TODO rename FlightPhase to FlightMode
enum Capability { enum Capability {
OwnerName,
FlightPhases, FlightPhases,
FlightModesName, FlightModesName,
FlightPhasesHaveFades, FlightPhasesHaveFades,
@@ -1002,7 +1014,6 @@ enum Capability {
ExtraChannels, ExtraChannels,
ExtraInputs, ExtraInputs,
ExtendedTrims, ExtendedTrims,
HasInputFilter,
NumCurves, NumCurves,
NumCurvePoints, NumCurvePoints,
OffsetWeight, OffsetWeight,
@@ -1015,11 +1026,7 @@ enum Capability {
Haptic, Haptic,
HapticLength, HapticLength,
HapticMode, HapticMode,
HasBlInvert,
HasBeeper, HasBeeper,
BandgapMeasure,
PotScrolling,
TrainerSwitch,
ModelTrainerEnable, ModelTrainerEnable,
Timer2ThrTrig, Timer2ThrTrig,
HasExpoNames, HasExpoNames,
@@ -1034,8 +1041,6 @@ enum Capability {
OptrexDisplay, OptrexDisplay,
PPMExtCtrl, PPMExtCtrl,
PPMFrameLength, PPMFrameLength,
gsSwitchMask,
BLonStickMove,
DSM2Indexes, DSM2Indexes,
Telemetry, Telemetry,
TelemetryUnits, TelemetryUnits,
@@ -1050,8 +1055,6 @@ enum Capability {
TelemetryCustomScreens, TelemetryCustomScreens,
TelemetryCustomScreensFieldsPerLine, TelemetryCustomScreensFieldsPerLine,
TelemetryRSSIModel, TelemetryRSSIModel,
TelemetryAlarm,
TelemetryInternalAlarm,
TelemetryTimeshift, TelemetryTimeshift,
TelemetryMaxMultiplier, TelemetryMaxMultiplier,
HasAltitudeSel, HasAltitudeSel,
@@ -1059,9 +1062,6 @@ enum Capability {
HasVarioSink, HasVarioSink,
HasVariants, HasVariants,
HasFailsafe, HasFailsafe,
HasPPMSim,
HasCrossTrims,
HasStickScroll,
HasSoundMixer, HasSoundMixer,
NumModules, NumModules,
PPMCenter, PPMCenter,
@@ -1084,7 +1084,6 @@ enum Capability {
LuaInputs, LuaInputs,
LimitsPer1000, LimitsPer1000,
EnhancedCurves, EnhancedCurves,
TelemetryInternalAlarms,
HasFasOffset, HasFasOffset,
HasMahPersistent, HasMahPersistent,
MultiposPots, MultiposPots,
@@ -1373,6 +1372,11 @@ inline unsigned int GetCurrentFirmwareVariant()
return current_firmware_variant.variant; return current_firmware_variant.variant;
} }
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] : "???") #define CHECK_IN_ARRAY(T, index) ((unsigned int)index < (unsigned int)(sizeof(T)/sizeof(T[0])) ? T[(unsigned int)index] : "???")
#endif #endif
@@ -213,22 +213,14 @@ int Er9xInterface::getCapability(const Capability capability)
return 1; return 1;
case Timer2ThrTrig: case Timer2ThrTrig:
return 1; return 1;
case TrainerSwitch:
return 1;
case OffsetWeight: case OffsetWeight:
return 125; return 125;
case BandgapMeasure:
return 1;
case PotScrolling:
return 1;
case SoundMod: case SoundMod:
return 1; return 1;
case SoundPitch: case SoundPitch:
return 1; return 1;
case Haptic: case Haptic:
return 1; return 1;
case OwnerName:
return 10;
case Timers: case Timers:
return 1; return 1;
case Pots: case Pots:
@@ -251,10 +243,6 @@ int Er9xInterface::getCapability(const Capability capability)
return 0; return 0;
case Simulation: case Simulation:
return 1; return 1;
case gsSwitchMask:
return 1;
case BLonStickMove:
return 1;
case Telemetry: case Telemetry:
return TM_HASTELEMETRY|TM_HASWSHH; return TM_HASTELEMETRY|TM_HASWSHH;
case TelemetryUnits: case TelemetryUnits:
@@ -270,14 +258,9 @@ int Er9xInterface::getCapability(const Capability capability)
case LCDWidth: case LCDWidth:
return 128; return 128;
case VoicesAsNumbers: case VoicesAsNumbers:
case TelemetryInternalAlarm:
case HasPPMSim:
case HasCrossTrims:
case HasStickScroll:
case HasAltitudeSel: case HasAltitudeSel:
case HasContrast: case HasContrast:
case HasVolume: case HasVolume:
case HasBlInvert:
case ModelVoice: case ModelVoice:
case Gvars: case Gvars:
return 7; return 7;
@@ -255,22 +255,12 @@ int Ersky9xInterface::getCapability(const Capability capability)
return 1; return 1;
case Timer2ThrTrig: case Timer2ThrTrig:
return 1; return 1;
case TrainerSwitch:
return 1;
case BandgapMeasure:
return 1;
case PotScrolling:
return 1;
case SoundMod: case SoundMod:
return 1; return 1;
case SoundPitch: case SoundPitch:
return 1; return 1;
case Haptic: case Haptic:
return 1; return 1;
case OwnerName:
return 10;
case HasInputFilter:
return 0;
case ModelVoice: case ModelVoice:
return 1; return 1;
case Timers: case Timers:
@@ -297,10 +287,6 @@ int Ersky9xInterface::getCapability(const Capability capability)
return 0; return 0;
case Simulation: case Simulation:
return 1; return 1;
case gsSwitchMask:
return 1;
case BLonStickMove:
return 1;
case Telemetry: case Telemetry:
return TM_HASTELEMETRY|TM_HASWSHH; return TM_HASTELEMETRY|TM_HASWSHH;
case TelemetryUnits: case TelemetryUnits:
@@ -219,8 +219,6 @@ int Gruvin9xInterface::getSize(GeneralSettings &settings)
int Gruvin9xInterface::getCapability(const Capability capability) int Gruvin9xInterface::getCapability(const Capability capability)
{ {
switch (capability) { switch (capability) {
case OwnerName:
return 0;
case Mixes: case Mixes:
return G9X_MAX_MIXERS; return G9X_MAX_MIXERS;
case FlightPhases: case FlightPhases:
@@ -681,7 +681,7 @@ t_Open9xArmFrSkyData_v210::operator FrSkyData ()
c9x.channels[1] = channels[1]; c9x.channels[1] = channels[1];
c9x.usrProto = usrProto; c9x.usrProto = usrProto;
c9x.voltsSource = voltsSource; c9x.voltsSource = voltsSource;
c9x.blades = blades; c9x.blades = blades+2;
c9x.currentSource=currentSource; c9x.currentSource=currentSource;
c9x.screens[0].type = 1; c9x.screens[0].type = 1;
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
@@ -709,7 +709,7 @@ t_Open9xArmFrSkyData_v211::operator FrSkyData ()
c9x.channels[1] = channels[1]; c9x.channels[1] = channels[1];
c9x.usrProto = usrProto; c9x.usrProto = usrProto;
c9x.voltsSource = voltsSource; c9x.voltsSource = voltsSource;
c9x.blades = blades; c9x.blades = blades+2;
c9x.currentSource=currentSource; c9x.currentSource=currentSource;
c9x.screens[0].type = 1; c9x.screens[0].type = 1;
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
@@ -843,7 +843,7 @@ t_Open9xFrSkyData_v204::operator FrSkyData ()
c9x.channels[1] = channels[1]; c9x.channels[1] = channels[1];
c9x.usrProto = usrProto; c9x.usrProto = usrProto;
c9x.imperial = imperial; c9x.imperial = imperial;
c9x.blades = blades; c9x.blades = blades+2;
c9x.screens[0].type = 1; c9x.screens[0].type = 1;
for (int i=0; i<4; i++) for (int i=0; i<4; i++)
c9x.screens[0].body.bars[i] = bars[i]; c9x.screens[0].body.bars[i] = bars[i];
@@ -857,7 +857,7 @@ t_Open9xFrSkyData_v205::operator FrSkyData ()
c9x.channels[1] = channels[1]; c9x.channels[1] = channels[1];
c9x.usrProto = usrProto; c9x.usrProto = usrProto;
c9x.imperial = imperial; c9x.imperial = imperial;
c9x.blades = blades; c9x.blades = blades+2;
c9x.screens[0].type = 1; c9x.screens[0].type = 1;
for (int i=0; i<4; i++) for (int i=0; i<4; i++)
c9x.screens[0].body.bars[i] = bars[i]; c9x.screens[0].body.bars[i] = bars[i];
@@ -873,7 +873,7 @@ t_Open9xFrSkyData_v208::operator FrSkyData ()
c9x.channels[1] = channels[1]; c9x.channels[1] = channels[1];
c9x.usrProto = usrProto; c9x.usrProto = usrProto;
c9x.voltsSource = voltsSource; c9x.voltsSource = voltsSource;
c9x.blades = blades; c9x.blades = blades+2;
c9x.currentSource=currentSource; c9x.currentSource=currentSource;
c9x.screens[0].type = 1; c9x.screens[0].type = 1;
for (int i=0; i<4; i++) for (int i=0; i<4; i++)
@@ -890,7 +890,7 @@ t_Open9xFrSkyData_v210::operator FrSkyData ()
c9x.channels[1] = channels[1]; c9x.channels[1] = channels[1];
c9x.usrProto = usrProto; c9x.usrProto = usrProto;
c9x.voltsSource = voltsSource; c9x.voltsSource = voltsSource;
c9x.blades = blades; c9x.blades = blades+2;
c9x.currentSource=currentSource; c9x.currentSource=currentSource;
int lines_screen_index = 0; int lines_screen_index = 0;
@@ -74,6 +74,7 @@ namespace Open9xGruvin9x {
#include "radio/src/simpgmspace.cpp" #include "radio/src/simpgmspace.cpp"
#include "radio/src/templates.cpp" #include "radio/src/templates.cpp"
#include "radio/src/translations.cpp" #include "radio/src/translations.cpp"
#include "radio/src/fonts.cpp"
#include "radio/src/audio_avr.cpp" #include "radio/src/audio_avr.cpp"
#include "radio/src/buzzer.cpp" #include "radio/src/buzzer.cpp"
#include "radio/src/targets/gruvin9x/somo14d.cpp" #include "radio/src/targets/gruvin9x/somo14d.cpp"
@@ -73,6 +73,7 @@ namespace Open9xM128 {
#include "radio/src/simpgmspace.cpp" #include "radio/src/simpgmspace.cpp"
#include "radio/src/templates.cpp" #include "radio/src/templates.cpp"
#include "radio/src/translations.cpp" #include "radio/src/translations.cpp"
#include "radio/src/fonts.cpp"
#include "radio/src/audio_avr.cpp" #include "radio/src/audio_avr.cpp"
#include "radio/src/targets/stock/voice.cpp" #include "radio/src/targets/stock/voice.cpp"
#include "radio/src/telemetry/frsky.cpp" #include "radio/src/telemetry/frsky.cpp"
@@ -54,6 +54,7 @@
#define GPS #define GPS
#define FAI_CHOICE #define FAI_CHOICE
#define NUM_POTS 3
#define EEPROM_VARIANT 3 #define EEPROM_VARIANT 3
#undef min #undef min
@@ -90,6 +91,7 @@ namespace Open9xSky9x {
#include "radio/src/simpgmspace.cpp" #include "radio/src/simpgmspace.cpp"
#include "radio/src/templates.cpp" #include "radio/src/templates.cpp"
#include "radio/src/translations.cpp" #include "radio/src/translations.cpp"
#include "radio/src/fonts.cpp"
#include "radio/src/telemetry/frsky.cpp" #include "radio/src/telemetry/frsky.cpp"
#include "radio/src/targets/sky9x/audio_driver.cpp" #include "radio/src/targets/sky9x/audio_driver.cpp"
#include "radio/src/audio_arm.cpp" #include "radio/src/audio_arm.cpp"
@@ -23,7 +23,6 @@
#define PCBTARANIS #define PCBTARANIS
#define CPUARM #define CPUARM
#define HELI #define HELI
#define TEMPLATES
#define SPLASH #define SPLASH
#define FLIGHT_MODES #define FLIGHT_MODES
#define FRSKY #define FRSKY
@@ -54,6 +53,8 @@
#define LUA_MODEL_SCRIPTS #define LUA_MODEL_SCRIPTS
#define EEPROM_VARIANT 3 #define EEPROM_VARIANT 3
#define NUM_POTS 5
#undef min #undef min
#undef max #undef max
@@ -71,7 +72,6 @@ inline int geteepromsize() {
#include "radio/src/protocols/ppm_arm.cpp" #include "radio/src/protocols/ppm_arm.cpp"
#include "radio/src/protocols/pxx_arm.cpp" #include "radio/src/protocols/pxx_arm.cpp"
#include "radio/src/protocols/dsm2_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_common.cpp"
#include "radio/src/eeprom_conversions.cpp" #include "radio/src/eeprom_conversions.cpp"
#include "radio/src/eeprom_rlc.cpp" #include "radio/src/eeprom_rlc.cpp"
@@ -102,8 +102,8 @@ inline int geteepromsize() {
#undef SDCARD #undef SDCARD
#include "radio/src/simpgmspace.cpp" #include "radio/src/simpgmspace.cpp"
#define SDCARD #define SDCARD
#include "radio/src/templates.cpp"
#include "radio/src/translations.cpp" #include "radio/src/translations.cpp"
#include "radio/src/fonts.cpp"
#include "radio/src/telemetry/frsky_sport.cpp" #include "radio/src/telemetry/frsky_sport.cpp"
#include "radio/src/targets/taranis/audio_driver.cpp" #include "radio/src/targets/taranis/audio_driver.cpp"
#include "radio/src/audio_arm.cpp" #include "radio/src/audio_arm.cpp"
@@ -152,9 +152,6 @@ int16_t g_anas[NUM_STICKS+5];
uint16_t anaIn(uint8_t chan) uint16_t anaIn(uint8_t chan)
{ {
if (chan == 8)
return 1800;
else
return g_anas[chan]; return g_anas[chan];
} }
+142 -47
View File
@@ -11,7 +11,7 @@
#define HAS_PERSISTENT_TIMERS(board) (IS_ARM(board) || board == BOARD_GRUVIN9X) #define HAS_PERSISTENT_TIMERS(board) (IS_ARM(board) || board == BOARD_GRUVIN9X)
#define HAS_LARGE_LCD(board) IS_TARANIS(board) #define HAS_LARGE_LCD(board) IS_TARANIS(board)
#define MAX_VIEWS(board) (HAS_LARGE_LCD(board) ? 2 : 256) #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(board) (IS_TARANIS(board) ? 8 : 7)
#define MAX_SWITCHES_POSITION(board) (IS_TARANIS(board) ? 22 : 9) #define MAX_SWITCHES_POSITION(board) (IS_TARANIS(board) ? 22 : 9)
#define MAX_ROTARY_ENCODERS(board) (board==BOARD_GRUVIN9X ? 2 : (board==BOARD_SKY9X ? 1 : 0)) #define MAX_ROTARY_ENCODERS(board) (board==BOARD_GRUVIN9X ? 2 : (board==BOARD_SKY9X ? 1 : 0))
@@ -172,8 +172,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++); addConversion(RawSource(SOURCE_TYPE_STICK, i), val++);
}
for (int i=0; i<MAX_ROTARY_ENCODERS(board); i++) for (int i=0; i<MAX_ROTARY_ENCODERS(board); i++)
addConversion(RawSource(SOURCE_TYPE_ROTARY_ENCODER, 0), val++); addConversion(RawSource(SOURCE_TYPE_ROTARY_ENCODER, 0), val++);
@@ -291,6 +294,32 @@ class SourcesConversionTable: public ConversionTable {
} }
}; };
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> template <int N>
class SwitchField: public ConversionField< SignedField<N> > { class SwitchField: public ConversionField< SignedField<N> > {
public: public:
@@ -384,8 +413,12 @@ class TelemetrySourcesConversionTable: public ConversionTable {
addConversion(1+TELEMETRY_SOURCE_T2_MAX, val++); addConversion(1+TELEMETRY_SOURCE_T2_MAX, val++);
addConversion(1+TELEMETRY_SOURCE_SPEED_MAX, val++); addConversion(1+TELEMETRY_SOURCE_SPEED_MAX, val++);
addConversion(1+TELEMETRY_SOURCE_DIST_MAX, val++); addConversion(1+TELEMETRY_SOURCE_DIST_MAX, val++);
addConversion(1+TELEMETRY_SOURCE_CELL_MIN, val++); if (version >= 216) {
addConversion(1+TELEMETRY_SOURCE_VFAS_MIN, 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++); addConversion(1+TELEMETRY_SOURCE_POWER_MAX, val++);
if (IS_ARM(board) && version >= 216) { if (IS_ARM(board) && version >= 216) {
for (int i=0; i<5; i++) for (int i=0; i<5; i++)
@@ -697,32 +730,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) { if (gvar < -10000) {
_gvar = 512 + gvar + 10000; _gvar = GV1 + gvar + 10000;
} }
else if (gvar > 10000) { else if (gvar > 10000) {
_gvar = 512 + gvar - 10001; _gvar = GV1 + gvar - 10001;
} }
else { else {
_gvar = gvar; _gvar = gvar;
} }
} }
void importGvarParam(int & gvar, const int _gvar) void importGvarParam(int & gvar, const int _gvar, int version)
{ {
if (_gvar >= 512) { int GV1 = (version >= 216 ? 4096 : 512);
gvar = 10001 + _gvar - 512;
if (_gvar >= GV1) {
gvar = 10001 + _gvar - GV1;
} }
else if (_gvar >= 512-5) { else if (_gvar >= GV1-9) {
gvar = -10000 + _gvar - 512; gvar = -10000 + _gvar - GV1;
} }
else if (_gvar < -512) { else if (_gvar < -GV1) {
gvar = -10000 + _gvar + 513; gvar = -10000 + _gvar + GV1 + 1;
} }
else if (_gvar < -512+5) { else if (_gvar < -GV1+9) {
gvar = 10000 + _gvar + 513; gvar = 10000 + _gvar + GV1 + 1;
} }
else { else {
gvar = _gvar; gvar = _gvar;
@@ -744,12 +781,14 @@ class MixField: public TransformedField {
if (IS_TARANIS(board) && version >= 216) { if (IS_TARANIS(board) && version >= 216) {
internalField.Append(new UnsignedField<8>(_destCh)); internalField.Append(new UnsignedField<8>(_destCh));
internalField.Append(new UnsignedField<16>(mix.phases)); 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 SignedField<16>(_weight));
internalField.Append(new SwitchField<8>(mix.swtch, board, version)); internalField.Append(new SwitchField<8>(mix.swtch, board, version));
internalField.Append(new CurveReferenceField(mix.curve, board, version)); internalField.Append(new CurveReferenceField(mix.curve, board, version));
internalField.Append(new UnsignedField<4>(mix.mixWarn)); 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.delayUp));
internalField.Append(new UnsignedField<8>(mix.delayDown)); internalField.Append(new UnsignedField<8>(mix.delayDown));
internalField.Append(new UnsignedField<8>(mix.speedUp)); internalField.Append(new UnsignedField<8>(mix.speedUp));
@@ -759,6 +798,26 @@ class MixField: public TransformedField {
internalField.Append(new ZCharField<8>(mix.name)); internalField.Append(new ZCharField<8>(mix.name));
internalField.Append(new SpareBitsField<8>()); 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)) { else if (IS_ARM(board)) {
internalField.Append(new UnsignedField<8>(_destCh)); internalField.Append(new UnsignedField<8>(_destCh));
internalField.Append(new UnsignedField<16>(mix.phases)); internalField.Append(new UnsignedField<16>(mix.phases));
@@ -775,7 +834,7 @@ class MixField: public TransformedField {
internalField.Append(new SignedField<8>(_curveParam)); internalField.Append(new SignedField<8>(_curveParam));
if (version >= 214) { if (version >= 214) {
internalField.Append(new UnsignedField<4>(mix.mixWarn)); internalField.Append(new UnsignedField<4>(mix.mixWarn));
internalField.Append(new UnsignedField<4>(mix.srcVariant)); internalField.Append(new SpareBitsField<4>());
} }
else { else {
internalField.Append(new UnsignedField<8>(mix.mixWarn)); internalField.Append(new UnsignedField<8>(mix.mixWarn));
@@ -865,9 +924,9 @@ class MixField: public TransformedField {
} }
if (IS_ARM(board)) { if (IS_ARM(board)) {
exportGvarParam(mix.weight, _weight); exportGvarParam(mix.weight, _weight, version);
if (version >= 214) if (version >= 214)
exportGvarParam(mix.sOffset, _offset); exportGvarParam(mix.sOffset, _offset, version);
else else
splitGvarParam(mix.sOffset, _offset, _offsetMode, board, version); splitGvarParam(mix.sOffset, _offset, _offsetMode, board, version);
} }
@@ -879,7 +938,7 @@ class MixField: public TransformedField {
virtual void afterImport() 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.srcRaw.type == SOURCE_TYPE_STICK && mix.srcRaw.index < NUM_STICKS) {
if (!mix.noExpo) { if (!mix.noExpo) {
mix.srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, mix.srcRaw.index, model); mix.srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, mix.srcRaw.index, model);
@@ -900,9 +959,9 @@ class MixField: public TransformedField {
} }
if (IS_ARM(board)) { if (IS_ARM(board)) {
importGvarParam(mix.weight, _weight); importGvarParam(mix.weight, _weight, version);
if (version >= 214) if (version >= 214)
importGvarParam(mix.sOffset, _offset); importGvarParam(mix.sOffset, _offset, version);
else else
concatGvarParam(mix.sOffset, _offset, _offsetMode, board, version); concatGvarParam(mix.sOffset, _offset, _offsetMode, board, version);
} }
@@ -910,6 +969,13 @@ class MixField: public TransformedField {
concatGvarParam(mix.weight, _weight, _weightMode, board, version); concatGvarParam(mix.weight, _weight, _weightMode, board, version);
concatGvarParam(mix.sOffset, _offset, _offsetMode, 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: protected:
@@ -938,17 +1004,28 @@ class InputField: public TransformedField {
{ {
if (IS_TARANIS(board) && version >= 216) { if (IS_TARANIS(board) && version >= 216) {
internalField.Append(new SourceField<8>(expo.srcRaw, board, version, 0)); 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 UnsignedField<8>(expo.chn, "Channel"));
internalField.Append(new SwitchField<8>(expo.swtch, board, version)); internalField.Append(new SwitchField<8>(expo.swtch, board, version));
internalField.Append(new UnsignedField<16>(expo.phases)); internalField.Append(new UnsignedField<16>(expo.phases));
internalField.Append(new SignedField<8>(_weight, "Weight")); 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 ZCharField<8>(expo.name));
internalField.Append(new SignedField<8>(expo.offset, "Offset")); internalField.Append(new SignedField<8>(expo.offset, "Offset"));
internalField.Append(new CurveReferenceField(expo.curve, board, version)); internalField.Append(new CurveReferenceField(expo.curve, board, version));
internalField.Append(new SpareBitsField<8>()); 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)) { else if (IS_ARM(board)) {
internalField.Append(new UnsignedField<8>(expo.mode, "Mode")); internalField.Append(new UnsignedField<8>(expo.mode, "Mode"));
internalField.Append(new UnsignedField<8>(expo.chn, "Channel")); internalField.Append(new UnsignedField<8>(expo.chn, "Channel"));
@@ -1008,9 +1085,11 @@ class InputField: public TransformedField {
virtual void afterImport() virtual void afterImport()
{ {
if (IS_TARANIS(board) && version < 216) { if (IS_TARANIS(board)) {
if (expo.mode) { if (version < 216) {
expo.srcRaw = RawSource(SOURCE_TYPE_STICK, expo.chn); if (expo.mode) {
expo.srcRaw = RawSource(SOURCE_TYPE_STICK, expo.chn);
}
} }
} }
@@ -1041,7 +1120,7 @@ class LimitField: public StructField {
LimitField(LimitData & limit, BoardEnum board, unsigned int version): LimitField(LimitData & limit, BoardEnum board, unsigned int version):
StructField("Limit") 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.min, +1000));
Append(new ConversionField< SignedField<16> >(limit.max, -1000)); Append(new ConversionField< SignedField<16> >(limit.max, -1000));
} }
@@ -1808,7 +1887,7 @@ class AvrCustomFunctionField: public TransformedField {
internalField.Append(new UnsignedField<5>(_union_param)); internalField.Append(new UnsignedField<5>(_union_param));
internalField.Append(new UnsignedField<1>(_active)); 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 SwitchField<8>(fn.swtch, board, version));
internalField.Append(new UnsignedField<3>(_union_param)); 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"))); internalField.Append(new ConversionField< UnsignedField<5> >((unsigned int &)fn.func, &functionsConversionTable, "Function", ::QObject::tr("OpenTX on this board doesn't accept this function")));
@@ -2069,7 +2148,7 @@ class FrskyField: public StructField {
else { else {
Append(new UnsignedField<8>(frsky.voltsSource)); 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<8>(frsky.currentSource));
Append(new UnsignedField<1>(frsky.screens[0].type)); Append(new UnsignedField<1>(frsky.screens[0].type));
@@ -2111,12 +2190,12 @@ class FrskyField: public StructField {
Append(new UnsignedField<1>(frsky.channels[i].alarms[j].greater)); 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.channels[i].multiplier, 0, 3, "Multiplier"));
} }
Append(new UnsignedField<2>(frsky.usrProto)); Append(new UnsignedField<2>(frsky.usrProto, "USR Proto"));
Append(new UnsignedField<2>(frsky.blades)); Append(new ConversionField< UnsignedField<2> >((unsigned int &)frsky.blades, -2));
Append(new UnsignedField<1>(frsky.screens[0].type)); Append(new UnsignedField<1>(frsky.screens[0].type));
Append(new UnsignedField<1>(frsky.screens[1].type)); Append(new UnsignedField<1>(frsky.screens[1].type));
Append(new UnsignedField<2>(frsky.voltsSource)); Append(new UnsignedField<2>(frsky.voltsSource, "Volts Source"));
Append(new SignedField<4>(frsky.varioMin)); Append(new SignedField<4>(frsky.varioMin, "Vario Min"));
Append(new SignedField<4>(frsky.varioMax)); Append(new SignedField<4>(frsky.varioMax));
for (int i=0; i<2; i++) { for (int i=0; i<2; i++) {
Append(new ConversionField< UnsignedField<2> >(frsky.rssiAlarms[i].level, &rssiConversionTable[i], "RSSI level")); Append(new ConversionField< UnsignedField<2> >(frsky.rssiAlarms[i].level, &rssiConversionTable[i], "RSSI level"));
@@ -2165,7 +2244,8 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
board(board), board(board),
version(version), version(version),
variant(variant), variant(variant),
protocolsConversionTable(board) protocolsConversionTable(board),
throttleSourceConversionTable(board, version)
{ {
sprintf(name, "Model %s", modelData.name); sprintf(name, "Model %s", modelData.name);
@@ -2275,7 +2355,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
internalField.Append(new SignedField<8>(modelData.moduleData[0].ppmFrameLength)); 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) { if (!afterrelease21March2013) {
internalField.Append(new UnsignedField<8>(modelData.modelId)); internalField.Append(new UnsignedField<8>(modelData.modelId));
@@ -2425,7 +2505,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
generalData(generalData), generalData(generalData),
board(board), board(board),
version(version), version(version),
inputsCount(4 + MAX_POTS(board, version)) inputsCount(4 + MAX_POTS(board))
{ {
generalData.version = version; generalData.version = version;
generalData.variant = variant; generalData.variant = variant;
@@ -2442,12 +2522,18 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
} }
} }
else { else {
for (int i=0; i<inputsCount; i++) for (int i=0; i<inputsCount; i++) {
internalField.Append(new SignedField<16>(generalData.calibMid[i])); if (!IS_TARANIS(board) || i!=6)
for (int i=0; i<inputsCount; i++) internalField.Append(new SignedField<16>(generalData.calibMid[i]));
internalField.Append(new SignedField<16>(generalData.calibSpanNeg[i])); }
for (int i=0; i<inputsCount; i++) for (int i=0; i<inputsCount; i++) {
internalField.Append(new SignedField<16>(generalData.calibSpanPos[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)); internalField.Append(new UnsignedField<16>(chkSum));
@@ -2549,8 +2635,8 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
} }
if (IS_TARANIS(board) && version >= 216) { if (IS_TARANIS(board) && version >= 216) {
internalField.Append(new UnsignedField<8>(generalData.hw_uartMode)); internalField.Append(new UnsignedField<8>(generalData.hw_uartMode));
for (int i=0; i<8; i++) { for (int i=0; i<4; i++) {
internalField.Append(new UnsignedField<1>(generalData.potsType[i])); internalField.Append(new UnsignedField<2>(potsType[i]));
} }
} }
} }
@@ -2569,6 +2655,11 @@ void OpenTxGeneralData::beforeExport()
sum += generalData.calibSpanPos[i]; sum += generalData.calibSpanPos[i];
if (++count == 12) break; 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 { else {
for (int i=0; i<inputsCount; i++) for (int i=0; i<inputsCount; i++)
@@ -2581,4 +2672,8 @@ void OpenTxGeneralData::beforeExport()
void OpenTxGeneralData::afterImport() void OpenTxGeneralData::afterImport()
{ {
for (int i=0; i<4; i++) {
if (i<2 && generalData.potsType[i] == 0)
generalData.potsType[i] = 1;
}
} }
@@ -65,6 +65,7 @@ class OpenTxGeneralData: public TransformedField {
unsigned int version; unsigned int version;
int inputsCount; int inputsCount;
unsigned int chkSum; unsigned int chkSum;
unsigned int potsType[4];
}; };
class ProtocolsConversionTable: public ConversionTable 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 class ChannelsConversionTable: public ConversionTable
{ {
public: public:
@@ -133,6 +140,7 @@ class OpenTxModelData: public TransformedField {
char name[256]; char name[256];
int subprotocols[C9X_NUM_MODULES+1/*trainer*/]; int subprotocols[C9X_NUM_MODULES+1/*trainer*/];
ProtocolsConversionTable protocolsConversionTable; ProtocolsConversionTable protocolsConversionTable;
ThrottleSourceConversionTable throttleSourceConversionTable;
ChannelsConversionTable channelsConversionTable; ChannelsConversionTable channelsConversionTable;
}; };
@@ -451,8 +451,6 @@ int OpenTxInterface::getSize(GeneralSettings &settings)
int OpenTxInterface::getCapability(const Capability capability) int OpenTxInterface::getCapability(const Capability capability)
{ {
switch (capability) { switch (capability) {
case OwnerName:
return 0;
case ModelImage: case ModelImage:
if (IS_TARANIS(board)) if (IS_TARANIS(board))
return 1; return 1;
@@ -493,6 +491,8 @@ int OpenTxInterface::getCapability(const Capability capability)
case FlightModesName: case FlightModesName:
case GvarsName: case GvarsName:
return (IS_TARANIS(board) ? 10 : 6); return (IS_TARANIS(board) ? 10 : 6);
case HasChNames:
return (IS_TARANIS(board) ? 1 : 0);
case GvarsInCS: case GvarsInCS:
case HasFAIMode: case HasFAIMode:
return 1; return 1;
@@ -594,7 +594,7 @@ int OpenTxInterface::getCapability(const Capability capability)
case MixesWithoutExpo: case MixesWithoutExpo:
return 1; return 1;
case NumCurves: case NumCurves:
return (IS_ARM(board) ? 16 : 8); return (IS_TARANIS(board) ? 32 : (IS_ARM(board) ? 16 : 8));
case HasMixerNames: case HasMixerNames:
return (IS_ARM(board) ? (IS_TARANIS(board) ? 8 : 6) : false); return (IS_ARM(board) ? (IS_TARANIS(board) ? 8 : 6) : false);
case HasExpoNames: case HasExpoNames:
@@ -619,8 +619,6 @@ int OpenTxInterface::getCapability(const Capability capability)
return 1; return 1;
case TelemetryRSSIModel: case TelemetryRSSIModel:
return 1; return 1;
case TelemetryAlarm:
return 0;
case TelemetryTimeshift: case TelemetryTimeshift:
return 1; return 1;
case TelemetryMaxMultiplier: case TelemetryMaxMultiplier:
@@ -676,8 +674,6 @@ int OpenTxInterface::getCapability(const Capability capability)
case LuaInputs: case LuaInputs:
case LimitsPer1000: case LimitsPer1000:
case EnhancedCurves: case EnhancedCurves:
case TelemetryInternalAlarms:
return IS_TARANIS(board);
case HasFasOffset: case HasFasOffset:
return (IS_STOCK(board) ? false : true); return (IS_STOCK(board) ? false : true);
case HasMahPersistent: case HasMahPersistent:
@@ -53,6 +53,8 @@
#define EEPROM_VARIANT SIMU_STOCK_VARIANTS #define EEPROM_VARIANT SIMU_STOCK_VARIANTS
#define GAUGES #define GAUGES
#define NUM_POTS 3
#undef min #undef min
#undef max #undef max
@@ -78,6 +80,7 @@ namespace Open9x {
#include "radio/src/telemetry/frsky.cpp" #include "radio/src/telemetry/frsky.cpp"
#include "radio/src/templates.cpp" #include "radio/src/templates.cpp"
#include "radio/src/translations.cpp" #include "radio/src/translations.cpp"
#include "radio/src/fonts.cpp"
#include "radio/src/targets/stock/voice.cpp" #include "radio/src/targets/stock/voice.cpp"
#include "radio/src/buzzer.cpp" #include "radio/src/buzzer.cpp"
#include "radio/src/translations/tts_en.cpp" #include "radio/src/translations/tts_en.cpp"
@@ -145,8 +145,6 @@ int Th9xInterface::getCapability(const Capability capability)
switch (capability) { switch (capability) {
case Mixes: case Mixes:
return TH9X_MAX_MIXERS; return TH9X_MAX_MIXERS;
case OwnerName:
return 0;
case Timers: case Timers:
return 1; return 1;
case Pots: case Pots:
@@ -168,8 +166,6 @@ int Th9xInterface::getCapability(const Capability capability)
case Simulation: case Simulation:
return 1; return 1;
case HasContrast: case HasContrast:
case HasInputFilter:
return 1;
case CSFunc: case CSFunc:
return 13; return 13;
case SlowScale: case SlowScale:
+43 -157
View File
@@ -13,6 +13,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
* *
*/ */
#include <QtGui> #include <QtGui>
#include "hexinterface.h" #include "hexinterface.h"
#include "splash.h" #include "splash.h"
@@ -20,192 +21,77 @@
int getFileType(const QString &fullFileName) int getFileType(const QString &fullFileName)
{ {
if(QFileInfo(fullFileName).suffix().toUpper()=="HEX") return FILE_TYPE_HEX; QString suffix = QFileInfo(fullFileName).suffix().toUpper();
if(QFileInfo(fullFileName).suffix().toUpper()=="BIN") return FILE_TYPE_BIN; if (suffix == "HEX")
if(QFileInfo(fullFileName).suffix().toUpper()=="EEPM") return FILE_TYPE_EEPM; return FILE_TYPE_HEX;
if(QFileInfo(fullFileName).suffix().toUpper()=="EEPE") return FILE_TYPE_EEPE; else if (suffix == "BIN")
if(QFileInfo(fullFileName).suffix().toUpper()=="XML") return FILE_TYPE_XML; return FILE_TYPE_BIN;
return 0; 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),
isValidFlag(false)
{ {
char * temp = (char *)malloc(MAX_FSIZE);
date = "";
time = "";
svn = "";
build = "";
isValidFlag = true;
QFile file(fileName); QFile file(fileName);
flash_size=0; if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { //reading HEX TEXT file
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //reading HEX TEXT file
isValidFlag = false;
}
else {
QTextStream inputStream(&file); QTextStream inputStream(&file);
flash_size = HexInterface(inputStream).load((uint8_t *)temp, MAX_FSIZE); flash_size = HexInterface(inputStream).load((uint8_t *)flash.data(), MAX_FSIZE);
file.close(); file.close();
inputStream.reset();
if (flash_size == 0) { if (flash_size == 0) {
QFile file(fileName);
file.open(QIODevice::ReadOnly); file.open(QIODevice::ReadOnly);
char * bin_flash = (char *)malloc(MAX_FSIZE); flash_size = file.read((char *)flash.data(), 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) { if (flash_size > 0) {
SeekSvn(); svn = seekLabel(SVN_MARK);
SeekDate(); version = seekLabel(VERS_MARK);
SeekTime(); date = seekLabel(DATE_MARK);
SeekBuild(); time = seekLabel(TIME_MARK);
eeprom = seekLabel(EEPR_MARK);
SeekSplash(); SeekSplash();
} isValidFlag = true;
else {
isValidFlag = false;
} }
} }
free(temp);
} }
QString FlashInterface::getDate(void) QString FlashInterface::seekString(const QString & string)
{ {
return date; QString result = "";
}
QString FlashInterface::getTime(void) int start = flash.indexOf(string);
{
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) { if (start > 0) {
start += QString(SVN_MARK).length(); start += string.length();
for (i = start; i < (start + 20); i++) { int end = -1;
if (flash.at(i) == 0) { for (int i=start; i<start+20; i++) {
char c = flash.at(i);
if (c == '\0' || c == '\036') {
end = i; end = i;
break; break;
} }
} }
if (end > 0) { if (end > 0) {
svn = QString(flash.mid(start, (end - start))).trimmed(); result = flash.mid(start, (end - start)).trimmed();
}
else {
svn = QString("");
} }
} }
return result;
} }
void FlashInterface::SeekDate(void) QString FlashInterface::seekLabel(const QString & label)
{ {
int i, start = -1, end = -1, startsvn=0; QString result = seekString(label + "\037\033:");
startsvn = flash.indexOf(QString(SVN_MARK)); if (!result.isEmpty())
if (startsvn>0) { return result;
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) return seekString(label + ":");
{
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();
}
else {
build = QString("");
}
}
}
} }
void FlashInterface::SeekSplash(void) void FlashInterface::SeekSplash(void)
+46 -47
View File
@@ -14,6 +14,7 @@
#ifndef FLASHINTERFACE_H #ifndef FLASHINTERFACE_H
#define FLASHINTERFACE_H #define FLASHINTERFACE_H
#include <QDialog> #include <QDialog>
#include <QtGui> #include <QtGui>
#include <inttypes.h> #include <inttypes.h>
@@ -32,12 +33,12 @@
#define ERSKY9X_SPS "SPS" #define ERSKY9X_SPS "SPS"
#define ERSKY9X_SPE "SPE" #define ERSKY9X_SPE "SPE"
#define ERSKY9X_OFFSET (7) #define ERSKY9X_OFFSET (7)
#define VERS_MARK "VERS:" #define VERS_MARK "VERS"
#define SVN_MARK "SVN:" #define SVN_MARK "SVN"
#define DATE_MARK "DATE:" #define DATE_MARK "DATE"
#define TIME_MARK "TIME:" #define TIME_MARK "TIME"
#define BLD_MARK "BLD:" #define BLD_MARK "BLD"
#define VAR_MARK "EEPR:" #define EEPR_MARK "EEPR"
#define FILE_TYPE_BIN 1 #define FILE_TYPE_BIN 1
#define FILE_TYPE_HEX 2 #define FILE_TYPE_HEX 2
@@ -49,48 +50,46 @@ int getFileType(const QString &fullFileName);
class FlashInterface class FlashInterface
{ {
public: public:
FlashInterface(QString filename); FlashInterface(QString filename);
QString getDate(); inline QString getDate() { return date; }
QString getTime(); inline QString getTime() { return time; }
QString getSvn(); inline QString getSvn() { return svn; }
int getSize(); int getSize() { return flash_size; }
QString getBuild(); inline QString getVersion() { return version; }
QImage getSplash(); inline QString getEEprom() { return eeprom; }
bool setSplash(const QImage & newsplash); QImage getSplash();
bool hasSplash(); bool setSplash(const QImage & newsplash);
int getSplashWidth(); bool hasSplash();
uint getSplashHeight(); int getSplashWidth();
uint getSplashColors(); uint getSplashHeight();
QImage::Format getSplashFormat(); uint getSplashColors();
uint saveFlash(QString fileName); QImage::Format getSplashFormat();
bool isValid(); uint saveFlash(QString fileName);
bool isValid();
private: private:
QByteArray flash; QByteArray flash;
void SeekVer(); QString seekString(const QString & string);
void SeekSvn(); QString seekLabel(const QString & label);
void SeekDate(); void SeekSplash();
void SeekTime(); QString filename;
void SeekBuild(); QString date;
void SeekSplash(); QString time;
QString filename; QString svn;
QString date; QString version;
QString time; QString eeprom;
QString svn; QByteArray splash;
QString build; uint splash_offset;
QByteArray splash; uint splash_type;
uint splash_offset; uint splash_size;
uint splash_type; uint splash_width;
uint splash_size; uint splash_height;
uint splash_width; uint splash_colors;
uint splash_height; QImage::Format splash_format;
uint splash_colors; uint flash_size;
QImage::Format splash_format; bool isValidFlag;
uint flash_size;
protected:
bool isValidFlag;
}; };
#endif /* FLASHINTERFACE_H */ #endif /* FLASHINTERFACE_H */
+65 -374
View File
@@ -2,6 +2,7 @@
#include "ui_generaledit.h" #include "ui_generaledit.h"
#include "helpers.h" #include "helpers.h"
#include "appdata.h" #include "appdata.h"
#include <QDateTime>
#include <QtGui> #include <QtGui>
#define BIT_WARN_THR ( 0x01 ) #define BIT_WARN_THR ( 0x01 )
@@ -79,8 +80,6 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
} }
} }
QRegExp rx(CHAR_FOR_NAMES_REGEX);
ui->ownerNameLE->setValidator(new QRegExpValidator(rx, this));
switchDefPosEditLock=true; switchDefPosEditLock=true;
populateBacklightCB(ui->backlightswCB, g_eeGeneral.backlightMode); populateBacklightCB(ui->backlightswCB, g_eeGeneral.backlightMode);
bool voice = current_firmware_variant.id.contains("voice"); bool voice = current_firmware_variant.id.contains("voice");
@@ -116,18 +115,21 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->bgVolume_label->hide(); ui->bgVolume_label->hide();
ui->wavVolume_SL->hide(); ui->wavVolume_SL->hide();
ui->wavVolume_label->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 { } else {
ui->beepVolume_SL->setValue(g_eeGeneral.beepVolume); ui->beepVolume_SL->setValue(g_eeGeneral.beepVolume);
ui->varioVolume_SL->setValue(g_eeGeneral.varioVolume); ui->varioVolume_SL->setValue(g_eeGeneral.varioVolume);
ui->bgVolume_SL->setValue(g_eeGeneral.backgroundVolume); ui->bgVolume_SL->setValue(g_eeGeneral.backgroundVolume);
ui->wavVolume_SL->setValue(g_eeGeneral.wavVolume); ui->wavVolume_SL->setValue(g_eeGeneral.wavVolume);
} ui->varioP0_SB->setValue(700+(g_eeGeneral.varioPitch*10));
updateVarioPitchRange();
if (!GetEepromInterface()->getCapability(HasBlInvert)) { ui->varioPMax_SB->setValue(700+(g_eeGeneral.varioPitch*10)+1000+(g_eeGeneral.varioRange*10));
ui->blinvert_cb->hide(); ui->varioR0_SB->setValue(500+(g_eeGeneral.varioRepeat*10));
ui->blinvert_label->hide();
} else {
ui->blinvert_cb->setChecked(g_eeGeneral.blightinv);
} }
if (!GetEepromInterface()->getCapability(HasFAIMode)) { if (!GetEepromInterface()->getCapability(HasFAIMode)) {
ui->faimode_CB->hide(); ui->faimode_CB->hide();
@@ -136,35 +138,6 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
else { else {
ui->faimode_CB->setChecked(g_eeGeneral.fai); 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 (!GetEepromInterface()->getCapability( HasPxxCountry)) {
ui->countrycode_label->hide(); ui->countrycode_label->hide();
ui->countrycode_CB->hide(); ui->countrycode_CB->hide();
@@ -212,9 +185,6 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->label_CurrentCalib->hide(); ui->label_CurrentCalib->hide();
} }
if (GetEepromInterface()->getCapability(TelemetryRSSIModel) ) {
ui->tabWidget->removeTab(2);
}
ui->tabWidget->setCurrentIndex(0); ui->tabWidget->setCurrentIndex(0);
if (!GetEepromInterface()->getCapability(SoundMod)) { if (!GetEepromInterface()->getCapability(SoundMod)) {
@@ -235,80 +205,12 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->label_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)) { if (!GetEepromInterface()->getCapability(HapticMode)) {
ui->hapticmodeCB->setDisabled(true); ui->hapticmodeCB->setDisabled(true);
ui->hapticmodeCB->hide(); ui->hapticmodeCB->hide();
ui->label_hapticmode->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=GetEepromInterface()->getCapability(RotaryEncoders);
if (renumber==0) { if (renumber==0) {
ui->re_label->hide(); ui->re_label->hide();
@@ -316,28 +218,15 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
} else { } else {
populateRotEncCB(ui->re_CB, g_eeGeneral.reNavigation, renumber); 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->contrastSB->setValue(g_eeGeneral.contrast);
ui->battwarningDSB->setValue((double)g_eeGeneral.vBatWarn/10); ui->battwarningDSB->setValue((double)g_eeGeneral.vBatWarn/10);
ui->backlightautoSB->setValue(g_eeGeneral.backlightDelay*5); ui->backlightautoSB->setValue(g_eeGeneral.backlightDelay*5);
ui->inactimerSB->setValue(g_eeGeneral.inactivityTimer); 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->memwarnChkB->setChecked(!g_eeGeneral.disableMemoryWarning); //Default is zero=checked
ui->alarmwarnChkB->setChecked(!g_eeGeneral.disableAlarmWarning);//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->splashScreenChkB->setChecked(!g_eeGeneral.splashMode);
ui->hideNameOnSplashChkB->setChecked(!g_eeGeneral.hideNameOnSplash);
ui->trnMode_1->setCurrentIndex(g_eeGeneral.trainer.mix[0].mode); ui->trnMode_1->setCurrentIndex(g_eeGeneral.trainer.mix[0].mode);
ui->trnChn_1->setCurrentIndex(g_eeGeneral.trainer.mix[0].src); ui->trnChn_1->setCurrentIndex(g_eeGeneral.trainer.mix[0].src);
@@ -368,6 +257,7 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
if (GetEepromInterface()->getCapability(MultiposPots)) { if (GetEepromInterface()->getCapability(MultiposPots)) {
ui->pot1Type->setCurrentIndex(g_eeGeneral.potsType[0]); ui->pot1Type->setCurrentIndex(g_eeGeneral.potsType[0]);
ui->pot2Type->setCurrentIndex(g_eeGeneral.potsType[1]); ui->pot2Type->setCurrentIndex(g_eeGeneral.potsType[1]);
ui->pot3Type->setCurrentIndex(g_eeGeneral.potsType[2]);
} }
else { else {
ui->potsTypeSeparator->hide(); ui->potsTypeSeparator->hide();
@@ -375,6 +265,16 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->pot1TypeLabel->hide(); ui->pot1TypeLabel->hide();
ui->pot2Type->hide(); ui->pot2Type->hide();
ui->pot2TypeLabel->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();
} }
} }
@@ -395,6 +295,18 @@ void GeneralEdit::on_pot2Type_currentIndexChanged(int index)
updateSettings(); 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() void GeneralEdit::unlockSwitchEdited()
{ {
int i=0; int i=0;
@@ -428,9 +340,8 @@ void GeneralEdit::setValues()
ui->speakerPitchSB->setValue(g_eeGeneral.speakerPitch); ui->speakerPitchSB->setValue(g_eeGeneral.speakerPitch);
ui->hapticStrengthSB->setValue(g_eeGeneral.hapticStrength); ui->hapticStrengthSB->setValue(g_eeGeneral.hapticStrength);
ui->hapticmodeCB->setCurrentIndex(g_eeGeneral.hapticMode+2); 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->CurrentCalib_SB->setValue((double)g_eeGeneral.currentCalib);
ui->battCalib->setValue((double)g_eeGeneral.vBatCalib/10);
ui->ana1Neg->setValue(g_eeGeneral.calibSpanNeg[0]); ui->ana1Neg->setValue(g_eeGeneral.calibSpanNeg[0]);
ui->ana2Neg->setValue(g_eeGeneral.calibSpanNeg[1]); ui->ana2Neg->setValue(g_eeGeneral.calibSpanNeg[1]);
@@ -466,27 +377,6 @@ void GeneralEdit::setValues()
ui->PPM_MultiplierDSB->setValue((qreal)(g_eeGeneral.PPM_Multiplier+10)/10); 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() void GeneralEdit::updateSettings()
{ {
radioData.generalSettings = g_eeGeneral; radioData.generalSettings = g_eeGeneral;
@@ -505,10 +395,9 @@ void GeneralEdit::on_battwarningDSB_editingFinished()
updateSettings(); updateSettings();
} }
void GeneralEdit::on_battcalibDSB_editingFinished() void GeneralEdit::on_battCalibDSB_editingFinished()
{ {
g_eeGeneral.vBatCalib = ui->battcalibDSB->value()*10; g_eeGeneral.vBatCalib = ui->battCalibDSB->value()*10;
ui->battCalib->setValue(ui->battcalibDSB->value());
updateSettings(); updateSettings();
} }
@@ -596,29 +485,12 @@ void GeneralEdit::on_timezoneSB_editingFinished()
updateSettings(); 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() void GeneralEdit::on_inactimerSB_editingFinished()
{ {
g_eeGeneral.inactivityTimer = ui->inactimerSB->value(); g_eeGeneral.inactivityTimer = ui->inactimerSB->value();
updateSettings(); updateSettings();
} }
void GeneralEdit::on_inputfilterCB_currentIndexChanged(int index)
{
g_eeGeneral.filterInput = index;
updateSettings();
}
void GeneralEdit::on_memwarnChkB_stateChanged(int ) void GeneralEdit::on_memwarnChkB_stateChanged(int )
{ {
g_eeGeneral.disableMemoryWarning = ui->memwarnChkB->isChecked() ? 0 : 1; g_eeGeneral.disableMemoryWarning = ui->memwarnChkB->isChecked() ? 0 : 1;
@@ -631,12 +503,6 @@ void GeneralEdit::on_alarmwarnChkB_stateChanged(int )
updateSettings(); updateSettings();
} }
void GeneralEdit::on_enableTelemetryAlarmChkB_stateChanged(int )
{
g_eeGeneral.enableTelemetryAlarm = ui->enableTelemetryAlarmChkB->isChecked();
updateSettings();
}
void GeneralEdit::on_beeperCB_currentIndexChanged(int index) void GeneralEdit::on_beeperCB_currentIndexChanged(int index)
{ {
g_eeGeneral.beeperMode = (BeeperMode)(index-2); g_eeGeneral.beeperMode = (BeeperMode)(index-2);
@@ -885,13 +751,6 @@ void GeneralEdit::on_ana8Pos_editingFinished()
updateSettings(); 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() void GeneralEdit::on_volume_SB_editingFinished()
{ {
g_eeGeneral.speakerVolume = ui->volume_SB->value(); g_eeGeneral.speakerVolume = ui->volume_SB->value();
@@ -934,6 +793,31 @@ void GeneralEdit::on_bgVolume_SL_valueChanged()
updateSettings(); 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() void GeneralEdit::on_PPM1_editingFinished()
{ {
g_eeGeneral.trainer.calib[0] = ui->PPM1->value(); g_eeGeneral.trainer.calib[0] = ui->PPM1->value();
@@ -963,49 +847,18 @@ void GeneralEdit::on_tabWidget_currentChanged(int index)
g.generalEditTab(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 ) void GeneralEdit::on_splashScreenChkB_stateChanged(int )
{ {
g_eeGeneral.splashMode = ui->splashScreenChkB->isChecked() ? 0 : 1; g_eeGeneral.splashMode = ui->splashScreenChkB->isChecked() ? 0 : 1;
updateSettings(); updateSettings();
} }
void GeneralEdit::on_hideNameOnSplashChkB_stateChanged(int )
{
g_eeGeneral.hideNameOnSplash = ui->hideNameOnSplashChkB->isChecked() ? 0 : 1;
updateSettings();
}
void GeneralEdit::on_PPM_MultiplierDSB_editingFinished() void GeneralEdit::on_PPM_MultiplierDSB_editingFinished()
{ {
g_eeGeneral.PPM_Multiplier = (int)(ui->PPM_MultiplierDSB->value()*10)-10; g_eeGeneral.PPM_Multiplier = (int)(ui->PPM_MultiplierDSB->value()*10)-10;
updateSettings(); updateSettings();
} }
void GeneralEdit::on_ownerNameLE_editingFinished()
{
strncpy(g_eeGeneral.ownerName, ui->ownerNameLE->text().toAscii(), 10);
updateSettings();
}
void GeneralEdit::on_speakerPitchSB_editingFinished() void GeneralEdit::on_speakerPitchSB_editingFinished()
{ {
g_eeGeneral.speakerPitch = ui->speakerPitchSB->value(); g_eeGeneral.speakerPitch = ui->speakerPitchSB->value();
@@ -1024,18 +877,6 @@ void GeneralEdit::on_soundModeCB_currentIndexChanged(int index)
updateSettings(); 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 ) void GeneralEdit::on_faimode_CB_stateChanged(int )
{ {
if (ui->faimode_CB->isChecked()) { if (ui->faimode_CB->isChecked()) {
@@ -1053,159 +894,6 @@ void GeneralEdit::on_faimode_CB_stateChanged(int )
updateSettings(); 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() void GeneralEdit::on_calretrieve_PB_clicked()
{ {
int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt(); int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt();
@@ -1356,6 +1044,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].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].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)); 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.")); QMessageBox::information(this, "Companion", tr("Calibration and HW parameters saved."));
} }
} }
+8 -30
View File
@@ -27,20 +27,13 @@ private:
bool mavbaudEditLock; bool mavbaudEditLock;
void getGeneralSwitchDefPos(int i, bool val); void getGeneralSwitchDefPos(int i, bool val);
void setSwitchDefPos(); void setSwitchDefPos();
void updateVarioPitchRange();
signals: signals:
void modelValuesChanged(); void modelValuesChanged();
private slots: 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_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_speakerPitchSB_editingFinished();
void on_timezoneSB_editingFinished(); void on_timezoneSB_editingFinished();
void on_hapticStrengthSB_editingFinished(); void on_hapticStrengthSB_editingFinished();
@@ -51,11 +44,7 @@ private slots:
void on_hapticLengthCB_currentIndexChanged(int index); void on_hapticLengthCB_currentIndexChanged(int index);
void on_PPM_MultiplierDSB_editingFinished(); void on_PPM_MultiplierDSB_editingFinished();
void on_splashScreenChkB_stateChanged(int ); void on_splashScreenChkB_stateChanged(int );
void on_hideNameOnSplashChkB_stateChanged(int);
void on_beepCountDownChkB_stateChanged(int );
void on_beepMinuteChkB_stateChanged(int );
void on_alarmwarnChkB_stateChanged(int ); void on_alarmwarnChkB_stateChanged(int );
void on_enableTelemetryAlarmChkB_stateChanged(int );
void on_gpsFormatCB_currentIndexChanged(int index); void on_gpsFormatCB_currentIndexChanged(int index);
void on_tabWidget_currentChanged(int index); void on_tabWidget_currentChanged(int index);
void on_displayTypeCB_currentIndexChanged(int index); void on_displayTypeCB_currentIndexChanged(int index);
@@ -65,22 +54,17 @@ private slots:
void on_units_CB_currentIndexChanged(int index); void on_units_CB_currentIndexChanged(int index);
void on_trnMode_1_currentIndexChanged(int index); void on_trnMode_1_currentIndexChanged(int index);
void on_trnChn_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_trnWeight_1_editingFinished();
void on_trnMode_2_currentIndexChanged(int index); void on_trnMode_2_currentIndexChanged(int index);
void on_trnChn_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_trnWeight_2_editingFinished();
void on_trnMode_3_currentIndexChanged(int index); void on_trnMode_3_currentIndexChanged(int index);
void on_trnChn_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_trnWeight_3_editingFinished();
void on_trnMode_4_currentIndexChanged(int index); void on_trnMode_4_currentIndexChanged(int index);
void on_swtchCB_4_currentIndexChanged(int index);
void on_trnChn_4_currentIndexChanged(int index); void on_trnChn_4_currentIndexChanged(int index);
void on_trnWeight_4_editingFinished(); void on_trnWeight_4_editingFinished();
void on_battCalib_editingFinished();
void on_CurrentCalib_SB_editingFinished(); void on_CurrentCalib_SB_editingFinished();
void on_ana1Neg_editingFinished(); void on_ana1Neg_editingFinished();
@@ -119,33 +103,27 @@ private slots:
void on_varioVolume_SL_valueChanged(); void on_varioVolume_SL_valueChanged();
void on_wavVolume_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_pot1Type_currentIndexChanged(int index);
void on_pot2Type_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_stickmodeCB_currentIndexChanged(int index);
void on_channelorderCB_currentIndexChanged(int index); void on_channelorderCB_currentIndexChanged(int index);
void on_beeperCB_currentIndexChanged(int index); void on_beeperCB_currentIndexChanged(int index);
void on_memwarnChkB_stateChanged(int ); void on_memwarnChkB_stateChanged(int );
void on_telalarmsChkB_stateChanged(int );
void on_inputfilterCB_currentIndexChanged(int index);
void on_inactimerSB_editingFinished(); void on_inactimerSB_editingFinished();
void on_backlightautoSB_editingFinished(); void on_backlightautoSB_editingFinished();
void on_backlightswCB_currentIndexChanged(int index); void on_backlightswCB_currentIndexChanged(int index);
void on_mavbaud_CB_currentIndexChanged(int index); void on_mavbaud_CB_currentIndexChanged(int index);
void on_voiceLang_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_battwarningDSB_editingFinished();
void on_contrastSB_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_calretrieve_PB_clicked();
void on_calstore_PB_clicked(); void on_calstore_PB_clicked();
void unlockSwitchEdited(); void unlockSwitchEdited();
+894 -1345
View File
File diff suppressed because it is too large Load Diff
+36 -60
View File
@@ -4,6 +4,41 @@
#include "simulatordialog.h" #include "simulatordialog.h"
#include "flashinterface.h" #include "flashinterface.h"
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, char * phasename) QString getPhaseName(int val, char * phasename)
{ {
if (!val) return "---"; if (!val) return "---";
@@ -63,27 +98,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) 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")}; 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 +109,6 @@ void populateRotEncCB(QComboBox *b, int value, int renumber)
b->setCurrentIndex(value); 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) QString getProtocolStr(const int proto)
{ {
static const char *strings[] = { "OFF", static const char *strings[] = { "OFF",
@@ -292,7 +281,7 @@ void CurveGroup::update()
if (lastType != curve.type) { if (lastType != curve.type) {
lastType = curve.type; lastType = curve.type;
curveValueCB->clear(); 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()); curveValueCB->addItem(CurveReference(CurveReference::CURVE_REF_CUSTOM, i).toString());
} }
} }
@@ -761,19 +750,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) QString getFrSkyUnits(int units)
{ {
switch(units) { switch(units) {
+2 -3
View File
@@ -4,6 +4,8 @@
#include <QtGui> #include <QtGui>
#include "eeprominterface.h" #include "eeprominterface.h"
extern const QColor colors[C9X_MAX_CURVES];
#define TMR_NUM_OPTION (TMR_VAROFS+2*9+2*GetEepromInterface()->getCapability(LogicalSwitches)-1) #define TMR_NUM_OPTION (TMR_VAROFS+2*9+2*GetEepromInterface()->getCapability(LogicalSwitches)-1)
//convert from mode 1 to mode generalSettings.stickMode //convert from mode 1 to mode generalSettings.stickMode
@@ -27,7 +29,6 @@
void populateGvSourceCB(QComboBox *b, int value); void populateGvSourceCB(QComboBox *b, int value);
void populateVoiceLangCB(QComboBox *b, QString language); void populateVoiceLangCB(QComboBox *b, QString language);
void populateTTraceCB(QComboBox *b, int value);
void populateRotEncCB(QComboBox *b, int value, int renumber); void populateRotEncCB(QComboBox *b, int value, int renumber);
void populateBacklightCB(QComboBox *b, const uint8_t value); void populateBacklightCB(QComboBox *b, const uint8_t value);
@@ -88,7 +89,6 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr=
void populatePhasesCB(QComboBox *b, int value); void populatePhasesCB(QComboBox *b, int value);
void populateGvarUseCB(QComboBox *b, unsigned int phase); void populateGvarUseCB(QComboBox *b, unsigned int phase);
void populateCustomScreenFieldCB(QComboBox *b, unsigned int value, bool last, int hubproto);
QString getProtocolStr(const int proto); QString getProtocolStr(const int proto);
QString getPhasesStr(unsigned int phases, ModelData & model); QString getPhasesStr(unsigned int phases, ModelData & model);
@@ -120,7 +120,6 @@ QString getCenterBeep(ModelData * g_model);
/* FrSky helpers */ /* FrSky helpers */
QString getFrSkyAlarmType(int alarm); QString getFrSkyAlarmType(int alarm);
QString getFrSkyBlades(int blades);
QString getFrSkyUnits(int units); QString getFrSkyUnits(int units);
QString getFrSkyProtocol(int protocol); QString getFrSkyProtocol(int protocol);
QString getFrSkyMeasure(int units); QString getFrSkyMeasure(int units);
Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

+25 -16
View File
@@ -63,6 +63,7 @@
#include "warnings.h" #include "warnings.h"
#include "helpers.h" #include "helpers.h"
#include "appdata.h" #include "appdata.h"
#include "taranisnotfound.h"
#include "firmwares/opentx/opentxinterface.h" // TODO get rid of this include #include "firmwares/opentx/opentxinterface.h" // TODO get rid of this include
#define DONATE_STR "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QUZ48K4SEXDP2" #define DONATE_STR "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QUZ48K4SEXDP2"
@@ -222,7 +223,7 @@ void MainWindow::checkForUpdates(bool ignoreSettings, QString & fwId)
if(ignoreSettings) { if(ignoreSettings) {
downloadDialog_forWait = new downloadDialog(this, tr("Checking for updates")); downloadDialog_forWait = new downloadDialog(this, tr("Checking for updates"));
downloadDialog_forWait->show(); downloadDialog_forWait->exec();
} else { } else {
downloadDialog_forWait = NULL; // TODO needed? downloadDialog_forWait = NULL; // TODO needed?
} }
@@ -272,7 +273,7 @@ void MainWindow::checkForUpdateFinished(QNetworkReply * reply)
downloadDialog * dd = new downloadDialog(this, QString(OPENTX_COMPANION_DOWNLOADS C9X_INSTALLER).arg(version), fileName); downloadDialog * dd = new downloadDialog(this, QString(OPENTX_COMPANION_DOWNLOADS C9X_INSTALLER).arg(version), fileName);
installer_fileName = fileName; installer_fileName = fileName;
connect(dd, SIGNAL(accepted()), this, SLOT(updateDownloaded())); connect(dd, SIGNAL(accepted()), this, SLOT(updateDownloaded()));
dd->show(); dd->exec();
} }
} }
#else #else
@@ -1024,7 +1025,8 @@ void MainWindow::readEeprom()
if (IS_TARANIS(eepromInterface->getBoard())) { if (IS_TARANIS(eepromInterface->getBoard())) {
QString path=FindTaranisPath(); QString path=FindTaranisPath();
if (path.isEmpty()) { if (path.isEmpty()) {
QMessageBox::warning(this, tr("Taranis radio not found"), tr("Impossible to identify the radio on your system, please verify the eeprom disk is connected.")); taranisNotFoundDialog *tnfd = new taranisNotFoundDialog(this);
tnfd->exec();
res=false; res=false;
} else { } else {
QStringList str; QStringList str;
@@ -1080,7 +1082,8 @@ void MainWindow::writeFileToEeprom()
if (IS_TARANIS(eepromInterface->getBoard())) { if (IS_TARANIS(eepromInterface->getBoard())) {
QString path=FindTaranisPath(); QString path=FindTaranisPath();
if (path.isEmpty()) { if (path.isEmpty()) {
QMessageBox::warning(this, tr("Taranis radio not found"), tr("Impossible to identify the radio on your system, please verify the eeprom disk is connected.")); taranisNotFoundDialog *tnfd = new taranisNotFoundDialog(this);
tnfd->exec();
return; return;
} else { } else {
QStringList str; QStringList str;
@@ -1131,7 +1134,8 @@ void MainWindow::writeFileToEeprom()
if (IS_TARANIS(eepromInterface->getBoard())) { if (IS_TARANIS(eepromInterface->getBoard())) {
QString path=FindTaranisPath(); QString path=FindTaranisPath();
if (path.isEmpty()) { if (path.isEmpty()) {
QMessageBox::warning(this, tr("Taranis radio not found"), tr("Impossible to identify the radio on your system, please verify the eeprom disk is connected.")); taranisNotFoundDialog *tnfd = new taranisNotFoundDialog(this);
tnfd->exec();
return; return;
} else { } else {
QStringList str; QStringList str;
@@ -1156,7 +1160,8 @@ void MainWindow::writeFileToEeprom()
if (IS_TARANIS(eepromInterface->getBoard())) { if (IS_TARANIS(eepromInterface->getBoard())) {
QString path=FindTaranisPath(); QString path=FindTaranisPath();
if (path.isEmpty()) { if (path.isEmpty()) {
QMessageBox::warning(this, tr("Taranis radio not found"), tr("Impossible to identify the radio on your system, please verify the eeprom disk is connected.")); taranisNotFoundDialog *tnfd = new taranisNotFoundDialog(this);
tnfd->exec();
return; return;
} }
else { else {
@@ -1251,15 +1256,16 @@ bool MainWindow::convertEEPROM(QString backupFile, QString restoreFile, QString
if ((svnTags.at(0) == "open9x")||(svnTags.at(0) == "opentx")) { if ((svnTags.at(0) == "open9x")||(svnTags.at(0) == "opentx")) {
if (revision > 1464) { if (revision > 1464) {
QString fwBuild = flash.getBuild(); QString fwEEprom = flash.getEEprom();
if (fwBuild.contains("-")) { if (fwEEprom.contains("-")) {
QStringList buildTags = fwBuild.split("-", QString::SkipEmptyParts); QStringList buildTags = fwEEprom.split("-", QString::SkipEmptyParts);
if (buildTags.size() >= 1) if (buildTags.size() >= 1)
version = buildTags.at(0).toInt(); version = buildTags.at(0).toInt();
if (buildTags.size() >= 2) if (buildTags.size() >= 2)
variant = buildTags.at(1).toInt(); variant = buildTags.at(1).toInt();
} else { }
version = fwBuild.toInt(); // TODO changer le nom de la variable else {
version = fwEEprom.toInt();
} }
} }
else { else {
@@ -1401,7 +1407,8 @@ void MainWindow::readEepromToFile()
if (IS_TARANIS(eepromInterface->getBoard())) { if (IS_TARANIS(eepromInterface->getBoard())) {
QString path=FindTaranisPath(); QString path=FindTaranisPath();
if (path.isEmpty()) { if (path.isEmpty()) {
QMessageBox::warning(this, tr("Taranis radio not found"), tr("Impossible to identify the radio on your system, please verify that the eeprom disk is connected.")); taranisNotFoundDialog *tnfd = new taranisNotFoundDialog(this);
tnfd->exec();
return; return;
} }
else { else {
@@ -1530,18 +1537,20 @@ MdiChild *MainWindow::createMdiChild()
return child; return child;
} }
QAction * MainWindow::addAct(QString icon, QString sName, QString lName, QKeySequence::StandardKey shortcut, const char *slot) QAction * MainWindow::addAct(QString icon, QString sName, QString lName, QKeySequence::StandardKey shortcut, const char *slot, QObject *slotObj)
{ {
QAction * newAction = new QAction( this ); QAction * newAction = new QAction( this );
if (!icon.isEmpty()) if (!icon.isEmpty())
newAction->setIcon(CompanionIcon(icon)); newAction->setIcon(CompanionIcon(icon));
if (!sName.isEmpty()) if (!sName.isEmpty())
newAction->setText(sName); newAction->setText(sName);
if (!lName.isEmpty()) if (!lName.isEmpty())
newAction->setStatusTip(lName); newAction->setStatusTip(lName);
if (shortcut != 0) if (shortcut != 0)
newAction->setShortcuts(shortcut); newAction->setShortcuts(shortcut);
connect(newAction, SIGNAL(triggered()), this, slot); if (slotObj == NULL)
slotObj = this;
connect(newAction, SIGNAL(triggered()), slotObj, slot);
return newAction; return newAction;
} }
@@ -1584,7 +1593,7 @@ void MainWindow::createActions()
openAct = addAct("open.png", tr("Open Models+Settings..."), tr("Open Models and Settings file"), QKeySequence::Open, SLOT(openFile())); openAct = addAct("open.png", tr("Open Models+Settings..."), tr("Open Models and Settings file"), QKeySequence::Open, SLOT(openFile()));
saveAct = addAct("save.png", tr("Save Models+Settings..."), tr("Save Models and Settings file"), QKeySequence::Save, SLOT(save())); saveAct = addAct("save.png", tr("Save Models+Settings..."), tr("Save Models and Settings file"), QKeySequence::Save, SLOT(save()));
saveAsAct = addAct("saveas.png", tr("Save Models+Settings as..."), tr("Save Models and Settings file"), QKeySequence::SaveAs, SLOT(saveAs())); saveAsAct = addAct("saveas.png", tr("Save Models+Settings as..."), tr("Save Models and Settings file"), QKeySequence::SaveAs, SLOT(saveAs()));
exitAct = addAct("exit.png", tr("Exit"), tr("Exit the application"), QKeySequence::Quit, SLOT(newFile())); exitAct = addAct("exit.png", tr("Exit"), tr("Exit the application"), QKeySequence::Quit, SLOT(closeAllWindows()), qApp);
cutAct = addAct("cut.png", tr("Cut Model"), tr("Cut current model to the clipboard"), QKeySequence::Cut, SLOT(cut())); cutAct = addAct("cut.png", tr("Cut Model"), tr("Cut current model to the clipboard"), QKeySequence::Cut, SLOT(cut()));
copyAct = addAct("copy.png", tr("Copy Model..."), tr("Copy current model to the clipboard"), QKeySequence::Copy, SLOT(copy())); copyAct = addAct("copy.png", tr("Copy Model..."), tr("Copy current model to the clipboard"), QKeySequence::Copy, SLOT(copy()));
pasteAct = addAct("paste.png", tr("Paste Model..."), tr("Paste model from clipboard"), QKeySequence::Paste, SLOT(paste())); pasteAct = addAct("paste.png", tr("Paste Model..."), tr("Paste model from clipboard"), QKeySequence::Paste, SLOT(paste()));
+2 -2
View File
@@ -49,7 +49,7 @@
#include "eeprominterface.h" #include "eeprominterface.h"
#define SPLASH_TIME 5 #define SPLASH_TIME 5
#define MAX_RECENT 10 #define MAX_RECENT 15
#define MAX_PROFILES 15 #define MAX_PROFILES 15
class MdiChild; class MdiChild;
@@ -158,7 +158,7 @@ private slots:
private: private:
void createActions(); void createActions();
QAction * addAct(QString, QString, QString, QKeySequence::StandardKey, const char *); QAction * addAct(QString, QString, QString, QKeySequence::StandardKey, const char *, QObject *slotObj=NULL);
QAction * addAct(QActionGroup *, QString, QString, const char *); QAction * addAct(QActionGroup *, QString, QString, const char *);
QAction * addAct(QString, QString, QString, const char *); QAction * addAct(QString, QString, QString, const char *);
+18 -10
View File
@@ -53,6 +53,7 @@
#include "helpers.h" #include "helpers.h"
#include "appdata.h" #include "appdata.h"
#include "wizarddialog.h" #include "wizarddialog.h"
#include "taranisnotfound.h"
#include <QFileInfo> #include <QFileInfo>
#if defined WIN32 || !defined __GNUC__ #if defined WIN32 || !defined __GNUC__
@@ -69,6 +70,7 @@ MdiChild::MdiChild():
fileChanged(false) fileChanged(false)
{ {
ui->setupUi(this); ui->setupUi(this);
this->setWindowIcon(CompanionIcon("open.png")); this->setWindowIcon(CompanionIcon("open.png"));
ui->SimulateTxButton->setIcon(CompanionIcon("simulate.png")); ui->SimulateTxButton->setIcon(CompanionIcon("simulate.png"));
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
@@ -196,6 +198,7 @@ void MdiChild::wizardEdit()
void MdiChild::openEditWindow() void MdiChild::openEditWindow()
{ {
QApplication::setOverrideCursor(Qt::WaitCursor);
int row = ui->modelsList->currentRow(); int row = ui->modelsList->currentRow();
if (row == 0){ if (row == 0){
generalEdit(); generalEdit();
@@ -209,6 +212,7 @@ void MdiChild::openEditWindow()
modelEdit(); modelEdit();
} }
} }
QApplication::restoreOverrideCursor();
} }
void MdiChild::newFile() void MdiChild::newFile()
@@ -518,7 +522,8 @@ void MdiChild::writeEeprom() // write to Tx
} }
backupEnable=false; backupEnable=false;
} }
} else { }
else {
backupEnable=false; backupEnable=false;
} }
QString stickCal=g.profile[g.id()].stickPotCalib(); QString stickCal=g.profile[g.id()].stickPotCalib();
@@ -541,7 +546,8 @@ void MdiChild::writeEeprom() // write to Tx
if (IS_TARANIS(eepromInterface->getBoard())) { if (IS_TARANIS(eepromInterface->getBoard())) {
QString path=((MainWindow *)this->parent())->FindTaranisPath(); QString path=((MainWindow *)this->parent())->FindTaranisPath();
if (path.isEmpty()) { if (path.isEmpty()) {
QMessageBox::warning(this, tr("Taranis radio not found"), tr("Impossible to identify the radio on your system, please verify the eeprom disk is connected.")); taranisNotFoundDialog *tnfd = new taranisNotFoundDialog(this);
tnfd->exec();
return; return;
} }
else { else {
@@ -597,7 +603,8 @@ void MdiChild::writeEeprom() // write to Tx
if (IS_TARANIS(eepromInterface->getBoard())) { if (IS_TARANIS(eepromInterface->getBoard())) {
QString path=((MainWindow *)this->parent())->FindTaranisPath(); QString path=((MainWindow *)this->parent())->FindTaranisPath();
if (path.isEmpty()) { if (path.isEmpty()) {
QMessageBox::warning(this, tr("Taranis radio not found"), tr("Impossible to identify the radio on your system, please verify the eeprom disk is connected.")); taranisNotFoundDialog *tnfd = new taranisNotFoundDialog(this);
tnfd->exec();
return; return;
} }
else { else {
@@ -618,7 +625,8 @@ void MdiChild::writeEeprom() // write to Tx
if (IS_TARANIS(eepromInterface->getBoard())) { if (IS_TARANIS(eepromInterface->getBoard())) {
QString path=((MainWindow *)this->parent())->FindTaranisPath(); QString path=((MainWindow *)this->parent())->FindTaranisPath();
if (path.isEmpty()) { if (path.isEmpty()) {
QMessageBox::warning(this, tr("Taranis radio not found"), tr("Impossible to identify the radio on your system, please verify the eeprom disk is connected.")); taranisNotFoundDialog *tnfd = new taranisNotFoundDialog(this);
tnfd->exec();
return; return;
} }
else { else {
@@ -654,7 +662,8 @@ void MdiChild::print(int model, QString filename)
printDialog *pd = new printDialog(this, &radioData.generalSettings, &radioData.models[model], filename); printDialog *pd = new printDialog(this, &radioData.generalSettings, &radioData.models[model], filename);
pd->show(); pd->show();
} else { }
else {
if(ui->modelsList->currentRow()<1) return; if(ui->modelsList->currentRow()<1) return;
printDialog *pd = new printDialog(this, &radioData.generalSettings, &radioData.models[ui->modelsList->currentRow()-1]); printDialog *pd = new printDialog(this, &radioData.generalSettings, &radioData.models[ui->modelsList->currentRow()-1]);
pd->show(); pd->show();
@@ -693,9 +702,8 @@ bool MdiChild::loadBackup()
.arg(file.errorString())); .arg(file.errorString()));
return false; return false;
} }
uint8_t *eeprom = (uint8_t *)malloc(eeprom_size); QByteArray eeprom(eeprom_size, 0);
memset(eeprom, 0, eeprom_size); long result = file.read((char*)eeprom.data(), eeprom_size);
long result = file.read((char*)eeprom, eeprom_size);
file.close(); file.close();
if (result != eeprom_size) { if (result != eeprom_size) {
@@ -707,7 +715,7 @@ bool MdiChild::loadBackup()
return false; return false;
} }
if (!LoadBackup(radioData, eeprom, eeprom_size, index)) { if (!LoadBackup(radioData, (uint8_t *)eeprom.data(), eeprom_size, index)) {
QMessageBox::critical(this, tr("Error"), QMessageBox::critical(this, tr("Error"),
tr("Invalid binary backup File %1") tr("Invalid binary backup File %1")
.arg(fileName)); .arg(fileName));
@@ -715,6 +723,6 @@ bool MdiChild::loadBackup()
} }
ui->modelsList->refreshList(); ui->modelsList->refreshList();
free(eeprom);
return true; return true;
} }
+36 -6
View File
@@ -10,18 +10,24 @@ Channels::Channels(QWidget * parent, ModelData & model):
ModelPanel(parent, model) ModelPanel(parent, model)
{ {
QGridLayout * gridLayout = new QGridLayout(this); QGridLayout * gridLayout = new QGridLayout(this);
bool minimize = false;
int col = 1; int col = 1;
if (GetEepromInterface()->getCapability(ChannelsName)) if (GetEepromInterface()->getCapability(ChannelsName))
{
minimize=true;
addLabel(gridLayout, tr("Name"), col++); addLabel(gridLayout, tr("Name"), col++);
addLabel(gridLayout, tr("Offset"), col++); }
addLabel(gridLayout, tr("Min"), col++); addLabel(gridLayout, tr("Offset"), col++, minimize);
addLabel(gridLayout, tr("Max"), col++); addLabel(gridLayout, tr("Min"), col++, minimize);
addLabel(gridLayout, tr("Invert"), col++); addLabel(gridLayout, tr("Max"), col++, minimize);
addLabel(gridLayout, tr("Invert"), col++, minimize);
if (IS_TARANIS(GetEepromInterface()->getBoard()))
addLabel(gridLayout, tr("Curve"), col++, minimize);
if (GetEepromInterface()->getCapability(PPMCenter)) if (GetEepromInterface()->getCapability(PPMCenter))
addLabel(gridLayout, tr("Center"), col++); addLabel(gridLayout, tr("Center"), col++, minimize);
if (GetEepromInterface()->getCapability(SYMLimits)) if (GetEepromInterface()->getCapability(SYMLimits))
addLabel(gridLayout, tr("Sym"), col++); addLabel(gridLayout, tr("Sym"), col++, true);
for (int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) { for (int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) {
col = 0; col = 0;
@@ -29,6 +35,7 @@ Channels::Channels(QWidget * parent, ModelData & model):
// Channel label // Channel label
QLabel *label = new QLabel(this); QLabel *label = new QLabel(this);
label->setText(tr("Channel %1").arg(i+1)); label->setText(tr("Channel %1").arg(i+1));
label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
gridLayout->addWidget(label, i+1, col++, 1, 1); gridLayout->addWidget(label, i+1, col++, 1, 1);
// Channel name // Channel name
@@ -88,6 +95,19 @@ Channels::Channels(QWidget * parent, ModelData & model):
connect(invCB, SIGNAL(currentIndexChanged(int)), this, SLOT(invEdited())); connect(invCB, SIGNAL(currentIndexChanged(int)), this, SLOT(invEdited()));
gridLayout->addWidget(invCB, i+1, col++, 1, 1); gridLayout->addWidget(invCB, i+1, col++, 1, 1);
// Curve
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
QComboBox * curveCB = new QComboBox(this);
curveCB->setProperty("index", i);
int numcurves = GetEepromInterface()->getCapability(NumCurves);
for (int j=-numcurves; j<=numcurves; j++) {
curveCB->addItem(CurveReference(CurveReference::CURVE_REF_CUSTOM, j).toString(), j);
}
curveCB->setCurrentIndex(model.limitData[i].curve.value+numcurves);
connect(curveCB, SIGNAL(currentIndexChanged(int)), this, SLOT(curveEdited()));
gridLayout->addWidget(curveCB, i+1, col++, 1, 1);
}
// PPM center // PPM center
if (GetEepromInterface()->getCapability(PPMCenter)) { if (GetEepromInterface()->getCapability(PPMCenter)) {
QSpinBox * center = new QSpinBox(this); QSpinBox * center = new QSpinBox(this);
@@ -110,6 +130,8 @@ Channels::Channels(QWidget * parent, ModelData & model):
gridLayout->addWidget(symlimits, i+1, col++, 1, 1); gridLayout->addWidget(symlimits, i+1, col++, 1, 1);
} }
} }
// Push the rows up
addVSpring(gridLayout, 0,GetEepromInterface()->getCapability(Outputs)+1);
} }
Channels::~Channels() Channels::~Channels()
@@ -168,6 +190,14 @@ void Channels::invEdited()
emit modified(); emit modified();
} }
void Channels::curveEdited()
{
QComboBox *cb = qobject_cast<QComboBox*>(sender());
int index = cb->property("index").toInt();
model.limitData[index].curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, cb->itemData(cb->currentIndex()).toInt());
emit modified();
}
void Channels::ppmcenterEdited() void Channels::ppmcenterEdited()
{ {
QSpinBox *sb = qobject_cast<QSpinBox*>(sender()); QSpinBox *sb = qobject_cast<QSpinBox*>(sender());
+1
View File
@@ -18,6 +18,7 @@ class Channels : public ModelPanel
void minEdited(); void minEdited();
void maxEdited(); void maxEdited();
void invEdited(); void invEdited();
void curveEdited();
void ppmcenterEdited(); void ppmcenterEdited();
}; };
-217
View File
@@ -1,217 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="ca_ctype_label_2">
<property name="text">
<string>Curve type</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="ca_coeff_SB_2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="ca_coeff_label_2">
<property name="text">
<string>Coefficient</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="ca_side_CB_2">
<item>
<property name="text">
<string>Both</string>
</property>
</item>
<item>
<property name="text">
<string>x&gt;0</string>
</property>
</item>
<item>
<property name="text">
<string>x&lt;0</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="ca_ymid_label_2">
<property name="text">
<string>Y at X=0</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="ca_ymax_SB_2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="ca_ymid_SB_2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="ca_side_label_2">
<property name="text">
<string>Side</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="ca_ymin_label_2">
<property name="text">
<string>Y at X=-100</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="ca_ymin_SB_2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="ca_ymax_label_2">
<property name="text">
<string>Y at X=100</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="ca_ctype_CB_2">
<item>
<property name="text">
<string>Linear</string>
</property>
</item>
<item>
<property name="text">
<string>Single Expo</string>
</property>
</item>
<item>
<property name="text">
<string>Symmetrical f(x)=-f(-x)</string>
</property>
</item>
<item>
<property name="text">
<string>Symmetrical f(x)=f(-x)</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<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>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
+178 -241
View File
@@ -10,24 +10,87 @@
#define GFX_MARGIN 16 #define GFX_MARGIN 16
static const QColor colors[C9X_MAX_CURVES] = { #define CURVE_COEFF_ENABLE 1
QColor(0,0,127), #define CURVE_YMID_ENABLE 2
QColor(0,127,0), #define CURVE_YMIN_ENABLE 4
QColor(127,0,0),
QColor(0,127,127), float curveLinear(float x, float coeff, float yMin, float yMid, float yMax)
QColor(127,0,127), {
QColor(127,127,0), float a = (yMax-yMin) / 200.0;
QColor(127,127,127), return yMin + a * (x+100.0);
QColor(0,0,255), }
QColor(0,127,255),
QColor(127,0,255), float c9xexpou(float point, float coeff)
QColor(0,255,0), {
QColor(0,255,127), float x = point*1024.0/100.0;
QColor(127,255,0), float k = coeff*256.0/100.0;
QColor(255,0,0), return ((k*x*x*x/(1024*1024) + x*(256-k) + 128) / 256) / 1024.0 * 100;
QColor(255,0,127), }
QColor(255,127,0),
}; float curveExpo(float x, float coeff, float yMin, float yMid, float yMax)
{
float a = (yMax-yMin) / 100.0;
x += 100.0;
x /= 2.0;
if (coeff >= 0) {
return round(c9xexpou(x, coeff)*a + yMin);
}
else {
coeff = -coeff;
x = 100 - x;
return round((100.0 - c9xexpou(x, coeff))*a + yMin);
}
}
float curveSymmetricalY(float x, float coeff, float yMin, float yMid, float yMax)
{
bool invert;
if (x<0) {
x = -x;
invert = 1;
}
else {
invert = 0;
}
float y;
if (coeff >= 0) {
y = round(c9xexpou(x, coeff) * (yMax/100.0));
}
else {
coeff = -coeff;
x = 100.0 - x;
y = round((100.0-c9xexpou(x, coeff)) * (yMax/100.0));
}
if (invert) {
y = -y;
}
return y;
}
float curveSymmetricalX(float x, float coeff, float yMin, float yMid, float yMax)
{
float a = (yMax-yMid) / 100.0;
if (x<0)
x = -x;
float y;
if (coeff >= 0) {
y = round(c9xexpou(x, coeff) * a + yMid);
}
else {
coeff = -coeff;
x = 100-x;
y = round((100.0-c9xexpou(x, coeff)) * a + yMid);
}
return y;
}
#if 0 #if 0
#ifdef __APPLE__ #ifdef __APPLE__
@@ -145,6 +208,11 @@ Curves::Curves(QWidget * parent, ModelData & model):
} }
} }
addTemplate(tr("Linear"), CURVE_YMIN_ENABLE, curveLinear);
addTemplate(tr("Single Expo"), CURVE_COEFF_ENABLE | CURVE_YMIN_ENABLE, curveExpo);
addTemplate(tr("Symmetrical f(x)=-f(-x)"), CURVE_COEFF_ENABLE, curveSymmetricalY);
addTemplate(tr("Symmetrical f(x)=f(-x)"), CURVE_COEFF_ENABLE | CURVE_YMID_ENABLE, curveSymmetricalX);
lock = false; lock = false;
} }
@@ -189,41 +257,16 @@ void Curves::update()
ui->curveName->setText(model.curves[currentCurve].name); ui->curveName->setText(model.curves[currentCurve].name);
} }
int count = model.curves[currentCurve].count;
for (int i=0; i<count; i++) {
spny[i]->show();
spny[i]->setValue(model.curves[currentCurve].points[i].y);
if (model.curves[currentCurve].type == CurveData::CURVE_TYPE_CUSTOM) {
spnx[i]->show();
if (i==0 || i==model.curves[currentCurve].count-1) {
spnx[i]->setDisabled(true);
spnx[i]->setMaximum(+100);
spnx[i]->setMinimum(-100);
}
else {
spnx[i]->setMaximum(model.curves[currentCurve].points[i+1].x);
spnx[i]->setMinimum(model.curves[currentCurve].points[i-1].x);
}
spnx[i]->setValue(model.curves[currentCurve].points[i].x);
}
else {
spnx[i]->hide();
}
}
for (int i=count; i<C9X_MAX_POINTS; i++) {
spny[i]->hide();
spnx[i]->hide();
}
updateCurveType(); updateCurveType();
updateCurve(); updateCurve();
updateCurvePoints();
lock = false; lock = false;
} }
void Curves::setCurrentCurve(int index) void Curves::setCurrentCurve(int index)
{ {
currentCurve = index; currentCurve = index;
} }
void Curves::updateCurveType() void Curves::updateCurveType()
@@ -253,6 +296,8 @@ void Curves::updateCurveType()
void Curves::updateCurve() void Curves::updateCurve()
{ {
lock = true;
Node * nodel = 0; Node * nodel = 0;
Node * nodex = 0; Node * nodex = 0;
QColor color; QColor color;
@@ -317,18 +362,51 @@ void Curves::updateCurve()
scene->addItem(nodex); scene->addItem(nodex);
if (i>0) scene->addItem(new Edge(nodel, nodex)); if (i>0) scene->addItem(new Edge(nodel, nodex));
} }
lock = false;
}
void Curves::updateCurvePoints()
{
lock = true;
int count = model.curves[currentCurve].count;
for (int i=0; i<count; i++) {
spny[i]->show();
spny[i]->setValue(model.curves[currentCurve].points[i].y);
if (model.curves[currentCurve].type == CurveData::CURVE_TYPE_CUSTOM) {
spnx[i]->show();
if (i==0 || i==model.curves[currentCurve].count-1) {
spnx[i]->setDisabled(true);
spnx[i]->setMaximum(+100);
spnx[i]->setMinimum(-100);
}
else {
spnx[i]->setMaximum(model.curves[currentCurve].points[i+1].x);
spnx[i]->setMinimum(model.curves[currentCurve].points[i-1].x);
}
spnx[i]->setValue(model.curves[currentCurve].points[i].x);
}
else {
spnx[i]->hide();
}
}
for (int i=count; i<C9X_MAX_POINTS; i++) {
spny[i]->hide();
spnx[i]->hide();
}
lock = false;
} }
void Curves::onPointEdited() void Curves::onPointEdited()
{ {
if (!lock) { if (!lock) {
lock = true;
int index = sender()->property("index").toInt(); int index = sender()->property("index").toInt();
model.curves[currentCurve].points[index].x = spnx[index]->value(); model.curves[currentCurve].points[index].x = spnx[index]->value();
model.curves[currentCurve].points[index].y = spny[index]->value(); model.curves[currentCurve].points[index].y = spny[index]->value();
updateCurve(); updateCurve();
emit modified(); emit modified();
lock = false;
} }
} }
@@ -390,7 +468,7 @@ void Curves::on_curvePoints_currentIndexChanged(int index)
// TODO something better + reuse! // TODO something better + reuse!
for (int i=0; i<C9X_MAX_POINTS; i++) { for (int i=0; i<C9X_MAX_POINTS; i++) {
model.curves[currentCurve].points[i].x = (i >= model.curves[currentCurve].count-1 ? +100 : -100 + (200*i)/(numpoints-1)); model.curves[currentCurve].points[i].x = (i >= numpoints-1 ? +100 : -100 + (200*i)/(numpoints-1));
model.curves[currentCurve].points[i].y = 0; model.curves[currentCurve].points[i].y = 0;
} }
@@ -413,7 +491,7 @@ void Curves::on_curveCustom_currentIndexChanged(int index)
// TODO something better + reuse! // TODO something better + reuse!
for (int i=0; i<C9X_MAX_POINTS; i++) { for (int i=0; i<C9X_MAX_POINTS; i++) {
model.curves[currentCurve].points[i].x = (i >= model.curves[currentCurve].count-1 ? +100 : -100 + (200*i)/(numpoints-1)); model.curves[currentCurve].points[i].x = (i >= numpoints-1 ? +100 : -100 + (200*i)/(numpoints-1));
model.curves[currentCurve].points[i].y = 0; model.curves[currentCurve].points[i].y = 0;
} }
@@ -444,213 +522,72 @@ void Curves::resizeEvent(QResizeEvent *event)
QRect qr = ui->curvePreview->contentsRect(); QRect qr = ui->curvePreview->contentsRect();
ui->curvePreview->scene()->setSceneRect(GFX_MARGIN, GFX_MARGIN, qr.width()-GFX_MARGIN*2, qr.height()-GFX_MARGIN*2); ui->curvePreview->scene()->setSceneRect(GFX_MARGIN, GFX_MARGIN, qr.width()-GFX_MARGIN*2, qr.height()-GFX_MARGIN*2);
updateCurve(); updateCurve();
ModelPanel::resizeEvent(event); ModelPanel::resizeEvent(event);
} }
#if 0 void Curves::on_curveType_currentIndexChanged()
void ModelEdit::on_ca_ctype_CB_currentIndexChanged()
{ {
int index=ui->ca_ctype_CB->currentIndex(); int index = ui->curveType->currentIndex();
switch (index) { unsigned int flags = templates[index].flags;
ui->curveCoeffLabel->setVisible(flags & CURVE_COEFF_ENABLE);
ui->curveCoeff->setVisible(flags & CURVE_COEFF_ENABLE);
ui->yMax->setValue(100);
ui->yMidLabel->setVisible(flags & CURVE_YMID_ENABLE);
ui->yMid->setVisible(flags & CURVE_YMID_ENABLE);
ui->yMid->setValue(0);
ui->yMinLabel->setVisible(flags & CURVE_YMIN_ENABLE);
ui->yMin->setVisible(flags & CURVE_YMIN_ENABLE);
ui->yMin->setValue(-100);
}
void Curves::addTemplate(QString name, unsigned int flags, curveFunction function)
{
CurveCreatorTemplate tmpl;
tmpl.name = name;
tmpl.flags = flags;
tmpl.function = function;
templates.append(tmpl);
ui->curveType->addItem(name);
}
void Curves::on_curveApply_clicked()
{
int index = ui->curveType->currentIndex();
int numpoints = model.curves[currentCurve].count;
for (int i=0; i<numpoints; i++) {
float x;
if (model.curves[currentCurve].type == CurveData::CURVE_TYPE_CUSTOM)
x = model.curves[currentCurve].points[i].x;
else
x = -100.0 + (200.0/(numpoints-1))*i;
bool apply = false;
switch (ui->curveSide->currentIndex()) {
case 0: case 0:
ui->ca_coeff_SB->hide(); apply = true;
ui->ca_coeff_label->hide();
ui->ca_ymid_SB->hide();
ui->ca_ymid_label->hide();
ui->ca_ymin_SB->show();
ui->ca_ymin_label->show();
ui->ca_ymin_SB->setValue(-100);
ui->ca_ymax_SB->setValue(100);
break; break;
case 1: case 1:
ui->ca_coeff_SB->show(); if (x>=0)
ui->ca_coeff_label->show(); apply = true;
ui->ca_ymid_SB->hide();
ui->ca_ymid_label->hide();
ui->ca_ymin_SB->show();
ui->ca_ymin_label->show();
ui->ca_ymin_SB->setValue(-100);
ui->ca_ymax_SB->setValue(100);
break; break;
case 2: case 2:
ui->ca_coeff_SB->show(); if (x<0)
ui->ca_coeff_label->show(); apply = true;
ui->ca_ymid_SB->hide();
ui->ca_ymid_label->hide();
ui->ca_ymin_SB->hide();
ui->ca_ymin_label->hide();
ui->ca_ymax_SB->setValue(100);
break;
case 3:
ui->ca_coeff_SB->show();
ui->ca_coeff_label->show();
ui->ca_ymid_SB->show();
ui->ca_ymid_label->show();
ui->ca_ymin_SB->hide();
ui->ca_ymin_label->hide();
ui->ca_ymid_SB->setValue(0);
ui->ca_ymax_SB->setValue(100);
break; break;
} }
}
float c9xexpou(float point, float coeff) if (apply) {
{ model.curves[currentCurve].points[i].y = templates[index].function(x, ui->curveCoeff->value(), ui->yMin->value(), ui->yMid->value(), ui->yMax->value());
float x=point*1024.0/100.0;
float k=coeff*256.0/100.0;
return ((k*x*x*x/(1024*1024) + x*(256-k) + 128) / 256)/1024.0*100;
}
void ModelEdit::on_ca_apply_PB_clicked()
{
int index=ui->ca_ctype_CB->currentIndex();
float x;
int y;
int invert=0;
float a;
if (index==0) {
a=(ui->ca_ymax_SB->value()-ui->ca_ymin_SB->value())/200.0;
int numpoints=model.curves[currentCurve].count;
for (int i=0; i<numpoints; i++) {
if (model.curves[currentCurve].type == CurveData::CURVE_TYPE_CUSTOM) {
x=(model.curves[currentCurve].points[i].x+100);
} else {
x=(200.0/(numpoints-1))*i;
}
y=ui->ca_ymin_SB->value()+a*x;
switch (ui->ca_side_CB->currentIndex()) {
case 0:
model.curves[currentCurve].points[i].y=y;
break;
case 1:
if (x>=100) {
model.curves[currentCurve].points[i].y=y;
}
break;
case 2:
if (x<100) {
model.curves[currentCurve].points[i].y=y;
}
break;
}
}
} else if (index==1) {
int numpoints=model.curves[currentCurve].count;
for (int i=0; i<numpoints; i++) {
if (model.curves[currentCurve].type == CurveData::CURVE_TYPE_CUSTOM) {
x=((model.curves[currentCurve].points[i].x)+100)/2.0;
} else {
x=(100.0/(numpoints-1))*i;
}
a=ui->ca_coeff_SB->value();
if (a>=0) {
y=round(c9xexpou(x,a)*(ui->ca_ymax_SB->value()-ui->ca_ymin_SB->value())/100.0+ui->ca_ymin_SB->value());
} else {
a=-a;
x=100-x;
y=round((100.0-c9xexpou(x,a))*(ui->ca_ymax_SB->value()-ui->ca_ymin_SB->value())/100.0+ui->ca_ymin_SB->value());
}
switch (ui->ca_side_CB->currentIndex()) {
case 0:
model.curves[currentCurve].points[i].y=y;
break;
case 1:
if (x>=50) {
model.curves[currentCurve].points[i].y=y;
}
break;
case 2:
if (x<50) {
model.curves[currentCurve].points[i].y=y;
}
break;
}
}
} else if (index==2) {
int numpoints=model.curves[currentCurve].count;
for (int i=0; i<numpoints; i++) {
if (model.curves[currentCurve].type == CurveData::CURVE_TYPE_CUSTOM) {
x=(model.curves[currentCurve].points[i].x);
} else {
x=-100.0+(200.0/(numpoints-1))*i;
}
a=ui->ca_coeff_SB->value();
if (x<0) {
x=-x;
invert=1;
} else {
invert=0;
}
if (a>=0) {
y=round(c9xexpou(x,a)*(ui->ca_ymax_SB->value()/100.0));
} else {
a=-a;
x=100-x;
y=round((100.0-c9xexpou(x,a))*(ui->ca_ymax_SB->value()/100.0));
}
switch (ui->ca_side_CB->currentIndex()) {
case 0:
if (invert==1) {
model.curves[currentCurve].points[i].y=-y;
} else {
model.curves[currentCurve].points[i].y=y;
}
break;
case 1:
if (invert==0) {
model.curves[currentCurve].points[i].y=y;
}
break;
case 2:
if (invert==1) {
model.curves[currentCurve].points[i].y=-y;
}
break;
}
}
} else if (index==3) {
int numpoints=model.curves[currentCurve].count;
for (int i=0; i<numpoints; i++) {
if (model.curves[currentCurve].type == CurveData::CURVE_TYPE_CUSTOM) {
x=(model.curves[currentCurve].points[i].x);
} else {
x=-100.0+(200.0/(numpoints-1))*i;
}
int pos=(x>=0);
a=ui->ca_coeff_SB->value();
if (x<0) {
x=-x;
}
if (a>=0) {
y=round(c9xexpou(x,a)*((ui->ca_ymax_SB->value()-ui->ca_ymid_SB->value())/100.0)+ui->ca_ymid_SB->value());
} else {
a=-a;
x=100-x;
y=round((100.0-c9xexpou(x,a))*((ui->ca_ymax_SB->value()-ui->ca_ymid_SB->value())/100.0)+ui->ca_ymid_SB->value());
}
switch (ui->ca_side_CB->currentIndex()) {
case 0:
model.curves[currentCurve].points[i].y=y;
break;
case 1:
if (pos) {
model.curves[currentCurve].points[i].y=y;
}
break;
case 2:
if (!pos) {
model.curves[currentCurve].points[i].y=y;
}
break;
}
}
} }
updateSettings(); }
setCurrentCurve(currentCurve);
drawCurve(); updateCurve();
updateCurvePoints();
emit modified();
} }
#if 0
void ModelEdit::clearCurves(bool ask) void ModelEdit::clearCurves(bool ask)
{ {
if (ask) { if (ask) {
+14
View File
@@ -8,6 +8,14 @@ namespace Ui {
class Curves; class Curves;
} }
typedef float (*curveFunction) (float x, float coeff, float yMin, float yMid, float yMax);
struct CurveCreatorTemplate {
QString name;
unsigned int flags;
curveFunction function;
};
class Curves : public ModelPanel class Curves : public ModelPanel
{ {
Q_OBJECT Q_OBJECT
@@ -30,9 +38,12 @@ class Curves : public ModelPanel
void onNodeMoved(int x, int y); void onNodeMoved(int x, int y);
void onNodeFocus(); void onNodeFocus();
void onNodeUnfocus(); void onNodeUnfocus();
void on_curveType_currentIndexChanged();
void on_curveApply_clicked();
protected: protected:
virtual void resizeEvent(QResizeEvent *event); virtual void resizeEvent(QResizeEvent *event);
void addTemplate(QString name, unsigned int flags, curveFunction function);
private: private:
Ui::Curves *ui; Ui::Curves *ui;
@@ -40,10 +51,13 @@ class Curves : public ModelPanel
bool visibleCurves[C9X_MAX_CURVES]; bool visibleCurves[C9X_MAX_CURVES];
QSpinBox * spnx[C9X_MAX_POINTS]; QSpinBox * spnx[C9X_MAX_POINTS];
QSpinBox * spny[C9X_MAX_POINTS]; QSpinBox * spny[C9X_MAX_POINTS];
QVector<CurveCreatorTemplate> templates;
void setCurrentCurve(int index); void setCurrentCurve(int index);
void updateCurve(); void updateCurve();
void updateCurveType(); void updateCurveType();
void updateCurvePoints();
bool allowCurveType(int points, CurveData::CurveType type); bool allowCurveType(int points, CurveData::CurveType type);
void setPointY(int i, int x, int y);
}; };
+244 -61
View File
@@ -6,23 +6,55 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>638</width> <width>718</width>
<height>587</height> <height>539</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<layout class="QGridLayout" name="gridLayout_80" columnstretch="0,0,0,0,0"> <layout class="QGridLayout" name="curvesLayout"/>
<item row="0" column="0" rowspan="3"> </item>
<layout class="QGridLayout" name="curvesLayout"/> <item>
<layout class="QVBoxLayout" name="verticalLayout_1">
<property name="rightMargin">
<number>10</number>
</property>
<item>
<widget class="QGraphicsView" name="curvePreview">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>400</width>
<height>400</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item> </item>
<item row="0" column="1" rowspan="3"> <item>
<layout class="QGridLayout" name="gridLayout_8" rowstretch="0,0,0" columnstretch="1,0"> <layout class="QGridLayout" name="gridLayout">
<item row="1" column="1"> <item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout"> <widget class="QLabel" name="curveNameLabel">
<property name="text">
<string>Curve name</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,0">
<property name="rightMargin"> <property name="rightMargin">
<number>0</number> <number>0</number>
</property> </property>
@@ -59,7 +91,14 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="0"> <item row="1" column="1">
<widget class="QLineEdit" name="curveName">
<property name="maxLength">
<number>6</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="curveTypeLabel"> <widget class="QLabel" name="curveTypeLabel">
<property name="text"> <property name="text">
<string>Curve type</string> <string>Curve type</string>
@@ -69,45 +108,26 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0">
<widget class="QLabel" name="curveNameLabel">
<property name="text">
<string>Curve name</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QLineEdit" name="curveName"> <spacer name="verticalSpacer">
<property name="maxLength"> <property name="orientation">
<number>6</number> <enum>Qt::Vertical</enum>
</property> </property>
</widget> <property name="sizeHint" stdset="0">
</item>
<item row="0" column="0" colspan="2">
<widget class="QGraphicsView" name="curvePreview">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size> <size>
<width>400</width> <width>20</width>
<height>400</height> <height>40</height>
</size> </size>
</property> </property>
<property name="alignment"> </spacer>
<set>Qt::AlignCenter</set>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
<item row="0" column="2" rowspan="3" colspan="2"> </layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="pointsLayout"> <layout class="QGridLayout" name="pointsLayout">
<property name="horizontalSpacing"> <property name="horizontalSpacing">
<number>0</number> <number>0</number>
@@ -123,37 +143,200 @@
</property> </property>
</layout> </layout>
</item> </item>
<item row="5" column="0" colspan="5"> <item>
<spacer name="verticalSpacer_6"> <spacer name="verticalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>0</height> <height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="4" rowspan="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="QGroupBox" name="curveCreator">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="title">
<string>Curve Creator</string>
</property>
<layout class="QGridLayout" name="gridLayout_76" rowstretch="0,0,0,0,0,0,0,0">
<item row="3" column="0">
<widget class="QLabel" name="yMidLabel">
<property name="text">
<string>Y at X=0</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="3">
<widget class="QSpinBox" name="yMax">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="yMaxLabel">
<property name="text">
<string>Y at X=100</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QSpinBox" name="curveCoeff">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item row="5" column="1" colspan="3">
<widget class="QComboBox" name="curveSide">
<item>
<property name="text">
<string>Both</string>
</property>
</item>
<item>
<property name="text">
<string>x&gt;0</string>
</property>
</item>
<item>
<property name="text">
<string>x&lt;0</string>
</property>
</item>
</widget>
</item>
<item row="2" column="1" colspan="3">
<widget class="QSpinBox" name="yMin">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item row="6" column="0" colspan="4">
<widget class="QPushButton" name="curveApply">
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="curveSideLabel">
<property name="text">
<string>Side</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="3">
<widget class="QSpinBox" name="yMid">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item row="0" column="1" colspan="3">
<widget class="QComboBox" name="curveType"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="curveTypeLabel_2">
<property name="text">
<string>Curve type</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="yMinLabel">
<property name="text">
<string>Y at X=-100</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="curveCoeffLabel">
<property name="text">
<string>Coefficient</string>
</property>
</widget>
</item>
<item row="7" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<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>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>
+19 -8
View File
@@ -54,11 +54,11 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
{ {
QGridLayout * gridLayout = new QGridLayout(this); QGridLayout * gridLayout = new QGridLayout(this);
int col = 1; addLabel(gridLayout, tr("Switch"), 1);
addLabel(gridLayout, tr("Switch"), col++); addLabel(gridLayout, tr("Action"), 2);
addLabel(gridLayout, tr("Action"), col++); addLabel(gridLayout, tr("Parameters"), 3);
addLabel(gridLayout, tr("Parameters"), col++); addLabel(gridLayout, tr("Enable"), 4, true );
addLabel(gridLayout, tr("Enable"), col++); addEmptyLabel(gridLayout, 5 );
lock = true; lock = true;
int num_fsw = GetEepromInterface()->getCapability(CustomFunctions); int num_fsw = GetEepromInterface()->getCapability(CustomFunctions);
@@ -104,13 +104,15 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
label->setContextMenuPolicy(Qt::CustomContextMenu); label->setContextMenuPolicy(Qt::CustomContextMenu);
label->setMouseTracking(true); label->setMouseTracking(true);
label->setProperty("index", i); label->setProperty("index", i);
label->setText(tr("CF%1").arg(i+1)); label->setText(tr("SF%1").arg(i+1));
gridLayout->addWidget(label, i+1, 0); label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(fsw_customContextMenuRequested(QPoint))); connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(fsw_customContextMenuRequested(QPoint)));
gridLayout->addWidget(label, i+1, 0);
// The switch // The switch
fswtchSwtch[i] = new QComboBox(this); fswtchSwtch[i] = new QComboBox(this);
fswtchSwtch[i]->setProperty("index", i); fswtchSwtch[i]->setProperty("index", i);
fswtchSwtch[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
connect(fswtchSwtch[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited())); connect(fswtchSwtch[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
gridLayout->addWidget(fswtchSwtch[i], i+1, 1); gridLayout->addWidget(fswtchSwtch[i], i+1, 1);
populateSwitchCB(fswtchSwtch[i], model.funcSw[i].swtch, POPULATE_ONOFF); populateSwitchCB(fswtchSwtch[i], model.funcSw[i].swtch, POPULATE_ONOFF);
@@ -161,6 +163,12 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
connect(fswtchParamArmT[i], SIGNAL(editTextChanged ( const QString)), this, SLOT(customFunctionEdited())); connect(fswtchParamArmT[i], SIGNAL(editTextChanged ( const QString)), this, SLOT(customFunctionEdited()));
#ifdef PHONON #ifdef PHONON
phononLock=false;
clickObject = new Phonon::MediaObject(this);
clickOutput = new Phonon::AudioOutput(Phonon::NoCategory, this);
Phonon::createPath(clickObject, clickOutput);
connect(clickObject, SIGNAL(stateChanged(Phonon::State,Phonon::State)), this, SLOT(mediaPlayer_state(Phonon::State,Phonon::State)));
playBT[i] = new QPushButton(this); playBT[i] = new QPushButton(this);
playBT[i]->setProperty("index", i); playBT[i]->setProperty("index", i);
playBT[i]->setProperty("state", "play"); playBT[i]->setProperty("state", "play");
@@ -178,11 +186,13 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
fswtchEnable[i] = new QCheckBox(this); fswtchEnable[i] = new QCheckBox(this);
fswtchEnable[i]->setProperty("index", i); fswtchEnable[i]->setProperty("index", i);
fswtchEnable[i]->setText(tr("ON")); fswtchEnable[i]->setText(tr("ON"));
fswtchEnable[i]->setFixedWidth( 50 );
repeatLayout->addWidget(fswtchEnable[i], i+1); repeatLayout->addWidget(fswtchEnable[i], i+1);
fswtchEnable[i]->setChecked(model.funcSw[i].enabled); fswtchEnable[i]->setChecked(model.funcSw[i].enabled);
connect(fswtchEnable[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited())); connect(fswtchEnable[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited()));
} }
// Push rows upward
addDoubleSpring(gridLayout, 5, num_fsw+1);
lock = false; lock = false;
} }
@@ -203,6 +213,7 @@ void CustomFunctionsPanel::mediaPlayer_state(Phonon::State newState, Phonon::Sta
clickObject->clearQueue(); clickObject->clearQueue();
clickObject->clear(); clickObject->clear();
for (int i=0; i<GetEepromInterface()->getCapability(CustomFunctions); i++) { for (int i=0; i<GetEepromInterface()->getCapability(CustomFunctions); i++) {
playBT[i]->setProperty("state", "play");
playBT[i]->setObjectName(QString("play_%1").arg(i)); playBT[i]->setObjectName(QString("play_%1").arg(i));
playBT[i]->setIcon(CompanionIcon("play.png")); playBT[i]->setIcon(CompanionIcon("play.png"));
} }
+8 -7
View File
@@ -1,13 +1,13 @@
#include "expodialog.h" #include "expodialog.h"
#include "ui_expodialog.h" #include "ui_expodialog.h"
#include "eeprominterface.h"
#include "helpers.h" #include "helpers.h"
ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, int stickMode) : ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, int stickMode, char * inputName) :
QDialog(parent), QDialog(parent),
ui(new Ui::ExpoDialog), ui(new Ui::ExpoDialog),
model(model), model(model),
ed(expoData) ed(expoData),
inputName(inputName)
{ {
ui->setupUi(this); ui->setupUi(this);
QLabel * lb_fp[] = {ui->lb_FP0,ui->lb_FP1,ui->lb_FP2,ui->lb_FP3,ui->lb_FP4,ui->lb_FP5,ui->lb_FP6,ui->lb_FP7,ui->lb_FP8 }; QLabel * lb_fp[] = {ui->lb_FP0,ui->lb_FP1,ui->lb_FP2,ui->lb_FP3,ui->lb_FP4,ui->lb_FP5,ui->lb_FP6,ui->lb_FP7,ui->lb_FP8 };
@@ -45,8 +45,6 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, i
} }
if (GetEepromInterface()->getCapability(VirtualInputs)) { if (GetEepromInterface()->getCapability(VirtualInputs)) {
ui->sideLabel->hide();
ui->sideCB->hide();
ui->inputName->setMaxLength(4); ui->inputName->setMaxLength(4);
populateSourceCB(ui->sourceCB, ed->srcRaw, model, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS | POPULATE_TELEMETRY); populateSourceCB(ui->sourceCB, ed->srcRaw, model, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS | POPULATE_TELEMETRY);
ui->sourceCB->removeItem(0); ui->sourceCB->removeItem(0);
@@ -76,7 +74,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, i
} }
ui->inputName->setValidator(new QRegExpValidator(rx, this)); ui->inputName->setValidator(new QRegExpValidator(rx, this));
ui->inputName->setText(model.inputNames[ed->chn]); ui->inputName->setText(inputName);
ui->lineName->setValidator(new QRegExpValidator(rx, this)); ui->lineName->setValidator(new QRegExpValidator(rx, this));
ui->lineName->setText(ed->name); ui->lineName->setText(ed->name);
@@ -93,6 +91,9 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, i
for (int i=0; i<9; i++) { for (int i=0; i<9; i++) {
connect(cb_fp[i], SIGNAL(toggled(bool)), this, SLOT(valuesChanged())); connect(cb_fp[i], SIGNAL(toggled(bool)), this, SLOT(valuesChanged()));
} }
if (GetEepromInterface()->getCapability(VirtualInputs))
connect(ui->inputName, SIGNAL(editingFinished()), this, SLOT(valuesChanged()));
QTimer::singleShot(0, this, SLOT(shrink())); QTimer::singleShot(0, this, SLOT(shrink()));
} }
@@ -137,7 +138,7 @@ void ExpoDialog::valuesChanged()
ed->mode = ui->sideCB->currentIndex() + 1; ed->mode = ui->sideCB->currentIndex() + 1;
strcpy(ed->name, ui->lineName->text().toAscii().data()); strcpy(ed->name, ui->lineName->text().toAscii().data());
strcpy(model.inputNames[ed->chn], ui->inputName->text().toAscii().data()); strcpy(inputName, ui->inputName->text().toAscii().data());
ed->phases=0; ed->phases=0;
for (int i=8; i>=0 ; i--) { for (int i=8; i>=0 ; i--) {
+2 -1
View File
@@ -14,7 +14,7 @@ namespace Ui {
class ExpoDialog : public QDialog { class ExpoDialog : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expodata, int stickMode); ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expodata, int stickMode, char * inputName);
~ExpoDialog(); ~ExpoDialog();
protected: protected:
@@ -28,6 +28,7 @@ class ExpoDialog : public QDialog {
Ui::ExpoDialog * ui; Ui::ExpoDialog * ui;
ModelData & model; ModelData & model;
ExpoData * ed; ExpoData * ed;
char * inputName;
GVarGroup * gvGroup; GVarGroup * gvGroup;
CurveGroup * curveGroup; CurveGroup * curveGroup;
}; };
+15 -2
View File
@@ -165,7 +165,7 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<layout class="QGridLayout" name="leftTrims_3" columnstretch="0,1" columnminimumwidth="80,0"> <layout class="QGridLayout" name="leftTrims_3" columnstretch="0,1">
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="trim1Label"> <widget class="QLabel" name="trim1Label">
<property name="text"> <property name="text">
@@ -299,7 +299,7 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<layout class="QGridLayout" name="righTrims_2" columnstretch="0,1" columnminimumwidth="80,0"> <layout class="QGridLayout" name="righTrims_2" columnstretch="0,1">
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="trim4Label"> <widget class="QLabel" name="trim4Label">
<property name="text"> <property name="text">
@@ -423,6 +423,19 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="0" column="4">
<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>
</layout> </layout>
</item> </item>
<item> <item>
+22 -44
View File
@@ -194,33 +194,29 @@ void FlightMode::update()
for (int i=0; i<gvCount; i++) { for (int i=0; i<gvCount; i++) {
gvNames[i]->setText(model.gvars_names[i]); gvNames[i]->setText(model.gvars_names[i]);
if (phase.gvars[i] < 1024) { gvValues[i]->setDisabled(false);
gvValues[i]->setValue(phase.gvars[i]); int idx = phase.gvars[i];
gvValues[i]->setDisabled(false); PhaseData *phasegvar = &phase;
} while (idx >= 1024) {
else { idx -= 1025;
int idx = phase.gvars[i] - 1025; phasegvar = &model.phaseData[idx];
if (idx >= i) idx++; idx = phasegvar->gvars[i];
// TODO no!!!! gvValues[i]->setDisabled(true);
PhaseData *phasegvar = &model.phaseData[idx];
gvValues[i]->setValue(phasegvar->gvars[i]);
gvValues[i]->setDisabled(true);
} }
gvValues[i]->setValue(phasegvar->gvars[i]);
} }
for (int i=0; i<reCount; i++) { for (int i=0; i<reCount; i++) {
if (phase.rotaryEncoders[i] < 1024) { reValues[i]->setDisabled(false);
reValues[i]->setValue(phase.rotaryEncoders[i]); int idx = phase.rotaryEncoders[i];
reValues[i]->setDisabled(false); PhaseData *phasere = &phase;
} while (idx >= 1024) {
else { idx -= 1025;
int idx = phase.rotaryEncoders[i] - 1025; phasere = &model.phaseData[idx];
if (idx >= i) idx++; idx = phasere->rotaryEncoders[i];
// TODO no!!!!
PhaseData *phasere = &model.phaseData[idx];
reValues[i]->setValue(phasere->rotaryEncoders[i]);
reValues[i]->setDisabled(true); reValues[i]->setDisabled(true);
} }
reValues[i]->setValue(phasere->rotaryEncoders[i]);
} }
} }
@@ -311,21 +307,12 @@ void FlightMode::phaseGVUse_currentIndexChanged(int index)
QComboBox *comboBox = qobject_cast<QComboBox*>(sender()); QComboBox *comboBox = qobject_cast<QComboBox*>(sender());
int gvar = comboBox->property("index").toInt(); int gvar = comboBox->property("index").toInt();
if (index == 0) { if (index == 0) {
int value = phase.gvars[gvar]; phase.gvars[gvar]=0;
if (value>1024) {
value=0;
}
gvValues[gvar]->setValue(value);
gvValues[gvar]->setEnabled(true);
phase.gvars[gvar]=value;
} }
else { else {
phase.gvars[gvar] = 1024+index; phase.gvars[gvar] = 1024+index;
// TOTO it's wrong!!!
int value = model.phaseData[index + (index>phaseIdx ? 0 :-1)].gvars[gvar];
gvValues[gvar]->setValue(value);
gvValues[gvar]->setDisabled(true);
} }
update();
emit modified(); emit modified();
lock = false; lock = false;
} }
@@ -348,21 +335,12 @@ void FlightMode::phaseREUse_currentIndexChanged(int index)
QComboBox *comboBox = qobject_cast<QComboBox*>(sender()); QComboBox *comboBox = qobject_cast<QComboBox*>(sender());
int re = comboBox->property("index").toInt(); int re = comboBox->property("index").toInt();
if (index == 0) { if (index == 0) {
// TODO no!!! phase.rotaryEncoders[re] = 0;
int value = phase.rotaryEncoders[re];
if (value > 1024) {
value = 0;
}
reValues[re]->setValue(value);
reValues[re]->setEnabled(true);
phase.rotaryEncoders[re] = value;
} }
else { else {
phase.rotaryEncoders[re] = 1024 + index; phase.rotaryEncoders[re] = 1024 + index; ;
int value = model.phaseData[index + (index>phaseIdx ? 0 :-1)].rotaryEncoders[re];
reValues[re]->setValue(value);
reValues[re]->setDisabled(true) ;
} }
update();
lock = false; lock = false;
emit modified(); emit modified();
} }
+12 -7
View File
@@ -98,12 +98,11 @@ void InputsPanel::update()
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString(); str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString();
} }
} }
else {
switch (md->mode) { switch (md->mode) {
case (1): str += " <-"; break; case (1): str += " <-"; break;
case (2): str += " ->"; break; case (2): str += " ->"; break;
default: str += " "; break; default: str += " "; break;
};
} }
str += " " + tr("Weight(%1)").arg(getGVarString(md->weight)); str += " " + tr("Weight(%1)").arg(getGVarString(md->weight));
@@ -169,12 +168,18 @@ void InputsPanel::gm_openExpo(int index)
if(index<0 || index>=C9X_MAX_EXPOS) return; if(index<0 || index>=C9X_MAX_EXPOS) return;
ExpoData mixd(model.expoData[index]); ExpoData mixd(model.expoData[index]);
char inputName[4+1];
emit modified(); emit modified();
update(); update();
ExpoDialog *g = new ExpoDialog(this, model, &mixd, generalSettings.stickMode); if (GetEepromInterface()->getCapability(VirtualInputs))
strcpy(inputName, model.inputNames[mixd.chn]);
ExpoDialog *g = new ExpoDialog(this, model, &mixd, generalSettings.stickMode, inputName);
if (g->exec()) { if (g->exec()) {
model.expoData[index] = mixd; model.expoData[index] = mixd;
if (GetEepromInterface()->getCapability(VirtualInputs))
strcpy(model.inputNames[mixd.chn], inputName);
emit modified(); emit modified();
update(); update();
} }
+119 -106
View File
@@ -28,12 +28,10 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model):
// The label // The label
QLabel * label = new QLabel(this); QLabel * label = new QLabel(this);
label->setProperty("index", i); label->setProperty("index", i);
if (i < 9) label->setText(tr("L%1").arg(i+1));
label->setText(tr("LS%1").arg(i+1));
else
label->setText(tr("LS%1").arg(QChar('A'+i-9)));
label->setContextMenuPolicy(Qt::CustomContextMenu); label->setContextMenuPolicy(Qt::CustomContextMenu);
label->setMouseTracking(true); label->setMouseTracking(true);
label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(csw_customContextMenuRequested(QPoint))); connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(csw_customContextMenuRequested(QPoint)));
gridLayout->addWidget(label, i+1, 0); gridLayout->addWidget(label, i+1, 0);
@@ -60,10 +58,11 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model):
cswitchValue[i]->setVisible(false); cswitchValue[i]->setVisible(false);
// V2 // V2
QHBoxLayout *v2Layout = new QHBoxLayout();
cswitchSource2[i] = new QComboBox(this); cswitchSource2[i] = new QComboBox(this);
cswitchSource2[i]->setProperty("index", i); cswitchSource2[i]->setProperty("index", i);
connect(cswitchSource2[i], SIGNAL(currentIndexChanged(int)), this, SLOT(v2Edited(int))); connect(cswitchSource2[i], SIGNAL(currentIndexChanged(int)), this, SLOT(v2Edited(int)));
gridLayout->addWidget(cswitchSource2[i], i+1, 3); v2Layout->addWidget(cswitchSource2[i]);
cswitchSource2[i]->setVisible(false); cswitchSource2[i]->setVisible(false);
cswitchOffset[i] = new QDoubleSpinBox(this); cswitchOffset[i] = new QDoubleSpinBox(this);
cswitchOffset[i]->setProperty("index",i); cswitchOffset[i]->setProperty("index",i);
@@ -72,8 +71,18 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model):
cswitchOffset[i]->setAccelerated(true); cswitchOffset[i]->setAccelerated(true);
cswitchOffset[i]->setDecimals(0); cswitchOffset[i]->setDecimals(0);
connect(cswitchOffset[i], SIGNAL(editingFinished()), this, SLOT(edited())); connect(cswitchOffset[i], SIGNAL(editingFinished()), this, SLOT(edited()));
gridLayout->addWidget(cswitchOffset[i], i+1, 3);
cswitchOffset[i]->setVisible(false); cswitchOffset[i]->setVisible(false);
v2Layout->addWidget(cswitchOffset[i]);
cswitchOffset2[i] = new QDoubleSpinBox(this);
cswitchOffset2[i]->setProperty("index",i);
cswitchOffset2[i]->setMaximum(125);
cswitchOffset2[i]->setMinimum(-125);
cswitchOffset2[i]->setAccelerated(true);
cswitchOffset2[i]->setDecimals(0);
connect(cswitchOffset2[i], SIGNAL(editingFinished()), this, SLOT(edited()));
cswitchOffset2[i]->setVisible(false);
v2Layout->addWidget(cswitchOffset2[i]);
gridLayout->addLayout(v2Layout, i+1, 3);
// AND // AND
cswitchAnd[i] = new QComboBox(this); cswitchAnd[i] = new QComboBox(this);
@@ -105,7 +114,8 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model):
gridLayout->addWidget(cswitchDelay[i], i+1, 6); gridLayout->addWidget(cswitchDelay[i], i+1, 6);
} }
} }
// Push rows upward
addVSpring(gridLayout,0,GetEepromInterface()->getCapability(LogicalSwitches)+1);
lock = false; lock = false;
} }
@@ -205,19 +215,19 @@ void LogicalSwitchesPanel::edited()
switch (model.customSw[i].getFunctionFamily()) switch (model.customSw[i].getFunctionFamily())
{ {
case LS_FAMILY_VOFS: case LS_FAMILY_VOFS:
{ {
source = RawSource(model.customSw[i].val1, &model); source = RawSource(model.customSw[i].val1, &model);
RawSourceRange range = source.getRange(); RawSourceRange range = source.getRange();
if (model.customSw[i].func == LS_FN_DPOS || model.customSw[i].func == LS_FN_DAPOS) { if (model.customSw[i].func == LS_FN_DPOS || model.customSw[i].func == LS_FN_DAPOS) {
model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step); model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step);
cswitchOffset[i]->setValue(model.customSw[i].val2*range.step); cswitchOffset[i]->setValue(model.customSw[i].val2*range.step);
} }
else { else {
model.customSw[i].val2 = ((cswitchOffset[i]->value()-range.offset)/range.step)/* TODO - source.getRawOffset(model)*/; model.customSw[i].val2 = ((cswitchOffset[i]->value()-range.offset)/range.step)/* TODO - source.getRawOffset(model)*/;
cswitchOffset[i]->setValue((model.customSw[i].val2 /* + TODO source.getRawOffset(model)*/)*range.step+range.offset); cswitchOffset[i]->setValue((model.customSw[i].val2 /* + TODO source.getRawOffset(model)*/)*range.step+range.offset);
}
} }
break; break;
}
case LS_FAMILY_TIMER: case LS_FAMILY_TIMER:
model.customSw[i].val1 = TimToVal(cswitchValue[i]->value()); model.customSw[i].val1 = TimToVal(cswitchValue[i]->value());
model.customSw[i].val2 = TimToVal(cswitchOffset[i]->value()); model.customSw[i].val2 = TimToVal(cswitchOffset[i]->value());
@@ -225,8 +235,14 @@ void LogicalSwitchesPanel::edited()
updateTimerParam(cswitchOffset[i], model.customSw[i].val2); updateTimerParam(cswitchOffset[i], model.customSw[i].val2);
break; break;
case LS_FAMILY_STAY: case LS_FAMILY_STAY:
model.customSw[i].val2 = TimToVal(cswitchOffset[i]->value()); if (sender() == cswitchOffset[i]) {
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, true); model.customSw[i].val2 = TimToVal(cswitchOffset[i]->value());
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, true);
}
else {
model.customSw[i].val3 = TimToVal(cswitchOffset2[i]->value()) - model.customSw[i].val2;
}
updateTimerParam(cswitchOffset2[i], model.customSw[i].val2+model.customSw[i].val3, true);
break; break;
default: default:
break; break;
@@ -243,92 +259,98 @@ void LogicalSwitchesPanel::updateTimerParam(QDoubleSpinBox *sb, int timer, bool
sb->setMinimum(allowZero ? 0.0 : 0.1); sb->setMinimum(allowZero ? 0.0 : 0.1);
sb->setMaximum(175); sb->setMaximum(175);
float value = ValToTim(timer); float value = ValToTim(timer);
if (value>60) if (value>=60)
sb->setSingleStep(1); sb->setSingleStep(1);
else if (value>2) else if (value>=2)
sb->setSingleStep(0.5); sb->setSingleStep(0.5);
else else
sb->setSingleStep(0.1); sb->setSingleStep(0.1);
sb->setValue(value); sb->setValue(value);
} }
#define SOURCE1_VISIBLE 0x1
#define SOURCE2_VISIBLE 0x2
#define VALUE1_VISIBLE 0x4
#define VALUE2_VISIBLE 0x8
#define VALUE3_VISIBLE 0x10
void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i) void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
{ {
lock = true; lock = true;
RawSource source = RawSource(model.customSw[i].val1, &model); unsigned int mask = 0;
RawSourceRange range = source.getRange(); RawSource source = RawSource(model.customSw[i].val1, &model);
RawSourceRange range = source.getRange();
switch (model.customSw[i].getFunctionFamily()) switch (model.customSw[i].getFunctionFamily())
{ {
case LS_FAMILY_VOFS: case LS_FAMILY_VOFS:
cswitchSource1[i]->setVisible(true); mask |= SOURCE1_VISIBLE | VALUE2_VISIBLE;
cswitchSource2[i]->setVisible(false); populateSourceCB(cswitchSource1[i], source, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
cswitchValue[i]->setVisible(false); cswitchOffset[i]->setDecimals(range.decimals);
cswitchOffset[i]->setVisible(true); cswitchOffset[i]->setSingleStep(range.step);
populateSourceCB(cswitchSource1[i], source, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0)); if (model.customSw[i].func == LS_FN_DPOS || model.customSw[i].func == LS_FN_DAPOS) {
cswitchOffset[i]->setDecimals(range.decimals); cswitchOffset[i]->setMinimum(range.step*-127);
cswitchOffset[i]->setSingleStep(range.step); cswitchOffset[i]->setMaximum(range.step*127);
if (model.customSw[i].func == LS_FN_DPOS || model.customSw[i].func == LS_FN_DAPOS) { cswitchOffset[i]->setValue(range.step*model.customSw[i].val2);
cswitchOffset[i]->setMinimum(range.step*-127); }
cswitchOffset[i]->setMaximum(range.step*127); else {
cswitchOffset[i]->setValue(range.step*model.customSw[i].val2); cswitchOffset[i]->setMinimum(range.min);
} cswitchOffset[i]->setMaximum(range.max);
else { cswitchOffset[i]->setValue(range.step*(model.customSw[i].val2/* TODO+source.getRawOffset(model)*/)+range.offset);
cswitchOffset[i]->setMinimum(range.min); }
cswitchOffset[i]->setMaximum(range.max); break;
cswitchOffset[i]->setValue(range.step*(model.customSw[i].val2/* TODO+source.getRawOffset(model)*/)+range.offset); case LS_FAMILY_VBOOL:
} case LS_FAMILY_STICKY:
break; mask |= SOURCE1_VISIBLE | SOURCE2_VISIBLE;
case LS_FAMILY_VBOOL: populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1));
case LS_FAMILY_STICKY: populateSwitchCB(cswitchSource2[i], RawSwitch(model.customSw[i].val2));
cswitchSource1[i]->setVisible(true); break;
cswitchSource2[i]->setVisible(true); case LS_FAMILY_STAY:
cswitchValue[i]->setVisible(false); mask |= SOURCE1_VISIBLE | VALUE2_VISIBLE | VALUE3_VISIBLE;
cswitchOffset[i]->setVisible(false); populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1));
populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1)); updateTimerParam(cswitchOffset[i], model.customSw[i].val2, true);
populateSwitchCB(cswitchSource2[i], RawSwitch(model.customSw[i].val2)); updateTimerParam(cswitchOffset2[i], model.customSw[i].val2+model.customSw[i].val3, true);
break; break;
case LS_FAMILY_STAY: case LS_FAMILY_VCOMP:
cswitchSource1[i]->setVisible(true); mask |= SOURCE1_VISIBLE | SOURCE2_VISIBLE;
cswitchSource2[i]->setVisible(false); populateSourceCB(cswitchSource1[i], RawSource(model.customSw[i].val1), model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
cswitchValue[i]->setVisible(false); populateSourceCB(cswitchSource2[i], RawSource(model.customSw[i].val2), model, POPULATE_SOURCES | POPULATE_TRIMS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1)); break;
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, true); case LS_FAMILY_TIMER:
break; updateTimerParam(cswitchValue[i], model.customSw[i].val1);
case LS_FAMILY_VCOMP: updateTimerParam(cswitchOffset[i], model.customSw[i].val2);
cswitchSource1[i]->setVisible(true); break;
cswitchSource2[i]->setVisible(true); }
cswitchValue[i]->setVisible(false);
cswitchOffset[i]->setVisible(false);
populateSourceCB(cswitchSource1[i], RawSource(model.customSw[i].val1), model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
populateSourceCB(cswitchSource2[i], RawSource(model.customSw[i].val2), model, POPULATE_SOURCES | POPULATE_TRIMS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
break;
case LS_FAMILY_TIMER:
cswitchSource1[i]->setVisible(false);
cswitchSource2[i]->setVisible(false);
updateTimerParam(cswitchValue[i], model.customSw[i].val1);
updateTimerParam(cswitchOffset[i], model.customSw[i].val2);
break;
}
lock = false; cswitchSource1[i]->setVisible(mask & SOURCE1_VISIBLE);
cswitchSource2[i]->setVisible(mask & SOURCE2_VISIBLE);
cswitchValue[i]->setVisible(mask & VALUE1_VISIBLE);
cswitchOffset[i]->setVisible(mask & VALUE2_VISIBLE);
cswitchOffset2[i]->setVisible(mask & VALUE3_VISIBLE);
lock = false;
}
void LogicalSwitchesPanel::updateLine(int i)
{
lock = true;
populateCSWCB(csw[i], model.customSw[i].func);
lock = true;
setSwitchWidgetVisibility(i);
lock = true;
populateAndSwitchCB(cswitchAnd[i], RawSwitch(model.customSw[i].andsw));
if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) {
cswitchDuration[i]->setValue(model.customSw[i].duration/10.0);
cswitchDelay[i]->setValue(model.customSw[i].delay/10.0);
}
lock = false;
} }
void LogicalSwitchesPanel::update() void LogicalSwitchesPanel::update()
{ {
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) { for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) {
lock = true; updateLine(i);
populateCSWCB(csw[i], model.customSw[i].func);
lock = false;
setSwitchWidgetVisibility(i);
lock = true;
populateAndSwitchCB(cswitchAnd[i], RawSwitch(model.customSw[i].andsw));
if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) {
cswitchDuration[i]->setValue(model.customSw[i].duration/10.0);
cswitchDelay[i]->setValue(model.customSw[i].delay/10.0);
}
lock = false;
} }
} }
@@ -338,36 +360,27 @@ void LogicalSwitchesPanel::cswPaste()
const QMimeData *mimeData = clipboard->mimeData(); const QMimeData *mimeData = clipboard->mimeData();
if (mimeData->hasFormat("application/x-companion-csw")) { if (mimeData->hasFormat("application/x-companion-csw")) {
QByteArray cswData = mimeData->data("application/x-companion-csw"); QByteArray cswData = mimeData->data("application/x-companion-csw");
LogicalSwitchData *csw = &model.customSw[selectedSwitch]; LogicalSwitchData *csw = &model.customSw[selectedSwitch];
memcpy(csw, cswData.mid(0, sizeof(LogicalSwitchData)).constData(), sizeof(LogicalSwitchData)); memcpy(csw, cswData.mid(0, sizeof(LogicalSwitchData)).constData(), sizeof(LogicalSwitchData));
emit modified(); emit modified();
updateSelectedSwitch(); updateLine(selectedSwitch);
} }
} }
void LogicalSwitchesPanel::cswDelete() void LogicalSwitchesPanel::cswDelete()
{ {
model.customSw[selectedSwitch].clear(); model.customSw[selectedSwitch].clear();
emit modified(); emit modified();
updateSelectedSwitch(); updateLine(selectedSwitch);
} }
void LogicalSwitchesPanel::cswCopy() void LogicalSwitchesPanel::cswCopy()
{ {
QByteArray cswData; QByteArray cswData;
cswData.append((char*)&model.customSw[selectedSwitch],sizeof(LogicalSwitchData)); cswData.append((char*)&model.customSw[selectedSwitch],sizeof(LogicalSwitchData));
QMimeData *mimeData = new QMimeData; QMimeData *mimeData = new QMimeData;
mimeData->setData("application/x-companion-csw", cswData); mimeData->setData("application/x-companion-csw", cswData);
QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard); QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard);
}
void LogicalSwitchesPanel::updateSelectedSwitch()
{
lock = true;
populateCSWCB(csw[selectedSwitch], model.customSw[selectedSwitch].func);
setSwitchWidgetVisibility(selectedSwitch);
lock = false;
} }
void LogicalSwitchesPanel::cswCut() void LogicalSwitchesPanel::cswCut()
+2 -2
View File
@@ -32,6 +32,7 @@ class LogicalSwitchesPanel : public ModelPanel
QComboBox * csw[C9X_NUM_CSW]; QComboBox * csw[C9X_NUM_CSW];
QDoubleSpinBox * cswitchValue[C9X_NUM_CSW]; QDoubleSpinBox * cswitchValue[C9X_NUM_CSW];
QDoubleSpinBox * cswitchOffset[C9X_NUM_CSW]; QDoubleSpinBox * cswitchOffset[C9X_NUM_CSW];
QDoubleSpinBox * cswitchOffset2[C9X_NUM_CSW];
QComboBox * cswitchAnd[C9X_NUM_CSW]; QComboBox * cswitchAnd[C9X_NUM_CSW];
QDoubleSpinBox * cswitchDuration[C9X_NUM_CSW]; QDoubleSpinBox * cswitchDuration[C9X_NUM_CSW];
QDoubleSpinBox * cswitchDelay[C9X_NUM_CSW]; QDoubleSpinBox * cswitchDelay[C9X_NUM_CSW];
@@ -40,8 +41,7 @@ class LogicalSwitchesPanel : public ModelPanel
void setSwitchWidgetVisibility(int i); void setSwitchWidgetVisibility(int i);
int selectedSwitch; int selectedSwitch;
void updateSelectedSwitch(); void updateLine(int index);
void updateV2(int index);
void updateTimerParam(QDoubleSpinBox *sb, int timer, bool allowZero=false); void updateTimerParam(QDoubleSpinBox *sb, int timer, bool allowZero=false);
}; };
+7 -10
View File
@@ -27,12 +27,6 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, i
gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, md->weight, 100, -limit, limit); gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, md->weight, 100, -limit, limit);
gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, md->sOffset, 0, -limit, limit); gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, md->sOffset, 0, -limit, limit);
if (GetEepromInterface()->getCapability(VirtualInputs)) {
ui->trimLabel->hide();
ui->trimCB->hide();
}
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, md->curve); curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, md->curve);
ui->MixDR_CB->setChecked(md->noExpo==0); ui->MixDR_CB->setChecked(md->noExpo==0);
@@ -41,10 +35,13 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, i
ui->label_MixDR->hide(); ui->label_MixDR->hide();
} }
ui->trimCB->addItem(tr("Rud"), 1); if (!GetEepromInterface()->getCapability(VirtualInputs)) {
ui->trimCB->addItem(tr("Ele"), 2); ui->trimCB->addItem(tr("Rud"));
ui->trimCB->addItem(tr("Thr"), 3); ui->trimCB->addItem(tr("Ele"));
ui->trimCB->addItem(tr("Ail"), 4); ui->trimCB->addItem(tr("Thr"));
ui->trimCB->addItem(tr("Ail"));
}
ui->trimCB->setCurrentIndex(1 - md->carryTrim); ui->trimCB->setCurrentIndex(1 - md->carryTrim);
int namelength = GetEepromInterface()->getCapability(HasMixerNames); int namelength = GetEepromInterface()->getCapability(HasMixerNames);
+35 -52
View File
@@ -43,6 +43,29 @@ MixesPanel::~MixesPanel()
{ {
} }
QString MixesPanel::getChannelLabel(int curDest)
{
QString str;
int outputs = GetEepromInterface()->getCapability(Outputs);
if (curDest > outputs) {
str = QObject::tr("X%1 ").arg(curDest-outputs);
}
else {
str = QObject::tr("CH%1").arg(curDest);
str.append(" ");
str = str.left(4);
if (GetEepromInterface()->getCapability(HasChNames)) {
QString name = model.limitData[curDest-1].name;
if (!name.isEmpty()) {
name = QString("(") + name + QString(")");
}
name.append(" ");
str += name.left(8);
}
}
return str;
}
void MixesPanel::update() void MixesPanel::update()
{ {
// curDest -> destination channel4 // curDest -> destination channel4
@@ -52,26 +75,13 @@ void MixesPanel::update()
unsigned int curDest = 0; unsigned int curDest = 0;
int i; int i;
unsigned int outputs = GetEepromInterface()->getCapability(Outputs); unsigned int outputs = GetEepromInterface()->getCapability(Outputs);
int showNames = false; // TODO in a menu ui->showNames_Ckb->isChecked();
for (i=0; i<GetEepromInterface()->getCapability(Mixes); i++) { for (i=0; i<GetEepromInterface()->getCapability(Mixes); i++) {
MixData *md = &model.mixData[i]; MixData *md = &model.mixData[i];
if ((md->destCh==0) || (md->destCh>outputs+(unsigned int)GetEepromInterface()->getCapability(ExtraChannels))) continue; if ((md->destCh==0) || (md->destCh>outputs+(unsigned int)GetEepromInterface()->getCapability(ExtraChannels))) continue;
QString str = ""; QString str = "";
while (curDest<(md->destCh-1)) { while (curDest < md->destCh-1) {
curDest++; curDest++;
if (curDest > outputs) { str = getChannelLabel(curDest);
str = tr("X%1 ").arg(curDest-outputs);
}
else {
str = tr("CH%1%2").arg(curDest/10).arg(curDest%10);
if (GetEepromInterface()->getCapability(HasChNames) && showNames) {
QString name=model.limitData[curDest-1].name;
if (!name.isEmpty()) {
name.append(" ");
str=name.left(6);
}
}
}
qba.clear(); qba.clear();
qba.append((quint8)-curDest); qba.append((quint8)-curDest);
QListWidgetItem *itm = new QListWidgetItem(str); QListWidgetItem *itm = new QListWidgetItem(str);
@@ -79,23 +89,12 @@ void MixesPanel::update()
MixerlistWidget->addItem(itm); MixerlistWidget->addItem(itm);
} }
if (md->destCh > outputs) { str = getChannelLabel(md->destCh);
str = tr("X%1 ").arg(md->destCh-outputs);
}
else {
str = tr("CH%1%2").arg(md->destCh/10).arg(md->destCh%10);
str.append(" ");
if (GetEepromInterface()->getCapability(HasChNames) && showNames) {
QString name=model.limitData[md->destCh-1].name;
if (!name.isEmpty()) {
name.append(" ");
str=name.left(6);
}
}
}
if (curDest != md->destCh) { if (curDest != md->destCh) {
curDest = md->destCh; curDest = md->destCh;
} else { }
else {
str.fill(' '); str.fill(' ');
} }
@@ -116,13 +115,11 @@ void MixesPanel::update()
str += " " + tr("Switch(%1)").arg(md->swtch.toString()); str += " " + tr("Switch(%1)").arg(md->swtch.toString());
} }
if (!GetEepromInterface()->getCapability(VirtualInputs)) { if (md->carryTrim>0) {
if (md->carryTrim>0) { str += " " + tr("No Trim");
str += " " + tr("No Trim"); }
} else if (md->carryTrim<0) {
else if (md->carryTrim<0) { str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString();
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString();
}
} }
if (md->noExpo) str += " " + tr("No DR/Expo"); if (md->noExpo) str += " " + tr("No DR/Expo");
@@ -154,21 +151,7 @@ void MixesPanel::update()
while(curDest<outputs+GetEepromInterface()->getCapability(ExtraChannels)) { while(curDest<outputs+GetEepromInterface()->getCapability(ExtraChannels)) {
curDest++; curDest++;
QString str; QString str = getChannelLabel(curDest);
if (curDest > outputs) {
str = tr("X%1 ").arg(curDest-outputs);
}
else {
str = tr("CH%1%2").arg(curDest/10).arg(curDest%10);
if (GetEepromInterface()->getCapability(HasChNames) && showNames) {
QString name=model.limitData[curDest-1].name;
if (!name.isEmpty()) {
name.append(" ");
str=name.left(6);
}
}
}
qba.clear(); qba.clear();
qba.append((quint8)-curDest); qba.append((quint8)-curDest);
QListWidgetItem *itm = new QListWidgetItem(str); QListWidgetItem *itm = new QListWidgetItem(str);
+1 -1
View File
@@ -50,7 +50,7 @@ class MixesPanel : public ModelPanel
void mixersDeleteList(QList<int> list); void mixersDeleteList(QList<int> list);
QList<int> createMixListFromSelected(); QList<int> createMixListFromSelected();
void setSelectedByMixList(QList<int> list); void setSelectedByMixList(QList<int> list);
QString getChannelLabel(int curDest);
}; };
#endif // MIXES_H #endif // MIXES_H
+2 -1
View File
@@ -22,6 +22,7 @@ ModelEdit::ModelEdit(RadioData & radioData, int modelId, bool openWizard, bool i
generalSettings(radioData.generalSettings) generalSettings(radioData.generalSettings)
{ {
ui->setupUi(this); ui->setupUi(this);
setWindowIcon(CompanionIcon("edit.png"));
restoreGeometry(g.modelEditGeo()); restoreGeometry(g.modelEditGeo());
ui->pushButton->setIcon(CompanionIcon("simulate.png")); ui->pushButton->setIcon(CompanionIcon("simulate.png"));
addTab(new Setup(this, model), tr("Setup")); addTab(new Setup(this, model), tr("Setup"));
@@ -32,7 +33,7 @@ ModelEdit::ModelEdit(RadioData & radioData, int modelId, bool openWizard, bool i
addTab(new Channels(this, model), tr("Channels")); addTab(new Channels(this, model), tr("Channels"));
addTab(new LogicalSwitchesPanel(this, model), tr("Logical Switches")); addTab(new LogicalSwitchesPanel(this, model), tr("Logical Switches"));
if (GetEepromInterface()->getCapability(CustomFunctions)) if (GetEepromInterface()->getCapability(CustomFunctions))
addTab(new CustomFunctionsPanel(this, model, radioData.generalSettings), tr("Switch Assignment")); addTab(new CustomFunctionsPanel(this, model, radioData.generalSettings), tr("Special Functions"));
addTab(new Curves(this, model), tr("Curves")); addTab(new Curves(this, model), tr("Curves"));
if (GetEepromInterface()->getCapability(Telemetry) & TM_HASTELEMETRY) if (GetEepromInterface()->getCapability(Telemetry) & TM_HASTELEMETRY)
addTab(new TelemetryPanel(this, model), tr("Telemetry")); addTab(new TelemetryPanel(this, model), tr("Telemetry"));
+29 -2
View File
@@ -16,15 +16,42 @@ void ModelPanel::update()
{ {
} }
void ModelPanel::addLabel(QGridLayout * gridLayout, QString text, int col) void ModelPanel::addLabel(QGridLayout * gridLayout, QString text, int col, bool minimize)
{ {
QLabel *label = new QLabel(this); QLabel *label = new QLabel(this);
label->setFrameShape(QFrame::Panel); label->setFrameShape(QFrame::Panel);
label->setFrameShadow(QFrame::Raised); label->setFrameShadow(QFrame::Raised);
label->setMidLineWidth(0); label->setMidLineWidth(0);
label->setAlignment(Qt::AlignCenter); label->setAlignment(Qt::AlignCenter);
label->setMargin(3); label->setMargin(5);
label->setText(text); label->setText(text);
if (!minimize)
label->setMinimumWidth(100);
gridLayout->addWidget(label, 0, col, 1, 1); gridLayout->addWidget(label, 0, col, 1, 1);
} }
void ModelPanel::addEmptyLabel(QGridLayout * gridLayout, int col)
{
QLabel *label = new QLabel(this);
label->setText("");
gridLayout->addWidget(label, 0, col, 1, 1);
}
void ModelPanel::addHSpring(QGridLayout * gridLayout, int col, int row)
{
QSpacerItem * spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
gridLayout->addItem(spacer, row, col);
}
void ModelPanel::addVSpring(QGridLayout * gridLayout, int col, int row)
{
QSpacerItem * spacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
gridLayout->addItem(spacer, row, col);
}
void ModelPanel::addDoubleSpring(QGridLayout * gridLayout, int col, int row)
{
QSpacerItem * spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding );
gridLayout->addItem(spacer, row, col);
}
+5 -2
View File
@@ -22,8 +22,11 @@ class ModelPanel : public QWidget
protected: protected:
ModelData & model; ModelData & model;
bool lock; bool lock;
void addLabel(QGridLayout * gridLayout, QString text, int col); void addLabel(QGridLayout * gridLayout, QString text, int col, bool mimimize=false);
void addEmptyLabel(QGridLayout * gridLayout, int col);
void addHSpring(QGridLayout *, int col, int row);
void addVSpring(QGridLayout *, int col, int row);
void addDoubleSpring(QGridLayout *, int col, int row);
}; };
#endif // CHANNELS_H #endif // CHANNELS_H
+51 -13
View File
@@ -112,11 +112,15 @@ ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module
else { else {
ui->label_trainerMode->hide(); ui->label_trainerMode->hide();
ui->trainerMode->hide(); ui->trainerMode->hide();
if (moduleIdx == 0) if (GetEepromInterface()->getCapability(NumModules) > 1) {
label = tr("Internal Radio System"); if (moduleIdx == 0)
else label = tr("Internal Radio System");
label = tr("External Radio Module"); else
label = tr("External Radio Module");
}
else {
label = tr("Radio System");
}
} }
ui->label_module->setText(label); ui->label_module->setText(label);
@@ -351,14 +355,13 @@ Setup::Setup(QWidget *parent, ModelData & model):
QString path = g.profile[g.id()].sdPath(); QString path = g.profile[g.id()].sdPath();
path.append("/BMP/"); path.append("/BMP/");
QDir qd(path); QDir qd(path);
int vml = GetEepromInterface()->getCapability(VoicesMaxLength)+4;
if (qd.exists()) { if (qd.exists()) {
QStringList filters; QStringList filters;
filters << "*.bmp" << "*.bmp"; filters << "*.bmp" << "*.bmp";
foreach ( QString file, qd.entryList(filters, QDir::Files) ) { foreach ( QString file, qd.entryList(filters, QDir::Files) ) {
QFileInfo fi(file); QFileInfo fi(file);
QString temp = fi.completeBaseName(); QString temp = fi.completeBaseName();
if (!items.contains(temp) && temp.length() <= vml) { if (!items.contains(temp) && temp.length() <= 10+4) {
items.append(temp); items.append(temp);
} }
} }
@@ -500,8 +503,10 @@ void Setup::on_trimIncrement_currentIndexChanged(int index)
void Setup::on_throttleSource_currentIndexChanged(int index) void Setup::on_throttleSource_currentIndexChanged(int index)
{ {
model.thrTraceSrc = index; if (!lock) {
emit modified(); model.thrTraceSrc = ui->throttleSource->itemData(index).toInt();
emit modified();
}
} }
void Setup::on_name_editingFinished() void Setup::on_name_editingFinished()
@@ -514,8 +519,8 @@ void Setup::on_name_editingFinished()
void Setup::on_image_currentIndexChanged(int index) void Setup::on_image_currentIndexChanged(int index)
{ {
if (!lock) { if (!lock) {
strncpy(model.bitmap, ui->image->currentText().toAscii(), GetEepromInterface()->getCapability(VoicesMaxLength)); strncpy(model.bitmap, ui->image->currentText().toAscii(), 10);
QString path=g.profile[g.id()].sdPath(); QString path = g.profile[g.id()].sdPath();
path.append("/BMP/"); path.append("/BMP/");
QDir qd(path); QDir qd(path);
if (qd.exists()) { if (qd.exists()) {
@@ -530,7 +535,7 @@ void Setup::on_image_currentIndexChanged(int index)
image.load(fileName); image.load(fileName);
} }
if (!image.isNull()) { if (!image.isNull()) {
ui->imagePreview->setPixmap(QPixmap::fromImage(image.scaled( 64,32)));; ui->imagePreview->setPixmap(QPixmap::fromImage(image.scaled(64, 32)));;
} }
else { else {
ui->imagePreview->clear(); ui->imagePreview->clear();
@@ -543,12 +548,45 @@ void Setup::on_image_currentIndexChanged(int index)
} }
} }
void Setup::populateThrottleSourceCB()
{
const QString sources9x[] = { QObject::tr("THR"), QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3")};
const QString sourcesTaranis[] = { QObject::tr("THR"), QObject::tr("S1"), QObject::tr("S2"), QObject::tr("S3"), QObject::tr("LS"), QObject::tr("RS")};
unsigned int i;
lock = true;
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
for (i=0; i<6; i++) {
ui->throttleSource->addItem(sourcesTaranis[i], i);
}
}
else {
for (i=0; i<4; i++) {
ui->throttleSource->addItem(sources9x[i], i);
}
}
if (model.thrTraceSrc < i)
ui->throttleSource->setCurrentIndex(model.thrTraceSrc);
int channels = (IS_ARM(GetEepromInterface()->getBoard()) ? 32 : 16);
for (int i=0; i<channels; i++) {
ui->throttleSource->addItem(QObject::tr("CH%1").arg(i+1, 2, 10, QChar('0')), THROTTLE_SOURCE_FIRST_CHANNEL+i);
if (model.thrTraceSrc == unsigned(THROTTLE_SOURCE_FIRST_CHANNEL+i))
ui->throttleSource->setCurrentIndex(ui->throttleSource->count()-1);
}
lock = false;
}
void Setup::update() void Setup::update()
{ {
ui->name->setText(model.name); ui->name->setText(model.name);
ui->throttleReverse->setChecked(model.throttleReversed); ui->throttleReverse->setChecked(model.throttleReversed);
populateTTraceCB(ui->throttleSource, model.thrTraceSrc); populateThrottleSourceCB();
ui->throttleWarning->setChecked(!model.disableThrottleWarning); ui->throttleWarning->setChecked(!model.disableThrottleWarning);
//trim inc, thro trim, thro expo, instatrim //trim inc, thro trim, thro expo, instatrim
+2
View File
@@ -6,6 +6,7 @@
#include <QCheckBox> #include <QCheckBox>
#include <QSlider> #include <QSlider>
#include <QSpinBox> #include <QSpinBox>
#include <QComboBox>
#include <QLabel> #include <QLabel>
namespace Ui { namespace Ui {
@@ -104,6 +105,7 @@ class Setup : public ModelPanel
void updateStartupSwitches(); void updateStartupSwitches();
void updatePotWarnings(); void updatePotWarnings();
void updateBeepCenter(); void updateBeepCenter();
void populateThrottleSourceCB();
}; };
#endif // SETUP_H #endif // SETUP_H
+421 -288
View File
@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>787</width> <width>840</width>
<height>727</height> <height>520</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -16,175 +16,88 @@
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="1"> <item row="4" column="1">
<layout class="QGridLayout" name="gridLayout_37" columnstretch="0,0,0,0,0,0"> <layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="3"> <item row="0" column="3">
<widget class="QComboBox" name="image"/> <widget class="QCheckBox" name="throttleReverse">
</item> <property name="whatsThis">
<item row="0" column="4"> <string>Reverse throttle operation.
<widget class="QLabel" name="imagePreview"> If this is checked the throttle will be reversed. Idle will be forward, trim will also be reversed and the throttle warning will be reversed as well.
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum"> </string>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="minimumSize"> <property name="layoutDirection">
<size> <enum>Qt::LeftToRight</enum>
<width>64</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>32</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property> </property>
<property name="text"> <property name="text">
<string/> <string>Reverse Throttle</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="5"> <item row="1" column="1">
<spacer name="horizontalSpacer_26"> <widget class="QCheckBox" name="extendedLimits">
<property name="orientation"> <property name="layoutDirection">
<enum>Qt::Horizontal</enum> <enum>Qt::LeftToRight</enum>
</property> </property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_24">
<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="2">
<widget class="QLabel" name="modelImage_label">
<property name="text"> <property name="text">
<string>Model Image</string> <string>Extended Limits</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLineEdit" name="name"> <widget class="QComboBox" name="throttleSource">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="maxLength"> </widget>
<number>10</number> </item>
<item row="1" column="2">
<widget class="QCheckBox" name="extendedTrims">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Extended Trims</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> <item row="0" column="1">
</item> <widget class="QCheckBox" name="throttleTrim">
<item row="0" column="0"> <property name="layoutDirection">
<widget class="QLabel" name="label"> <enum>Qt::LeftToRight</enum>
<property name="text"> </property>
<string>Model Name</string> <property name="text">
</property> <string>Throttle Trim</string>
<property name="alignment"> </property>
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </widget>
</property> </item>
</widget> <item row="0" column="2">
</item> <widget class="QCheckBox" name="throttleWarning">
<item row="2" column="0"> <property name="layoutDirection">
<widget class="QLabel" name="label_timer2"> <enum>Qt::LeftToRight</enum>
<property name="text"> </property>
<string>Timer2</string> <property name="text">
</property> <string>Throttle Warning</string>
<property name="alignment"> </property>
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </widget>
</property> </item>
</widget> <item row="0" column="4">
</item> <spacer name="horizontalSpacer">
<item row="1" column="0"> <property name="orientation">
<widget class="QLabel" name="label_2"> <enum>Qt::Horizontal</enum>
<property name="text"> </property>
<string>Timer1</string> <property name="sizeHint" stdset="0">
</property> <size>
<property name="alignment"> <width>40</width>
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <height>20</height>
</property> </size>
</widget> </property>
</item> </spacer>
<item row="3" column="0"> </item>
<widget class="QLabel" name="label_ttrace"> <item row="1" column="0">
<property name="text">
<string>Throttle Source</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="swwarn_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Switch Warnings</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Center beep</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="7" column="1">
<layout class="QGridLayout" name="centerBeepLayout"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Trim Increment</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QComboBox" name="trimIncrement"> <widget class="QComboBox" name="trimIncrement">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
@@ -219,173 +132,393 @@
</item> </item>
</widget> </widget>
</item> </item>
<item> <item row="1" column="3">
<widget class="QCheckBox" name="extendedLimits">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Extended Limits</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="extendedTrims">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Extended Trims</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="displayText"> <widget class="QCheckBox" name="displayText">
<property name="layoutDirection"> <property name="layoutDirection">
<enum>Qt::RightToLeft</enum> <enum>Qt::LeftToRight</enum>
</property> </property>
<property name="text"> <property name="text">
<string>Display Checklist</string> <string>Display Checklist</string>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<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>
</layout> </layout>
</item> </item>
<item row="3" column="1"> <item row="2" column="0" alignment="Qt::AlignRight|Qt::AlignVCenter">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <widget class="QLabel" name="label_timer2">
<item> <property name="font">
<widget class="QComboBox" name="throttleSource"> <font>
<property name="sizePolicy"> <weight>50</weight>
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <bold>false</bold>
<horstretch>0</horstretch> </font>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="throttleTrim">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Throttle Trim</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="throttleWarning">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Throttle Warning</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="throttleReverse">
<property name="whatsThis">
<string>Reverse throttle operation.
If this is checked the throttle will be reversed. Idle will be forward, trim will also be reversed and the throttle warning will be reversed as well.
</string>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Reverse Throttle</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_9">
<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="5" column="1">
<layout class="QGridLayout" name="switchesStartupLayout" rowstretch="0" columnstretch="0">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
</layout>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_potWarning">
<property name="enabled">
<bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Pot Warnings</string> <string>Timer2</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1"> <item row="1" column="0" alignment="Qt::AlignRight|Qt::AlignVCenter">
<layout class="QGridLayout" name="potWarningLayout"> <widget class="QLabel" name="label_2">
<item row="0" column="0"> <property name="font">
<widget class="QComboBox" name="potWarningMode"> <font>
<item> <weight>50</weight>
<property name="text"> <bold>false</bold>
<string>OFF</string> </font>
</property> </property>
</item> <property name="text">
<item> <string>Timer1</string>
<property name="text"> </property>
<string>Manual</string> <property name="alignment">
</property> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</item> </property>
<item> </widget>
<property name="text"> </item>
<string>Auto</string> <item row="4" column="0">
</property> <layout class="QVBoxLayout" name="verticalLayout_2">
</item> <item alignment="Qt::AlignRight">
<widget class="QLabel" name="label_ttrace">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Throttle Source</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item alignment="Qt::AlignRight">
<widget class="QLabel" name="label_10">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Trim Increment</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item row="3" column="1">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="6" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<layout class="QGridLayout" name="centerBeepLayout"/>
</item>
<item>
<spacer name="horizontalSpacer_4">
<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="7" column="0" colspan="2">
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_12">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Center beep</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="Line" name="line_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="name">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxLength">
<number>10</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="modelImage_label">
<property name="text">
<string>Model Image</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="imagePreview">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>64</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>32</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="image"/>
</item>
<item>
<spacer name="horizontalSpacer_26">
<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>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="8" column="0" alignment="Qt::AlignLeft|Qt::AlignTop">
<widget class="QLabel" name="swwarn_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Warnings</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="8" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Switch Warnings</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="switchesStartupLayout" rowstretch="0" columnstretch="0">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item alignment="Qt::AlignTop">
<widget class="QLabel" name="label_potWarning">
<property name="text">
<string>Pot Warnings</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="potWarningLayout">
<item row="0" column="0" alignment="Qt::AlignTop">
<widget class="QComboBox" name="potWarningMode">
<item>
<property name="text">
<string>OFF</string>
</property>
</item>
<item>
<property name="text">
<string>Manual</string>
</property>
</item>
<item>
<property name="text">
<string>Auto</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_3">
<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="0" column="0" alignment="Qt::AlignLeft|Qt::AlignTop">
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Model</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QVBoxLayout" name="modulesLayout"/> <layout class="QVBoxLayout" name="modulesLayout"/>
</item> </item>
<item> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer_3">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
+168 -122
View File
@@ -6,14 +6,46 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>694</width> <width>628</width>
<height>340</height> <height>300</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_module">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Label</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="moduleGB"> <widget class="QGroupBox" name="moduleGB">
<property name="sizePolicy"> <property name="sizePolicy">
@@ -35,7 +67,41 @@
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
<layout class="QGridLayout" name="gridLayout_69" rowstretch="0,0,0,0,0,0,0,0,0" columnstretch="0,0,0,0,0,0,0"> <layout class="QGridLayout" name="gridLayout_69" rowstretch="0,0,0,0,0,0,0,0,0" columnstretch="0,0,0,0,0,0,0">
<item row="7" column="1" colspan="5"> <property name="margin">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="2" column="3" alignment="Qt::AlignLeft">
<widget class="QSpinBox" name="channelsStart">
<property name="maximumSize">
<size>
<width>125</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="suffix">
<string>ch</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>32</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
<item row="6" column="1" colspan="5">
<widget class="QFrame" name="failsafesFrame"> <widget class="QFrame" name="failsafesFrame">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
@@ -56,7 +122,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="6" column="0"> <item row="5" column="0">
<widget class="QLabel" name="label_failsafeMode"> <widget class="QLabel" name="label_failsafeMode">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
@@ -72,7 +138,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="2" alignment="Qt::AlignRight"> <item row="2" column="2" alignment="Qt::AlignRight">
<widget class="QLabel" name="label_channelsStart"> <widget class="QLabel" name="label_channelsStart">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
@@ -88,7 +154,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="2" column="1">
<widget class="QComboBox" name="protocol"> <widget class="QComboBox" name="protocol">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
@@ -98,7 +164,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="4" alignment="Qt::AlignRight"> <item row="3" column="4" alignment="Qt::AlignRight">
<widget class="QLabel" name="label_ppmDelay"> <widget class="QLabel" name="label_ppmDelay">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
@@ -114,7 +180,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="5"> <item row="3" column="5">
<widget class="QSpinBox" name="ppmDelay"> <widget class="QSpinBox" name="ppmDelay">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
@@ -142,7 +208,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="3" alignment="Qt::AlignLeft"> <item row="3" column="3" alignment="Qt::AlignLeft">
<widget class="QComboBox" name="ppmPolarity"> <widget class="QComboBox" name="ppmPolarity">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
@@ -168,23 +234,7 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item row="0" column="1">
<widget class="QLabel" name="label_rxNumber">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>RX Number</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="trainerMode"> <widget class="QComboBox" name="trainerMode">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -210,7 +260,7 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="4" column="2" alignment="Qt::AlignRight"> <item row="3" column="2" alignment="Qt::AlignRight">
<widget class="QLabel" name="label_ppmPolarity"> <widget class="QLabel" name="label_ppmPolarity">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
@@ -226,7 +276,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" alignment="Qt::AlignRight"> <item row="0" column="0" alignment="Qt::AlignRight">
<widget class="QLabel" name="label_trainerMode"> <widget class="QLabel" name="label_trainerMode">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
@@ -242,38 +292,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="3" column="1">
<widget class="QSpinBox" name="rxNumber">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>125</width>
<height>16777215</height>
</size>
</property>
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>125</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QDoubleSpinBox" name="ppmFrameLength"> <widget class="QDoubleSpinBox" name="ppmFrameLength">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -307,33 +326,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0" alignment="Qt::AlignRight"> <item row="2" column="5" alignment="Qt::AlignLeft">
<widget class="QLabel" name="label_ppmFrameLength">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>PPM Frame Length</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="0" colspan="7">
<widget class="QLabel" name="label_module">
<property name="styleSheet">
<string notr="true">font-weight: bold;</string>
</property>
<property name="text">
<string>Label</string>
</property>
</widget>
</item>
<item row="3" column="5" alignment="Qt::AlignLeft">
<widget class="QSpinBox" name="channelsCount"> <widget class="QSpinBox" name="channelsCount">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
@@ -361,35 +354,23 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="3" alignment="Qt::AlignLeft"> <item row="3" column="0" alignment="Qt::AlignRight">
<widget class="QSpinBox" name="channelsStart"> <widget class="QLabel" name="label_ppmFrameLength">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>125</width> <width>16777215</width>
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="text">
<string>PPM Frame Length</string>
</property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
<property name="suffix">
<string>ch</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>32</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget> </widget>
</item> </item>
<item row="3" column="4" alignment="Qt::AlignRight"> <item row="2" column="4" alignment="Qt::AlignRight">
<widget class="QLabel" name="label_channelsCount"> <widget class="QLabel" name="label_channelsCount">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@@ -411,7 +392,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1" alignment="Qt::AlignLeft"> <item row="5" column="1" alignment="Qt::AlignLeft">
<widget class="QComboBox" name="failsafeMode"> <widget class="QComboBox" name="failsafeMode">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -440,9 +421,14 @@
<string>No Pulses</string> <string>No Pulses</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>Receiver</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item row="7" column="0" alignment="Qt::AlignRight"> <item row="6" column="0" alignment="Qt::AlignRight">
<widget class="QLabel" name="failsafesLayoutLabel"> <widget class="QLabel" name="failsafesLayoutLabel">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
@@ -458,20 +444,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="0"> <item row="2" column="0" alignment="Qt::AlignRight">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0" alignment="Qt::AlignRight">
<widget class="QLabel" name="label_protocol"> <widget class="QLabel" name="label_protocol">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
@@ -487,6 +460,79 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="6">
<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="8" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="5">
<widget class="QSpinBox" name="rxNumber">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>125</width>
<height>16777215</height>
</size>
</property>
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>125</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
<item row="5" column="4">
<widget class="QLabel" name="label_rxNumber">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>RX Number</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
+72 -19
View File
@@ -28,10 +28,20 @@ TelemetryAnalog::TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog):
update(); update();
ui->UnitCB->setCurrentIndex(analog.type); ui->UnitCB->setCurrentIndex(analog.type);
ui->alarm1LevelCB->setCurrentIndex(analog.alarms[0].level); if (!IS_TARANIS(GetEepromInterface()->getBoard())) {
ui->alarm1GreaterCB->setCurrentIndex(analog.alarms[0].greater); ui->alarm1LevelCB->setCurrentIndex(analog.alarms[0].level);
ui->alarm2LevelCB->setCurrentIndex(analog.alarms[1].level); ui->alarm1GreaterCB->setCurrentIndex(analog.alarms[0].greater);
ui->alarm2GreaterCB->setCurrentIndex(analog.alarms[1].greater); ui->alarm2LevelCB->setCurrentIndex(analog.alarms[1].level);
ui->alarm2GreaterCB->setCurrentIndex(analog.alarms[1].greater);
}
else {
ui->alarm1LevelCB->hide();
ui->alarm2LevelCB->hide();
ui->alarm1GreaterCB->hide();
ui->alarm2GreaterCB->hide();
ui->alarm1Label->setText(tr("Low Alarm"));
ui->alarm2Label->setText(tr("Critical Alarm"));
}
if (!(GetEepromInterface()->getCapability(Telemetry) & TM_HASOFFSET)) { if (!(GetEepromInterface()->getCapability(Telemetry) & TM_HASOFFSET)) {
ui->CalibSB->hide(); ui->CalibSB->hide();
@@ -281,7 +291,7 @@ TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model,
for (int c=0; c<GetEepromInterface()->getCapability(TelemetryCustomScreensFieldsPerLine); c++) { for (int c=0; c<GetEepromInterface()->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
fieldsCB[l][c] = new QComboBox(this); fieldsCB[l][c] = new QComboBox(this);
fieldsCB[l][c]->setProperty("index", c + (l<<8)); fieldsCB[l][c]->setProperty("index", c + (l<<8));
populateCustomScreenFieldCB(fieldsCB[l][c], screen.body.lines[l].source[c], (l<4), model.frsky.usrProto); populateTelemetrySourceCB(fieldsCB[l][c], screen.body.lines[l].source[c], l==3, model.frsky.usrProto);
ui->screenNumsLayout->addWidget(fieldsCB[l][c], l, c, 1, 1); ui->screenNumsLayout->addWidget(fieldsCB[l][c], l, c, 1, 1);
connect(fieldsCB[l][c], SIGNAL(currentIndexChanged(int)), this, SLOT(customFieldChanged(int))); connect(fieldsCB[l][c], SIGNAL(currentIndexChanged(int)), this, SLOT(customFieldChanged(int)));
} }
@@ -290,7 +300,7 @@ TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model,
for (int l=0; l<4; l++) { for (int l=0; l<4; l++) {
barsCB[l] = new QComboBox(this); barsCB[l] = new QComboBox(this);
barsCB[l]->setProperty("index", l); barsCB[l]->setProperty("index", l);
populateCustomScreenFieldCB(barsCB[l], screen.body.bars[l].source, false, model.frsky.usrProto); populateTelemetrySourceCB(barsCB[l], screen.body.bars[l].source, false, model.frsky.usrProto);
connect(barsCB[l], SIGNAL(currentIndexChanged(int)), this, SLOT(barSourceChanged(int))); connect(barsCB[l], SIGNAL(currentIndexChanged(int)), this, SLOT(barSourceChanged(int)));
ui->screenBarsLayout->addWidget(barsCB[l], l, 0, 1, 1); ui->screenBarsLayout->addWidget(barsCB[l], l, 0, 1, 1);
@@ -316,6 +326,31 @@ TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model,
update(); update();
} }
void TelemetryCustomScreen::populateTelemetrySourceCB(QComboBox *b, unsigned int value, bool last, int hubproto)
{
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_STATUS_COUNT : TELEMETRY_SOURCES_DISPLAY_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);
}
TelemetryCustomScreen::~TelemetryCustomScreen() TelemetryCustomScreen::~TelemetryCustomScreen()
{ {
delete ui; delete ui;
@@ -347,6 +382,8 @@ void TelemetryCustomScreen::update()
void TelemetryCustomScreen::updateBar(int line) void TelemetryCustomScreen::updateBar(int line)
{ {
lock = true;
int index = screen.body.bars[line].source; int index = screen.body.bars[line].source;
barsCB[line]->setCurrentIndex(index); barsCB[line]->setCurrentIndex(index);
if (index) { if (index) {
@@ -372,6 +409,8 @@ void TelemetryCustomScreen::updateBar(int line)
minSB[line]->setDisabled(true); minSB[line]->setDisabled(true);
maxSB[line]->setDisabled(true); maxSB[line]->setDisabled(true);
} }
lock = false;
} }
void TelemetryCustomScreen::on_screenType_currentIndexChanged(int index) void TelemetryCustomScreen::on_screenType_currentIndexChanged(int index)
@@ -393,13 +432,15 @@ void TelemetryCustomScreen::customFieldChanged(int value)
void TelemetryCustomScreen::barSourceChanged(int index) void TelemetryCustomScreen::barSourceChanged(int index)
{ {
QComboBox * cb = qobject_cast<QComboBox*>(sender()); if (!lock) {
int line = cb->property("index").toInt(); QComboBox * cb = qobject_cast<QComboBox*>(sender());
screen.body.bars[line].source = index; int line = cb->property("index").toInt();
screen.body.bars[line].barMin = 0; screen.body.bars[line].source = index;
screen.body.bars[line].barMax = 0; screen.body.bars[line].barMin = 0;
updateBar(line); screen.body.bars[line].barMax = 0;
emit modified(); updateBar(line);
emit modified();
}
} }
void TelemetryCustomScreen::barMinChanged(double value) void TelemetryCustomScreen::barMinChanged(double value)
@@ -447,6 +488,10 @@ TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model):
ui->customScreens->addTab(tab, tr("Telemetry screen %1").arg(i+1)); ui->customScreens->addTab(tab, tr("Telemetry screen %1").arg(i+1));
} }
if (IS_ARM(GetEepromInterface()->getBoard())) {
ui->bladesCount->setMinimum(1);
}
setup(); setup();
} }
@@ -467,8 +512,16 @@ void TelemetryPanel::setup()
} }
ui->rssiAlarm1SB->setValue(model.frsky.rssiAlarms[0].value); ui->rssiAlarm1SB->setValue(model.frsky.rssiAlarms[0].value);
ui->rssiAlarm2SB->setValue(model.frsky.rssiAlarms[1].value); ui->rssiAlarm2SB->setValue(model.frsky.rssiAlarms[1].value);
ui->rssiAlarm1CB->setCurrentIndex(model.frsky.rssiAlarms[0].level); if (!IS_TARANIS(GetEepromInterface()->getBoard())) {
ui->rssiAlarm2CB->setCurrentIndex(model.frsky.rssiAlarms[1].level); ui->rssiAlarm1CB->setCurrentIndex(model.frsky.rssiAlarms[0].level);
ui->rssiAlarm2CB->setCurrentIndex(model.frsky.rssiAlarms[1].level);
}
else {
ui->rssiAlarm1CB->hide();
ui->rssiAlarm2CB->hide();
ui->rssiAlarm1Label->setText(tr("Low Alarm"));
ui->rssiAlarm2Label->setText(tr("Critical Alarm"));
}
if (!GetEepromInterface()->getCapability(HasAltitudeSel)) { if (!GetEepromInterface()->getCapability(HasAltitudeSel)) {
ui->AltitudeGPS_ChkB->hide(); ui->AltitudeGPS_ChkB->hide();
@@ -585,7 +638,7 @@ void TelemetryPanel::setup()
ui->frskyProtoCB->setCurrentIndex(model.frsky.usrProto); ui->frskyProtoCB->setCurrentIndex(model.frsky.usrProto);
ui->frskyUnitsCB->setCurrentIndex(model.frsky.imperial); ui->frskyUnitsCB->setCurrentIndex(model.frsky.imperial);
ui->frskyBladesCB->setCurrentIndex(model.frsky.blades); ui->bladesCount->setValue(model.frsky.blades);
ui->frskyCurrentCB->setCurrentIndex(model.frsky.currentSource); ui->frskyCurrentCB->setCurrentIndex(model.frsky.currentSource);
ui->frskyVoltCB->setCurrentIndex(model.frsky.voltsSource); ui->frskyVoltCB->setCurrentIndex(model.frsky.voltsSource);
@@ -599,13 +652,13 @@ void TelemetryPanel::onAnalogModified()
void TelemetryPanel::on_frskyUnitsCB_currentIndexChanged(int index) void TelemetryPanel::on_frskyUnitsCB_currentIndexChanged(int index)
{ {
model.frsky.imperial=index; model.frsky.imperial = index;
emit modified(); emit modified();
} }
void TelemetryPanel::on_frskyBladesCB_currentIndexChanged(int index) void TelemetryPanel::on_bladesCount_editingFinished()
{ {
model.frsky.blades=index; model.frsky.blades = ui->bladesCount->value();
emit modified(); emit modified();
} }
+4 -1
View File
@@ -61,6 +61,9 @@ class TelemetryCustomScreen : public ModelPanel
void barMinChanged(double value); void barMinChanged(double value);
void barMaxChanged(double value); void barMaxChanged(double value);
protected:
void populateTelemetrySourceCB(QComboBox *b, unsigned int value, bool last, int hubproto);
private: private:
void updateBar(int line); void updateBar(int line);
Ui::TelemetryCustomScreen * ui; Ui::TelemetryCustomScreen * ui;
@@ -86,7 +89,7 @@ class TelemetryPanel : public ModelPanel
void onAnalogModified(); void onAnalogModified();
void on_frskyProtoCB_currentIndexChanged(int index); void on_frskyProtoCB_currentIndexChanged(int index);
void on_frskyUnitsCB_currentIndexChanged(int index); void on_frskyUnitsCB_currentIndexChanged(int index);
void on_frskyBladesCB_currentIndexChanged(int index); void on_bladesCount_editingFinished();
void on_frskyCurrentCB_currentIndexChanged(int index); void on_frskyCurrentCB_currentIndexChanged(int index);
void on_frskyVoltCB_currentIndexChanged(int index); void on_frskyVoltCB_currentIndexChanged(int index);
void on_AltitudeToolbar_ChkB_toggled(bool checked); void on_AltitudeToolbar_ChkB_toggled(bool checked);
+313 -124
View File
@@ -6,16 +6,19 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>692</width> <width>757</width>
<height>457</height> <height>457</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,1"> <layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,0,0,0">
<property name="spacing">
<number>0</number>
</property>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_14" stretch="0,0,0"> <layout class="QHBoxLayout" name="horizontalLayout_14" stretch="0,0,0,0,0">
<property name="sizeConstraint"> <property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum> <enum>QLayout::SetMinimumSize</enum>
</property> </property>
@@ -33,37 +36,86 @@
<property name="styleSheet"> <property name="styleSheet">
<string notr="true"/> <string notr="true"/>
</property> </property>
<property name="title">
<string>A1</string>
</property>
<property name="flat"> <property name="flat">
<bool>false</bool> <bool>false</bool>
</property> </property>
<layout class="QVBoxLayout" name="A1Layout"> <layout class="QVBoxLayout" name="A1Layout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin"> <property name="topMargin">
<number>1</number> <number>0</number>
</property>
<property name="rightMargin">
<number>3</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>1</number> <number>3</number>
</property> </property>
<item>
<widget class="QLabel" name="label_7">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>A1</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="A2GB"> <widget class="QGroupBox" name="A2GB">
<property name="title"> <property name="flat">
<string>A2</string> <bool>false</bool>
</property> </property>
<layout class="QVBoxLayout" name="A2Layout"> <layout class="QVBoxLayout" name="A2Layout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin"> <property name="topMargin">
<number>1</number> <number>0</number>
</property>
<property name="rightMargin">
<number>3</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>1</number> <number>3</number>
</property> </property>
<item>
<widget class="QLabel" name="label_6">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>A2</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="RSSIGB"> <widget class="QGroupBox" name="RSSIGB">
<property name="sizePolicy"> <property name="sizePolicy">
@@ -72,14 +124,52 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="title"> <property name="flat">
<string>RSSI</string> <bool>false</bool>
</property> </property>
<layout class="QGridLayout" name="gridLayout_7"> <layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0"> <property name="leftMargin">
<widget class="QLabel" name="label_927"> <number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item row="1" 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="3" column="1">
<spacer name="verticalSpacer_16">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="rssiAlarm1Label">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@@ -98,7 +188,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="1" column="1">
<widget class="QComboBox" name="rssiAlarm1CB"> <widget class="QComboBox" name="rssiAlarm1CB">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
@@ -128,7 +218,7 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="0" column="2"> <item row="1" column="2">
<widget class="QSpinBox" name="rssiAlarm1SB"> <widget class="QSpinBox" name="rssiAlarm1SB">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
@@ -156,10 +246,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_928"> <widget class="QLabel" name="rssiAlarm2Label">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@@ -175,7 +265,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="2" column="1">
<widget class="QComboBox" name="rssiAlarm2CB"> <widget class="QComboBox" name="rssiAlarm2CB">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
@@ -205,7 +295,7 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="1" column="2"> <item row="2" column="2">
<widget class="QSpinBox" name="rssiAlarm2SB"> <widget class="QSpinBox" name="rssiAlarm2SB">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
@@ -233,18 +323,18 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="0" column="0">
<spacer name="verticalSpacer_16"> <widget class="QLabel" name="label_5">
<property name="orientation"> <property name="font">
<enum>Qt::Vertical</enum> <font>
<weight>75</weight>
<bold>true</bold>
</font>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="text">
<size> <string>RSSI</string>
<width>20</width>
<height>0</height>
</size>
</property> </property>
</spacer> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@@ -252,7 +342,17 @@
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_13" stretch="1,1"> <widget class="Line" name="line_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_13" stretch="1,0,1">
<property name="spacing">
<number>0</number>
</property>
<property name="sizeConstraint"> <property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum> <enum>QLayout::SetMinimumSize</enum>
</property> </property>
@@ -264,19 +364,31 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="title">
<string>Serial Protocol</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6"> <layout class="QVBoxLayout" name="verticalLayout_6">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin"> <property name="topMargin">
<number>1</number> <number>0</number>
</property>
<property name="rightMargin">
<number>3</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>1</number> <number>3</number>
</property> </property>
<item> <item>
<layout class="QGridLayout" name="gridLayout_34" columnstretch="0,1,1,1"> <layout class="QGridLayout" name="gridLayout_34" columnstretch="0,1,1,1">
<item row="2" column="0"> <property name="horizontalSpacing">
<number>9</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item row="3" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
@@ -289,7 +401,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="2" column="1">
<widget class="QComboBox" name="frskyUnitsCB"> <widget class="QComboBox" name="frskyUnitsCB">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -309,7 +421,7 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="2" column="2"> <item row="3" column="2">
<widget class="QLabel" name="current_label"> <widget class="QLabel" name="current_label">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
@@ -328,7 +440,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_112"> <widget class="QLabel" name="label_112">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
@@ -347,7 +459,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="3"> <item row="3" column="3">
<widget class="QComboBox" name="frskyCurrentCB"> <widget class="QComboBox" name="frskyCurrentCB">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -377,7 +489,7 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="0" column="1" colspan="3"> <item row="1" column="1" colspan="3">
<widget class="QComboBox" name="frskyProtoCB"> <widget class="QComboBox" name="frskyProtoCB">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
@@ -397,7 +509,7 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="3" column="1">
<widget class="QComboBox" name="frskyVoltCB"> <widget class="QComboBox" name="frskyVoltCB">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -427,32 +539,7 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="1" column="3"> <item row="2" column="0">
<widget class="QComboBox" name="frskyBladesCB">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>2</string>
</property>
</item>
<item>
<property name="text">
<string>3</string>
</property>
</item>
<item>
<property name="text">
<string>4</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_113"> <widget class="QLabel" name="label_113">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
@@ -471,7 +558,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="2"> <item row="2" column="2">
<widget class="QLabel" name="blades_label"> <widget class="QLabel" name="blades_label">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
@@ -484,11 +571,53 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Serial Protocol</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QDoubleSpinBox" name="bladesCount">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>2.000000000000000</double>
</property>
<property name="maximum">
<double>5.000000000000000</double>
</property>
<property name="value">
<double>2.000000000000000</double>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="altimetryGB"> <widget class="QGroupBox" name="altimetryGB">
<property name="sizePolicy"> <property name="sizePolicy">
@@ -497,19 +626,28 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="title">
<string>Altimetry / Vario</string>
</property>
<layout class="QGridLayout" name="gridLayout_39"> <layout class="QGridLayout" name="gridLayout_39">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin"> <property name="topMargin">
<number>1</number> <number>0</number>
</property>
<property name="rightMargin">
<number>3</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>1</number> <number>3</number>
</property>
<property name="spacing">
<number>0</number>
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_40" rowstretch="1,0,0" columnstretch="0,0"> <layout class="QGridLayout" name="gridLayout_40" rowstretch="1,0,0,0" columnstretch="0,0">
<item row="0" column="1"> <property name="horizontalSpacing">
<number>9</number>
</property>
<item row="1" column="1">
<widget class="QComboBox" name="varioSourceCB"> <widget class="QComboBox" name="varioSourceCB">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
@@ -544,7 +682,7 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="2" column="1">
<layout class="QGridLayout" name="gridLayout_66" columnstretch="1,0,0,0"> <layout class="QGridLayout" name="gridLayout_66" columnstretch="1,0,0,0">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="VarioLabel_1"> <widget class="QLabel" name="VarioLabel_1">
@@ -558,7 +696,7 @@
<string>Sink Max</string> <string>Sink Max</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
@@ -681,7 +819,7 @@
<string>Climb Max</string> <string>Climb Max</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
@@ -697,7 +835,7 @@
<string>Sink Min</string> <string>Sink Min</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
@@ -713,27 +851,27 @@
<string>Climb Min</string> <string>Climb Min</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item row="0" column="0"> <item row="1" column="0">
<widget class="QLabel" name="varioSource_label"> <widget class="QLabel" name="varioSource_label">
<property name="text"> <property name="text">
<string>Vario source</string> <string>Vario source</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="2" column="0">
<widget class="QLabel" name="varioLimit_label"> <widget class="QLabel" name="varioLimit_label">
<property name="text"> <property name="text">
<string>Vario limits</string> <string>Vario limits</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0" colspan="2"> <item row="3" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_16"> <layout class="QHBoxLayout" name="horizontalLayout_16">
<item> <item>
<widget class="QCheckBox" name="AltitudeGPS_ChkB"> <widget class="QCheckBox" name="AltitudeGPS_ChkB">
@@ -763,6 +901,19 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Altimetry</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>
@@ -770,6 +921,13 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="Line" name="line_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="variousGB"> <widget class="QGroupBox" name="variousGB">
<property name="sizePolicy"> <property name="sizePolicy">
@@ -778,19 +936,38 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="title">
<string>Various</string>
</property>
<layout class="QGridLayout" name="gridLayout_6"> <layout class="QGridLayout" name="gridLayout_6">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin"> <property name="topMargin">
<number>1</number> <number>0</number>
</property>
<property name="rightMargin">
<number>3</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>1</number> <number>9</number>
</property>
<property name="spacing">
<number>0</number>
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="1" column="1"> <property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<item row="1" column="2">
<widget class="QLabel" name="mahCount_label">
<property name="text">
<string>mAh count</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QSpinBox" name="mahCount_SB"> <widget class="QSpinBox" name="mahCount_SB">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -803,34 +980,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1" alignment="Qt::AlignHCenter"> <item row="1" column="1">
<widget class="QLabel" name="mahCount_label">
<property name="text">
<string>mAh count</string>
</property>
</widget>
</item>
<item row="0" column="0" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="fasOffset_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>FAS Offset</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="mahCount_ChkB">
<property name="text">
<string>Persistent mAh</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QDoubleSpinBox" name="fasOffset_DSB"> <widget class="QDoubleSpinBox" name="fasOffset_DSB">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -852,7 +1002,27 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="2"> <item row="1" column="0">
<widget class="QLabel" name="fasOffset_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>FAS Offset</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QCheckBox" name="mahCount_ChkB">
<property name="text">
<string>Persistent mAh</string>
</property>
</widget>
</item>
<item row="1" column="5">
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@@ -865,6 +1035,25 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Various</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>
+19 -4
View File
@@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>272</width> <width>276</width>
<height>118</height> <height>118</height>
</rect> </rect>
</property> </property>
@@ -14,6 +14,21 @@
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item> <item>
<layout class="QGridLayout" name="gridLayout_11" columnstretch="1,1,1,1" columnminimumwidth="0,0,0,0"> <layout class="QGridLayout" name="gridLayout_11" columnstretch="1,1,1,1" columnminimumwidth="0,0,0,0">
<item row="0" column="0"> <item row="0" column="0">
@@ -43,7 +58,7 @@
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_919"> <widget class="QLabel" name="alarm1Label">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@@ -106,7 +121,7 @@
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_921"> <widget class="QLabel" name="alarm2Label">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@@ -260,7 +275,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1" colspan="2"> <item row="0" column="1" colspan="3">
<widget class="QComboBox" name="UnitCB"> <widget class="QComboBox" name="UnitCB">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+1 -4
View File
@@ -277,10 +277,7 @@ void ModelsListWidget::refreshList()
clear(); clear();
int msize; int msize;
div_t divresult; div_t divresult;
QString name = radioData->generalSettings.ownerName; addItem(tr("General Settings"));
if(!name.isEmpty())
name.prepend(" - ");
addItem(tr("General Settings") + name);
EEPROMInterface *eepromInterface = GetEepromInterface(); EEPROMInterface *eepromInterface = GetEepromInterface();
int availableEEpromSize = eepromInterface->getEEpromSize()-64; //let's consider fat int availableEEpromSize = eepromInterface->getEEpromSize()-64; //let's consider fat
+11 -25
View File
@@ -42,7 +42,8 @@ printDialog::printDialog(QWidget *parent, GeneralSettings *gg, ModelData *gm, QS
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) { if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
gvars=1; gvars=1;
} }
} else { }
else {
gvars=1; gvars=1;
} }
@@ -519,23 +520,6 @@ void printDialog::printCurves()
int i,r,g,b,c,count; int i,r,g,b,c,count;
char buffer[16]; char buffer[16];
QPen pen(Qt::black, 2, Qt::SolidLine); QPen pen(Qt::black, 2, Qt::SolidLine);
QColor * qplot_color[16];
qplot_color[0]=new QColor(0,0,127);
qplot_color[1]=new QColor(0,127,0);
qplot_color[2]=new QColor(127,0,0);
qplot_color[3]=new QColor(0,127,127);
qplot_color[4]=new QColor(127,0,127);
qplot_color[5]=new QColor(127,127,0);
qplot_color[6]=new QColor(127,127,127);
qplot_color[7]=new QColor(0,0,255);
qplot_color[8]=new QColor(0,127,255);
qplot_color[9]=new QColor(127,0,255);
qplot_color[10]=new QColor(0,255,0);
qplot_color[11]=new QColor(0,255,127);
qplot_color[12]=new QColor(127,255,0);
qplot_color[13]=new QColor(255,0,0);
qplot_color[14]=new QColor(255,0,127);
qplot_color[15]=new QColor(255,127,0);
QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-before:auto;\" width=\"100%\"><tr><td><h2>"; QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-before:auto;\" width=\"100%\"><tr><td><h2>";
str.append(tr("Curves")); str.append(tr("Curves"));
@@ -552,16 +536,18 @@ void printDialog::printCurves()
painter.drawRect(0,0,ISIZEW,ISIZEW); painter.drawRect(0,0,ISIZEW,ISIZEW);
str.append("<table border=0 cellspacing=0 cellpadding=3 width=\"100%\">"+QString("<tr><td width=\"400\"><img src=\"%1\" border=0></td><td><table border=1 cellspacing=0 cellpadding=3 width=\"100%\">").arg(curvefile5)); str.append("<table border=0 cellspacing=0 cellpadding=3 width=\"100%\">"+QString("<tr><td width=\"400\"><img src=\"%1\" border=0></td><td><table border=1 cellspacing=0 cellpadding=3 width=\"100%\">").arg(curvefile5));
for(i=0; i<numcurves; i++) { for(i=0; i<numcurves; i++) {
pen.setColor(*qplot_color[i]); pen.setColor(colors[i]);
painter.setPen(pen); painter.setPen(pen);
qplot_color[i]->getRgb(&r,&g,&b); colors[i].getRgb(&r,&g,&b);
c=r; c=r;
c*=256; c*=256;
c+=g; c+=g;
c*=256; c*=256;
c+=b; c+=b;
sprintf(buffer,"%06x",c); sprintf(buffer,"%06x",c);
str.append(QString("<tr><td width=\"70\"><font color=#%1><b>").arg(buffer)+tr("Curve")+QString(" %1</b></font></td></tr>").arg(i+1)); if(i%2 == 0) str.append("<tr>");
str.append(QString("<td width=\"70\"><font color=#%1><b>").arg(buffer)+tr("Curve")+QString(" %1</b></font></td>").arg(i+1));
if(i%2) str.append("</tr>");
} }
str.append("</table></td></tr><tr><td colspan=2><table border=1 cellspacing=0 cellpadding=3 width=\"100%\">"); str.append("</table></td></tr><tr><td colspan=2><table border=1 cellspacing=0 cellpadding=3 width=\"100%\">");
str.append("<tr>"); str.append("<tr>");
@@ -576,9 +562,9 @@ void printDialog::printCurves()
str.append(doTC(tr("pt %1").arg(i+1), "", true)); str.append(doTC(tr("pt %1").arg(i+1), "", true));
str.append("</tr>"); str.append("</tr>");
for(i=0; i<numcurves; i++) { for(i=0; i<numcurves; i++) {
pen.setColor(*qplot_color[i]); pen.setColor(colors[i]);
painter.setPen(pen); painter.setPen(pen);
qplot_color[i]->getRgb(&r,&g,&b); colors[i].getRgb(&r,&g,&b);
c=r; c=r;
c*=256; c*=256;
c+=g; c+=g;
@@ -697,7 +683,7 @@ void printDialog::printFSwitches()
{ {
int sc=0; int sc=0;
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">"; QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
str.append("<tr><td><h2>"+tr("Switch Assignments")+"</h2></td></tr>"); str.append("<tr><td><h2>"+tr("Special Functions")+"</h2></td></tr>");
str.append("<tr><td><table border=0 cellspacing=0 cellpadding=3><tr>"); str.append("<tr><td><table border=0 cellspacing=0 cellpadding=3><tr>");
str.append(doTC(tr("Switch"), "", true)); str.append(doTC(tr("Switch"), "", true));
str.append(doTL(tr("Function"), "", true)); str.append(doTL(tr("Function"), "", true));
@@ -767,7 +753,7 @@ void printDialog::printFrSky()
str.append("<tr><td colspan=10 align=\"Left\" height=\"4px\"></td></tr>"); str.append("<tr><td colspan=10 align=\"Left\" height=\"4px\"></td></tr>");
str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("Frsky serial protocol")+"</b></td><td colspan=8 align=\"left\">"+getFrSkyProtocol(fd->usrProto)+"</td></tr>"); str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("Frsky serial protocol")+"</b></td><td colspan=8 align=\"left\">"+getFrSkyProtocol(fd->usrProto)+"</td></tr>");
str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("System of units")+"</b></td><td colspan=8 align=\"left\">"+getFrSkyMeasure(fd->imperial)+"</td></tr>"); str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("System of units")+"</b></td><td colspan=8 align=\"left\">"+getFrSkyMeasure(fd->imperial)+"</td></tr>");
str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("Propeller blades")+"</b></td><td colspan=8 align=\"left\">"+getFrSkyBlades(fd->blades)+"</td></tr>"); str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("Blades")+"</b></td><td colspan=8 align=\"left\">"+fd->blades+"</td></tr>");
str.append("<tr><td colspan=10 align=\"Left\" height=\"4px\"></td></tr></table>"); str.append("<tr><td colspan=10 align=\"Left\" height=\"4px\"></td></tr></table>");
#if 0 #if 0
if (GetEepromInterface()->getCapability(TelemetryBars) || (GetEepromInterface()->getCapability(TelemetryCSFields))) { if (GetEepromInterface()->getCapability(TelemetryBars) || (GetEepromInterface()->getCapability(TelemetryCSFields))) {
+2 -1
View File
@@ -364,7 +364,7 @@ void SimulatorDialog9X::setLightOn(bool enable)
list << "bl" << "gr" << "rd" << "or" << "yl"; list << "bl" << "gr" << "rd" << "or" << "yl";
bg = QString("-") + list[backLight]; bg = QString("-") + list[backLight];
} }
ui->top->setStyleSheet(QString("background:url(:/images/9xdt.png%1);").arg(bg)); ui->top->setStyleSheet(QString("background:url(:/images/9xdt%1.png);").arg(bg));
ui->bottom->setStyleSheet(QString("background:url(:/images/9xdb%1.png);").arg(bg)); ui->bottom->setStyleSheet(QString("background:url(:/images/9xdb%1.png);").arg(bg));
ui->left->setStyleSheet(QString("background:url(:/images/9xdl%1.png);").arg(bg)); ui->left->setStyleSheet(QString("background:url(:/images/9xdl%1.png);").arg(bg));
ui->right->setStyleSheet(QString("background:url(:/images/9xdr%1.png);").arg(bg)); ui->right->setStyleSheet(QString("background:url(:/images/9xdr%1.png);").arg(bg));
@@ -515,6 +515,7 @@ void SimulatorDialogTaranis::getValues()
{ {
-ui->dialP_1->value(), -ui->dialP_1->value(),
ui->dialP_2->value(), ui->dialP_2->value(),
0,
-ui->dialP_3->value(), -ui->dialP_3->value(),
ui->dialP_4->value() ui->dialP_4->value()
}, },
+5 -1
View File
@@ -14,6 +14,10 @@
* *
*/ */
#if !defined(NUM_LOGICAL_SWITCH) && defined(NUM_CSW)
#define NUM_LOGICAL_SWITCH NUM_CSW
#endif
#ifdef INIT_IMPORT #ifdef INIT_IMPORT
#undef INIT_IMPORT #undef INIT_IMPORT
#ifdef FRSKY #ifdef FRSKY
@@ -49,7 +53,7 @@ if (inputs.rotenc) PIOB->PIO_PDSR &= ~0x40; else PIOB->PIO_PDSR |= 0x40;
#undef GETVALUES_IMPORT #undef GETVALUES_IMPORT
memset(outputs.chans, 0, sizeof(outputs.chans)); memset(outputs.chans, 0, sizeof(outputs.chans));
memcpy(outputs.chans, g_chans512, sizeof(g_chans512)); memcpy(outputs.chans, g_chans512, sizeof(g_chans512));
for (int i=0; i<NUM_CSW; i++) for (int i=0; i<NUM_LOGICAL_SWITCH; i++)
#if defined(BOLD_FONT) #if defined(BOLD_FONT)
outputs.vsw[i] = getSwitch(SWSRC_SW1+i); outputs.vsw[i] = getSwitch(SWSRC_SW1+i);
#else #else
@@ -21,7 +21,7 @@
struct TxInputs { struct TxInputs {
int sticks[NUM_STICKS]; /* lh lv rv rh */ int sticks[NUM_STICKS]; /* lh lv rv rh */
int pots[4]; /* TODO NUM_POTS */ int pots[5]; /* TODO NUM_POTS */
int switches[10]; /* TODO NUM_SWITCHES */ int switches[10]; /* TODO NUM_SWITCHES */
bool keys[6]; /* TODO NUM_KEYS */ bool keys[6]; /* TODO NUM_KEYS */
bool rotenc; bool rotenc;
+17 -2
View File
@@ -101,17 +101,32 @@ int main(int argc, char *argv[])
RegisterFirmwares(); RegisterFirmwares();
SimulatorDialog *dialog; SimulatorDialog *dialog;
const char * eepromFileName;
if (argc > 1 && !strcmp(argv[1], "taranis")) { QMessageBox msgBox;
msgBox.setWindowTitle("Radio type");
msgBox.setText("Which radio type do you want to simulate?");
msgBox.setIcon(QMessageBox::Question);
QAbstractButton *taranisButton = msgBox.addButton("Taranis", QMessageBox::ActionRole);
msgBox.addButton("9X", QMessageBox::ActionRole);
QPushButton *exitButton = msgBox.addButton(QMessageBox::Close);
msgBox.exec();
if (msgBox.clickedButton() == exitButton)
return 0;
else if (msgBox.clickedButton() == taranisButton) {
current_firmware_variant = GetFirmwareVariant("opentx-taranis-en"); current_firmware_variant = GetFirmwareVariant("opentx-taranis-en");
eepromFileName = "eeprom-taranis.bin";
dialog = new SimulatorDialogTaranis(); dialog = new SimulatorDialogTaranis();
} }
else { else {
eepromFileName = "eeprom-9x.bin";
dialog = new SimulatorDialog9X(); dialog = new SimulatorDialog9X();
} }
dialog->show(); dialog->show();
dialog->start("eeprom.bin"); dialog->start(eepromFileName);
int result = app.exec(); int result = app.exec();
+19
View File
@@ -0,0 +1,19 @@
#include "taranisnotfound.h"
#include "ui_taranisnotfound.h"
taranisNotFoundDialog::taranisNotFoundDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::taranisNotFoundDialog)
{
ui->setupUi(this);
}
taranisNotFoundDialog::~taranisNotFoundDialog()
{
delete ui;
}
void taranisNotFoundDialog::on_OK_clicked()
{
accept();
}
+22
View File
@@ -0,0 +1,22 @@
#ifndef TARANISNOTFOUNDDIALOG_H
#define TARANISNOTFOUNDDIALOG_H
#include <QDialog>
namespace Ui {
class taranisNotFoundDialog;
}
class taranisNotFoundDialog : public QDialog
{
Q_OBJECT
public:
explicit taranisNotFoundDialog(QWidget *parent = 0);
~taranisNotFoundDialog();
private:
Ui::taranisNotFoundDialog *ui;
private slots:
void on_OK_clicked();
};
#endif // TARANISNOTFOUNDDIALOG_H
+117
View File
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>taranisNotFoundDialog</class>
<widget class="QDialog" name="taranisNotFoundDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>367</width>
<height>350</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>367</width>
<height>350</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>367</width>
<height>350</height>
</size>
</property>
<property name="windowTitle">
<string>No Taranis Radio Found</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;No Taranis Radio was found!&lt;/p&gt;&lt;p&gt;Make sure that you hold the lower trim buttons towards the center while you turn it on.&lt;/p&gt;&lt;p&gt;Then connect the USB wire.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="companion.qrc">:/images/taranison.png</pixmap>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<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>
<widget class="QPushButton" name="OK">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources>
<include location="companion.qrc"/>
</resources>
<connections/>
</ui>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -110,10 +110,17 @@ Section "OpenTX companion" SecDummy
${registerExtension} "$INSTDIR\companion.exe" ".companion" "EEPE_File" ${registerExtension} "$INSTDIR\companion.exe" ".companion" "EEPE_File"
${registerExtension} "$INSTDIR\companion.exe" ".eepm" "EEPM_File" ${registerExtension} "$INSTDIR\companion.exe" ".eepm" "EEPM_File"
;Create uninstaller ;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe" WriteUninstaller "$INSTDIR\Uninstall.exe"
;Registry information for add/remove programs
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX" "DisplayName" "OpenTX Companion"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX" "DisplayIcon" "$\"$INSTDIR\companion.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX" "Publisher" "OpenTX"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX" "URLInfoAbout" "http://www.open-tx.org"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ImageMaker" "QuietUninstallString" "$\"$INSTDIR\Uninstall.exe$\" /S"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
;Create shortcuts ;Create shortcuts
@@ -178,6 +185,7 @@ Section "Uninstall"
RMDir "$SMPROGRAMS\$StartMenuFolder" RMDir "$SMPROGRAMS\$StartMenuFolder"
DeleteRegKey /ifempty HKCU "Software\companion9x" DeleteRegKey /ifempty HKCU "Software\companion9x"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX"
SectionEnd SectionEnd
+17 -8
View File
@@ -12,14 +12,14 @@
;General ;General
;Name and file ;Name and file
Name "OpenTX companion" Name "OpenTX Companion"
OutFile "companionInstall_v@C9X_VERSION@.exe" OutFile "companionInstall_v@C9X_VERSION@.exe"
;Default installation folder ;Default installation folder
InstallDir "$PROGRAMFILES\OpenTX companion" InstallDir "$PROGRAMFILES\OpenTX"
;Get installation folder from registry if available ;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\companion9x" "" InstallDirRegKey HKCU "Software\OpenTX" ""
;Compressor options ;Compressor options
SetCompressor /FINAL /SOLID lzma SetCompressor /FINAL /SOLID lzma
@@ -66,7 +66,7 @@
;Start Menu Folder Page Configuration ;Start Menu Folder Page Configuration
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU" !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\companion9x" !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\OpenTX"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
@@ -77,7 +77,7 @@
!define MUI_FINISHPAGE_NOAUTOCLOSE !define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_RUN !define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_CHECKED !define MUI_FINISHPAGE_RUN_CHECKED
!define MUI_FINISHPAGE_RUN_TEXT "Launch companion" !define MUI_FINISHPAGE_RUN_TEXT "Launch OpenTX Companion"
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink" !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
# !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED # !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
# !define MUI_FINISHPAGE_SHOWREADME $INSTDIR\readme.txt # !define MUI_FINISHPAGE_SHOWREADME $INSTDIR\readme.txt
@@ -95,7 +95,7 @@
;-------------------------------- ;--------------------------------
;Installer Sections ;Installer Sections
Section "OpenTX companion" SecDummy Section "OpenTX Companion" SecDummy
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"
@@ -129,7 +129,7 @@ Section "OpenTX companion" SecDummy
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"
;Store installation folder ;Store installation folder
WriteRegStr HKCU "Software\companion9x" "" $INSTDIR WriteRegStr HKCU "Software\OpenTX" "" $INSTDIR
;Associate with extentions ,bin and .hex ;Associate with extentions ,bin and .hex
${registerExtension} "$INSTDIR\companion.exe" ".bin" "BIN_File" ${registerExtension} "$INSTDIR\companion.exe" ".bin" "BIN_File"
@@ -141,6 +141,14 @@ Section "OpenTX companion" SecDummy
;Create uninstaller ;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe" WriteUninstaller "$INSTDIR\Uninstall.exe"
;Registry information for add/remove programs
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX" "DisplayName" "OpenTX Companion"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX" "DisplayIcon" "$\"$INSTDIR\companion.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX" "Publisher" "OpenTX"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX" "URLInfoAbout" "http://www.open-tx.org"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ImageMaker" "QuietUninstallString" "$\"$INSTDIR\Uninstall.exe$\" /S"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
;Create shortcuts ;Create shortcuts
@@ -207,7 +215,8 @@ Section "Uninstall"
Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk"
RMDir "$SMPROGRAMS\$StartMenuFolder" RMDir "$SMPROGRAMS\$StartMenuFolder"
DeleteRegKey /ifempty HKCU "Software\companion9x" DeleteRegKey /ifempty HKCU "Software\OpenTX"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX"
SectionEnd SectionEnd
+2 -2
View File
@@ -1,6 +1,6 @@
Copyright © 2011-2013 Bertrand Songis and Romolo Manfredini Copyright © 2011-2014 OpenTX team
companion9x is based on code named eePe by author - Erez Raviv <erezraviv@gmail.com> OpenTX Companion is based on code named eePe by author - Erez Raviv <erezraviv@gmail.com>
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
+22 -1
View File
@@ -1,5 +1,26 @@
<SVN CURRENT> <SVN CURRENT>
<h2>2940 / 2014-02-02</h2>
[Arm Boards]
<ul>
<li>Wav files played even in silent mode
<li>GPS support had broken VFAS
</ul>
[all]
<ul>
<li>Custom function triggered by a CSW based on analog triggering erroneously at powerup
<li>Problem with mixer weight field when !GVARS
<li>PPM5 was broken
</ul>
<h2>2923 / 2014-01-08</h2>
[Arm Boards]
<ul>
<li>Audio freeze bug fixed
<li>Aurora gimbals support
</ul>
<h2>2834 / 2013-10-29</h2> <h2>2834 / 2013-10-29</h2>
[Arm Boards] [Arm Boards]
<ul> <ul>
@@ -10,7 +31,7 @@
[all] [all]
<ul> <ul>
<li>Mixer bug when a MULTIPLY mix used with a slow <li>Mixer bug when a MULTIPLY mix used with a slow
<li>I GVAR popup removed <li>GVAR popup removed
<li>Sticky virtual switches are reset when ResetFlight function is called <li>Sticky virtual switches are reset when ResetFlight function is called
</ul> </ul>
+19 -4
View File
@@ -1,13 +1,28 @@
<SVN CURRENT> <SVN CURRENT>
<h2>2940 / 2014-02-02</h2>
<ul>
<li>Wav files played even in silent mode
<li>GPS support had broken VFAS
<li>Custom function triggered by a CSW based on analog triggering erroneously at powerup
<li>Problem with mixer weight field when !GVARS
<li>PPM5 was broken
</ul>
<h2>2923 / 2014-01-08</h2>
<ul>
<li>DSM2 Support
<li>New S.PORT sensors support
<li>Audio freeze bug fixed
<li>Telemetry corruption
<li>A2 alarms reinstated in D16 mode for X8R2Analog sensor
<li>Telemetry lost alarm no more triggered by a telemetry reset
</ul>
<h2>2834 / 2013-10-29</h2> <h2>2834 / 2013-10-29</h2>
<ul> <ul>
<li>Altitude played without decimal when &gt;= 10m <li>Altitude played without decimal when &gt;= 10m
<li>Check to avoid too long paths when playing SD files <li>Check to avoid too long paths when playing SD files
</ul>
[all]
<ul>
<li>Mixer bug when a MULTIPLY mix used with a slow <li>Mixer bug when a MULTIPLY mix used with a slow
<li>I GVAR popup removed <li>I GVAR popup removed
<li>Sticky virtual switches are reset when ResetFlight function is called <li>Sticky virtual switches are reset when ResetFlight function is called
+1
View File
@@ -16,3 +16,4 @@
/SOUNDS /SOUNDS
/LOGS /LOGS
/allsrc.cpp /allsrc.cpp
/BMP
+13 -3
View File
@@ -28,14 +28,20 @@ extern "C" {
/ object instead of the sector buffer in the individual file object for file / object instead of the sector buffer in the individual file object for file
/ data transfer. This reduces memory consumption 512 bytes each file object. */ / data transfer. This reduces memory consumption 512 bytes each file object. */
#if defined(BOOT)
#define _FS_READONLY 1 /* 0:Read/Write or 1:Read only */
#else
#define _FS_READONLY 0 /* 0:Read/Write or 1:Read only */ #define _FS_READONLY 0 /* 0:Read/Write or 1:Read only */
#endif
/* Setting _FS_READONLY to 1 defines read only configuration. This removes /* Setting _FS_READONLY to 1 defines read only configuration. This removes
/ writing functions, f_write, f_sync, f_unlink, f_mkdir, f_chmod, f_rename, / writing functions, f_write, f_sync, f_unlink, f_mkdir, f_chmod, f_rename,
/ f_truncate and useless f_getfree. */ / f_truncate and useless f_getfree. */
#if defined(BOOT)
#define _FS_MINIMIZE 1 /* 0 to 3 */
#else
#define _FS_MINIMIZE 0 /* 0 to 3 */ #define _FS_MINIMIZE 0 /* 0 to 3 */
#endif
/* The _FS_MINIMIZE option defines minimization level to remove some functions. /* The _FS_MINIMIZE option defines minimization level to remove some functions.
/ /
/ 0: Full function. / 0: Full function.
@@ -45,7 +51,11 @@ extern "C" {
/ 3: f_lseek is removed in addition to 2. */ / 3: f_lseek is removed in addition to 2. */
#if defined(BOOT)
#define _USE_STRFUNC 0 /* 0:Disable or 1-2:Enable */
#else
#define _USE_STRFUNC 1 /* 0:Disable or 1-2:Enable */ #define _USE_STRFUNC 1 /* 0:Disable or 1-2:Enable */
#endif
/* To enable string functions, set _USE_STRFUNC to 1 or 2. */ /* To enable string functions, set _USE_STRFUNC to 1 or 2. */
@@ -186,7 +196,7 @@ extern "C" {
/* A header file that defines sync object types on the O/S, such as /* A header file that defines sync object types on the O/S, such as
/ windows.h, ucos_ii.h and semphr.h, must be included prior to ff.h. */ / windows.h, ucos_ii.h and semphr.h, must be included prior to ff.h. */
#if defined(CPUARM) #if defined(CPUARM) && !defined(BOOT)
#define _FS_REENTRANT 1 /* 0:Disable or 1:Enable */ #define _FS_REENTRANT 1 /* 0:Disable or 1:Enable */
#define _SYNC_t unsigned char /*OS_MutexID*/ /* O/S dependent type of sync object. e.g. HANDLE, OS_EVENT*, ID and etc.. */ #define _SYNC_t unsigned char /*OS_MutexID*/ /* O/S dependent type of sync object. e.g. HANDLE, OS_EVENT*, ID and etc.. */
#else #else
+31 -18
View File
@@ -271,8 +271,9 @@ MENUS_LOCK == NO
# Define programs and commands. # Define programs and commands.
SHELL = sh SHELL = sh
IMG2LBM = -python ../util/img2lbm.py IMG2LBM = -python ../util/img2lbm.py
BIN2LBM = -python ../util/bin2lbm.py
TRANSLATE = -python ../util/translate.py TRANSLATE = -python ../util/translate.py
VERSION = 2.0 VERSION = 1.99
SRC = SRC =
CPPSRC = CPPSRC =
@@ -281,7 +282,7 @@ EXTRAINCDIRS =
# MCU name # MCU name
ifneq ($(PCB), $(filter $(PCB), STD 9X 9XR STD128 9X128 9XR128 9X2561 9XR2561 GRUVIN9X MEGA2560 SKY9X TARANIS)) ifneq ($(PCB), $(filter $(PCB), STD 9X 9XR STD128 9X128 9XR128 9X2561 9XR2561 GRUVIN9X MEGA2560 SKY9X TARANIS))
$(error Sorry, the PCB $(PCB) is not supported yet in openTx) $(error Sorry, the PCB $(PCB) is not supported yet in OpenTX)
endif endif
GVARS_VARIANT = +1 GVARS_VARIANT = +1
@@ -613,7 +614,7 @@ ifeq ($(PCB), TARANIS)
else else
CPPDEFS = -DREV4 CPPDEFS = -DREV4
endif endif
LDSCRIPT = targets/taranis/stm32_flash.ld LDSCRIPT = targets/taranis/stm32_flash_bl.ld
TRGT = arm-none-eabi- TRGT = arm-none-eabi-
MCU = cortex-m3 MCU = cortex-m3
OPT = 2 OPT = 2
@@ -627,13 +628,14 @@ ifeq ($(PCB), TARANIS)
EXTRAINCDIRS += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/inc EXTRAINCDIRS += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/inc
EXTRAINCDIRS += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/inc targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/hid/inc EXTRAINCDIRS += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/inc targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/hid/inc
BOARDSRC = targets/taranis/board_taranis.cpp BOARDSRC = targets/taranis/board_taranis.cpp
EXTRABOARDSRC += targets/taranis/lcd_driver.cpp targets/taranis/aspi.cpp targets/taranis/i2c.c EXTRABOARDSRC += targets/taranis/lcd_driver.cpp targets/taranis/aspi.c targets/taranis/i2c.c targets/taranis/delays.c
SRC += CoOS/kernel/core.c CoOS/kernel/hook.c CoOS/kernel/task.c CoOS/kernel/event.c CoOS/kernel/time.c CoOS/kernel/timer.c CoOS/kernel/flag.c CoOS/kernel/mutex.c CoOS/kernel/serviceReq.c CoOS/portable/GCC/port.c CoOS/portable/arch.c SRC += CoOS/kernel/core.c CoOS/kernel/hook.c CoOS/kernel/task.c CoOS/kernel/event.c CoOS/kernel/time.c CoOS/kernel/timer.c CoOS/kernel/flag.c CoOS/kernel/mutex.c CoOS/kernel/serviceReq.c CoOS/portable/GCC/port.c CoOS/portable/arch.c
SRC += targets/taranis/pwr_driver.c targets/taranis/usb_driver.c
EEPROMSRC = eeprom_common.cpp eeprom_rlc.cpp eeprom_conversions.cpp EEPROMSRC = eeprom_common.cpp eeprom_rlc.cpp eeprom_conversions.cpp
PULSESSRC = protocols/pulses_arm.cpp protocols/ppm_arm.cpp protocols/pxx_arm.cpp PULSESSRC = protocols/pulses_arm.cpp protocols/ppm_arm.cpp protocols/pxx_arm.cpp
CPPSRC += audio_arm.cpp CPPSRC += audio_arm.cpp
CPPSRC += targets/taranis/pwr_driver.cpp targets/taranis/pulses_driver.cpp targets/taranis/keys_driver.cpp targets/taranis/adc_driver.cpp targets/taranis/trainer_driver.cpp targets/taranis/audio_driver.cpp targets/taranis/delays.cpp targets/taranis/uart3_driver.cpp targets/taranis/sport_driver.cpp CPPSRC += targets/taranis/pulses_driver.cpp targets/taranis/keys_driver.cpp targets/taranis/adc_driver.cpp targets/taranis/trainer_driver.cpp targets/taranis/audio_driver.cpp targets/taranis/uart3_driver.cpp targets/taranis/sport_driver.cpp
CPPSRC += bmp.cpp gui/view_channels.cpp gui/view_about.cpp gui/view_text.cpp CPPSRC += bmp.cpp gui/view_channels.cpp gui/view_about.cpp gui/view_text.cpp loadboot.cpp
SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/system_stm32f2xx.c SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/system_stm32f2xx.c
SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/misc.c SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/misc.c
SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_gpio.c SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_gpio.c
@@ -645,18 +647,14 @@ ifeq ($(PCB), TARANIS)
SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_pwr.c SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_pwr.c
SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_usart.c SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_usart.c
SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/gcc_ride7/startup_stm32f2xx.s SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/gcc_ride7/startup_stm32f2xx.s
SRC += targets/taranis/usb_bsp.c targets/taranis/usbd_desc.c SRC += targets/taranis/usb_bsp.c targets/taranis/usbd_desc.c targets/taranis/usbd_hid_joystick.c
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_core.c SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_core.c
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_dcd.c SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_dcd.c
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_dcd_int.c SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_dcd_int.c
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_core.c SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_core.c
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_ioreq.c SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_ioreq.c
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_req.c SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_req.c
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_data.c EXTRABOARDSRC += targets/taranis/usbd_usr.cpp
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_scsi.c
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_bot.c
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_core.c
EXTRABOARDSRC += targets/taranis/usbd_usr.cpp targets/taranis/usbd_storage_msd.cpp
SRC += targets/sky9x/syscalls.c SRC += targets/sky9x/syscalls.c
ifneq ($(LUA), NO) ifneq ($(LUA), NO)
@@ -697,6 +695,7 @@ ifeq ($(PCB), TARANIS)
CPPSRC += protocols/hubsan.cpp CPPSRC += protocols/hubsan.cpp
CPPSRC += targets/taranis/a7105_driver.cpp CPPSRC += targets/taranis/a7105_driver.cpp
endif endif
endif endif
CC = $(TRGT)gcc CC = $(TRGT)gcc
@@ -728,7 +727,7 @@ else
TTS_SRC = $(shell sh -c "if test -f $(STD_TTS_SRC); then echo $(STD_TTS_SRC); else echo translations/tts_en.cpp; fi") TTS_SRC = $(shell sh -c "if test -f $(STD_TTS_SRC); then echo $(STD_TTS_SRC); else echo translations/tts_en.cpp; fi")
endif endif
CPPSRC += opentx.cpp $(PULSESSRC) stamp.cpp gui/menus.cpp gui/menu_model.cpp gui/menu_general.cpp gui/view_main.cpp gui/view_statistics.cpp $(EEPROMSRC) lcd.cpp keys.cpp maths.cpp translations.cpp $(TTS_SRC) CPPSRC += opentx.cpp $(PULSESSRC) stamp.cpp gui/menus.cpp gui/menu_model.cpp gui/menu_general.cpp gui/view_main.cpp gui/view_statistics.cpp $(EEPROMSRC) lcd.cpp keys.cpp maths.cpp translations.cpp fonts.cpp $(TTS_SRC)
# Debugging format. # Debugging format.
# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs. # Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
@@ -979,8 +978,10 @@ ifeq ($(HELI), YES)
endif endif
ifeq ($(TEMPLATES), YES) ifeq ($(TEMPLATES), YES)
CPPDEFS += -DTEMPLATES ifneq ($(PCB), TARANIS)
CPPSRC += templates.cpp CPPDEFS += -DTEMPLATES
CPPSRC += templates.cpp
endif
endif endif
ifeq ($(PXX), YES) ifeq ($(PXX), YES)
@@ -1082,10 +1083,21 @@ all: begin gccversion sizebefore build sizeafter end
# Change the build target to build a HEX file or a library. # Change the build target to build a HEX file or a library.
ifeq ($(ARCH), AVR) ifeq ($(ARCH), AVR)
build: stamp_header tra lbm allsrc.cpp elf remallsrc hex build: stamp_header tra lbm allsrc.cpp elf remallsrc hex
else ifeq ($(PCB), TARANIS)
build: stamp_header tra lbm bootloader.lbm allsrc.cpp elf remallsrc bin
else else
build: stamp_header tra lbm allsrc.cpp elf remallsrc bin build: stamp_header tra lbm allsrc.cpp elf remallsrc bin
endif endif
# build bootloader
bootloader.lbm: bootloader/bootloader_ramBoot.bin
test -z "$$(find $^ -size +32k)"
$(BIN2LBM) $^ $@
.PHONY bootloader/bootloader_ramBoot.bin:
@echo "Building bootloader..."
$(MAKE) -C bootloader PCB=$(PCB) PCBREV=$(PCBREV)
tra: translations/en.h translations/cz.h translations/de.h translations/es.h translations/fi.h translations/fr.h translations/it.h translations/pl.h translations/pt.h translations/se.h tra: translations/en.h translations/cz.h translations/de.h translations/es.h translations/fi.h translations/fr.h translations/it.h translations/pl.h translations/pt.h translations/se.h
lbm: fonts bitmaps/sticks.lbm lbm: fonts bitmaps/sticks.lbm
@@ -1237,7 +1249,7 @@ sizeafter:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); fi @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); fi
# Display compiler version information. # Display compiler version information.
gccversion : gccversion:
@$(CC) --version @$(CC) --version
FOXINC=-I/usr/local/include/fox-1.6 -I/usr/include/fox-1.6 \ FOXINC=-I/usr/local/include/fox-1.6 -I/usr/include/fox-1.6 \
@@ -1277,8 +1289,7 @@ endif
%.eep: %.elf %.eep: %.elf
@echo @echo
@echo $(MSG_EEPROM) $@ @echo $(MSG_EEPROM) $@
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 -O $(FORMAT) $< $@
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
# Create a symbol table from ELF output file. # Create a symbol table from ELF output file.
%.sym: %.elf %.sym: %.elf
@@ -1344,6 +1355,8 @@ clean_list :
$(REMOVE) *.lst $(REMOVE) *.lst
$(REMOVE) allsrc.cpp $(REMOVE) allsrc.cpp
$(REMOVE) stamp-opentx.h $(REMOVE) stamp-opentx.h
$(REMOVE) `find . -name "*.lbm"`
$(MAKE) -C bootloader clean
#### Install #### Install
+2 -2
View File
@@ -324,7 +324,7 @@ void getSwitchAudioFile(char * filename, int index)
str += 5; str += 5;
} }
else { else {
str += 1; *(str+1) = 0;
} }
strcat(str, SOUNDS_EXT); strcat(str, SOUNDS_EXT);
} }
@@ -390,7 +390,7 @@ void referenceModelAudioFiles()
} }
// Logical Switches Audio Files <switchname>-[on|off].wav // Logical Switches Audio Files <switchname>-[on|off].wav
for (int i=0; i<NUM_CSW && !found; i++) { for (int i=0; i<NUM_LOGICAL_SWITCH && !found; i++) {
for (int event=0; event<2; event++) { for (int event=0; event<2; event++) {
getLogicalSwitchAudioFile(path, i, event); getLogicalSwitchAudioFile(path, i, event);
if (!strcmp(filename, fn)) { if (!strcmp(filename, fn)) {
+1
View File
@@ -0,0 +1 @@
/*.o
+342
View File
@@ -0,0 +1,342 @@
#
# !!!! Do NOT edit this makefile with an editor which replace tabs by spaces !!!!
#
##############################################################################################
#
# On command line:
#
# make all = Create project
#
# make clean = Clean project files.
#
# To rebuild project do "make clean" and "make all".
#
##############################################################################################
# Start of default section
#
TRGT = arm-none-eabi-
CC = $(TRGT)gcc
CP = $(TRGT)objcopy
CLSS = $(TRGT)objdump
AS = $(TRGT)as
#gcc -x assembler-with-cpp
BIN = $(CP) -O ihex
BINX = $(CP) -O binary
OBJDIR = .
MCU = cortex-m3
# List all default C defines here, like -D_DEBUG=1
DDEFS =
# List all default ASM defines here, like -D_DEBUG=1
DADEFS =
# List all default directories to look for include files here
DINCDIR =
# List the default directory to look for the libraries here
DLIBDIR =
# List all default libraries here
DLIBS =
MEMORIES = sram
EXT = STD
#
# End of default section
##############################################################################################
##############################################################################################
# Start of user section
#
#
# Define project name and Ram/Flash mode here
PROJECT = bootloader
ifeq ($(PCB), TARANIS)
RUN_FROM_FLASH = 0
else
ifeq ($(PCB), X9D)
RUN_FROM_FLASH = 0
else
RUN_FROM_FLASH = 1
endif
endif
# PCB revision
PCBREV =
EXTRAINCDIRS =
#
# Define linker script file here
#
ifeq ($(RUN_FROM_FLASH), 1)
ifeq ($(REVX), 1)
LDSCRIPT = sam3s8c_boot.ld
FULL_PRJ = $(PROJECT)_flash8
EXTRAINCDIRS += include
# EXTRAINCDIRS += ../
else
LDSCRIPT = sam3s4c_boot.ld
FULL_PRJ = $(PROJECT)_flash4
EXTRAINCDIRS += include
# EXTRAINCDIRS += ../
endif
TRGT = arm-none-eabi-
CPPDEFS += -DPCBSKY
UDEFS = -Dat91sam3s8
# If REVX board
ifeq ($(REVX), 1)
CPPDEFS += -DREVX
endif
CPPDEFS += -DREVB
else
ifeq ($(PCB), TARANIS)
ARCH = ARM
LDSCRIPT = ../targets/taranis/stm32_ramBoot.ld
TRGT = arm-none-eabi-
CPPDEFS += -DHSE_VALUE=12000000
CPPDEFS += -DPCBTARANIS
FULL_PRJ = $(PROJECT)_ramBoot
EXTRAINCDIRS += ../targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/inc
EXTRAINCDIRS += ../targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Include
EXTRAINCDIRS += ../targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc
EXTRAINCDIRS += ../targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/inc
EXTRAINCDIRS += ../targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/inc
EXTRAINCDIRS += ../targets/taranis
EXTRAINCDIRS += ../fonts/std
ifeq ($(PCBREV), REV3)
CPPDEFS += -DREV3
else ifeq ($(PCBREV), REV4a)
CPPDEFS += -DREV4a
else
CPPDEFS += -DREV4
endif
endif
endif
# List all user C define here, like -D_DEBUG=1
# Define ASM defines here
UADEFS =
ifeq ($(PCB), TARANIS)
SRC = ../targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/system_stm32f2xx.c \
../targets/taranis/i2c.c \
../targets/taranis/delays.c \
../targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_rcc.c \
../targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_gpio.c \
../targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_spi.c \
../targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/misc.c \
../FatFs/ff.c \
../FatFs/option/ccsbcs.c \
../targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_core.c \
../targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_dcd.c \
../targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_dcd_int.c \
../targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_core.c \
../targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_ioreq.c \
../targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_req.c \
../targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_data.c \
../targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_scsi.c \
../targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_bot.c \
../targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_core.c \
../targets/taranis/usbd_desc.c \
../targets/taranis/aspi.c \
../targets/taranis/usb_bsp.c \
../targets/taranis/usb_driver.c \
../targets/taranis/pwr_driver.c
CPPSRC = ../targets/taranis/lcd_driver.cpp \
../targets/taranis/keys_driver.cpp \
../targets/taranis/diskio.cpp \
../targets/taranis/usbd_usr.cpp \
../targets/taranis/usbd_storage_msd.cpp \
../lcd.cpp \
../keys.cpp \
../fonts.cpp \
boot.cpp
# List ASM source files here
ASRC = ../targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/gcc_ride7/startup_stm32f2xx.s
else
# List C source files here
SRC = core_cm3.c \
board_lowlevel.c \
crt.c \
usb/device/core/USBD_UDP.c usb/device/core/USBDDriver.c usb/device/core/USBDCallbacks.c \
usb/device/massstorage/MSDDriver.c usb/device/massstorage/MSDDStateMachine.c \
usb/device/massstorage/MSDLun.c usb/device/massstorage/MSDDriverDescriptors.c usb/device/massstorage/SBCMethods.c \
usb/common/core/USBEndpointDescriptor.c usb/common/core/USBGenericRequest.c \
usb/common/core/USBFeatureRequest.c usb/common/core/USBInterfaceRequest.c usb/common/core/USBGetDescriptorRequest.c \
usb/common/core/USBSetAddressRequest.c usb/common/core/USBSetConfigurationRequest.c \
usb/common/core/USBConfigurationDescriptor.c usb/common/core/USBGenericDescriptor.c \
MEDSdcard.c \
vectors_sam3s.c
CPPSRC = lcdboot.cpp \
ff.cpp \
diskio.cpp \
driversboot.cpp \
logicioboot.cpp \
sdcard_driver.cpp \
massstorage.cpp \
bootsamEeprom.cpp \
ff_lfn.cpp \
power.cpp \
boot.cpp
# List ASM source files here
ASRC =
endif
# List all user directories here
UINCDIR = ./inc
# \
# ./cmsis/core \
# ./cmsis/device
# List the user directory to look for the libraries here
ULIBDIR =
# List all user libraries here
ULIBS =
# Define optimisation level here
OPT = -Os
#
# End of user defines
##############################################################################################
VPATH = $(DIRS)
INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR))
LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
ifeq ($(RUN_FROM_FLASH), 0)
DEFS = $(DDEFS) $(UDEFS) -DRUN_FROM_FLASH=0
else
DEFS = $(DDEFS) $(UDEFS) -DRUN_FROM_FLASH=1
endif
ADEFS = $(DADEFS) $(UADEFS)
AXOBJS = $(ASRC:%.s=%.o)
CXOBJS = $(SRC:%.c=%.o)
CPPXOBJS = $(CPPSRC:%.cpp=%.o)
LIBS = $(DLIBS) $(ULIBS)
MCFLAGS = -mcpu=$(MCU)
#ASFLAGS = $(MCFLAGS) -g -gdwarf-2 -Wa,-amhls=$(OBJDIR)/$(notdir $(<:.s=.lst)) $(ADEFS)
CPFLAGS = $(MCFLAGS) $(OPT) -gdwarf-2 -mthumb -fomit-frame-pointer -Wall -Wstrict-prototypes -fverbose-asm $(DEFS)
LDFLAGS = $(MCFLAGS) -mthumb -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(FULL_PRJ).map,--cref,--no-warn-mismatch $(LIBDIR)
CPPFLAGS = $(MCFLAGS) $(OPT) -gdwarf-2 -mthumb -fomit-frame-pointer -Wall -fverbose-asm $(DEFS)
CPPFLAGS += $(CPPDEFS)
CPFLAGS += $(CPPDEFS)
CPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
AOBJS = $(patsubst %,$(OBJDIR)/%,$(notdir $(AXOBJS) ))
COBJS = $(patsubst %,$(OBJDIR)/%,$(notdir $(CXOBJS) ))
CPPOBJS = $(patsubst %,$(OBJDIR)/%,$(notdir $(CPPXOBJS) ))
DIRS = $(sort $(dir $(AXOBJS) $(CXOBJS) $(CPPXOBJS) ) )
CPPDEFS += -DCPUARM
# If serial Debug required
ifeq ($(DEBUG), 1)
CPPDEFS += -DDEBUG
endif
CPPDEFS += -DBOOT
# Generate dependency information
CPFLAGS += -MD -MP -MF .dep/$(@F).d
CPPFLAGS += -MD -MP -MF .dep/$(@F).d
CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
#
# makefile rules
#
all: size_before $(OBJS) $(COBJS) $(CPPOBJS) $(FULL_PRJ).elf $(FULL_PRJ).hex $(FULL_PRJ).lss $(FULL_PRJ).bin size
#begin:
# @echo $(AXOBJS) $(CXOBJS) $(CPPXOBJS)
# @echo
# @echo $(OBJS) $(COBJS) $(CPPOBJS)
# @echo
# @echo $(DIRS)
size_before:
# arm-none-eabi-size $(FULL_PRJ).elf
@if test -f $(FULL_PRJ).elf; then arm-none-eabi-size $(FULL_PRJ).elf; fi
size:
# arm-none-eabi-size $(FULL_PRJ).elf
@if test -f $(FULL_PRJ).elf; then arm-none-eabi-size $(FULL_PRJ).elf; fi
$(CPPOBJS) : $(OBJDIR)/%.o : %.cpp
$(CC) -c $(CPPFLAGS) -fno-exceptions -I . $(INCDIR) $< -o $@
$(COBJS) : $(OBJDIR)/%.o : %.c
$(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@
$(AOBJS) : $(OBJDIR)/%.o : %.s
$(AS) -c $(ASFLAGS) $< -o $@
%elf: $(AOBJS) $(COBJS) $(CPPOBJS)
$(CC) $(AOBJS) $(COBJS) $(CPPOBJS) $(LDFLAGS) $(LIBS) -o $@
# Create extended listing file from ELF output file.
%.lss: %.elf
$(CLSS) -h -S $< > $@
%hex: %elf
$(BIN) $< $@
%bin: %elf
$(BINX) $< $@
# $(PROJECT)_flash8
# $(PROJECT)_flash4
# $(PROJECT)_ramBootS
# $(PROJECT)_ramBootT
clean:
-rm -f *.o
-rm -f *.elf
-rm -f *.map
-rm -f *.hex
-rm -f *.bin
-rm -f *.lss
-rm -fR .dep
#
# Include the dependency files, should be the last of the makefile
#
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
# *** EOF ***
+943
View File
@@ -0,0 +1,943 @@
/****************************************************************************
* Copyright (c) 2014 by Michael Blandford. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
****************************************************************************
* Other Authors:
* - Andre Bernet
* - Bertrand Songis
* - Bryan J. Rentoul (Gruvin)
* - Cameron Weeks
* - Erez Raviv
* - Jean-Pierre Parisy
* - Karl Szmutny
* - Michal Hlavinka
* - Pat Mackenzie
* - Philip Moss
* - Rob Thomson
* - Romolo Manfredini
* - Thomas Husterer
*
****************************************************************************/
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#if defined(PCBTARANIS)
#include "stm32f2xx_flash.h"
#endif
#include "board_taranis.h"
#include "../pwr.h"
#include "../lcd.h"
#include "../keys.h"
#include "../sdcard.h"
#include "../FatFs/ff.h"
#include "../FatFs/diskio.h"
#include "../translations/en.h"
#if defined(PCBTARANIS)
#define BOOTLOADER_TITLE " OpenTX Boot Loader v1.0"
#define BOOT_KEY_UP KEY_PLUS
#define BOOT_KEY_DOWN KEY_MINUS
#define BOOT_KEY_LEFT KEY_MENU
#define BOOT_KEY_RIGHT KEY_PAGE
#define BOOT_KEY_MENU KEY_ENTER
#define BOOT_KEY_EXIT KEY_EXIT
#define DISPLAY_CHAR_WIDTH 35
#elif defined(PCBSKY9X)
#define BOOTLOADER_TITLE "Boot Loader - Sky9x"
#endif
#define BOOTLOADER_SIZE 0x8000
#if defined(PCBTARANIS)
#define FIRMWARE_ADDRESS 0x08000000
#elif defined(PCBSKY9X)
#define FIRMWARE_ADDRESS 0x00400000
#endif
// states
enum BootLoaderStates {
ST_START,
ST_FLASH_MENU,
ST_DIR_CHECK,
ST_OPEN_DIR,
ST_FILE_LIST,
ST_FLASH_CHECK,
ST_FLASHING,
ST_FLASH_DONE,
ST_USB,
ST_REBOOT,
};
/*----------------------------------------------------------------------------
* Local variables
*----------------------------------------------------------------------------*/
uint32_t FirmwareSize;
uint32_t Master_frequency;
volatile uint8_t Tenms;
uint8_t EE_timer;
TCHAR FlashFilename[60];
FIL FlashFile;
DIR Dj;
FILINFO Finfo;
TCHAR Filenames[20][50];
uint32_t FileSize[20];
uint32_t FnStartIndex;
uint32_t Valid;
uint32_t FlashSize;
uint32_t FlashBlocked = 1;
uint32_t LockBits;
uint32_t Block_buffer[1024];
UINT BlockCount;
#if defined(PCBSKY9X)
extern int32_t EblockAddress;
#endif
extern uint32_t EepromBlocked;
extern void init_spi(void);
extern void writeBlock(void);
/*----------------------------------------------------------------------------
* Global functions
*----------------------------------------------------------------------------*/
#if defined(PCBSKY9X)
// Starts TIMER0 at full speed (MCK/2) for delay timing
// @ 36MHz this is 18MHz
// This was 6 MHz, we may need to slow it to TIMER_CLOCK2 (MCK/8=4.5 MHz)
void start_timer0()
{
register Tc *ptc;
PMC->PMC_PCER0 |= 0x00800000L; // Enable peripheral clock to TC0
ptc = TC0;// Tc block 0 (TC0-2)
ptc->TC_BCR = 0;// No sync
ptc->TC_BMR = 2;
ptc->TC_CHANNEL[0].TC_CMR = 0x00008001;// Waveform mode MCK/8 for 36MHz osc.(Upset be write below)
ptc->TC_CHANNEL[0].TC_RC = 0xFFF0;
ptc->TC_CHANNEL[0].TC_RA = 0;
ptc->TC_CHANNEL[0].TC_CMR = 0x00008040;// 0000 0000 0000 0000 1000 0000 0100 0000, stop at regC, 18MHz
ptc->TC_CHANNEL[0].TC_CCR = 5;// Enable clock and trigger it (may only need trigger)
}
void stop_timer0( void )
{
TC0->TC_CHANNEL[0].TC_CCR = TC_CCR0_CLKDIS; // Disable clock
}
void delay2ms()
{
TC0->TC_CHANNEL[0].TC_CCR = 5;// Enable clock and trigger it (may only need trigger)
while ( TC0->TC_CHANNEL[0].TC_CV < 36000 )// 2mS, Value depends on MCK/2 (used 18MHz)
{
// Wait
}
}
#endif
#if defined(PCBTARANIS)
uint32_t isFirmwareStart(uint32_t *block)
{
if ((block[0] & 0xFFFC0000) != 0x20000000) {
return 0;
}
if ((block[1] & 0xFFF00000) != 0x08000000) {
return 0;
}
if ((block[2] & 0xFFF00000) != 0x08000000) {
return 0;
}
return 1;
}
#elif defined(PCBSKY9X)
uint32_t isFirmwareStart( uint32_t *block )
{
if ((block[0] & 0xFFFE3000) != 0x20000000 ) {
return 0;
}
if ((block[1] & 0xFFF80000) != 0x00400000) {
return 0;
}
if ((block[2] & 0xFFF80000) != 0x00400000) {
return 0;
}
return 1;
}
#endif
#if defined(PCBSKY9X)
uint32_t (*IAP_Function)(uint32_t, uint32_t);
uint32_t program( uint32_t *address, uint32_t *buffer ) // size is 256 bytes
{
uint32_t FlashSectorNum;
uint32_t flash_cmd = 0;
uint32_t i;
// uint32_t flash_status = 0;
// uint32_t EFCIndex = 0; // 0:EEFC0, 1: EEFC1
/* Initialize the function pointer (retrieve function address from NMI vector) */
if ((uint32_t) address == FIRMWARE_START+BOOTLOADER_SIZE) {
if (isFirmwareStart(buffer))
FlashBlocked = 0;
else
FlashBlocked = 1;
}
if (FlashBlocked) {
return 1;
}
// Always initialise this here, setting a default doesn't seem to work
IAP_Function = (uint32_t (*)(uint32_t, uint32_t)) *(( uint32_t *)0x00800008);
FlashSectorNum = (uint32_t) address;
FlashSectorNum >>= 8;// page size is 256 bytes
FlashSectorNum &= 2047;// max page number
/* Send data to the sector here */
for ( i = 0; i < 64; i += 1 )
{
*address++ = *buffer++;
}
/* build the command to send to EEFC */
flash_cmd = (0x5A << 24) | (FlashSectorNum << 8) | 0x03; //AT91C_MC_FCMD_EWP ;
__disable_irq();
/* Call the IAP function with appropriate command */
i = IAP_Function( 0, flash_cmd );
__enable_irq();
return i;
}
uint32_t readLockBits()
{
// Always initialise this here, setting a default doesn't seem to work
IAP_Function = (uint32_t (*)(uint32_t, uint32_t)) *(( uint32_t *)0x00800008);
uint32_t flash_cmd = (0x5A << 24) | 0x0A;//AT91C_MC_FCMD_GLB ;
__disable_irq();
(void) IAP_Function( 0, flash_cmd );
__enable_irq();
return EFC->EEFC_FRR;
}
void clearLockBits()
{
uint32_t i;
uint32_t flash_cmd = 0;
// Always initialise this here, setting a default doesn't seem to work
IAP_Function = (uint32_t (*)(uint32_t, uint32_t)) *(( uint32_t *)0x00800008);
for ( i = 0; i < 16; i += 1 )
{
flash_cmd = (0x5A << 24) | ((128*i) << 8) | 0x09; //AT91C_MC_FCMD_CLB ;
__disable_irq();
/* Call the IAP function with appropriate command */
(void) IAP_Function( 0, flash_cmd );
__enable_irq();
}
}
#endif
void interrupt10ms(void)
{
Tenms |= 1; // 10 mS has passed
uint8_t enuk = KEY_MENU;
uint8_t in = ~readKeys();
for (int i = 1; i < 7; i++) {
uint8_t value = in & (1 << i);
keys[enuk].input(value, (EnumKeys) enuk);
++enuk;
}
}
#if defined(PCBSKY9X)
void init10msTimer()
{
register Tc *ptc;
register uint32_t timer;
PMC->PMC_PCER0 |= 0x02000000L; // Enable peripheral clock to TC2
timer = Master_frequency / 12800;// MCK/128 and 100 Hz
ptc = TC0;// Tc block 0 (TC0-2)
ptc->TC_BCR = 0;// No sync
ptc->TC_BMR = 0;
ptc->TC_CHANNEL[2].TC_CMR = 0x00008000;// Waveform mode
ptc->TC_CHANNEL[2].TC_RC = timer;// 10 Hz
ptc->TC_CHANNEL[2].TC_RA = timer >> 1;
ptc->TC_CHANNEL[2].TC_CMR = 0x0009C003;// 0000 0000 0000 1001 1100 0000 0000 0011
// MCK/128, set @ RA, Clear @ RC waveform
ptc->TC_CHANNEL[2].TC_CCR = 5;// Enable clock and trigger it (may only need trigger)
NVIC_EnableIRQ(TC2_IRQn);
TC0->TC_CHANNEL[2].TC_IER = TC_IER0_CPCS;
}
extern "C" void TC2_IRQHandler()
{
register uint32_t dummy;
/* Clear status bit to acknowledge interrupt */
dummy = TC0->TC_CHANNEL[2].TC_SR;
(void) dummy; // Discard value - prevents compiler warning
interrupt10ms();
}
#endif
#if defined(PCBTARANIS)
void init10msTimer()
{
// Timer14
RCC->APB1ENR |= RCC_APB1ENR_TIM14EN; // Enable clock
TIM14->ARR = 9999; // 10mS
TIM14->PSC = (PERI1_FREQUENCY * TIMER_MULT_APB1) / 1000000 - 1; // 1uS from 12MHz
TIM14->CCER = 0;
TIM14->CCMR1 = 0;
TIM14->EGR = 0;
TIM14->CR1 = 5;
TIM14->DIER |= 1;
NVIC_EnableIRQ(TIM8_TRG_COM_TIM14_IRQn);
}
extern "C" void TIM8_TRG_COM_TIM14_IRQHandler()
{
TIM14->SR &= ~TIM_SR_UIF;
interrupt10ms();
}
void init_hw_timer()
{
// Timer13
RCC->APB1ENR |= RCC_APB1ENR_TIM13EN; // Enable clock
TIM13->ARR = 65535;
TIM13->PSC = (PERI1_FREQUENCY * TIMER_MULT_APB1) / 10000000 - 1;// 0.1uS from 12MHz
TIM13->CCER = 0;
TIM13->CCMR1 = 0;
TIM13->EGR = 0;
TIM13->CR1 = 1;
}
// delay in units of 0.1 uS up to 6.5535 mS
void hw_delay(uint16_t time)
{
TIM13->CNT = 0;
TIM13->EGR = 1; // Re-start counter
while ( TIM13->CNT < time) {
// wait
}
}
//After reset, write is not allowed in the Flash control register (FLASH_CR) to protect the
//Flash memory against possible unwanted operations due, for example, to electric
//disturbances. The following sequence is used to unlock this register:
//1. Write KEY1 = 0x45670123 in the Flash key register (FLASH_KEYR)
//2. Write KEY2 = 0xCDEF89AB in the Flash key register (FLASH_KEYR)
//Any wrong sequence will return a bus error and lock up the FLASH_CR register until the
//next reset.
//The FLASH_CR register can be locked again by software by setting the LOCK bit in the
//FLASH_CR register.
void unlockFlash()
{
FLASH->KEYR = 0x45670123;
FLASH->KEYR = 0xCDEF89AB;
}
void waitFlashIdle()
{
while (FLASH->SR & FLASH_FLAG_BSY) {
wdt_reset();
}
}
#define SECTOR_MASK ((uint32_t)0xFFFFFF07)
void eraseSector(uint32_t sector)
{
waitFlashIdle();
FLASH->CR &= CR_PSIZE_MASK;
FLASH->CR |= FLASH_PSIZE_WORD;
FLASH->CR &= SECTOR_MASK;
FLASH->CR |= FLASH_CR_SER | (sector << 3);
FLASH->CR |= FLASH_CR_STRT;
/* Wait for operation to be completed */
waitFlashIdle();
/* if the erase operation is completed, disable the SER Bit */
FLASH->CR &= (~FLASH_CR_SER);
FLASH->CR &= SECTOR_MASK;
}
uint32_t program(uint32_t *address, uint32_t *buffer) // size is 256 bytes
{
uint32_t i;
if ((uint32_t) address == 0x08008000) {
if (isFirmwareStart(buffer)) {
FlashBlocked = 0;
}
else {
FlashBlocked = 1;
}
}
if (FlashBlocked) {
return 1;
}
if ((uint32_t) address == 0x08008000) {
eraseSector(2);
}
if ((uint32_t) address == 0x0800C000) {
eraseSector(3);
}
if ((uint32_t) address == 0x08010000) {
eraseSector(4);
}
if ((uint32_t) address == 0x08020000) {
eraseSector(5);
}
if ((uint32_t) address == 0x08040000) {
eraseSector(6);
}
if ((uint32_t) address == 0x08060000) {
eraseSector(7);
}
// Now program the 256 bytes
for (i = 0; i < 64; i += 1) {
/* Device voltage range supposed to be [2.7V to 3.6V], the operation will
be done by word */
// Wait for last operation to be completed
waitFlashIdle();
FLASH->CR &= CR_PSIZE_MASK;
FLASH->CR |= FLASH_PSIZE_WORD;
FLASH->CR |= FLASH_CR_PG;
*address = *buffer;
/* Wait for operation to be completed */
waitFlashIdle();
FLASH->CR &= (~FLASH_CR_PG);
/* Check the written value */
if (*address != *buffer) {
/* Flash content doesn't match SRAM content */
return 2;
}
/* Increment FLASH destination address */
address += 1;
buffer += 1;
}
return 0;
}
#endif
uint8_t *cpystr(uint8_t *dest, uint8_t *source)
{
while ((*dest++ = *source++))
;
return dest - 1;
}
FRESULT readBinDir(DIR *dj, FILINFO *fno)
{
FRESULT fr;
uint32_t loop;
do {
loop = 0;
fr = f_readdir(dj, fno); // First entry
if (fr != FR_OK || fno->fname[0] == 0) {
break;
}
if (*fno->lfname == 0) {
cpystr((uint8_t *) fno->lfname, (uint8_t *) fno->fname); // Copy 8.3 name
}
int32_t len = strlen(fno->lfname) - 4;
if (len < 0) {
loop = 1;
}
if (fno->lfname[len] != '.') {
loop = 1;
}
if ((fno->lfname[len + 1] != 'b') && (fno->lfname[len + 1] != 'B')) {
loop = 1;
}
if ((fno->lfname[len + 2] != 'i') && (fno->lfname[len + 2] != 'I')) {
loop = 1;
}
if ((fno->lfname[len + 3] != 'n') && (fno->lfname[len + 3] != 'N')) {
loop = 1;
}
} while (loop);
return fr;
}
uint32_t fillNames(uint32_t index)
{
uint32_t i;
FRESULT fr;
Finfo.lfname = Filenames[0];
Finfo.lfsize = 48;
fr = f_readdir(&Dj, 0); // rewind
fr = f_readdir(&Dj, &Finfo); // Skip .
fr = f_readdir(&Dj, &Finfo); // Skip ..
i = 0;
while (i <= index) {
fr = readBinDir(&Dj, &Finfo); // First entry
FileSize[0] = Finfo.fsize;
i += 1;
if (fr == FR_NO_FILE) {
return 0;
}
}
for (i = 1; i < 7; i += 1) {
Finfo.lfname = Filenames[i];
fr = readBinDir(&Dj, &Finfo); // First entry
FileSize[i] = Finfo.fsize;
if (fr != FR_OK || Finfo.fname[0] == 0) {
break;
}
}
return i;
}
FRESULT openFirmwareFile(uint32_t index)
{
cpystr(cpystr((uint8_t *)FlashFilename, (uint8_t *)FIRMWARES_PATH "/"), (uint8_t *) Filenames[index]);
f_open(&FlashFile, FlashFilename, FA_READ);
f_lseek(&FlashFile, BOOTLOADER_SIZE);
return f_read(&FlashFile, (BYTE *) Block_buffer, 4096, &BlockCount);
}
int menuFlashFile(uint32_t index, uint8_t event)
{
FRESULT fr;
lcd_putsLeft(4*FH, "\012Hold [ENT] to start loading" );
if (Valid == 0) {
// Validate file here
// return 3 if invalid
fr = openFirmwareFile(index);
fr = f_close(&FlashFile);
Valid = 1;
if (isFirmwareStart(Block_buffer) == 0) {
Valid = 2;
}
}
if (Valid == 2) {
lcd_putsLeft(4*FH, "\011No firmware found in the file!");
if (event == EVT_KEY_FIRST(BOOT_KEY_EXIT) || event == EVT_KEY_FIRST(BOOT_KEY_MENU)) {
return 0;
}
return -1;
}
if (event == EVT_KEY_LONG(BOOT_KEY_MENU)) {
fr = openFirmwareFile(index);
FirmwareSize = FileSize[index];
if (fr != FR_OK) {
return 0; // File open error
}
return 1;
}
else if (event == EVT_KEY_FIRST(BOOT_KEY_EXIT)) {
return 0;
}
return -1;
}
extern Key keys[];
static uint32_t PowerUpDelay;
int main()
{
uint8_t index = 0;
#if defined(PCBTARANIS)
uint8_t TenCount = 2;
#endif
uint8_t maxhsize = DISPLAY_CHAR_WIDTH;
FRESULT fr;
uint32_t state = ST_START;
uint32_t nameCount = 0;
uint32_t vpos = 0;
uint32_t hpos = 0;
uint32_t firmwareAddress = FIRMWARE_ADDRESS;
uint32_t firmwareWritten = 0;
#if defined(PCBTARANIS)
wdt_reset();
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN; // Enable portA clock
#endif
pwrInit();
#if defined(PCBSKY9X)
MATRIX->CCFG_SYSIO |= 0x000000F0L; // Disable syspins, enable B4,5,6,7
#endif
#if defined(PCBSKY9X)
init_SDcard();
PIOC->PIO_PER = PIO_PC25; // Enable bit C25 (USB-detect)
start_timer0();
#endif
lcdInit();
#if defined(PCBSKY9X)
extern uint8_t OptrexDisplay;
OptrexDisplay = 1;
#endif
lcd_clear();
lcd_putsLeft(0, BOOTLOADER_TITLE);
lcd_invert_line(0);
lcdRefresh();
#if defined(PCBSKY9X)
OptrexDisplay = 0;
lcdRefresh();
#endif
#if defined(PCBTARANIS)
keysInit();
I2C_EE_Init();
init_hw_timer();
#endif
__enable_irq();
init10msTimer();
#if defined(PCBSKY9X)
EblockAddress = -1;
init_spi();
#endif
#if defined(PCBSKY9X)
uint32_t chip_id = CHIPID->CHIPID_CIDR;
FlashSize = ( (chip_id >> 8 ) & 0x000F ) == 9 ? 256 : 512;
#elif defined(PCBTARANIS)
FlashSize = 512;
#endif
#if defined(PCBSKY9X)
LockBits = readLockBits();
if (LockBits) {
clearLockBits();
}
#endif
#if defined(PCBTARANIS)
// SD card detect pin
sdInit();
unlockFlash();
usbInit();
usbStart();
#endif
for (;;) {
wdt_reset();
if (Tenms) {
wdt_reset(); // Retrigger hardware watchdog
if (EE_timer) {
if (--EE_timer == 0) {
#if defined(PCBSKY9X)
writeBlock();
#endif
}
}
Tenms = 0;
lcd_clear();
lcd_putsLeft(0, BOOTLOADER_TITLE);
lcd_invert_line(0);
uint8_t event = getEvent();
if (usbPlugged()) {
state = ST_USB;
}
if (state == ST_START) {
lcd_putsLeft(2*FH, "\010Load Firmware");
lcd_putsLeft(3*FH, "\010Exit");
lcd_invert_line(2+vpos);
lcd_putsLeft(6*FH, INDENT "Or plug in a USB cable for mass storage");
if (event == EVT_KEY_FIRST(BOOT_KEY_DOWN) || event == EVT_KEY_FIRST(BOOT_KEY_UP)) {
vpos = (vpos+1) & 0x01;
}
else if (event == EVT_KEY_FIRST(BOOT_KEY_MENU)) {
if (vpos == 0)
state = ST_FLASH_MENU;
else
state = ST_REBOOT;
}
}
if (state == ST_USB) {
lcd_putsLeft(4*FH, "\026USB Connected");
if (usbPlugged() == 0) {
vpos = 0;
state = ST_START;
}
#if defined(PCBSKY9X)
usbMassStorage();
lcd_putc( 0, 6*FH, 'F' );
lcd_putc( 6, 6*FH, '0' + FlashBlocked );
lcd_putc( 0, 7*FH, 'E' );
lcd_putc( 6, 7*FH, '0' + EepromBlocked );
#endif
}
if (state == ST_FLASH_MENU) {
sdInit();
state = ST_DIR_CHECK;
}
else if (state == ST_DIR_CHECK) {
fr = f_chdir(FIRMWARES_PATH);
if (fr == FR_OK) {
state = ST_OPEN_DIR;
}
else {
lcd_putsLeft(2*FH, INDENT "No firmware in " FIRMWARES_PATH " directory");
if (event == EVT_KEY_FIRST(BOOT_KEY_EXIT) || event == EVT_KEY_FIRST(BOOT_KEY_MENU)) {
vpos = 0;
state = ST_START;
}
}
}
if (state == ST_OPEN_DIR) {
index = 0;
fr = f_opendir(&Dj, ".");
if (fr == FR_OK) {
state = ST_FILE_LIST;
nameCount = fillNames(0);
hpos = 0;
vpos = 0;
}
}
if (state == ST_FILE_LIST) {
uint32_t limit = 6;
if (nameCount < limit) {
limit = nameCount;
}
maxhsize = 0;
for (uint32_t i=0; i<limit; i++) {
uint32_t x;
x = strlen(Filenames[i]);
if (x > maxhsize) {
maxhsize = x;
}
if (x > DISPLAY_CHAR_WIDTH) {
if (hpos + DISPLAY_CHAR_WIDTH > x) {
x = x - DISPLAY_CHAR_WIDTH;
}
else {
x = hpos;
}
}
else {
x = 0;
}
lcd_putsnAtt(INDENT_WIDTH, 16 + FH * i, &Filenames[i][x], DISPLAY_CHAR_WIDTH, 0);
}
if (event == EVT_KEY_REPT(BOOT_KEY_DOWN) || event == EVT_KEY_FIRST(BOOT_KEY_DOWN)) {
if (vpos < limit - 1) {
vpos += 1;
}
else {
if (nameCount > limit) {
index += 1;
nameCount = fillNames(index);
}
}
}
else if (event == EVT_KEY_REPT(BOOT_KEY_UP) || event == EVT_KEY_FIRST(BOOT_KEY_UP)) {
if (vpos > 0) {
vpos -= 1;
}
else {
if (index) {
index -= 1;
nameCount = fillNames(index);
}
}
}
#if !defined(PCBTARANIS)
else if (event == EVT_KEY_REPT(BOOT_KEY_RIGHT) || event == EVT_KEY_FIRST(BOOT_KEY_RIGHT)) {
if (hpos + DISPLAY_CHAR_WIDTH < maxhsize) {
hpos += 1;
}
}
else if (event == EVT_KEY_REPT(BOOT_KEY_LEFT) || event == EVT_KEY_FIRST(BOOT_KEY_LEFT)) {
if (hpos) {
hpos -= 1;
}
}
#endif
else if (event == EVT_KEY_FIRST(BOOT_KEY_MENU)) {
// Select file to flash
state = ST_FLASH_CHECK;
Valid = 0;
}
else if (event == EVT_KEY_FIRST(BOOT_KEY_EXIT)) {
state = ST_START;
vpos = 0;
}
lcd_invert_line(2 + vpos);
}
else if (state == ST_FLASH_CHECK) {
int result = menuFlashFile(vpos, event);
FirmwareSize = FileSize[vpos] - BOOTLOADER_SIZE;
if (result == 0) {
// canceled
state = ST_FILE_LIST;
}
else if (result == 1) {
// confirmed
firmwareAddress = FIRMWARE_ADDRESS + BOOTLOADER_SIZE;
firmwareWritten = 0;
state = ST_FLASHING;
}
}
if (state == ST_FLASHING) {
// Commit to flashing
uint32_t blockOffset = 0;
lcd_putsLeft(4*FH, "\032Loading...");
while (BlockCount) {
program((uint32_t *) firmwareAddress, &Block_buffer[blockOffset]); // size is 256 bytes
blockOffset += 64; // 32-bit words (256 bytes)
firmwareAddress += 256;
if (BlockCount > 256) {
BlockCount -= 256;
}
else {
BlockCount = 0;
}
}
firmwareWritten += 4; // 4K blocks
lcd_rect( 3, 6*FH+4, 204, 7);
lcd_hline(5, 6*FH+6, (200*2*firmwareWritten-32)/(FlashSize), FORCE);
lcd_hline(5, 6*FH+7, (200*2*firmwareWritten-32)/(FlashSize), FORCE);
lcd_hline(5, 6*FH+8, (200*2*firmwareWritten-32)/(FlashSize), FORCE);
fr = f_read(&FlashFile, (BYTE *)Block_buffer, sizeof(Block_buffer), &BlockCount);
if (BlockCount == 0) {
state = ST_FLASH_DONE;
}
if (firmwareWritten >= FlashSize - 32) {
state = ST_FLASH_DONE; // Backstop
}
}
if (state == ST_FLASH_DONE) {
lcd_putsLeft(4*FH, "\024Loading Complete");
if (event == EVT_KEY_FIRST(BOOT_KEY_EXIT) || event == EVT_KEY_FIRST(BOOT_KEY_MENU)) {
state = ST_START;
vpos = 0;
}
}
if (event == EVT_KEY_LONG(BOOT_KEY_EXIT)) {
state = ST_REBOOT;
}
if (--TenCount == 0) {
TenCount = 2;
lcdRefresh();
}
if (PowerUpDelay < 20) { // 200 mS
PowerUpDelay += 1;
}
else {
sdPoll10ms();
}
}
if (pwrCheck() == e_power_off && state != ST_FLASHING && state != ST_USB) {
pwrOff();
for (;;) {
// Wait for power to go off
}
}
if (state == ST_REBOOT) {
if ((~readKeys() & 0x7E) == 0) {
NVIC_SystemReset();
}
}
}
return 0;
}

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