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
+17 -3
View File
@@ -1,7 +1,7 @@
PROJECT( companion )
SET( C9X_VERSION_MAJOR "1" )
SET( C9X_VERSION_MINOR "52" )
SET( C9X_VERSION_MINOR "99" )
SET( C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR} )
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
@@ -36,7 +36,7 @@ ELSE()
MESSAGE( "SDL not found! Joysticks support will be disabled" )
ENDIF()
FIND_PACKAGE( Qt4 REQUIRED )
FIND_PACKAGE(Qt4 4.8.4 REQUIRED)
SET( QT_USE_QTNETWORK True )
SET( QT_USE_QTXML True )
INCLUDE( ${QT_USE_FILE} )
@@ -90,6 +90,13 @@ add_custom_command(
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
)
add_custom_command(
OUTPUT ${RADIO_SRC_DIRECTORY}/stamp-opentx.h
COMMAND make stamp_header
DEPENDS ${RADIO_SRC_DIRECTORY}/Makefile
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/../..
@@ -128,6 +135,7 @@ set(companion_SRCS
firmwares/opentx/opentxsimulator.cpp
firmwares/ersky9x/ersky9xeeprom.cpp
firmwares/ersky9x/ersky9xinterface.cpp
${RADIO_SRC_DIRECTORY}/stamp-opentx.h
${RADIO_SRC_DIRECTORY}/bitmaps/sticks.lbm
${RADIO_SRC_DIRECTORY}/translations/en.h
appdata.cpp
@@ -151,6 +159,8 @@ set(companion_SRCS
splashlibrary.cpp
mainwindow.cpp
companion.cpp
modelconfigdialog.cpp
taranisnotfound.cpp
qcustomplot.cpp
wizarddata.cpp
wizarddialog.cpp
@@ -175,6 +185,8 @@ set(companion_MOC_HDRS
modelslist.h
mdichild.h
mainwindow.h
modelconfigdialog.h
taranisnotfound.h
qcustomplot.h
helpers.h
wizarddialog.h
@@ -196,6 +208,8 @@ set(companion_UIS
customizesplashdialog.ui
splashlibrary.ui
burndialog.ui
modelconfigdialog.ui
taranisnotfound.ui
)
set(companion_RCS
@@ -387,7 +401,7 @@ IF( WIN32 )
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/companionInstall.exe
COMMAND "${NSIS_EXE}" ARGS companion.nsi
DEPENDS ${PROJECT_NAME} ${PROJECT_BINARY_DIR}/companion.nsi
DEPENDS ${PROJECT_NAME} simulator ${PROJECT_BINARY_DIR}/companion.nsi
COMMENT "Windows NSIS Installer")
ADD_CUSTOM_TARGET( installer
+22 -13
View File
@@ -307,6 +307,7 @@ QString Profile::display() const { return _display; }
QString Profile::haptic() const { return _haptic; }
QString Profile::speaker() const { return _speaker; }
QString Profile::stickPotCalib() const { return _stickPotCalib; }
QString Profile::timeStamp() const { return _timeStamp; }
QString Profile::trainerCalib() const { return _trainerCalib; }
int Profile::currentCalib() const { return _currentCalib; }
int Profile::gsStickMode() const { return _gsStickMode; }
@@ -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::speaker (const QString x) { store(x, _speaker, "Speaker" ,"Profiles", QString("profile%1").arg(index));}
void Profile::stickPotCalib (const QString x) { store(x, _stickPotCalib, "StickPotCalib" ,"Profiles", QString("profile%1").arg(index));}
void Profile::timeStamp (const QString x) { store(x, _timeStamp, "TimeStamp" ,"Profiles", QString("profile%1").arg(index));}
void Profile::trainerCalib (const QString x) { store(x, _trainerCalib, "TrainerCalib" ,"Profiles", QString("profile%1").arg(index));}
void Profile::currentCalib (const int x) { store(x, _currentCalib, "currentCalib" ,"Profiles", QString("profile%1").arg(index));}
void Profile::gsStickMode (const int x) { store(x, _gsStickMode, "GSStickMode" ,"Profiles", QString("profile%1").arg(index));}
@@ -396,6 +398,24 @@ bool Profile::existsOnDisk()
return (keyList.length() > 0);
}
void Profile::initFwVariables()
{
_beeper = "";
_countryCode = "";
_display = "";
_haptic = "";
_speaker = "";
_stickPotCalib = "";
_timeStamp = "";
_trainerCalib = "";
_currentCalib = 0;
_gsStickMode = 0;
_ppmMultiplier = 0;
_vBatCalib = 0;
_vBatWarn = 0;
}
void Profile::init(int newIndex)
{
index = newIndex;
@@ -410,19 +430,7 @@ void Profile::init(int newIndex)
_channelOrder = 0;
_defaultMode = 1;
_beeper = "";
_countryCode = "";
_display = "";
_haptic = "";
_speaker = "";
_stickPotCalib = "";
_trainerCalib = "";
_currentCalib = 0;
_gsStickMode = 0;
_ppmMultiplier = 0;
_vBatCalib = 0;
_vBatWarn = 0;
initFwVariables();
// Do not write empty profiles to disk except the default (0) profile.
if ( index > 0 && !existsOnDisk())
@@ -450,6 +458,7 @@ void Profile::flush()
getset( _haptic, "Haptic" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _speaker, "Speaker" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _stickPotCalib, "StickPotCalib" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _timeStamp, "TimeStamp" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _trainerCalib, "TrainerCalib" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _currentCalib, "currentCalib" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _gsStickMode, "GSStickMode" ,0 ,"Profiles", QString("profile%1").arg(index));
+4
View File
@@ -120,6 +120,7 @@ class Profile: protected CompStoreObj
QString _haptic;
QString _speaker;
QString _stickPotCalib;
QString _timeStamp;
QString _trainerCalib;
int _currentCalib;
int _gsStickMode;
@@ -145,6 +146,7 @@ class Profile: protected CompStoreObj
QString haptic() const;
QString speaker() const;
QString stickPotCalib() const;
QString timeStamp() const;
QString trainerCalib() const;
int currentCalib() const;
int gsStickMode() const;
@@ -169,6 +171,7 @@ class Profile: protected CompStoreObj
void haptic (const QString);
void speaker (const QString);
void stickPotCalib (const QString);
void timeStamp (const QString);
void trainerCalib (const QString);
void currentCalib (const int);
void gsStickMode (const int);
@@ -181,6 +184,7 @@ class Profile: protected CompStoreObj
void remove();
bool existsOnDisk();
void init(int newIndex);
void initFwVariables();
void flush();
};
+17 -4
View File
@@ -68,12 +68,13 @@ void appPreferencesDialog::writeValues()
else
g.profile[g.id()].name(ui->profileNameLE->text());
// If a new radio type has been choosen, several things need to change
// If a new radio type has been choosen, several things need to reset
if ( initialRadioType != ui->radioCB->currentIndex())
{
g.profile[g.id()].fwName("");
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->profileNameLE->setText(g.profile[g.id()].name());
ui->SplashFileName->setText(g.profile[g.id()].splashFile());
initialRadioType = getRadioType(g.profile[g.id()].fwType());
ui->radioCB->setCurrentIndex(initialRadioType);
displayImage( g.profile[g.id()].splashFile() );
QString hwSettings;
if (g.profile[g.id()].stickPotCalib() == "" ) {
hwSettings = QString(tr("EMPTY: No radio settings stored in profile"));
}
else {
QString str = g.profile[g.id()].timeStamp();
if (str.isEmpty())
hwSettings = QString(tr("AVAILABLE: Radio settings of unknown age"));
else
hwSettings = QString(tr("AVAILABLE: Radio settings stored %1").arg(str));
}
ui->lblGeneralSettings->setText(hwSettings);
}
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);
QTimer::singleShot(500, this, SLOT(doCopy()));
}
} else {
if(wTitle.isEmpty())
setWindowTitle(getProgrammer() + " " + tr("result"));
}
else {
if (wTitle.isEmpty())
setWindowTitle(getProgrammer() + " " + tr("result"));
else
setWindowTitle(getProgrammer() + " - " + wTitle);
setWindowTitle(getProgrammer() + " - " + wTitle);
QFile exec;
winTitle=wTitle;
if (!(exec.exists(prog))) {
QMessageBox::critical(this, "Companion", getProgrammer() + " " + tr("executable not found"));
closeOpt = AVR_DIALOG_FORCE_CLOSE;
QTimer::singleShot(0, this, SLOT(forceClose()));
} else {
}
else {
foreach(QString str, arg) cmdLine.append(" " + str);
lfuse = 0;
hfuse = 0;
@@ -70,10 +72,11 @@ avrOutputDialog::avrOutputDialog(QWidget *parent, QString prog, QStringList arg,
phase=0;
currLine.clear();
if (!displayDetails) {
ui->plainTextEdit->hide();
QTimer::singleShot(0, this, SLOT(shrink()));
} else {
ui->checkBox->setChecked(true);
ui->plainTextEdit->hide();
QTimer::singleShot(0, this, SLOT(shrink()));
}
else {
ui->checkBox->setChecked(true);
}
process = new QProcess(this);
connect(process,SIGNAL(readyReadStandardError()), this, SLOT(doAddTextStdErr()));
@@ -241,10 +244,8 @@ void avrOutputDialog::doAddTextStdOut()
if (text.contains("Complete ")) {
#if !__GNUC__
if (kill_timer) {
delete kill_timer;
kill_timer = NULL;
}
delete kill_timer;
kill_timer = NULL;
#endif
int start = text.indexOf("Complete ");
int end = text.indexOf("%");
+1
View File
@@ -15,6 +15,7 @@ burnConfigDialog::burnConfigDialog(QWidget *parent) :
ui(new Ui::burnConfigDialog)
{
ui->setupUi(this);
setWindowIcon(CompanionIcon("configure.png"));
ui->avrdude_programmer->model()->sort(0);
getSettings();
+55
View File
@@ -501,6 +501,61 @@ Please only use this if you know what you are doing. There are no error checks
<string notr="true">com4</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">com5</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">com6</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">com7</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">com8</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">com9</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">com10</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">com11</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">com12</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">com13</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">com14</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">com15</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">lpt1</string>
+17 -13
View File
@@ -18,12 +18,13 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
hexType(Type)
{
ui->setupUi(this);
setWindowIcon(CompanionIcon("write_flash.png"));
if(!g.profile[g.id()].splashFile().isEmpty()){
if (!g.profile[g.id()].splashFile().isEmpty()){
imageSource=PROFILE;
imageFile=g.profile[g.id()].splashFile();
}
else{
else {
ui->useProfileImageCB->setDisabled(true);
imageSource=FIRMWARE;
imageFile="";
@@ -51,7 +52,7 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
ui->BurnFlashButton->setDisabled(true);
ui->FWFileName->clear();
ui->DateField->clear();
ui->SVNField->clear();
ui->versionField->clear();
ui->ModField->clear();
ui->FramFWInfo->hide();
ui->SplashFrame->hide();
@@ -131,7 +132,7 @@ void burnDialog::on_FlashLoadButton_clicked()
ui->BurnFlashButton->setDisabled(true);
ui->FWFileName->clear();
ui->DateField->clear();
ui->SVNField->clear();
ui->versionField->clear();
ui->ModField->clear();
ui->FramFWInfo->hide();
ui->SplashFrame->hide();
@@ -145,7 +146,7 @@ void burnDialog::on_FlashLoadButton_clicked()
checkFw(fileName);
}
else {
QString fileName = QFileDialog::getOpenFileName(this,tr("Choose file to load Models and Settings from"), g.eepromDir(), tr(EXTERNAL_EEPROM_FILES_FILTER));
QString fileName = QFileDialog::getOpenFileName(this,tr("Choose file to load Models and Settings from"), g.eepromDir(), tr(EEPE_FILES_FILTER));
if (checkeEprom(fileName)) {
if (burnraw==false) {
ui->BurnFlashButton->setEnabled(true);
@@ -191,8 +192,8 @@ void burnDialog::checkFw(QString fileName)
if (flash.isValid()) {
ui->FramFWInfo->show();
ui->DateField->setText(flash.getDate() + " " + flash.getTime());
ui->SVNField->setText(flash.getSvn());
ui->ModField->setText(flash.getBuild());
ui->versionField->setText(flash.getVersion().isEmpty() ? flash.getSvn() : flash.getVersion());
ui->ModField->setText(flash.getEEprom());
ui->SplashFrame->hide();
if (flash.hasSplash()) {
@@ -305,7 +306,7 @@ void burnDialog::displaySplash()
FlashInterface flash(ui->FWFileName->text());
image = flash.getSplash();
}
else{
else {
image.load(imageFile);
}
if (image.isNull()) {
@@ -425,15 +426,18 @@ void burnDialog::on_BurnFlashButton_clicked()
hexfileName->clear();
QMessageBox::critical(this, tr("Warning"), tr("Cannot save customized firmware"));
}
} else {
}
else {
hexfileName->clear();
QMessageBox::critical(this, tr("Warning"), tr("Custom image not found"));
}
} else {
hexfileName->clear();
hexfileName->append(fileName);
}
} else {
else {
hexfileName->clear();
hexfileName->append(fileName);
}
}
else {
QMessageBox::critical(this, tr("Warning"), tr("No firmware selected"));
hexfileName->clear();
}
-3
View File
@@ -7,12 +7,9 @@
#include "flashinterface.h"
#include "xmlinterface.h"
#define XML_FILES_FILTER "XML files (*.xml);;"
#define HEX_FILES_FILTER "HEX files (*.hex);;"
#define BIN_FILES_FILTER "BIN files (*.bin);;"
#define EEPE_FILES_FILTER "EEPE EEPROM files (*.eepe);;"
#define EEPM_FILES_FILTER "EEPE MODEL files (*.eepm);;"
// #define EEPROM_FILES_FILTER "EEPE files (*.xml *.eepe *.eepm *.bin *.hex);;" XML_FILES_FILTER EEPE_FILES_FILTER EEPM_FILES_FILTER BIN_FILES_FILTER HEX_FILES_FILTER
#define EEPROM_FILES_FILTER "EEPE files (*.eepe *.bin *.hex);;" EEPE_FILES_FILTER BIN_FILES_FILTER HEX_FILES_FILTER
#define FLASH_FILES_FILTER "FLASH files (*.bin *.hex);;" BIN_FILES_FILTER HEX_FILES_FILTER
#define EXTERNAL_EEPROM_FILES_FILTER "EEPROM files (*.bin *.hex);;" BIN_FILES_FILTER HEX_FILES_FILTER
+28 -46
View File
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>440</width>
<height>423</height>
<width>399</width>
<height>564</height>
</rect>
</property>
<property name="sizePolicy">
@@ -18,7 +18,7 @@
</property>
<property name="minimumSize">
<size>
<width>440</width>
<width>0</width>
<height>0</height>
</size>
</property>
@@ -113,8 +113,15 @@
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="3" column="0">
<widget class="QLabel" name="dateLabel">
<property name="text">
<string>Date &amp; Time</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="SVNField">
<widget class="QLineEdit" name="versionField">
<property name="readOnly">
<bool>true</bool>
</property>
@@ -135,20 +142,13 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="svnLabel">
<widget class="QLabel" name="versionLabel">
<property name="text">
<string>SVN</string>
<string>Version</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="dateLabel">
<property name="text">
<string>Date &amp; Time</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item row="3" column="1">
<widget class="QLineEdit" name="DateField">
<property name="readOnly">
<bool>true</bool>
@@ -171,6 +171,12 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>250</width>
<height>0</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
@@ -254,8 +260,8 @@
<item row="0" column="0">
<layout class="QGridLayout" name="SplashLayout" rowstretch="0,0,0,0,0,0,0">
<item row="0" column="1" rowspan="7">
<layout class="QGridLayout" name="gridLayout_2" rowstretch="1">
<item row="0" column="1">
<layout class="QGridLayout" name="gridLayout_2" rowstretch="0">
<item row="0" column="0">
<widget class="QLabel" name="imageLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
@@ -271,8 +277,8 @@
</property>
<property name="maximumSize">
<size>
<width>212</width>
<height>64</height>
<width>214</width>
<height>66</height>
</size>
</property>
<property name="frameShape">
@@ -281,6 +287,9 @@
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="text">
<string/>
</property>
@@ -289,32 +298,6 @@
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="0">
@@ -377,8 +360,7 @@
<tabstop>BurnFlashButton</tabstop>
<tabstop>FWFileName</tabstop>
<tabstop>FlashLoadButton</tabstop>
<tabstop>DateField</tabstop>
<tabstop>SVNField</tabstop>
<tabstop>versionField</tabstop>
<tabstop>ModField</tabstop>
<tabstop>useProfileImageCB</tabstop>
<tabstop>useFwImageCB</tabstop>
+1
View File
@@ -57,6 +57,7 @@
<file>images/x9r3.png</file>
<file>images/x9s0.png</file>
<file>images/x9t0.png</file>
<file>images/taranison.png</file>
<file>images/wizard/ailerons.png</file>
<file>images/wizard/airbrakes.png</file>
<file>images/wizard/bank.png</file>
+2 -2
View File
@@ -1069,7 +1069,7 @@ void compareDialog::printFSwitches()
QString color2;
int sc=0;
QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-before:always;\" width=\"100%\">";
str.append("<tr><td><h2>"+tr("Switch Assignment")+"</h2></td></tr>");
str.append("<tr><td><h2>"+tr("Special Functions")+"</h2></td></tr>");
str.append("<tr><td><table border=1 cellspacing=0 cellpadding=1 width=\"100%\"><tr>");
str.append("<td width=\"7%\" align=\"center\"><b>"+tr("Switch")+"</b></td>");
str.append("<td width=\"12%\" align=\"center\"><b>"+tr("Function")+"</b></td>");
@@ -1112,7 +1112,7 @@ void compareDialog::printFSwitches()
} else {
str.append("<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>");
}
str.append(doTC(tr("CF")+QString("%1").arg(i+1),"",true));
str.append(doTC(tr("SF")+QString("%1").arg(i+1),"",true));
if (g_model2->funcSw[i].swtch.type) {
str.append(doTC(g_model2->funcSw[i].swtch.toString(),color2));
str.append(doTC(g_model2->funcSw[i].funcToString(),color2));
+1 -1
View File
@@ -142,7 +142,7 @@ customizeSplashDialog::customizeSplashDialog(QWidget *parent) :
ui(new Ui::customizeSplashDialog)
{
ui->setupUi(this);
this->setWindowIcon(CompanionIcon("paint.png"));
setWindowIcon(CompanionIcon("paintbrush.png"));
ui->leftLibraryButton->setIcon(CompanionIcon("library.png"));
ui->rightLibraryButton->setIcon(CompanionIcon("library.png"));
+7 -1
View File
@@ -10,7 +10,7 @@
<x>0</x>
<y>0</y>
<width>1087</width>
<height>285</height>
<height>298</height>
</rect>
</property>
<property name="sizePolicy">
@@ -165,6 +165,9 @@
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="text">
<string/>
</property>
@@ -470,6 +473,9 @@
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="text">
<string/>
</property>
+12
View File
@@ -2,6 +2,7 @@
#include "ui_downloaddialog.h"
#include <QMessageBox>
#include <QtGui>
#include <QTime>
#include "helpers.h"
downloadDialog::downloadDialog(QWidget *parent, QString src, QString tgt) :
@@ -87,3 +88,14 @@ void downloadDialog::fileError()
file = 0;
reject();
}
void downloadDialog::closeEvent( QCloseEvent * event)
{
// Delay closing 2 seconds to avoid unpleasant flashing download dialogs
QTime closeTime= QTime::currentTime().addSecs(2);
while( QTime::currentTime() < closeTime )
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
event->accept();
}
+1
View File
@@ -27,6 +27,7 @@ private slots:
void updateDataReadProgress(qint64 bytesRead, qint64 totalBytes);
private:
void closeEvent( QCloseEvent * event);
Ui::downloadDialog *ui;
QNetworkAccessManager qnam;
+14 -10
View File
@@ -638,41 +638,45 @@ class ConversionField: public TransformedField {
virtual void beforeExport()
{
int val = field;
_field = field;
if (scale) {
val /= scale;
_field /= scale;
}
if (table) {
if (table->exportValue(val, _field))
if (table->exportValue(_field, _field))
return;
if (!error.isEmpty())
EEPROMWarnings += error + "\n";
}
if (shift) {
if (val < min) _field = min + shift;
else if (val > max) _field = max + shift;
else _field = val + shift;
if (_field < min) _field = min + shift;
else if (_field > max) _field = max + shift;
else _field += shift;
}
if (exportFunc) {
_field = exportFunc(val);
_field = exportFunc(_field);
}
}
virtual void afterImport()
{
field = _field;
if (table) {
if (table->importValue(_field, field))
if (table->importValue(field, field))
return;
}
field = _field - shift;
if (shift) {
field -= shift;
}
if (importFunc) {
field = importFunc(_field);
field = importFunc(field);
}
if (scale) {
+132 -106
View File
@@ -127,11 +127,14 @@ RawSourceRange RawSource::getRange(bool singleprec)
result.max = singleprec ? 1540 : 3000;
break;
case TELEMETRY_SOURCE_T1:
case TELEMETRY_SOURCE_T1_MAX:
case TELEMETRY_SOURCE_T2:
case TELEMETRY_SOURCE_T2_MAX:
result.min = -30;
result.max = 225;
break;
case TELEMETRY_SOURCE_RPM:
case TELEMETRY_SOURCE_RPM_MAX:
result.step = singleprec ? 50 : 1;
result.max = singleprec ? 12750 : 20000;
break;
@@ -139,6 +142,7 @@ RawSourceRange RawSource::getRange(bool singleprec)
result.max = 100;
break;
case TELEMETRY_SOURCE_SPEED:
case TELEMETRY_SOURCE_SPEED_MAX:
result.step = singleprec ? 4 : 1;
result.max = singleprec ? 944 : 2000;
if (model && !model->frsky.imperial) {
@@ -147,21 +151,26 @@ RawSourceRange RawSource::getRange(bool singleprec)
}
break;
case TELEMETRY_SOURCE_DIST:
case TELEMETRY_SOURCE_DIST_MAX:
result.step = singleprec ? 8 : 1;
result.max = singleprec ? 2040 : 10000;
break;
case TELEMETRY_SOURCE_CELL:
case TELEMETRY_SOURCE_CELL_MIN:
result.step = singleprec ? 0.02 : 0.01;
result.max = 5.1;
result.decimals = 2;
break;
case TELEMETRY_SOURCE_CELLS_SUM:
case TELEMETRY_SOURCE_CELLS_MIN:
case TELEMETRY_SOURCE_VFAS:
case TELEMETRY_SOURCE_VFAS_MIN:
result.step = 0.1;
result.max = 25.5;
result.decimals = 1;
break;
case TELEMETRY_SOURCE_CURRENT:
case TELEMETRY_SOURCE_CURRENT_MAX:
result.step = singleprec ? 0.5 : 0.1;
result.max = singleprec ? 127.5 : 200.0;
result.decimals = 1;
@@ -171,6 +180,7 @@ RawSourceRange RawSource::getRange(bool singleprec)
result.max = singleprec ? 5100 : 10000;
break;
case TELEMETRY_SOURCE_POWER:
case TELEMETRY_SOURCE_POWER_MAX:
result.step = singleprec ? 5 : 1;
result.max = singleprec ? 1275 : 2000;
break;
@@ -222,20 +232,20 @@ QString RawSource::toString()
QObject::tr("A1"), QObject::tr("A2"), QObject::tr("A3"), QObject::tr("A4"),
QObject::tr("Alt"), QObject::tr("Rpm"), QObject::tr("Fuel"), QObject::tr("T1"), QObject::tr("T2"),
QObject::tr("Speed"), QObject::tr("Dist"), QObject::tr("GPS Alt"),
QObject::tr("Cell"), QObject::tr("Cels"), QObject::tr("Vfas"), QObject::tr("Curr"), QObject::tr("Cnsp"), QObject::tr("Powr"),
QObject::tr("Cell"), QObject::tr("Cells"), QObject::tr("Vfas"), QObject::tr("Curr"), QObject::tr("Cnsp"), QObject::tr("Powr"),
QObject::tr("AccX"), QObject::tr("AccY"), QObject::tr("AccZ"),
QObject::tr("HDG "), QObject::tr("VSpd"), QObject::tr("ASpd"), QObject::tr("dTE"),
QObject::tr("A1-"), QObject::tr("A2-"), QObject::tr("A3-"), QObject::tr("A4-"),
QObject::tr("Alt-"), QObject::tr("Alt+"), QObject::tr("Rpm+"), QObject::tr("T1+"), QObject::tr("T2+"), QObject::tr("Spd+"), QObject::tr("Dst+"),
QObject::tr("Cel-"), QObject::tr("Cels-"), QObject::tr("Vfs-"), QObject::tr("Cur+"), QObject::tr("Pwr+"),
QObject::tr("Alt-"), QObject::tr("Alt+"), QObject::tr("Rpm+"), QObject::tr("T1+"), QObject::tr("T2+"), QObject::tr("Speed+"), QObject::tr("Dist+"),
QObject::tr("Cell-"), QObject::tr("Cells-"), QObject::tr("Vfas-"), QObject::tr("Curr+"), QObject::tr("Powr+"),
QObject::tr("ACC"), QObject::tr("Time"),
};
static const QString virtualSwitches[] = {
QObject::tr("LS1"), QObject::tr("LS2"), QObject::tr("LS3"), QObject::tr("LS4"), QObject::tr("LS5"), QObject::tr("LS6"), QObject::tr("LS7"), QObject::tr("LS8"), QObject::tr("LS9"), QObject::tr("LSA"),
QObject::tr("LSB"), QObject::tr("LSC"), QObject::tr("LSD"), QObject::tr("LSE"), QObject::tr("LSF"), QObject::tr("LSG"), QObject::tr("LSH"), QObject::tr("LSI"), QObject::tr("LSJ"), QObject::tr("LSK"),
QObject::tr("LSL"), QObject::tr("LSM"), QObject::tr("LSN"), QObject::tr("LSO"), QObject::tr("LSP"), QObject::tr("LSQ"), QObject::tr("LSR"), QObject::tr("LSS"), QObject::tr("LST"), QObject::tr("LSU"),
QObject::tr("LSV"), QObject::tr("LSW")
QObject::tr("L1"), QObject::tr("L2"), QObject::tr("L3"), QObject::tr("L4"), QObject::tr("L5"), QObject::tr("L6"), QObject::tr("L7"), QObject::tr("L8"), QObject::tr("L9"), QObject::tr("L10"),
QObject::tr("L11"), QObject::tr("L12"), QObject::tr("L13"), QObject::tr("L14"), QObject::tr("L15"), QObject::tr("L16"), QObject::tr("L17"), QObject::tr("L18"), QObject::tr("L19"), QObject::tr("L20"),
QObject::tr("L21"), QObject::tr("L22"), QObject::tr("L23"), QObject::tr("L24"), QObject::tr("L25"), QObject::tr("L26"), QObject::tr("L27"), QObject::tr("L28"), QObject::tr("L29"), QObject::tr("L30"),
QObject::tr("L31"), QObject::tr("L32")
};
if (index<0) {
@@ -265,7 +275,7 @@ QString RawSource::toString()
case SOURCE_TYPE_CYC:
return QObject::tr("CYC%1").arg(index+1);
case SOURCE_TYPE_PPM:
return QObject::tr("PPM%1").arg(index+1);
return QObject::tr("TR%1").arg(index+1);
case SOURCE_TYPE_CH:
if (index < GetEepromInterface()->getCapability(Outputs))
return QObject::tr("CH%1%2").arg((index+1)/10).arg((index+1)%10);
@@ -312,10 +322,10 @@ QString RawSwitch::toString()
};
static const QString virtualSwitches[] = {
QObject::tr("LS1"), QObject::tr("LS2"), QObject::tr("LS3"), QObject::tr("LS4"), QObject::tr("LS5"), QObject::tr("LS6"), QObject::tr("LS7"), QObject::tr("LS8"), QObject::tr("LS9"), QObject::tr("LSA"),
QObject::tr("LSB"), QObject::tr("LSC"), QObject::tr("LSD"), QObject::tr("LSE"), QObject::tr("LSF"), QObject::tr("LSG"), QObject::tr("LSH"), QObject::tr("LSI"), QObject::tr("LSJ"), QObject::tr("LSK"),
QObject::tr("LSL"), QObject::tr("LSM"), QObject::tr("LSN"), QObject::tr("LSO"), QObject::tr("LSP"), QObject::tr("LSQ"), QObject::tr("LSR"), QObject::tr("LSS"), QObject::tr("LST"), QObject::tr("LSU"),
QObject::tr("LSV"), QObject::tr("LSW")
QObject::tr("L1"), QObject::tr("L2"), QObject::tr("L3"), QObject::tr("L4"), QObject::tr("L5"), QObject::tr("L6"), QObject::tr("L7"), QObject::tr("L8"), QObject::tr("L9"), QObject::tr("L10"),
QObject::tr("L11"), QObject::tr("L12"), QObject::tr("L13"), QObject::tr("L14"), QObject::tr("L15"), QObject::tr("L16"), QObject::tr("L17"), QObject::tr("L18"), QObject::tr("L19"), QObject::tr("L20"),
QObject::tr("L21"), QObject::tr("L22"), QObject::tr("L23"), QObject::tr("L24"), QObject::tr("L25"), QObject::tr("L26"), QObject::tr("L27"), QObject::tr("L28"), QObject::tr("L29"), QObject::tr("L30"),
QObject::tr("L31"), QObject::tr("L32")
};
static const QString multiposPots[] = {
@@ -451,7 +461,7 @@ QString LogicalSwitchData::funcToString()
case LS_FN_STICKY:
return QObject::tr("Sticky");
case LS_FN_STAY:
return QObject::tr("Stay");
return QObject::tr("Edge");
default:
return QObject::tr("Unknown");
}
@@ -782,115 +792,122 @@ QString FuncSwData::repeatToString()
GeneralSettings::GeneralSettings()
{
memset(this, 0, sizeof(GeneralSettings));
contrast = 25;
vBatWarn = 90;
for (int i=0; i<(NUM_STICKS+C9X_NUM_POTS ); ++i) {
for (int i=0; i<NUM_STICKS+C9X_NUM_POTS; ++i) {
calibMid[i] = 0x200;
calibSpanNeg[i] = 0x180;
calibSpanPos[i] = 0x180;
}
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
potsType[0] = 1;
potsType[1] = 1;
}
templateSetup = g.profile[g.id()].channelOrder();
stickMode = g.profile[g.id()].defaultMode();
QString t_calib=g.profile[g.id()].stickPotCalib();
int potsnum=GetEepromInterface()->getCapability(Pots);
if (t_calib.isEmpty()) {
return;
}
else {
QString t_trainercalib=g.profile[g.id()].trainerCalib();
int8_t t_vBatCalib=(int8_t)g.profile[g.id()].vBatCalib();
int8_t t_currentCalib=(int8_t)g.profile[g.id()].currentCalib();
int8_t t_PPM_Multiplier=(int8_t)g.profile[g.id()].ppmMultiplier();
uint8_t t_stickMode=(uint8_t)g.profile[g.id()].gsStickMode();
uint8_t t_vBatWarn=(uint8_t)g.profile[g.id()].vBatWarn();
QString t_DisplaySet=g.profile[g.id()].display();
QString t_BeeperSet=g.profile[g.id()].beeper();
QString t_HapticSet=g.profile[g.id()].haptic();
QString t_SpeakerSet=g.profile[g.id()].speaker();
QString t_CountrySet=g.profile[g.id()].countryCode();
QString t_calib=g.profile[g.id()].stickPotCalib();
int potsnum=GetEepromInterface()->getCapability(Pots);
if (t_calib.isEmpty()) {
return;
}
else {
QString t_trainercalib=g.profile[g.id()].trainerCalib();
int8_t t_vBatCalib=(int8_t)g.profile[g.id()].vBatCalib();
int8_t t_currentCalib=(int8_t)g.profile[g.id()].currentCalib();
int8_t t_PPM_Multiplier=(int8_t)g.profile[g.id()].ppmMultiplier();
uint8_t t_stickMode=(uint8_t)g.profile[g.id()].gsStickMode();
uint8_t t_vBatWarn=(uint8_t)g.profile[g.id()].vBatWarn();
QString t_DisplaySet=g.profile[g.id()].display();
QString t_BeeperSet=g.profile[g.id()].beeper();
QString t_HapticSet=g.profile[g.id()].haptic();
QString t_SpeakerSet=g.profile[g.id()].speaker();
QString t_CountrySet=g.profile[g.id()].countryCode();
if ((t_calib.length()==(NUM_STICKS+potsnum)*12) && (t_trainercalib.length()==16)) {
QString Byte;
int16_t byte16;
bool ok;
for (int i=0; i<(NUM_STICKS+potsnum); i++) {
Byte=t_calib.mid(i*12,4);
byte16=(int16_t)Byte.toInt(&ok,16);
if (ok)
calibMid[i]=byte16;
Byte=t_calib.mid(4+i*12,4);
byte16=(int16_t)Byte.toInt(&ok,16);
if (ok)
calibSpanNeg[i]=byte16;
Byte=t_calib.mid(8+i*12,4);
byte16=(int16_t)Byte.toInt(&ok,16);
if (ok)
calibSpanPos[i]=byte16;
}
for (int i=0; i<4; i++) {
Byte=t_trainercalib.mid(i*4,4);
byte16=(int16_t)Byte.toInt(&ok,16);
if (ok)
trainer.calib[i]=byte16;
}
currentCalib=t_currentCalib;
vBatCalib=t_vBatCalib;
vBatWarn=t_vBatWarn;
PPM_Multiplier=t_PPM_Multiplier;
stickMode = t_stickMode;
if ((t_calib.length()==(NUM_STICKS+potsnum)*12) && (t_trainercalib.length()==16)) {
QString Byte;
int16_t byte16;
bool ok;
for (int i=0; i<(NUM_STICKS+potsnum); i++) {
Byte=t_calib.mid(i*12,4);
byte16=(int16_t)Byte.toInt(&ok,16);
if (ok)
calibMid[i]=byte16;
Byte=t_calib.mid(4+i*12,4);
byte16=(int16_t)Byte.toInt(&ok,16);
if (ok)
calibSpanNeg[i]=byte16;
Byte=t_calib.mid(8+i*12,4);
byte16=(int16_t)Byte.toInt(&ok,16);
if (ok)
calibSpanPos[i]=byte16;
}
if ((t_DisplaySet.length()==6) && (t_BeeperSet.length()==4) && (t_HapticSet.length()==6) && (t_SpeakerSet.length()==6)) {
uint8_t byte8u;
int8_t byte8;
bool ok;
byte8=(int8_t)t_DisplaySet.mid(0,2).toInt(&ok,16);
for (int i=0; i<4; i++) {
Byte=t_trainercalib.mid(i*4,4);
byte16=(int16_t)Byte.toInt(&ok,16);
if (ok)
optrexDisplay=(byte8==1 ? true : false);
byte8u=(uint8_t)t_DisplaySet.mid(2,2).toUInt(&ok,16);
trainer.calib[i]=byte16;
}
currentCalib=t_currentCalib;
vBatCalib=t_vBatCalib;
vBatWarn=t_vBatWarn;
PPM_Multiplier=t_PPM_Multiplier;
stickMode = t_stickMode;
}
if ((t_DisplaySet.length()==6) && (t_BeeperSet.length()==4) && (t_HapticSet.length()==6) && (t_SpeakerSet.length()==6)) {
uint8_t byte8u;
int8_t byte8;
bool ok;
byte8=(int8_t)t_DisplaySet.mid(0,2).toInt(&ok,16);
if (ok)
optrexDisplay=(byte8==1 ? true : false);
byte8u=(uint8_t)t_DisplaySet.mid(2,2).toUInt(&ok,16);
if (ok)
contrast=byte8u;
byte8u=(uint8_t)t_DisplaySet.mid(4,2).toUInt(&ok,16);
if (ok)
backlightBright=byte8u;
byte8=(int8_t)t_BeeperSet.mid(0,2).toUInt(&ok,16);
if (ok)
beeperMode=(BeeperMode)byte8;
byte8=(int8_t)t_BeeperSet.mid(2,2).toInt(&ok,16);
if (ok)
beeperLength=byte8;
byte8=(int8_t)t_HapticSet.mid(0,2).toUInt(&ok,16);
if (ok)
hapticMode=(BeeperMode)byte8;
byte8u=(uint8_t)t_HapticSet.mid(2,2).toUInt(&ok,16);
if (ok)
hapticStrength=byte8u;
byte8=(int8_t)t_HapticSet.mid(4,2).toInt(&ok,16);
if (ok)
hapticLength=byte8;
byte8u=(uint8_t)t_SpeakerSet.mid(0,2).toUInt(&ok,16);
if (ok)
speakerMode=byte8u;
byte8u=(uint8_t)t_SpeakerSet.mid(2,2).toUInt(&ok,16);
if (ok)
speakerPitch=byte8u;
byte8u=(uint8_t)t_SpeakerSet.mid(4,2).toUInt(&ok,16);
if (ok)
speakerVolume=byte8u;
if (t_CountrySet.length()==6) {
byte8u=(uint8_t)t_CountrySet.mid(0,2).toUInt(&ok,16);
if (ok)
contrast=byte8u;
byte8u=(uint8_t)t_DisplaySet.mid(4,2).toUInt(&ok,16);
countryCode=byte8u;
byte8u=(uint8_t)t_CountrySet.mid(2,2).toUInt(&ok,16);
if (ok)
backlightBright=byte8u;
byte8=(int8_t)t_BeeperSet.mid(0,2).toUInt(&ok,16);
if (ok)
beeperMode=(BeeperMode)byte8;
byte8=(int8_t)t_BeeperSet.mid(2,2).toInt(&ok,16);
if (ok)
beeperLength=byte8;
byte8=(int8_t)t_HapticSet.mid(0,2).toUInt(&ok,16);
if (ok)
hapticMode=(BeeperMode)byte8;
byte8u=(uint8_t)t_HapticSet.mid(2,2).toUInt(&ok,16);
if (ok)
hapticStrength=byte8u;
byte8=(int8_t)t_HapticSet.mid(4,2).toInt(&ok,16);
if (ok)
hapticLength=byte8;
byte8u=(uint8_t)t_SpeakerSet.mid(0,2).toUInt(&ok,16);
if (ok)
speakerMode=byte8u;
byte8u=(uint8_t)t_SpeakerSet.mid(2,2).toUInt(&ok,16);
if (ok)
speakerPitch=byte8u;
byte8u=(uint8_t)t_SpeakerSet.mid(4,2).toUInt(&ok,16);
if (ok)
speakerVolume=byte8u;
if (t_CountrySet.length()==6) {
byte8u=(uint8_t)t_CountrySet.mid(0,2).toUInt(&ok,16);
if (ok)
countryCode=byte8u;
byte8u=(uint8_t)t_CountrySet.mid(2,2).toUInt(&ok,16);
if (ok)
imperial=byte8u;
QString chars=t_CountrySet.mid(4,2);
ttsLanguage[0]=chars[0].toAscii();
ttsLanguage[1]=chars[1].toAscii();
}
imperial=byte8u;
QString chars=t_CountrySet.mid(4,2);
ttsLanguage[0]=chars[0].toAscii();
ttsLanguage[1]=chars[1].toAscii();
}
}
}
}
RawSource GeneralSettings::getDefaultSource(unsigned int channel) const
@@ -899,6 +916,15 @@ RawSource GeneralSettings::getDefaultSource(unsigned int channel) const
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()
{
clear();
+21 -17
View File
@@ -170,6 +170,19 @@ enum HeliSwashTypes {
extern const char * switches9X[];
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 {
TELEMETRY_SOURCE_TX_BATT,
TELEMETRY_SOURCE_TIMER1,
@@ -217,6 +230,7 @@ enum TelemetrySource {
TELEMETRY_SOURCE_CELL_MIN,
TELEMETRY_SOURCE_CELLS_MIN,
TELEMETRY_SOURCE_VFAS_MIN,
TELEMETRY_SOURCE_CURRENT_MAX,
TELEMETRY_SOURCE_POWER_MAX,
TELEMETRY_SOURCE_ACC,
TELEMETRY_SOURCE_GPS_TIME,
@@ -579,7 +593,6 @@ class MixData {
MixData() { clear(); }
unsigned int destCh; // 1..C9X_NUM_CHNOUT
RawSource srcRaw;
unsigned int srcVariant;
int weight;
RawSwitch swtch;
CurveReference curve; //0=symmetrisch
@@ -804,7 +817,7 @@ class FrSkyData {
FrSkyChannelData channels[2];
unsigned int usrProto;
unsigned int imperial;
unsigned int blades;
int blades;
unsigned int voltsSource;
bool altitudeDisplayed;
unsigned int currentSource;
@@ -820,7 +833,7 @@ class FrSkyData {
unsigned int storedMah;
int fasOffset;
void clear() { memset(this, 0, sizeof(FrSkyData)); rssiAlarms[0].clear(2, 45); rssiAlarms[1].clear(3, 42); varioSource = 2/*VARIO*/; }
void clear();
};
class MavlinkData {
@@ -975,7 +988,6 @@ class RadioData {
// TODO rename FlightPhase to FlightMode
enum Capability {
OwnerName,
FlightPhases,
FlightModesName,
FlightPhasesHaveFades,
@@ -1002,7 +1014,6 @@ enum Capability {
ExtraChannels,
ExtraInputs,
ExtendedTrims,
HasInputFilter,
NumCurves,
NumCurvePoints,
OffsetWeight,
@@ -1015,11 +1026,7 @@ enum Capability {
Haptic,
HapticLength,
HapticMode,
HasBlInvert,
HasBeeper,
BandgapMeasure,
PotScrolling,
TrainerSwitch,
ModelTrainerEnable,
Timer2ThrTrig,
HasExpoNames,
@@ -1034,8 +1041,6 @@ enum Capability {
OptrexDisplay,
PPMExtCtrl,
PPMFrameLength,
gsSwitchMask,
BLonStickMove,
DSM2Indexes,
Telemetry,
TelemetryUnits,
@@ -1050,8 +1055,6 @@ enum Capability {
TelemetryCustomScreens,
TelemetryCustomScreensFieldsPerLine,
TelemetryRSSIModel,
TelemetryAlarm,
TelemetryInternalAlarm,
TelemetryTimeshift,
TelemetryMaxMultiplier,
HasAltitudeSel,
@@ -1059,9 +1062,6 @@ enum Capability {
HasVarioSink,
HasVariants,
HasFailsafe,
HasPPMSim,
HasCrossTrims,
HasStickScroll,
HasSoundMixer,
NumModules,
PPMCenter,
@@ -1084,7 +1084,6 @@ enum Capability {
LuaInputs,
LimitsPer1000,
EnhancedCurves,
TelemetryInternalAlarms,
HasFasOffset,
HasMahPersistent,
MultiposPots,
@@ -1373,6 +1372,11 @@ inline unsigned int GetCurrentFirmwareVariant()
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] : "???")
#endif
@@ -213,22 +213,14 @@ int Er9xInterface::getCapability(const Capability capability)
return 1;
case Timer2ThrTrig:
return 1;
case TrainerSwitch:
return 1;
case OffsetWeight:
return 125;
case BandgapMeasure:
return 1;
case PotScrolling:
return 1;
case SoundMod:
return 1;
case SoundPitch:
return 1;
case Haptic:
return 1;
case OwnerName:
return 10;
case Timers:
return 1;
case Pots:
@@ -251,10 +243,6 @@ int Er9xInterface::getCapability(const Capability capability)
return 0;
case Simulation:
return 1;
case gsSwitchMask:
return 1;
case BLonStickMove:
return 1;
case Telemetry:
return TM_HASTELEMETRY|TM_HASWSHH;
case TelemetryUnits:
@@ -270,14 +258,9 @@ int Er9xInterface::getCapability(const Capability capability)
case LCDWidth:
return 128;
case VoicesAsNumbers:
case TelemetryInternalAlarm:
case HasPPMSim:
case HasCrossTrims:
case HasStickScroll:
case HasAltitudeSel:
case HasContrast:
case HasVolume:
case HasBlInvert:
case ModelVoice:
case Gvars:
return 7;
@@ -255,22 +255,12 @@ int Ersky9xInterface::getCapability(const Capability capability)
return 1;
case Timer2ThrTrig:
return 1;
case TrainerSwitch:
return 1;
case BandgapMeasure:
return 1;
case PotScrolling:
return 1;
case SoundMod:
return 1;
case SoundPitch:
return 1;
case Haptic:
return 1;
case OwnerName:
return 10;
case HasInputFilter:
return 0;
case ModelVoice:
return 1;
case Timers:
@@ -297,10 +287,6 @@ int Ersky9xInterface::getCapability(const Capability capability)
return 0;
case Simulation:
return 1;
case gsSwitchMask:
return 1;
case BLonStickMove:
return 1;
case Telemetry:
return TM_HASTELEMETRY|TM_HASWSHH;
case TelemetryUnits:
@@ -219,8 +219,6 @@ int Gruvin9xInterface::getSize(GeneralSettings &settings)
int Gruvin9xInterface::getCapability(const Capability capability)
{
switch (capability) {
case OwnerName:
return 0;
case Mixes:
return G9X_MAX_MIXERS;
case FlightPhases:
@@ -681,7 +681,7 @@ t_Open9xArmFrSkyData_v210::operator FrSkyData ()
c9x.channels[1] = channels[1];
c9x.usrProto = usrProto;
c9x.voltsSource = voltsSource;
c9x.blades = blades;
c9x.blades = blades+2;
c9x.currentSource=currentSource;
c9x.screens[0].type = 1;
for (int i=0; i<4; i++) {
@@ -709,7 +709,7 @@ t_Open9xArmFrSkyData_v211::operator FrSkyData ()
c9x.channels[1] = channels[1];
c9x.usrProto = usrProto;
c9x.voltsSource = voltsSource;
c9x.blades = blades;
c9x.blades = blades+2;
c9x.currentSource=currentSource;
c9x.screens[0].type = 1;
for (int i=0; i<4; i++) {
@@ -843,7 +843,7 @@ t_Open9xFrSkyData_v204::operator FrSkyData ()
c9x.channels[1] = channels[1];
c9x.usrProto = usrProto;
c9x.imperial = imperial;
c9x.blades = blades;
c9x.blades = blades+2;
c9x.screens[0].type = 1;
for (int i=0; i<4; i++)
c9x.screens[0].body.bars[i] = bars[i];
@@ -857,7 +857,7 @@ t_Open9xFrSkyData_v205::operator FrSkyData ()
c9x.channels[1] = channels[1];
c9x.usrProto = usrProto;
c9x.imperial = imperial;
c9x.blades = blades;
c9x.blades = blades+2;
c9x.screens[0].type = 1;
for (int i=0; i<4; i++)
c9x.screens[0].body.bars[i] = bars[i];
@@ -873,7 +873,7 @@ t_Open9xFrSkyData_v208::operator FrSkyData ()
c9x.channels[1] = channels[1];
c9x.usrProto = usrProto;
c9x.voltsSource = voltsSource;
c9x.blades = blades;
c9x.blades = blades+2;
c9x.currentSource=currentSource;
c9x.screens[0].type = 1;
for (int i=0; i<4; i++)
@@ -890,7 +890,7 @@ t_Open9xFrSkyData_v210::operator FrSkyData ()
c9x.channels[1] = channels[1];
c9x.usrProto = usrProto;
c9x.voltsSource = voltsSource;
c9x.blades = blades;
c9x.blades = blades+2;
c9x.currentSource=currentSource;
int lines_screen_index = 0;
@@ -74,6 +74,7 @@ namespace Open9xGruvin9x {
#include "radio/src/simpgmspace.cpp"
#include "radio/src/templates.cpp"
#include "radio/src/translations.cpp"
#include "radio/src/fonts.cpp"
#include "radio/src/audio_avr.cpp"
#include "radio/src/buzzer.cpp"
#include "radio/src/targets/gruvin9x/somo14d.cpp"
@@ -73,6 +73,7 @@ namespace Open9xM128 {
#include "radio/src/simpgmspace.cpp"
#include "radio/src/templates.cpp"
#include "radio/src/translations.cpp"
#include "radio/src/fonts.cpp"
#include "radio/src/audio_avr.cpp"
#include "radio/src/targets/stock/voice.cpp"
#include "radio/src/telemetry/frsky.cpp"
@@ -54,6 +54,7 @@
#define GPS
#define FAI_CHOICE
#define NUM_POTS 3
#define EEPROM_VARIANT 3
#undef min
@@ -90,6 +91,7 @@ namespace Open9xSky9x {
#include "radio/src/simpgmspace.cpp"
#include "radio/src/templates.cpp"
#include "radio/src/translations.cpp"
#include "radio/src/fonts.cpp"
#include "radio/src/telemetry/frsky.cpp"
#include "radio/src/targets/sky9x/audio_driver.cpp"
#include "radio/src/audio_arm.cpp"
@@ -23,7 +23,6 @@
#define PCBTARANIS
#define CPUARM
#define HELI
#define TEMPLATES
#define SPLASH
#define FLIGHT_MODES
#define FRSKY
@@ -54,6 +53,8 @@
#define LUA_MODEL_SCRIPTS
#define EEPROM_VARIANT 3
#define NUM_POTS 5
#undef min
#undef max
@@ -71,7 +72,6 @@ inline int geteepromsize() {
#include "radio/src/protocols/ppm_arm.cpp"
#include "radio/src/protocols/pxx_arm.cpp"
#include "radio/src/protocols/dsm2_arm.cpp"
#include "radio/src/targets/taranis/pwr_driver.cpp"
#include "radio/src/eeprom_common.cpp"
#include "radio/src/eeprom_conversions.cpp"
#include "radio/src/eeprom_rlc.cpp"
@@ -102,8 +102,8 @@ inline int geteepromsize() {
#undef SDCARD
#include "radio/src/simpgmspace.cpp"
#define SDCARD
#include "radio/src/templates.cpp"
#include "radio/src/translations.cpp"
#include "radio/src/fonts.cpp"
#include "radio/src/telemetry/frsky_sport.cpp"
#include "radio/src/targets/taranis/audio_driver.cpp"
#include "radio/src/audio_arm.cpp"
@@ -152,9 +152,6 @@ int16_t g_anas[NUM_STICKS+5];
uint16_t anaIn(uint8_t chan)
{
if (chan == 8)
return 1800;
else
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_LARGE_LCD(board) IS_TARANIS(board)
#define MAX_VIEWS(board) (HAS_LARGE_LCD(board) ? 2 : 256)
#define MAX_POTS(board, version) (IS_TARANIS(board) ? (version>=216 ? 5 : 4) : 3)
#define MAX_POTS(board) (IS_TARANIS(board) ? 5 : 3)
#define MAX_SWITCHES(board) (IS_TARANIS(board) ? 8 : 7)
#define MAX_SWITCHES_POSITION(board) (IS_TARANIS(board) ? 22 : 9)
#define MAX_ROTARY_ENCODERS(board) (board==BOARD_GRUVIN9X ? 2 : (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++);
}
for (int i=0; i<MAX_ROTARY_ENCODERS(board); i++)
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>
class SwitchField: public ConversionField< SignedField<N> > {
public:
@@ -384,8 +413,12 @@ class TelemetrySourcesConversionTable: public ConversionTable {
addConversion(1+TELEMETRY_SOURCE_T2_MAX, val++);
addConversion(1+TELEMETRY_SOURCE_SPEED_MAX, val++);
addConversion(1+TELEMETRY_SOURCE_DIST_MAX, val++);
addConversion(1+TELEMETRY_SOURCE_CELL_MIN, val++);
addConversion(1+TELEMETRY_SOURCE_VFAS_MIN, val++);
if (version >= 216) {
addConversion(1+TELEMETRY_SOURCE_CELL_MIN, val++);
addConversion(1+TELEMETRY_SOURCE_CELLS_MIN, val++);
addConversion(1+TELEMETRY_SOURCE_VFAS_MIN, val++);
}
addConversion(1+TELEMETRY_SOURCE_CURRENT_MAX, val++);
addConversion(1+TELEMETRY_SOURCE_POWER_MAX, val++);
if (IS_ARM(board) && version >= 216) {
for (int i=0; i<5; i++)
@@ -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) {
_gvar = 512 + gvar + 10000;
_gvar = GV1 + gvar + 10000;
}
else if (gvar > 10000) {
_gvar = 512 + gvar - 10001;
_gvar = GV1 + gvar - 10001;
}
else {
_gvar = gvar;
}
}
void importGvarParam(int & gvar, const int _gvar)
void importGvarParam(int & gvar, const int _gvar, int version)
{
if (_gvar >= 512) {
gvar = 10001 + _gvar - 512;
int GV1 = (version >= 216 ? 4096 : 512);
if (_gvar >= GV1) {
gvar = 10001 + _gvar - GV1;
}
else if (_gvar >= 512-5) {
gvar = -10000 + _gvar - 512;
else if (_gvar >= GV1-9) {
gvar = -10000 + _gvar - GV1;
}
else if (_gvar < -512) {
gvar = -10000 + _gvar + 513;
else if (_gvar < -GV1) {
gvar = -10000 + _gvar + GV1 + 1;
}
else if (_gvar < -512+5) {
gvar = 10000 + _gvar + 513;
else if (_gvar < -GV1+9) {
gvar = 10000 + _gvar + GV1 + 1;
}
else {
gvar = _gvar;
@@ -744,12 +781,14 @@ class MixField: public TransformedField {
if (IS_TARANIS(board) && version >= 216) {
internalField.Append(new UnsignedField<8>(_destCh));
internalField.Append(new UnsignedField<16>(mix.phases));
internalField.Append(new UnsignedField<8>((unsigned int &)mix.mltpx));
internalField.Append(new UnsignedField<2>((unsigned int &)mix.mltpx));
internalField.Append(new UnsignedField<1>((unsigned int &)mix.carryTrim));
internalField.Append(new SpareBitsField<5>());
internalField.Append(new SignedField<16>(_weight));
internalField.Append(new SwitchField<8>(mix.swtch, board, version));
internalField.Append(new CurveReferenceField(mix.curve, board, version));
internalField.Append(new UnsignedField<4>(mix.mixWarn));
internalField.Append(new UnsignedField<4>(mix.srcVariant));
internalField.Append(new SpareBitsField<4>());
internalField.Append(new UnsignedField<8>(mix.delayUp));
internalField.Append(new UnsignedField<8>(mix.delayDown));
internalField.Append(new UnsignedField<8>(mix.speedUp));
@@ -759,6 +798,26 @@ class MixField: public TransformedField {
internalField.Append(new ZCharField<8>(mix.name));
internalField.Append(new SpareBitsField<8>());
}
else if (IS_ARM(board) && version >= 216) {
internalField.Append(new UnsignedField<4>(_destCh));
internalField.Append(new UnsignedField<4>(mix.mixWarn));
internalField.Append(new UnsignedField<16>(mix.phases));
internalField.Append(new BoolField<1>(_curveMode));
internalField.Append(new BoolField<1>(mix.noExpo));
internalField.Append(new SignedField<3>(mix.carryTrim));
internalField.Append(new UnsignedField<2>((unsigned int &)mix.mltpx));
internalField.Append(new SpareBitsField<1>());
internalField.Append(new SignedField<16>(_weight));
internalField.Append(new SwitchField<8>(mix.swtch, board, version));
internalField.Append(new SignedField<8>(_curveParam));
internalField.Append(new UnsignedField<8>(mix.delayUp));
internalField.Append(new UnsignedField<8>(mix.delayDown));
internalField.Append(new UnsignedField<8>(mix.speedUp));
internalField.Append(new UnsignedField<8>(mix.speedDown));
internalField.Append(new SourceField<8>(mix.srcRaw, board, version, FLAG_NOTELEMETRY));
internalField.Append(new SignedField<16>(_offset));
internalField.Append(new ZCharField<6>(mix.name));
}
else if (IS_ARM(board)) {
internalField.Append(new UnsignedField<8>(_destCh));
internalField.Append(new UnsignedField<16>(mix.phases));
@@ -775,7 +834,7 @@ class MixField: public TransformedField {
internalField.Append(new SignedField<8>(_curveParam));
if (version >= 214) {
internalField.Append(new UnsignedField<4>(mix.mixWarn));
internalField.Append(new UnsignedField<4>(mix.srcVariant));
internalField.Append(new SpareBitsField<4>());
}
else {
internalField.Append(new UnsignedField<8>(mix.mixWarn));
@@ -865,9 +924,9 @@ class MixField: public TransformedField {
}
if (IS_ARM(board)) {
exportGvarParam(mix.weight, _weight);
exportGvarParam(mix.weight, _weight, version);
if (version >= 214)
exportGvarParam(mix.sOffset, _offset);
exportGvarParam(mix.sOffset, _offset, version);
else
splitGvarParam(mix.sOffset, _offset, _offsetMode, board, version);
}
@@ -879,7 +938,7 @@ class MixField: public TransformedField {
virtual void afterImport()
{
if (IS_TARANIS(board) || version < 216) {
if (IS_TARANIS(board) && version < 216) {
if (mix.srcRaw.type == SOURCE_TYPE_STICK && mix.srcRaw.index < NUM_STICKS) {
if (!mix.noExpo) {
mix.srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, mix.srcRaw.index, model);
@@ -900,9 +959,9 @@ class MixField: public TransformedField {
}
if (IS_ARM(board)) {
importGvarParam(mix.weight, _weight);
importGvarParam(mix.weight, _weight, version);
if (version >= 214)
importGvarParam(mix.sOffset, _offset);
importGvarParam(mix.sOffset, _offset, version);
else
concatGvarParam(mix.sOffset, _offset, _offsetMode, board, version);
}
@@ -910,6 +969,13 @@ class MixField: public TransformedField {
concatGvarParam(mix.weight, _weight, _weightMode, board, version);
concatGvarParam(mix.sOffset, _offset, _offsetMode, board, version);
}
if (IS_TARANIS(board) && version < 216) {
if (mix.sOffset >= -500 && mix.sOffset <= 500 && mix.weight >= -500 && mix.weight <= 500) {
mix.sOffset = divRoundClosest(mix.sOffset * mix.weight, 100);
}
if (mix.carryTrim < 0) mix.carryTrim = 0;
}
}
protected:
@@ -938,17 +1004,28 @@ class InputField: public TransformedField {
{
if (IS_TARANIS(board) && version >= 216) {
internalField.Append(new SourceField<8>(expo.srcRaw, board, version, 0));
internalField.Append(new UnsignedField<16>(expo.scale));
internalField.Append(new UnsignedField<16>(expo.scale, "Scale"));
internalField.Append(new UnsignedField<8>(expo.chn, "Channel"));
internalField.Append(new SwitchField<8>(expo.swtch, board, version));
internalField.Append(new UnsignedField<16>(expo.phases));
internalField.Append(new SignedField<8>(_weight, "Weight"));
internalField.Append(new SignedField<8>(expo.carryTrim));
internalField.Append(new SignedField<6>(expo.carryTrim, "CarryTrim"));
internalField.Append(new UnsignedField<2>(expo.mode, "Mode"));
internalField.Append(new ZCharField<8>(expo.name));
internalField.Append(new SignedField<8>(expo.offset, "Offset"));
internalField.Append(new CurveReferenceField(expo.curve, board, version));
internalField.Append(new SpareBitsField<8>());
}
else if (IS_ARM(board) && version >= 216) {
internalField.Append(new UnsignedField<2>(expo.mode, "Mode"));
internalField.Append(new UnsignedField<4>(expo.chn, "Channel"));
internalField.Append(new BoolField<2>(_curveMode));
internalField.Append(new SwitchField<8>(expo.swtch, board, version));
internalField.Append(new UnsignedField<16>(expo.phases, "Phases"));
internalField.Append(new SignedField<8>(_weight, "Weight"));
internalField.Append(new ZCharField<6>(expo.name));
internalField.Append(new SignedField<8>(_curveParam));
}
else if (IS_ARM(board)) {
internalField.Append(new UnsignedField<8>(expo.mode, "Mode"));
internalField.Append(new UnsignedField<8>(expo.chn, "Channel"));
@@ -1008,9 +1085,11 @@ class InputField: public TransformedField {
virtual void afterImport()
{
if (IS_TARANIS(board) && version < 216) {
if (expo.mode) {
expo.srcRaw = RawSource(SOURCE_TYPE_STICK, expo.chn);
if (IS_TARANIS(board)) {
if (version < 216) {
if (expo.mode) {
expo.srcRaw = RawSource(SOURCE_TYPE_STICK, expo.chn);
}
}
}
@@ -1041,7 +1120,7 @@ class LimitField: public StructField {
LimitField(LimitData & limit, BoardEnum board, unsigned int version):
StructField("Limit")
{
if (IS_ARM(board) && version >= 216) {
if (IS_TARANIS(board) && version >= 216) {
Append(new ConversionField< SignedField<16> >(limit.min, +1000));
Append(new ConversionField< SignedField<16> >(limit.max, -1000));
}
@@ -1808,7 +1887,7 @@ class AvrCustomFunctionField: public TransformedField {
internalField.Append(new UnsignedField<5>(_union_param));
internalField.Append(new UnsignedField<1>(_active));
}
if (version >= 213) {
else if (version >= 213) {
internalField.Append(new SwitchField<8>(fn.swtch, board, version));
internalField.Append(new UnsignedField<3>(_union_param));
internalField.Append(new ConversionField< UnsignedField<5> >((unsigned int &)fn.func, &functionsConversionTable, "Function", ::QObject::tr("OpenTX on this board doesn't accept this function")));
@@ -2069,7 +2148,7 @@ class FrskyField: public StructField {
else {
Append(new UnsignedField<8>(frsky.voltsSource));
}
Append(new UnsignedField<8>(frsky.blades));
Append(new ConversionField< SignedField<8> >(frsky.blades, -2));
Append(new UnsignedField<8>(frsky.currentSource));
Append(new UnsignedField<1>(frsky.screens[0].type));
@@ -2111,12 +2190,12 @@ class FrskyField: public StructField {
Append(new UnsignedField<1>(frsky.channels[i].alarms[j].greater));
Append(new UnsignedField<2>(frsky.channels[i].multiplier, 0, 3, "Multiplier"));
}
Append(new UnsignedField<2>(frsky.usrProto));
Append(new UnsignedField<2>(frsky.blades));
Append(new UnsignedField<2>(frsky.usrProto, "USR Proto"));
Append(new ConversionField< UnsignedField<2> >((unsigned int &)frsky.blades, -2));
Append(new UnsignedField<1>(frsky.screens[0].type));
Append(new UnsignedField<1>(frsky.screens[1].type));
Append(new UnsignedField<2>(frsky.voltsSource));
Append(new SignedField<4>(frsky.varioMin));
Append(new UnsignedField<2>(frsky.voltsSource, "Volts Source"));
Append(new SignedField<4>(frsky.varioMin, "Vario Min"));
Append(new SignedField<4>(frsky.varioMax));
for (int i=0; i<2; i++) {
Append(new ConversionField< UnsignedField<2> >(frsky.rssiAlarms[i].level, &rssiConversionTable[i], "RSSI level"));
@@ -2165,7 +2244,8 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
board(board),
version(version),
variant(variant),
protocolsConversionTable(board)
protocolsConversionTable(board),
throttleSourceConversionTable(board, version)
{
sprintf(name, "Model %s", modelData.name);
@@ -2275,7 +2355,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
internalField.Append(new SignedField<8>(modelData.moduleData[0].ppmFrameLength));
}
internalField.Append(new UnsignedField<8>(modelData.thrTraceSrc));
internalField.Append(new ConversionField< UnsignedField<8> >(modelData.thrTraceSrc, &throttleSourceConversionTable, "Throttle Source"));
if (!afterrelease21March2013) {
internalField.Append(new UnsignedField<8>(modelData.modelId));
@@ -2425,7 +2505,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
generalData(generalData),
board(board),
version(version),
inputsCount(4 + MAX_POTS(board, version))
inputsCount(4 + MAX_POTS(board))
{
generalData.version = version;
generalData.variant = variant;
@@ -2442,12 +2522,18 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
}
}
else {
for (int i=0; i<inputsCount; i++)
internalField.Append(new SignedField<16>(generalData.calibMid[i]));
for (int i=0; i<inputsCount; i++)
internalField.Append(new SignedField<16>(generalData.calibSpanNeg[i]));
for (int i=0; i<inputsCount; i++)
internalField.Append(new SignedField<16>(generalData.calibSpanPos[i]));
for (int i=0; i<inputsCount; i++) {
if (!IS_TARANIS(board) || i!=6)
internalField.Append(new SignedField<16>(generalData.calibMid[i]));
}
for (int i=0; i<inputsCount; i++) {
if (!IS_TARANIS(board) || i!=6)
internalField.Append(new SignedField<16>(generalData.calibSpanNeg[i]));
}
for (int i=0; i<inputsCount; i++) {
if (!IS_TARANIS(board) || i!=6)
internalField.Append(new SignedField<16>(generalData.calibSpanPos[i]));
}
}
internalField.Append(new UnsignedField<16>(chkSum));
@@ -2549,8 +2635,8 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
}
if (IS_TARANIS(board) && version >= 216) {
internalField.Append(new UnsignedField<8>(generalData.hw_uartMode));
for (int i=0; i<8; i++) {
internalField.Append(new UnsignedField<1>(generalData.potsType[i]));
for (int i=0; i<4; i++) {
internalField.Append(new UnsignedField<2>(potsType[i]));
}
}
}
@@ -2569,6 +2655,11 @@ void OpenTxGeneralData::beforeExport()
sum += generalData.calibSpanPos[i];
if (++count == 12) break;
}
for (int i=0; i<4; i++) {
potsType[i] = generalData.potsType[i];
if (i<2 && potsType[i] == 1)
potsType[i] = 0;
}
}
else {
for (int i=0; i<inputsCount; i++)
@@ -2581,4 +2672,8 @@ void OpenTxGeneralData::beforeExport()
void OpenTxGeneralData::afterImport()
{
for (int i=0; i<4; i++) {
if (i<2 && generalData.potsType[i] == 0)
generalData.potsType[i] = 1;
}
}
@@ -65,6 +65,7 @@ class OpenTxGeneralData: public TransformedField {
unsigned int version;
int inputsCount;
unsigned int chkSum;
unsigned int potsType[4];
};
class ProtocolsConversionTable: public ConversionTable
@@ -102,6 +103,12 @@ class ProtocolsConversionTable: public ConversionTable
}
};
class ThrottleSourceConversionTable: public ConversionTable {
public:
ThrottleSourceConversionTable(BoardEnum board, unsigned int version);
};
class ChannelsConversionTable: public ConversionTable
{
public:
@@ -133,6 +140,7 @@ class OpenTxModelData: public TransformedField {
char name[256];
int subprotocols[C9X_NUM_MODULES+1/*trainer*/];
ProtocolsConversionTable protocolsConversionTable;
ThrottleSourceConversionTable throttleSourceConversionTable;
ChannelsConversionTable channelsConversionTable;
};
@@ -451,8 +451,6 @@ int OpenTxInterface::getSize(GeneralSettings &settings)
int OpenTxInterface::getCapability(const Capability capability)
{
switch (capability) {
case OwnerName:
return 0;
case ModelImage:
if (IS_TARANIS(board))
return 1;
@@ -493,6 +491,8 @@ int OpenTxInterface::getCapability(const Capability capability)
case FlightModesName:
case GvarsName:
return (IS_TARANIS(board) ? 10 : 6);
case HasChNames:
return (IS_TARANIS(board) ? 1 : 0);
case GvarsInCS:
case HasFAIMode:
return 1;
@@ -594,7 +594,7 @@ int OpenTxInterface::getCapability(const Capability capability)
case MixesWithoutExpo:
return 1;
case NumCurves:
return (IS_ARM(board) ? 16 : 8);
return (IS_TARANIS(board) ? 32 : (IS_ARM(board) ? 16 : 8));
case HasMixerNames:
return (IS_ARM(board) ? (IS_TARANIS(board) ? 8 : 6) : false);
case HasExpoNames:
@@ -619,8 +619,6 @@ int OpenTxInterface::getCapability(const Capability capability)
return 1;
case TelemetryRSSIModel:
return 1;
case TelemetryAlarm:
return 0;
case TelemetryTimeshift:
return 1;
case TelemetryMaxMultiplier:
@@ -676,8 +674,6 @@ int OpenTxInterface::getCapability(const Capability capability)
case LuaInputs:
case LimitsPer1000:
case EnhancedCurves:
case TelemetryInternalAlarms:
return IS_TARANIS(board);
case HasFasOffset:
return (IS_STOCK(board) ? false : true);
case HasMahPersistent:
@@ -53,6 +53,8 @@
#define EEPROM_VARIANT SIMU_STOCK_VARIANTS
#define GAUGES
#define NUM_POTS 3
#undef min
#undef max
@@ -78,6 +80,7 @@ namespace Open9x {
#include "radio/src/telemetry/frsky.cpp"
#include "radio/src/templates.cpp"
#include "radio/src/translations.cpp"
#include "radio/src/fonts.cpp"
#include "radio/src/targets/stock/voice.cpp"
#include "radio/src/buzzer.cpp"
#include "radio/src/translations/tts_en.cpp"
@@ -145,8 +145,6 @@ int Th9xInterface::getCapability(const Capability capability)
switch (capability) {
case Mixes:
return TH9X_MAX_MIXERS;
case OwnerName:
return 0;
case Timers:
return 1;
case Pots:
@@ -168,8 +166,6 @@ int Th9xInterface::getCapability(const Capability capability)
case Simulation:
return 1;
case HasContrast:
case HasInputFilter:
return 1;
case CSFunc:
return 13;
case SlowScale:
+43 -157
View File
@@ -13,6 +13,7 @@
* GNU General Public License for more details.
*
*/
#include <QtGui>
#include "hexinterface.h"
#include "splash.h"
@@ -20,192 +21,77 @@
int getFileType(const QString &fullFileName)
{
if(QFileInfo(fullFileName).suffix().toUpper()=="HEX") return FILE_TYPE_HEX;
if(QFileInfo(fullFileName).suffix().toUpper()=="BIN") return FILE_TYPE_BIN;
if(QFileInfo(fullFileName).suffix().toUpper()=="EEPM") return FILE_TYPE_EEPM;
if(QFileInfo(fullFileName).suffix().toUpper()=="EEPE") return FILE_TYPE_EEPE;
if(QFileInfo(fullFileName).suffix().toUpper()=="XML") return FILE_TYPE_XML;
return 0;
QString suffix = QFileInfo(fullFileName).suffix().toUpper();
if (suffix == "HEX")
return FILE_TYPE_HEX;
else if (suffix == "BIN")
return FILE_TYPE_BIN;
else if (suffix == "EEPM")
return FILE_TYPE_EEPM;
else if (suffix == "EEPE")
return FILE_TYPE_EEPE;
else if (suffix == "XML")
return FILE_TYPE_XML;
else
return 0;
}
FlashInterface::FlashInterface(QString fileName)
FlashInterface::FlashInterface(QString fileName):
flash(MAX_FSIZE, 0),
flash_size(0),
isValidFlag(false)
{
char * temp = (char *)malloc(MAX_FSIZE);
date = "";
time = "";
svn = "";
build = "";
isValidFlag = true;
QFile file(fileName);
flash_size=0;
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //reading HEX TEXT file
isValidFlag = false;
}
else {
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { //reading HEX TEXT 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();
inputStream.reset();
if (flash_size == 0) {
QFile file(fileName);
file.open(QIODevice::ReadOnly);
char * bin_flash = (char *)malloc(MAX_FSIZE);
flash_size = file.read(bin_flash, MAX_FSIZE);
flash = QByteArray(bin_flash, flash_size);
free(bin_flash);
}
else {
flash = QByteArray(temp, flash_size);
flash_size = file.read((char *)flash.data(), MAX_FSIZE);
}
if (flash_size > 0) {
SeekSvn();
SeekDate();
SeekTime();
SeekBuild();
svn = seekLabel(SVN_MARK);
version = seekLabel(VERS_MARK);
date = seekLabel(DATE_MARK);
time = seekLabel(TIME_MARK);
eeprom = seekLabel(EEPR_MARK);
SeekSplash();
}
else {
isValidFlag = false;
isValidFlag = true;
}
}
free(temp);
}
QString FlashInterface::getDate(void)
QString FlashInterface::seekString(const QString & string)
{
return date;
}
QString result = "";
QString FlashInterface::getTime(void)
{
return time;
}
QString FlashInterface::getSvn(void)
{
return svn;
}
QString FlashInterface::getBuild(void)
{
return build;
}
int FlashInterface::getSize()
{
return flash_size;
}
void FlashInterface::SeekSvn(void)
{
int i, start = -1, end = -1;
start = flash.indexOf(QString(SVN_MARK));
int start = flash.indexOf(string);
if (start > 0) {
start += QString(SVN_MARK).length();
for (i = start; i < (start + 20); i++) {
if (flash.at(i) == 0) {
start += string.length();
int end = -1;
for (int i=start; i<start+20; i++) {
char c = flash.at(i);
if (c == '\0' || c == '\036') {
end = i;
break;
}
}
if (end > 0) {
svn = QString(flash.mid(start, (end - start))).trimmed();
}
else {
svn = QString("");
result = flash.mid(start, (end - start)).trimmed();
}
}
return result;
}
void FlashInterface::SeekDate(void)
QString FlashInterface::seekLabel(const QString & label)
{
int i, start = -1, end = -1, startsvn=0;
startsvn = flash.indexOf(QString(SVN_MARK));
if (startsvn>0) {
start = flash.indexOf(QString(DATE_MARK),startsvn);
} else {
start = flash.indexOf(QString(DATE_MARK));
}
if (start > 0) {
start += QString(DATE_MARK).length();
for (i = start; i < (start + 20); i++) {
if (flash.at(i) == 0) {
end = i;
break;
}
}
if (end > 0) {
date = QString(flash.mid(start, (end - start))).trimmed();
}
else {
date = QString("");
}
}
}
QString result = seekString(label + "\037\033:");
if (!result.isEmpty())
return result;
void FlashInterface::SeekTime(void)
{
int i, start = -1, end = -1, startsvn=0;
startsvn = flash.indexOf(QString(SVN_MARK));
if (startsvn>0) {
start = flash.indexOf(QString(TIME_MARK),startsvn);
} else {
start = flash.indexOf(QString(TIME_MARK));
}
if (start > 0) {
start += QString(TIME_MARK).length();
for (i = start; i < (start + 20); i++) {
if (flash.at(i) == 0) {
end = i;
break;
}
}
if (end > 0) {
time = QString(flash.mid(start, (end - start))).trimmed();
}
else {
time = QString("");
}
}
}
void FlashInterface::SeekBuild(void)
{
int i, start = -1, end = -1;
start = flash.indexOf(QString(BLD_MARK));
if (start > 0) {
start += QString(BLD_MARK).length();
for (i = start; i < (start + 20); i++) {
if (flash.at(i) == 0) {
end = i;
break;
}
}
if (end > 0) {
build = QString(flash.mid(start, (end - start))).trimmed();
}
else {
build = QString("");
}
}
else {
start = flash.indexOf(QString(VAR_MARK));
if (start > 0) {
start += QString(VAR_MARK).length();
for (i = start; i < (start + 20); i++) {
if (flash.at(i) == 0) {
end = i;
break;
}
}
if (end > 0) {
build = QString(flash.mid(start, (end - start))).trimmed();
}
else {
build = QString("");
}
}
}
return seekString(label + ":");
}
void FlashInterface::SeekSplash(void)
+46 -47
View File
@@ -14,6 +14,7 @@
#ifndef FLASHINTERFACE_H
#define FLASHINTERFACE_H
#include <QDialog>
#include <QtGui>
#include <inttypes.h>
@@ -32,12 +33,12 @@
#define ERSKY9X_SPS "SPS"
#define ERSKY9X_SPE "SPE"
#define ERSKY9X_OFFSET (7)
#define VERS_MARK "VERS:"
#define SVN_MARK "SVN:"
#define DATE_MARK "DATE:"
#define TIME_MARK "TIME:"
#define BLD_MARK "BLD:"
#define VAR_MARK "EEPR:"
#define VERS_MARK "VERS"
#define SVN_MARK "SVN"
#define DATE_MARK "DATE"
#define TIME_MARK "TIME"
#define BLD_MARK "BLD"
#define EEPR_MARK "EEPR"
#define FILE_TYPE_BIN 1
#define FILE_TYPE_HEX 2
@@ -49,48 +50,46 @@ int getFileType(const QString &fullFileName);
class FlashInterface
{
public:
FlashInterface(QString filename);
QString getDate();
QString getTime();
QString getSvn();
int getSize();
QString getBuild();
QImage getSplash();
bool setSplash(const QImage & newsplash);
bool hasSplash();
int getSplashWidth();
uint getSplashHeight();
uint getSplashColors();
QImage::Format getSplashFormat();
uint saveFlash(QString fileName);
bool isValid();
public:
FlashInterface(QString filename);
inline QString getDate() { return date; }
inline QString getTime() { return time; }
inline QString getSvn() { return svn; }
int getSize() { return flash_size; }
inline QString getVersion() { return version; }
inline QString getEEprom() { return eeprom; }
QImage getSplash();
bool setSplash(const QImage & newsplash);
bool hasSplash();
int getSplashWidth();
uint getSplashHeight();
uint getSplashColors();
QImage::Format getSplashFormat();
uint saveFlash(QString fileName);
bool isValid();
private:
QByteArray flash;
void SeekVer();
void SeekSvn();
void SeekDate();
void SeekTime();
void SeekBuild();
void SeekSplash();
QString filename;
QString date;
QString time;
QString svn;
QString build;
QByteArray splash;
uint splash_offset;
uint splash_type;
uint splash_size;
uint splash_width;
uint splash_height;
uint splash_colors;
QImage::Format splash_format;
uint flash_size;
protected:
bool isValidFlag;
private:
QByteArray flash;
QString seekString(const QString & string);
QString seekLabel(const QString & label);
void SeekSplash();
QString filename;
QString date;
QString time;
QString svn;
QString version;
QString eeprom;
QByteArray splash;
uint splash_offset;
uint splash_type;
uint splash_size;
uint splash_width;
uint splash_height;
uint splash_colors;
QImage::Format splash_format;
uint flash_size;
bool isValidFlag;
};
#endif /* FLASHINTERFACE_H */
+66 -375
View File
@@ -2,6 +2,7 @@
#include "ui_generaledit.h"
#include "helpers.h"
#include "appdata.h"
#include <QDateTime>
#include <QtGui>
#define BIT_WARN_THR ( 0x01 )
@@ -78,9 +79,7 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
}
}
}
QRegExp rx(CHAR_FOR_NAMES_REGEX);
ui->ownerNameLE->setValidator(new QRegExpValidator(rx, this));
switchDefPosEditLock=true;
populateBacklightCB(ui->backlightswCB, g_eeGeneral.backlightMode);
bool voice = current_firmware_variant.id.contains("voice");
@@ -116,18 +115,21 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->bgVolume_label->hide();
ui->wavVolume_SL->hide();
ui->wavVolume_label->hide();
ui->varioP0_label->hide();
ui->varioP0_SB->hide();
ui->varioPMax_label->hide();
ui->varioPMax_SB->hide();
ui->varioR0_label->hide();
ui->varioR0_SB->hide();
} else {
ui->beepVolume_SL->setValue(g_eeGeneral.beepVolume);
ui->varioVolume_SL->setValue(g_eeGeneral.varioVolume);
ui->bgVolume_SL->setValue(g_eeGeneral.backgroundVolume);
ui->wavVolume_SL->setValue(g_eeGeneral.wavVolume);
}
if (!GetEepromInterface()->getCapability(HasBlInvert)) {
ui->blinvert_cb->hide();
ui->blinvert_label->hide();
} else {
ui->blinvert_cb->setChecked(g_eeGeneral.blightinv);
ui->varioP0_SB->setValue(700+(g_eeGeneral.varioPitch*10));
updateVarioPitchRange();
ui->varioPMax_SB->setValue(700+(g_eeGeneral.varioPitch*10)+1000+(g_eeGeneral.varioRange*10));
ui->varioR0_SB->setValue(500+(g_eeGeneral.varioRepeat*10));
}
if (!GetEepromInterface()->getCapability(HasFAIMode)) {
ui->faimode_CB->hide();
@@ -136,35 +138,6 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
else {
ui->faimode_CB->setChecked(g_eeGeneral.fai);
}
ui->ownerNameLE->setText(g_eeGeneral.ownerName);
if (!GetEepromInterface()->getCapability(OwnerName)) {
ui->ownerNameLE->setDisabled(true);
ui->label_ownerName->hide();
ui->ownerNameLE->hide();
ui->hideNameOnSplashChkB->setDisabled(true);
ui->hideNameOnSplashChkB->hide();
ui->label_hideOwnerName->hide();
}
if (!GetEepromInterface()->getCapability(HasInputFilter)) {
ui->inputfilterCB->hide();
ui->inputfilterLabel->hide();
}
if (!GetEepromInterface()->getCapability(HasStickScroll)) {
ui->StickScrollChkB->hide();
ui->StickScrollLB->hide();
}
if (!GetEepromInterface()->getCapability(TelemetryInternalAlarm)) {
ui->frskyintalarmChkB->hide();
ui->label_frskyintalarm->hide();
}
if (!GetEepromInterface()->getCapability(HasCrossTrims)) {
ui->crosstrimChkB->hide();
ui->crosstrimLB->hide();
}
if (!GetEepromInterface()->getCapability(HasPPMSim)) {
ui->PPMSimLB->hide();
ui->PPMSimChkB->hide();
}
if (!GetEepromInterface()->getCapability( HasPxxCountry)) {
ui->countrycode_label->hide();
ui->countrycode_CB->hide();
@@ -212,9 +185,6 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->label_CurrentCalib->hide();
}
if (GetEepromInterface()->getCapability(TelemetryRSSIModel) ) {
ui->tabWidget->removeTab(2);
}
ui->tabWidget->setCurrentIndex(0);
if (!GetEepromInterface()->getCapability(SoundMod)) {
@@ -234,14 +204,6 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->hapticStrengthSB->hide();
ui->label_hapticStrengthSB->hide();
}
if (GetEepromInterface()->getCapability(PerModelTimers)) {
ui->beepCountDownChkB->hide();
ui->beepFlashChkB->hide();
ui->beepMinuteChkB->hide();
ui->label_timers->hide();
}
if (!GetEepromInterface()->getCapability(HapticMode)) {
ui->hapticmodeCB->setDisabled(true);
@@ -249,66 +211,6 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
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);
if (renumber==0) {
ui->re_label->hide();
@@ -316,28 +218,15 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
} else {
populateRotEncCB(ui->re_CB, g_eeGeneral.reNavigation, renumber);
}
ui->telalarmsChkB->setChecked(g_eeGeneral.enableTelemetryAlarm);
ui->PotScrollEnableChkB->setChecked(!g_eeGeneral.disablePotScroll);
ui->BandGapEnableChkB->setChecked(!g_eeGeneral.disableBG);
ui->contrastSB->setValue(g_eeGeneral.contrast);
ui->battwarningDSB->setValue((double)g_eeGeneral.vBatWarn/10);
ui->backlightautoSB->setValue(g_eeGeneral.backlightDelay*5);
ui->inactimerSB->setValue(g_eeGeneral.inactivityTimer);
ui->crosstrimChkB->setChecked(g_eeGeneral.crosstrim);
ui->frskyintalarmChkB->setChecked(g_eeGeneral.frskyinternalalarm);
ui->StickScrollChkB->setChecked(g_eeGeneral.stickScroll);
ui->PPMSimChkB->setChecked(g_eeGeneral.enablePpmsim);
ui->inputfilterCB->setCurrentIndex(g_eeGeneral.filterInput);
ui->memwarnChkB->setChecked(!g_eeGeneral.disableMemoryWarning); //Default is zero=checked
ui->alarmwarnChkB->setChecked(!g_eeGeneral.disableAlarmWarning);//Default is zero=checked
ui->enableTelemetryAlarmChkB->setChecked(g_eeGeneral.enableTelemetryAlarm);
ui->beepMinuteChkB->setChecked(g_eeGeneral.minuteBeep);
ui->beepCountDownChkB->setChecked(g_eeGeneral.preBeep);
ui->beepFlashChkB->setChecked(g_eeGeneral.flashBeep);
ui->splashScreenChkB->setChecked(!g_eeGeneral.splashMode);
ui->hideNameOnSplashChkB->setChecked(!g_eeGeneral.hideNameOnSplash);
ui->trnMode_1->setCurrentIndex(g_eeGeneral.trainer.mix[0].mode);
ui->trnChn_1->setCurrentIndex(g_eeGeneral.trainer.mix[0].src);
@@ -368,6 +257,7 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
if (GetEepromInterface()->getCapability(MultiposPots)) {
ui->pot1Type->setCurrentIndex(g_eeGeneral.potsType[0]);
ui->pot2Type->setCurrentIndex(g_eeGeneral.potsType[1]);
ui->pot3Type->setCurrentIndex(g_eeGeneral.potsType[2]);
}
else {
ui->potsTypeSeparator->hide();
@@ -375,6 +265,16 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->pot1TypeLabel->hide();
ui->pot2Type->hide();
ui->pot2TypeLabel->hide();
ui->pot3Type->hide();
ui->pot3TypeLabel->hide();
}
if (IS_TARANIS(eepromInterface->getBoard())) {
ui->serialPortMode->setCurrentIndex(g_eeGeneral.hw_uartMode);
}
else {
ui->serialPortMode->hide();
ui->serialPortLabel->hide();
}
}
@@ -395,6 +295,18 @@ void GeneralEdit::on_pot2Type_currentIndexChanged(int index)
updateSettings();
}
void GeneralEdit::on_pot3Type_currentIndexChanged(int index)
{
g_eeGeneral.potsType[2] = index;
updateSettings();
}
void GeneralEdit::on_serialPortMode_currentIndexChanged(int index)
{
g_eeGeneral.hw_uartMode = index;
updateSettings();
}
void GeneralEdit::unlockSwitchEdited()
{
int i=0;
@@ -428,9 +340,8 @@ void GeneralEdit::setValues()
ui->speakerPitchSB->setValue(g_eeGeneral.speakerPitch);
ui->hapticStrengthSB->setValue(g_eeGeneral.hapticStrength);
ui->hapticmodeCB->setCurrentIndex(g_eeGeneral.hapticMode+2);
ui->battcalibDSB->setValue((double)g_eeGeneral.vBatCalib/10);
ui->battCalibDSB->setValue((double)g_eeGeneral.vBatCalib/10);
ui->CurrentCalib_SB->setValue((double)g_eeGeneral.currentCalib);
ui->battCalib->setValue((double)g_eeGeneral.vBatCalib/10);
ui->ana1Neg->setValue(g_eeGeneral.calibSpanNeg[0]);
ui->ana2Neg->setValue(g_eeGeneral.calibSpanNeg[1]);
@@ -466,27 +377,6 @@ void GeneralEdit::setValues()
ui->PPM_MultiplierDSB->setValue((qreal)(g_eeGeneral.PPM_Multiplier+10)/10);
}
void GeneralEdit::setSwitchDefPos()
{
quint8 x = g_eeGeneral.switchWarningStates & 0x38;
if(x==0x00 || x==0x18 || x== 0x28 || x==0x38 || x==0x30) //illegal states for ID0/1/2
{
g_eeGeneral.switchWarningStates &= ~0x38; // turn all off, make sure only one is on
g_eeGeneral.switchWarningStates |= 0x08;
}
switchDefPosEditLock = true;
ui->swTHRChkB->setChecked(g_eeGeneral.switchWarningStates & 0x01);
ui->swRUDChkB->setChecked(g_eeGeneral.switchWarningStates & 0x02);
ui->swELEChkB->setChecked(g_eeGeneral.switchWarningStates & 0x04);
ui->swID0ChkB->setChecked(g_eeGeneral.switchWarningStates & 0x08);
ui->swID1ChkB->setChecked(g_eeGeneral.switchWarningStates & 0x10);
ui->swID2ChkB->setChecked(g_eeGeneral.switchWarningStates & 0x20);
ui->swAILChkB->setChecked(g_eeGeneral.switchWarningStates & 0x40);
ui->swGEAChkB->setChecked(g_eeGeneral.switchWarningStates & 0x80);
switchDefPosEditLock = false;
}
void GeneralEdit::updateSettings()
{
radioData.generalSettings = g_eeGeneral;
@@ -505,10 +395,9 @@ void GeneralEdit::on_battwarningDSB_editingFinished()
updateSettings();
}
void GeneralEdit::on_battcalibDSB_editingFinished()
void GeneralEdit::on_battCalibDSB_editingFinished()
{
g_eeGeneral.vBatCalib = ui->battcalibDSB->value()*10;
ui->battCalib->setValue(ui->battcalibDSB->value());
g_eeGeneral.vBatCalib = ui->battCalibDSB->value()*10;
updateSettings();
}
@@ -596,29 +485,12 @@ void GeneralEdit::on_timezoneSB_editingFinished()
updateSettings();
}
void GeneralEdit::on_blOnStickMoveSB_editingFinished()
{
int i = ui->blOnStickMoveSB->value()/5;
if((i*5)!=ui->blOnStickMoveSB->value())
ui->blOnStickMoveSB->setValue(i*5);
g_eeGeneral.lightOnStickMove = i;
updateSettings();
}
void GeneralEdit::on_inactimerSB_editingFinished()
{
g_eeGeneral.inactivityTimer = ui->inactimerSB->value();
updateSettings();
}
void GeneralEdit::on_inputfilterCB_currentIndexChanged(int index)
{
g_eeGeneral.filterInput = index;
updateSettings();
}
void GeneralEdit::on_memwarnChkB_stateChanged(int )
{
g_eeGeneral.disableMemoryWarning = ui->memwarnChkB->isChecked() ? 0 : 1;
@@ -631,12 +503,6 @@ void GeneralEdit::on_alarmwarnChkB_stateChanged(int )
updateSettings();
}
void GeneralEdit::on_enableTelemetryAlarmChkB_stateChanged(int )
{
g_eeGeneral.enableTelemetryAlarm = ui->enableTelemetryAlarmChkB->isChecked();
updateSettings();
}
void GeneralEdit::on_beeperCB_currentIndexChanged(int index)
{
g_eeGeneral.beeperMode = (BeeperMode)(index-2);
@@ -885,13 +751,6 @@ void GeneralEdit::on_ana8Pos_editingFinished()
updateSettings();
}
void GeneralEdit::on_battCalib_editingFinished()
{
g_eeGeneral.vBatCalib = ui->battCalib->value()*10;
ui->battcalibDSB->setValue(ui->battCalib->value());
updateSettings();
}
void GeneralEdit::on_volume_SB_editingFinished()
{
g_eeGeneral.speakerVolume = ui->volume_SB->value();
@@ -934,6 +793,31 @@ void GeneralEdit::on_bgVolume_SL_valueChanged()
updateSettings();
}
void GeneralEdit::on_varioP0_SB_editingFinished()
{
g_eeGeneral.varioPitch = (ui->varioP0_SB->value()-700)/10;
updateVarioPitchRange();
updateSettings();
}
void GeneralEdit::updateVarioPitchRange()
{
ui->varioPMax_SB->setMaximum(700+(g_eeGeneral.varioPitch*10)+1000+800);
ui->varioPMax_SB->setMinimum(700+(g_eeGeneral.varioPitch*10)+1000-800);
}
void GeneralEdit::on_varioPMax_SB_editingFinished()
{
g_eeGeneral.varioRange = (ui->varioPMax_SB->value()-(700+(g_eeGeneral.varioPitch*10))-1000)/10;
updateSettings();
}
void GeneralEdit::on_varioR0_SB_editingFinished()
{
g_eeGeneral.varioRepeat = (ui->varioR0_SB->value()-500)/10;
updateSettings();
}
void GeneralEdit::on_PPM1_editingFinished()
{
g_eeGeneral.trainer.calib[0] = ui->PPM1->value();
@@ -963,49 +847,18 @@ void GeneralEdit::on_tabWidget_currentChanged(int index)
g.generalEditTab(index);
}
void GeneralEdit::on_beepMinuteChkB_stateChanged(int )
{
g_eeGeneral.minuteBeep = ui->beepMinuteChkB->isChecked() ? 1 : 0;
updateSettings();
}
void GeneralEdit::on_beepCountDownChkB_stateChanged(int )
{
g_eeGeneral.preBeep = ui->beepCountDownChkB->isChecked() ? 1 : 0;
updateSettings();
}
void GeneralEdit::on_beepFlashChkB_stateChanged(int )
{
g_eeGeneral.flashBeep = ui->beepFlashChkB->isChecked() ? 1 : 0;
updateSettings();
}
void GeneralEdit::on_splashScreenChkB_stateChanged(int )
{
g_eeGeneral.splashMode = ui->splashScreenChkB->isChecked() ? 0 : 1;
updateSettings();
}
void GeneralEdit::on_hideNameOnSplashChkB_stateChanged(int )
{
g_eeGeneral.hideNameOnSplash = ui->hideNameOnSplashChkB->isChecked() ? 0 : 1;
updateSettings();
}
void GeneralEdit::on_PPM_MultiplierDSB_editingFinished()
{
g_eeGeneral.PPM_Multiplier = (int)(ui->PPM_MultiplierDSB->value()*10)-10;
updateSettings();
}
void GeneralEdit::on_ownerNameLE_editingFinished()
{
strncpy(g_eeGeneral.ownerName, ui->ownerNameLE->text().toAscii(), 10);
updateSettings();
}
void GeneralEdit::on_speakerPitchSB_editingFinished()
{
g_eeGeneral.speakerPitch = ui->speakerPitchSB->value();
@@ -1024,18 +877,6 @@ void GeneralEdit::on_soundModeCB_currentIndexChanged(int index)
updateSettings();
}
void GeneralEdit::on_PotScrollEnableChkB_stateChanged(int )
{
g_eeGeneral.disablePotScroll = ui->PotScrollEnableChkB->isChecked() ? false : true;
updateSettings();
}
void GeneralEdit::on_blinvert_cb_stateChanged(int )
{
g_eeGeneral.blightinv = ui->blinvert_cb->isChecked();
updateSettings();
}
void GeneralEdit::on_faimode_CB_stateChanged(int )
{
if (ui->faimode_CB->isChecked()) {
@@ -1053,159 +894,6 @@ void GeneralEdit::on_faimode_CB_stateChanged(int )
updateSettings();
}
void GeneralEdit::on_BandGapEnableChkB_stateChanged(int )
{
g_eeGeneral.disableBG = ui->BandGapEnableChkB->isChecked() ? false : true;
updateSettings();
}
void GeneralEdit::on_crosstrimChkB_stateChanged(int )
{
g_eeGeneral.crosstrim = ui->crosstrimChkB->isChecked() ? true : false;
updateSettings();
}
void GeneralEdit::on_frskyintalarmChkB_stateChanged(int )
{
g_eeGeneral.frskyinternalalarm = ui->frskyintalarmChkB->isChecked() ? true : false ;
updateSettings();
}
void GeneralEdit::on_StickScrollChkB_stateChanged(int )
{
g_eeGeneral.stickScroll = ui->StickScrollChkB->isChecked() ? true : false;
updateSettings();
}
void GeneralEdit::on_PPMSimChkB_stateChanged(int )
{
g_eeGeneral.enablePpmsim = ui->PPMSimChkB->isChecked() ? true : false;
updateSettings();
}
void GeneralEdit::on_swtchCB_1_currentIndexChanged(int index)
{
g_eeGeneral.trainer.mix[0].swtch = RawSwitch(ui->swtchCB_1->itemData(ui->swtchCB_1->currentIndex()).toInt());
updateSettings();
}
void GeneralEdit::on_swtchCB_2_currentIndexChanged(int index)
{
g_eeGeneral.trainer.mix[1].swtch = RawSwitch(ui->swtchCB_2->itemData(ui->swtchCB_2->currentIndex()).toInt());
updateSettings();
}
void GeneralEdit::on_swtchCB_3_currentIndexChanged(int index)
{
g_eeGeneral.trainer.mix[2].swtch = RawSwitch(ui->swtchCB_3->itemData(ui->swtchCB_3->currentIndex()).toInt());
updateSettings();
}
void GeneralEdit::on_swtchCB_4_currentIndexChanged(int index)
{
g_eeGeneral.trainer.mix[3].swtch = RawSwitch(ui->swtchCB_4->itemData(ui->swtchCB_4->currentIndex()).toInt());
updateSettings();
}
void GeneralEdit::getGeneralSwitchDefPos(int i, bool val)
{
if(val)
g_eeGeneral.switchWarningStates |= (1<<(i-1));
else
g_eeGeneral.switchWarningStates &= ~(1<<(i-1));
}
void GeneralEdit::on_swTHRChkB_stateChanged(int )
{
if(switchDefPosEditLock) return;
getGeneralSwitchDefPos(1,ui->swTHRChkB->isChecked());
updateSettings();
}
void GeneralEdit::on_telalarmsChkB_stateChanged(int )
{
g_eeGeneral.enableTelemetryAlarm=ui->telalarmsChkB->isChecked();
updateSettings();
}
void GeneralEdit::on_swRUDChkB_stateChanged(int )
{
if(switchDefPosEditLock) return;
getGeneralSwitchDefPos(2,ui->swRUDChkB->isChecked());
updateSettings();
}
void GeneralEdit::on_swELEChkB_stateChanged(int )
{
getGeneralSwitchDefPos(3,ui->swELEChkB->isChecked());
updateSettings();
}
void GeneralEdit::on_swID0ChkB_stateChanged(int )
{
if(switchDefPosEditLock) return;
if(ui->swID0ChkB->isChecked())
{
switchDefPosEditLock = true;
ui->swID1ChkB->setChecked(false);
ui->swID2ChkB->setChecked(false);
switchDefPosEditLock = false;
}
else
return;
g_eeGeneral.switchWarningStates &= ~0x30; //turn off ID1/2
getGeneralSwitchDefPos(4,ui->swID0ChkB->isChecked());
updateSettings();
}
void GeneralEdit::on_swID1ChkB_stateChanged(int )
{
if(switchDefPosEditLock) return;
if(ui->swID1ChkB->isChecked())
{
switchDefPosEditLock = true;
ui->swID0ChkB->setChecked(false);
ui->swID2ChkB->setChecked(false);
switchDefPosEditLock = false;
}
else
return;
g_eeGeneral.switchWarningStates &= ~0x28; //turn off ID0/2
getGeneralSwitchDefPos(5,ui->swID1ChkB->isChecked());
updateSettings();
}
void GeneralEdit::on_swID2ChkB_stateChanged(int )
{
if(switchDefPosEditLock) return;
if(ui->swID2ChkB->isChecked())
{
switchDefPosEditLock = true;
ui->swID0ChkB->setChecked(false);
ui->swID1ChkB->setChecked(false);
switchDefPosEditLock = false;
}
else
return;
g_eeGeneral.switchWarningStates &= ~0x18; //turn off ID1/2
getGeneralSwitchDefPos(6,ui->swID2ChkB->isChecked());
updateSettings();
}
void GeneralEdit::on_swAILChkB_stateChanged(int )
{
if(switchDefPosEditLock) return;
getGeneralSwitchDefPos(7,ui->swAILChkB->isChecked());
updateSettings();
}
void GeneralEdit::on_swGEAChkB_stateChanged(int )
{
if(switchDefPosEditLock) return;
getGeneralSwitchDefPos(8,ui->swGEAChkB->isChecked());
updateSettings();
}
void GeneralEdit::on_calretrieve_PB_clicked()
{
int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt();
@@ -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].speaker( QString("%1%2%3").arg((uint8_t)g_eeGeneral.speakerMode, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.speakerPitch, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.speakerVolume, 2, 16, QChar('0')));
g.profile[profile_id].countryCode( QString("%1%2%3").arg((uint8_t)g_eeGeneral.countryCode, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.imperial, 2, 16, QChar('0')).arg(g_eeGeneral.ttsLanguage));
QDateTime dateTime = QDateTime::currentDateTime();
g.profile[profile_id].timeStamp(dateTime.toString("yyyy-MM-dd hh:mm"));
QMessageBox::information(this, "Companion", tr("Calibration and HW parameters saved."));
}
}
+8 -30
View File
@@ -27,20 +27,13 @@ private:
bool mavbaudEditLock;
void getGeneralSwitchDefPos(int i, bool val);
void setSwitchDefPos();
void updateVarioPitchRange();
signals:
void modelValuesChanged();
private slots:
void on_ownerNameLE_editingFinished();
void on_PotScrollEnableChkB_stateChanged(int);
void on_blinvert_cb_stateChanged(int);
void on_faimode_CB_stateChanged(int );
void on_BandGapEnableChkB_stateChanged(int);
void on_crosstrimChkB_stateChanged(int );
void on_frskyintalarmChkB_stateChanged(int );
void on_StickScrollChkB_stateChanged(int );
void on_PPMSimChkB_stateChanged(int );
void on_speakerPitchSB_editingFinished();
void on_timezoneSB_editingFinished();
void on_hapticStrengthSB_editingFinished();
@@ -51,11 +44,7 @@ private slots:
void on_hapticLengthCB_currentIndexChanged(int index);
void on_PPM_MultiplierDSB_editingFinished();
void on_splashScreenChkB_stateChanged(int );
void on_hideNameOnSplashChkB_stateChanged(int);
void on_beepCountDownChkB_stateChanged(int );
void on_beepMinuteChkB_stateChanged(int );
void on_alarmwarnChkB_stateChanged(int );
void on_enableTelemetryAlarmChkB_stateChanged(int );
void on_gpsFormatCB_currentIndexChanged(int index);
void on_tabWidget_currentChanged(int index);
void on_displayTypeCB_currentIndexChanged(int index);
@@ -65,22 +54,17 @@ private slots:
void on_units_CB_currentIndexChanged(int index);
void on_trnMode_1_currentIndexChanged(int index);
void on_trnChn_1_currentIndexChanged(int index);
void on_swtchCB_1_currentIndexChanged(int index);
void on_trnWeight_1_editingFinished();
void on_trnMode_2_currentIndexChanged(int index);
void on_trnChn_2_currentIndexChanged(int index);
void on_swtchCB_2_currentIndexChanged(int index);
void on_trnWeight_2_editingFinished();
void on_trnMode_3_currentIndexChanged(int index);
void on_trnChn_3_currentIndexChanged(int index);
void on_swtchCB_3_currentIndexChanged(int index);
void on_trnWeight_3_editingFinished();
void on_trnMode_4_currentIndexChanged(int index);
void on_swtchCB_4_currentIndexChanged(int index);
void on_trnChn_4_currentIndexChanged(int index);
void on_trnWeight_4_editingFinished();
void on_battCalib_editingFinished();
void on_CurrentCalib_SB_editingFinished();
void on_ana1Neg_editingFinished();
@@ -119,33 +103,27 @@ private slots:
void on_varioVolume_SL_valueChanged();
void on_wavVolume_SL_valueChanged();
void on_varioP0_SB_editingFinished();
void on_varioPMax_SB_editingFinished();
void on_varioR0_SB_editingFinished();
void on_pot1Type_currentIndexChanged(int index);
void on_pot2Type_currentIndexChanged(int index);
void on_pot3Type_currentIndexChanged(int index);
void on_serialPortMode_currentIndexChanged(int index);
void on_stickmodeCB_currentIndexChanged(int index);
void on_channelorderCB_currentIndexChanged(int index);
void on_beeperCB_currentIndexChanged(int index);
void on_memwarnChkB_stateChanged(int );
void on_telalarmsChkB_stateChanged(int );
void on_inputfilterCB_currentIndexChanged(int index);
void on_inactimerSB_editingFinished();
void on_backlightautoSB_editingFinished();
void on_backlightswCB_currentIndexChanged(int index);
void on_mavbaud_CB_currentIndexChanged(int index);
void on_voiceLang_CB_currentIndexChanged(int index);
void on_blOnStickMoveSB_editingFinished();
void on_battcalibDSB_editingFinished();
void on_battCalibDSB_editingFinished();
void on_battwarningDSB_editingFinished();
void on_contrastSB_editingFinished();
void on_beepFlashChkB_stateChanged(int );
void on_swTHRChkB_stateChanged(int );
void on_swRUDChkB_stateChanged(int );
void on_swELEChkB_stateChanged(int );
void on_swID0ChkB_stateChanged(int );
void on_swID1ChkB_stateChanged(int );
void on_swID2ChkB_stateChanged(int );
void on_swAILChkB_stateChanged(int );
void on_swGEAChkB_stateChanged(int );
void on_calretrieve_PB_clicked();
void on_calstore_PB_clicked();
void unlockSwitchEdited();
+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 "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)
{
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)
{
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);
}
void populateCustomScreenFieldCB(QComboBox *b, unsigned int value, bool last=false, int hubproto=0)
{
int telem_hub[] = {0,0,0,0,0,0,0,0,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,0,0,2,2,1,1,1,1,1,1};
b->clear();
b->addItem(RawSource(SOURCE_TYPE_NONE, 0).toString());
for (unsigned int i = 0; i <= (last ? TELEMETRY_SOURCES_DISPLAY_COUNT : TELEMETRY_SOURCES_STATUS_COUNT); i++) {
b->addItem(RawSource(SOURCE_TYPE_TELEMETRY, i).toString());
if (!(i>=sizeof(telem_hub)/sizeof(int) || telem_hub[i]==0 || ((telem_hub[i]>=hubproto) && hubproto!=0))) {
QModelIndex index = b->model()->index(i, 0);
QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1);
}
}
if (value>=sizeof(telem_hub)/sizeof(int))
b->setCurrentIndex(0);
else if (telem_hub[value]==0 || ((telem_hub[value]>=hubproto) && hubproto!=0)) {
b->setCurrentIndex(value);
}
b->setMaxVisibleItems(10);
}
QString getProtocolStr(const int proto)
{
static const char *strings[] = { "OFF",
@@ -292,7 +281,7 @@ void CurveGroup::update()
if (lastType != curve.type) {
lastType = curve.type;
curveValueCB->clear();
for (int i=-numcurves; i<numcurves; i++) {
for (int i=-numcurves; i<=numcurves; i++) {
curveValueCB->addItem(CurveReference(CurveReference::CURVE_REF_CUSTOM, i).toString());
}
}
@@ -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)
{
switch(units) {
+2 -3
View File
@@ -4,6 +4,8 @@
#include <QtGui>
#include "eeprominterface.h"
extern const QColor colors[C9X_MAX_CURVES];
#define TMR_NUM_OPTION (TMR_VAROFS+2*9+2*GetEepromInterface()->getCapability(LogicalSwitches)-1)
//convert from mode 1 to mode generalSettings.stickMode
@@ -27,7 +29,6 @@
void populateGvSourceCB(QComboBox *b, int value);
void populateVoiceLangCB(QComboBox *b, QString language);
void populateTTraceCB(QComboBox *b, int value);
void populateRotEncCB(QComboBox *b, int value, int renumber);
void populateBacklightCB(QComboBox *b, const uint8_t value);
@@ -88,7 +89,6 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr=
void populatePhasesCB(QComboBox *b, int value);
void populateGvarUseCB(QComboBox *b, unsigned int phase);
void populateCustomScreenFieldCB(QComboBox *b, unsigned int value, bool last, int hubproto);
QString getProtocolStr(const int proto);
QString getPhasesStr(unsigned int phases, ModelData & model);
@@ -120,7 +120,6 @@ QString getCenterBeep(ModelData * g_model);
/* FrSky helpers */
QString getFrSkyAlarmType(int alarm);
QString getFrSkyBlades(int blades);
QString getFrSkyUnits(int units);
QString getFrSkyProtocol(int protocol);
QString getFrSkyMeasure(int units);
Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

+25 -16
View File
@@ -63,6 +63,7 @@
#include "warnings.h"
#include "helpers.h"
#include "appdata.h"
#include "taranisnotfound.h"
#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"
@@ -222,7 +223,7 @@ void MainWindow::checkForUpdates(bool ignoreSettings, QString & fwId)
if(ignoreSettings) {
downloadDialog_forWait = new downloadDialog(this, tr("Checking for updates"));
downloadDialog_forWait->show();
downloadDialog_forWait->exec();
} else {
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);
installer_fileName = fileName;
connect(dd, SIGNAL(accepted()), this, SLOT(updateDownloaded()));
dd->show();
dd->exec();
}
}
#else
@@ -1024,7 +1025,8 @@ void MainWindow::readEeprom()
if (IS_TARANIS(eepromInterface->getBoard())) {
QString path=FindTaranisPath();
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;
} else {
QStringList str;
@@ -1080,7 +1082,8 @@ void MainWindow::writeFileToEeprom()
if (IS_TARANIS(eepromInterface->getBoard())) {
QString path=FindTaranisPath();
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;
} else {
QStringList str;
@@ -1131,7 +1134,8 @@ void MainWindow::writeFileToEeprom()
if (IS_TARANIS(eepromInterface->getBoard())) {
QString path=FindTaranisPath();
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;
} else {
QStringList str;
@@ -1156,7 +1160,8 @@ void MainWindow::writeFileToEeprom()
if (IS_TARANIS(eepromInterface->getBoard())) {
QString path=FindTaranisPath();
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;
}
else {
@@ -1251,15 +1256,16 @@ bool MainWindow::convertEEPROM(QString backupFile, QString restoreFile, QString
if ((svnTags.at(0) == "open9x")||(svnTags.at(0) == "opentx")) {
if (revision > 1464) {
QString fwBuild = flash.getBuild();
if (fwBuild.contains("-")) {
QStringList buildTags = fwBuild.split("-", QString::SkipEmptyParts);
QString fwEEprom = flash.getEEprom();
if (fwEEprom.contains("-")) {
QStringList buildTags = fwEEprom.split("-", QString::SkipEmptyParts);
if (buildTags.size() >= 1)
version = buildTags.at(0).toInt();
if (buildTags.size() >= 2)
variant = buildTags.at(1).toInt();
} else {
version = fwBuild.toInt(); // TODO changer le nom de la variable
}
else {
version = fwEEprom.toInt();
}
}
else {
@@ -1401,7 +1407,8 @@ void MainWindow::readEepromToFile()
if (IS_TARANIS(eepromInterface->getBoard())) {
QString path=FindTaranisPath();
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;
}
else {
@@ -1530,18 +1537,20 @@ MdiChild *MainWindow::createMdiChild()
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 );
if (!icon.isEmpty())
newAction->setIcon(CompanionIcon(icon));
newAction->setIcon(CompanionIcon(icon));
if (!sName.isEmpty())
newAction->setText(sName);
if (!lName.isEmpty())
newAction->setStatusTip(lName);
if (shortcut != 0)
newAction->setShortcuts(shortcut);
connect(newAction, SIGNAL(triggered()), this, slot);
if (slotObj == NULL)
slotObj = this;
connect(newAction, SIGNAL(triggered()), slotObj, slot);
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()));
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()));
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()));
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()));
+2 -2
View File
@@ -49,7 +49,7 @@
#include "eeprominterface.h"
#define SPLASH_TIME 5
#define MAX_RECENT 10
#define MAX_RECENT 15
#define MAX_PROFILES 15
class MdiChild;
@@ -158,7 +158,7 @@ private slots:
private:
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(QString, QString, QString, const char *);
+728 -720
View File
File diff suppressed because it is too large Load Diff
+36 -6
View File
@@ -10,18 +10,24 @@ Channels::Channels(QWidget * parent, ModelData & model):
ModelPanel(parent, model)
{
QGridLayout * gridLayout = new QGridLayout(this);
bool minimize = false;
int col = 1;
if (GetEepromInterface()->getCapability(ChannelsName))
{
minimize=true;
addLabel(gridLayout, tr("Name"), col++);
addLabel(gridLayout, tr("Offset"), col++);
addLabel(gridLayout, tr("Min"), col++);
addLabel(gridLayout, tr("Max"), col++);
addLabel(gridLayout, tr("Invert"), col++);
}
addLabel(gridLayout, tr("Offset"), col++, minimize);
addLabel(gridLayout, tr("Min"), col++, minimize);
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))
addLabel(gridLayout, tr("Center"), col++);
addLabel(gridLayout, tr("Center"), col++, minimize);
if (GetEepromInterface()->getCapability(SYMLimits))
addLabel(gridLayout, tr("Sym"), col++);
addLabel(gridLayout, tr("Sym"), col++, true);
for (int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) {
col = 0;
@@ -29,6 +35,7 @@ Channels::Channels(QWidget * parent, ModelData & model):
// Channel label
QLabel *label = new QLabel(this);
label->setText(tr("Channel %1").arg(i+1));
label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
gridLayout->addWidget(label, i+1, col++, 1, 1);
// Channel name
@@ -88,6 +95,19 @@ Channels::Channels(QWidget * parent, ModelData & model):
connect(invCB, SIGNAL(currentIndexChanged(int)), this, SLOT(invEdited()));
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
if (GetEepromInterface()->getCapability(PPMCenter)) {
QSpinBox * center = new QSpinBox(this);
@@ -110,6 +130,8 @@ Channels::Channels(QWidget * parent, ModelData & model):
gridLayout->addWidget(symlimits, i+1, col++, 1, 1);
}
}
// Push the rows up
addVSpring(gridLayout, 0,GetEepromInterface()->getCapability(Outputs)+1);
}
Channels::~Channels()
@@ -168,6 +190,14 @@ void Channels::invEdited()
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()
{
QSpinBox *sb = qobject_cast<QSpinBox*>(sender());
+1
View File
@@ -18,6 +18,7 @@ class Channels : public ModelPanel
void minEdited();
void maxEdited();
void invEdited();
void curveEdited();
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
static 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),
};
#define CURVE_COEFF_ENABLE 1
#define CURVE_YMID_ENABLE 2
#define CURVE_YMIN_ENABLE 4
float curveLinear(float x, float coeff, float yMin, float yMid, float yMax)
{
float a = (yMax-yMin) / 200.0;
return yMin + a * (x+100.0);
}
float c9xexpou(float point, float coeff)
{
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;
}
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
#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;
}
@@ -189,41 +257,16 @@ void Curves::update()
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();
updateCurve();
updateCurvePoints();
lock = false;
}
void Curves::setCurrentCurve(int index)
{
currentCurve = index;
currentCurve = index;
}
void Curves::updateCurveType()
@@ -253,6 +296,8 @@ void Curves::updateCurveType()
void Curves::updateCurve()
{
lock = true;
Node * nodel = 0;
Node * nodex = 0;
QColor color;
@@ -317,18 +362,51 @@ void Curves::updateCurve()
scene->addItem(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()
{
if (!lock) {
lock = true;
int index = sender()->property("index").toInt();
model.curves[currentCurve].points[index].x = spnx[index]->value();
model.curves[currentCurve].points[index].y = spny[index]->value();
updateCurve();
emit modified();
lock = false;
}
}
@@ -390,7 +468,7 @@ void Curves::on_curvePoints_currentIndexChanged(int index)
// TODO something better + reuse!
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;
}
@@ -413,7 +491,7 @@ void Curves::on_curveCustom_currentIndexChanged(int index)
// TODO something better + reuse!
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;
}
@@ -444,213 +522,72 @@ void Curves::resizeEvent(QResizeEvent *event)
QRect qr = ui->curvePreview->contentsRect();
ui->curvePreview->scene()->setSceneRect(GFX_MARGIN, GFX_MARGIN, qr.width()-GFX_MARGIN*2, qr.height()-GFX_MARGIN*2);
updateCurve();
ModelPanel::resizeEvent(event);
}
#if 0
void ModelEdit::on_ca_ctype_CB_currentIndexChanged()
void Curves::on_curveType_currentIndexChanged()
{
int index=ui->ca_ctype_CB->currentIndex();
switch (index) {
int index = ui->curveType->currentIndex();
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:
ui->ca_coeff_SB->hide();
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);
apply = true;
break;
case 1:
ui->ca_coeff_SB->show();
ui->ca_coeff_label->show();
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);
if (x>=0)
apply = true;
break;
case 2:
ui->ca_coeff_SB->show();
ui->ca_coeff_label->show();
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);
if (x<0)
apply = true;
break;
}
}
float c9xexpou(float point, float coeff)
{
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;
}
}
if (apply) {
model.curves[currentCurve].points[i].y = templates[index].function(x, ui->curveCoeff->value(), ui->yMin->value(), ui->yMid->value(), ui->yMax->value());
}
updateSettings();
setCurrentCurve(currentCurve);
drawCurve();
}
updateCurve();
updateCurvePoints();
emit modified();
}
#if 0
void ModelEdit::clearCurves(bool ask)
{
if (ask) {
+14
View File
@@ -8,6 +8,14 @@ namespace Ui {
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
{
Q_OBJECT
@@ -30,9 +38,12 @@ class Curves : public ModelPanel
void onNodeMoved(int x, int y);
void onNodeFocus();
void onNodeUnfocus();
void on_curveType_currentIndexChanged();
void on_curveApply_clicked();
protected:
virtual void resizeEvent(QResizeEvent *event);
void addTemplate(QString name, unsigned int flags, curveFunction function);
private:
Ui::Curves *ui;
@@ -40,10 +51,13 @@ class Curves : public ModelPanel
bool visibleCurves[C9X_MAX_CURVES];
QSpinBox * spnx[C9X_MAX_POINTS];
QSpinBox * spny[C9X_MAX_POINTS];
QVector<CurveCreatorTemplate> templates;
void setCurrentCurve(int index);
void updateCurve();
void updateCurveType();
void updateCurvePoints();
bool allowCurveType(int points, CurveData::CurveType type);
void setPointY(int i, int x, int y);
};
+344 -161
View File
@@ -1,161 +1,344 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Curves</class>
<widget class="QWidget" name="Curves">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>638</width>
<height>587</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_80" columnstretch="0,0,0,0,0">
<item row="0" column="0" rowspan="3">
<layout class="QGridLayout" name="curvesLayout"/>
</item>
<item row="0" column="1" rowspan="3">
<layout class="QGridLayout" name="gridLayout_8" rowstretch="0,0,0" columnstretch="1,0">
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="rightMargin">
<number>0</number>
</property>
<item>
<widget class="QComboBox" name="curvePoints"/>
</item>
<item>
<widget class="QComboBox" name="curveCustom">
<item>
<property name="text">
<string>Standard</string>
</property>
</item>
<item>
<property name="text">
<string>Custom</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QComboBox" name="curveSmooth">
<item>
<property name="text">
<string>Lines</string>
</property>
</item>
<item>
<property name="text">
<string>Smooth</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="curveTypeLabel">
<property name="text">
<string>Curve type</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</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">
<widget class="QLineEdit" name="curveName">
<property name="maxLength">
<number>6</number>
</property>
</widget>
</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>
<width>400</width>
<height>400</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="2" rowspan="3" colspan="2">
<layout class="QGridLayout" name="pointsLayout">
<property name="horizontalSpacing">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>2</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</item>
<item row="5" column="0" colspan="5">
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</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>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Curves</class>
<widget class="QWidget" name="Curves">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>718</width>
<height>539</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QGridLayout" name="curvesLayout"/>
</item>
<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>
<layout class="QGridLayout" name="gridLayout">
<item row="1" 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="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,0">
<property name="rightMargin">
<number>0</number>
</property>
<item>
<widget class="QComboBox" name="curvePoints"/>
</item>
<item>
<widget class="QComboBox" name="curveCustom">
<item>
<property name="text">
<string>Standard</string>
</property>
</item>
<item>
<property name="text">
<string>Custom</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QComboBox" name="curveSmooth">
<item>
<property name="text">
<string>Lines</string>
</property>
</item>
<item>
<property name="text">
<string>Smooth</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<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">
<property name="text">
<string>Curve type</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<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>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="pointsLayout">
<property name="horizontalSpacing">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>2</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</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>
<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>
</widget>
<resources/>
<connections/>
</ui>
+19 -8
View File
@@ -54,11 +54,11 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
{
QGridLayout * gridLayout = new QGridLayout(this);
int col = 1;
addLabel(gridLayout, tr("Switch"), col++);
addLabel(gridLayout, tr("Action"), col++);
addLabel(gridLayout, tr("Parameters"), col++);
addLabel(gridLayout, tr("Enable"), col++);
addLabel(gridLayout, tr("Switch"), 1);
addLabel(gridLayout, tr("Action"), 2);
addLabel(gridLayout, tr("Parameters"), 3);
addLabel(gridLayout, tr("Enable"), 4, true );
addEmptyLabel(gridLayout, 5 );
lock = true;
int num_fsw = GetEepromInterface()->getCapability(CustomFunctions);
@@ -104,13 +104,15 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
label->setContextMenuPolicy(Qt::CustomContextMenu);
label->setMouseTracking(true);
label->setProperty("index", i);
label->setText(tr("CF%1").arg(i+1));
gridLayout->addWidget(label, i+1, 0);
label->setText(tr("SF%1").arg(i+1));
label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(fsw_customContextMenuRequested(QPoint)));
gridLayout->addWidget(label, i+1, 0);
// The switch
fswtchSwtch[i] = new QComboBox(this);
fswtchSwtch[i]->setProperty("index", i);
fswtchSwtch[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
connect(fswtchSwtch[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
gridLayout->addWidget(fswtchSwtch[i], i+1, 1);
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()));
#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]->setProperty("index", i);
playBT[i]->setProperty("state", "play");
@@ -178,11 +186,13 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
fswtchEnable[i] = new QCheckBox(this);
fswtchEnable[i]->setProperty("index", i);
fswtchEnable[i]->setText(tr("ON"));
fswtchEnable[i]->setFixedWidth( 50 );
repeatLayout->addWidget(fswtchEnable[i], i+1);
fswtchEnable[i]->setChecked(model.funcSw[i].enabled);
connect(fswtchEnable[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited()));
}
// Push rows upward
addDoubleSpring(gridLayout, 5, num_fsw+1);
lock = false;
}
@@ -203,6 +213,7 @@ void CustomFunctionsPanel::mediaPlayer_state(Phonon::State newState, Phonon::Sta
clickObject->clearQueue();
clickObject->clear();
for (int i=0; i<GetEepromInterface()->getCapability(CustomFunctions); i++) {
playBT[i]->setProperty("state", "play");
playBT[i]->setObjectName(QString("play_%1").arg(i));
playBT[i]->setIcon(CompanionIcon("play.png"));
}
+8 -7
View File
@@ -1,13 +1,13 @@
#include "expodialog.h"
#include "ui_expodialog.h"
#include "eeprominterface.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),
ui(new Ui::ExpoDialog),
model(model),
ed(expoData)
ed(expoData),
inputName(inputName)
{
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 };
@@ -45,8 +45,6 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, i
}
if (GetEepromInterface()->getCapability(VirtualInputs)) {
ui->sideLabel->hide();
ui->sideCB->hide();
ui->inputName->setMaxLength(4);
populateSourceCB(ui->sourceCB, ed->srcRaw, model, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS | POPULATE_TELEMETRY);
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->setText(model.inputNames[ed->chn]);
ui->inputName->setText(inputName);
ui->lineName->setValidator(new QRegExpValidator(rx, this));
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++) {
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()));
}
@@ -137,7 +138,7 @@ void ExpoDialog::valuesChanged()
ed->mode = ui->sideCB->currentIndex() + 1;
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;
for (int i=8; i>=0 ; i--) {
+2 -1
View File
@@ -14,7 +14,7 @@ namespace Ui {
class ExpoDialog : public QDialog {
Q_OBJECT
public:
ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expodata, int stickMode);
ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expodata, int stickMode, char * inputName);
~ExpoDialog();
protected:
@@ -28,6 +28,7 @@ class ExpoDialog : public QDialog {
Ui::ExpoDialog * ui;
ModelData & model;
ExpoData * ed;
char * inputName;
GVarGroup * gvGroup;
CurveGroup * curveGroup;
};
+15 -2
View File
@@ -165,7 +165,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<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">
<widget class="QLabel" name="trim1Label">
<property name="text">
@@ -299,7 +299,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<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">
<widget class="QLabel" name="trim4Label">
<property name="text">
@@ -423,6 +423,19 @@
</layout>
</widget>
</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>
</item>
<item>
+23 -45
View File
@@ -194,33 +194,29 @@ void FlightMode::update()
for (int i=0; i<gvCount; i++) {
gvNames[i]->setText(model.gvars_names[i]);
if (phase.gvars[i] < 1024) {
gvValues[i]->setValue(phase.gvars[i]);
gvValues[i]->setDisabled(false);
}
else {
int idx = phase.gvars[i] - 1025;
if (idx >= i) idx++;
// TODO no!!!!
PhaseData *phasegvar = &model.phaseData[idx];
gvValues[i]->setValue(phasegvar->gvars[i]);
gvValues[i]->setDisabled(true);
gvValues[i]->setDisabled(false);
int idx = phase.gvars[i];
PhaseData *phasegvar = &phase;
while (idx >= 1024) {
idx -= 1025;
phasegvar = &model.phaseData[idx];
idx = phasegvar->gvars[i];
gvValues[i]->setDisabled(true);
}
gvValues[i]->setValue(phasegvar->gvars[i]);
}
for (int i=0; i<reCount; i++) {
if (phase.rotaryEncoders[i] < 1024) {
reValues[i]->setValue(phase.rotaryEncoders[i]);
reValues[i]->setDisabled(false);
}
else {
int idx = phase.rotaryEncoders[i] - 1025;
if (idx >= i) idx++;
// TODO no!!!!
PhaseData *phasere = &model.phaseData[idx];
reValues[i]->setValue(phasere->rotaryEncoders[i]);
for (int i=0; i<reCount; i++) {
reValues[i]->setDisabled(false);
int idx = phase.rotaryEncoders[i];
PhaseData *phasere = &phase;
while (idx >= 1024) {
idx -= 1025;
phasere = &model.phaseData[idx];
idx = phasere->rotaryEncoders[i];
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());
int gvar = comboBox->property("index").toInt();
if (index == 0) {
int value = phase.gvars[gvar];
if (value>1024) {
value=0;
}
gvValues[gvar]->setValue(value);
gvValues[gvar]->setEnabled(true);
phase.gvars[gvar]=value;
phase.gvars[gvar]=0;
}
else {
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();
lock = false;
}
@@ -348,21 +335,12 @@ void FlightMode::phaseREUse_currentIndexChanged(int index)
QComboBox *comboBox = qobject_cast<QComboBox*>(sender());
int re = comboBox->property("index").toInt();
if (index == 0) {
// TODO no!!!
int value = phase.rotaryEncoders[re];
if (value > 1024) {
value = 0;
}
reValues[re]->setValue(value);
reValues[re]->setEnabled(true);
phase.rotaryEncoders[re] = value;
phase.rotaryEncoders[re] = 0;
}
else {
phase.rotaryEncoders[re] = 1024 + index;
int value = model.phaseData[index + (index>phaseIdx ? 0 :-1)].rotaryEncoders[re];
reValues[re]->setValue(value);
reValues[re]->setDisabled(true) ;
phase.rotaryEncoders[re] = 1024 + index; ;
}
update();
lock = false;
emit modified();
}
+12 -7
View File
@@ -98,12 +98,11 @@ void InputsPanel::update()
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString();
}
}
else {
switch (md->mode) {
case (1): str += " <-"; break;
case (2): str += " ->"; break;
default: str += " "; break;
};
switch (md->mode) {
case (1): str += " <-"; break;
case (2): str += " ->"; break;
default: str += " "; break;
}
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;
ExpoData mixd(model.expoData[index]);
char inputName[4+1];
emit modified();
update();
if (GetEepromInterface()->getCapability(VirtualInputs))
strcpy(inputName, model.inputNames[mixd.chn]);
ExpoDialog *g = new ExpoDialog(this, model, &mixd, generalSettings.stickMode);
ExpoDialog *g = new ExpoDialog(this, model, &mixd, generalSettings.stickMode, inputName);
if (g->exec()) {
model.expoData[index] = mixd;
if (GetEepromInterface()->getCapability(VirtualInputs))
strcpy(model.inputNames[mixd.chn], inputName);
emit modified();
update();
}
+119 -106
View File
@@ -28,12 +28,10 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model):
// The label
QLabel * label = new QLabel(this);
label->setProperty("index", i);
if (i < 9)
label->setText(tr("LS%1").arg(i+1));
else
label->setText(tr("LS%1").arg(QChar('A'+i-9)));
label->setText(tr("L%1").arg(i+1));
label->setContextMenuPolicy(Qt::CustomContextMenu);
label->setMouseTracking(true);
label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(csw_customContextMenuRequested(QPoint)));
gridLayout->addWidget(label, i+1, 0);
@@ -60,10 +58,11 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model):
cswitchValue[i]->setVisible(false);
// V2
QHBoxLayout *v2Layout = new QHBoxLayout();
cswitchSource2[i] = new QComboBox(this);
cswitchSource2[i]->setProperty("index", i);
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);
cswitchOffset[i] = new QDoubleSpinBox(this);
cswitchOffset[i]->setProperty("index",i);
@@ -72,8 +71,18 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model):
cswitchOffset[i]->setAccelerated(true);
cswitchOffset[i]->setDecimals(0);
connect(cswitchOffset[i], SIGNAL(editingFinished()), this, SLOT(edited()));
gridLayout->addWidget(cswitchOffset[i], i+1, 3);
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
cswitchAnd[i] = new QComboBox(this);
@@ -105,7 +114,8 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model):
gridLayout->addWidget(cswitchDelay[i], i+1, 6);
}
}
// Push rows upward
addVSpring(gridLayout,0,GetEepromInterface()->getCapability(LogicalSwitches)+1);
lock = false;
}
@@ -205,19 +215,19 @@ void LogicalSwitchesPanel::edited()
switch (model.customSw[i].getFunctionFamily())
{
case LS_FAMILY_VOFS:
{
source = RawSource(model.customSw[i].val1, &model);
RawSourceRange range = source.getRange();
if (model.customSw[i].func == LS_FN_DPOS || model.customSw[i].func == LS_FN_DAPOS) {
model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step);
cswitchOffset[i]->setValue(model.customSw[i].val2*range.step);
}
else {
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);
}
{
source = RawSource(model.customSw[i].val1, &model);
RawSourceRange range = source.getRange();
if (model.customSw[i].func == LS_FN_DPOS || model.customSw[i].func == LS_FN_DAPOS) {
model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step);
cswitchOffset[i]->setValue(model.customSw[i].val2*range.step);
}
else {
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);
}
break;
}
case LS_FAMILY_TIMER:
model.customSw[i].val1 = TimToVal(cswitchValue[i]->value());
model.customSw[i].val2 = TimToVal(cswitchOffset[i]->value());
@@ -225,8 +235,14 @@ void LogicalSwitchesPanel::edited()
updateTimerParam(cswitchOffset[i], model.customSw[i].val2);
break;
case LS_FAMILY_STAY:
model.customSw[i].val2 = TimToVal(cswitchOffset[i]->value());
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, true);
if (sender() == cswitchOffset[i]) {
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;
default:
break;
@@ -243,92 +259,98 @@ void LogicalSwitchesPanel::updateTimerParam(QDoubleSpinBox *sb, int timer, bool
sb->setMinimum(allowZero ? 0.0 : 0.1);
sb->setMaximum(175);
float value = ValToTim(timer);
if (value>60)
if (value>=60)
sb->setSingleStep(1);
else if (value>2)
else if (value>=2)
sb->setSingleStep(0.5);
else
sb->setSingleStep(0.1);
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)
{
lock = true;
RawSource source = RawSource(model.customSw[i].val1, &model);
RawSourceRange range = source.getRange();
unsigned int mask = 0;
RawSource source = RawSource(model.customSw[i].val1, &model);
RawSourceRange range = source.getRange();
switch (model.customSw[i].getFunctionFamily())
{
case LS_FAMILY_VOFS:
cswitchSource1[i]->setVisible(true);
cswitchSource2[i]->setVisible(false);
cswitchValue[i]->setVisible(false);
cswitchOffset[i]->setVisible(true);
populateSourceCB(cswitchSource1[i], source, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
cswitchOffset[i]->setDecimals(range.decimals);
cswitchOffset[i]->setSingleStep(range.step);
if (model.customSw[i].func == LS_FN_DPOS || model.customSw[i].func == LS_FN_DAPOS) {
cswitchOffset[i]->setMinimum(range.step*-127);
cswitchOffset[i]->setMaximum(range.step*127);
cswitchOffset[i]->setValue(range.step*model.customSw[i].val2);
}
else {
cswitchOffset[i]->setMinimum(range.min);
cswitchOffset[i]->setMaximum(range.max);
cswitchOffset[i]->setValue(range.step*(model.customSw[i].val2/* TODO+source.getRawOffset(model)*/)+range.offset);
}
break;
case LS_FAMILY_VBOOL:
case LS_FAMILY_STICKY:
cswitchSource1[i]->setVisible(true);
cswitchSource2[i]->setVisible(true);
cswitchValue[i]->setVisible(false);
cswitchOffset[i]->setVisible(false);
populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1));
populateSwitchCB(cswitchSource2[i], RawSwitch(model.customSw[i].val2));
break;
case LS_FAMILY_STAY:
cswitchSource1[i]->setVisible(true);
cswitchSource2[i]->setVisible(false);
cswitchValue[i]->setVisible(false);
populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1));
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, true);
break;
case LS_FAMILY_VCOMP:
cswitchSource1[i]->setVisible(true);
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;
}
switch (model.customSw[i].getFunctionFamily())
{
case LS_FAMILY_VOFS:
mask |= SOURCE1_VISIBLE | VALUE2_VISIBLE;
populateSourceCB(cswitchSource1[i], source, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
cswitchOffset[i]->setDecimals(range.decimals);
cswitchOffset[i]->setSingleStep(range.step);
if (model.customSw[i].func == LS_FN_DPOS || model.customSw[i].func == LS_FN_DAPOS) {
cswitchOffset[i]->setMinimum(range.step*-127);
cswitchOffset[i]->setMaximum(range.step*127);
cswitchOffset[i]->setValue(range.step*model.customSw[i].val2);
}
else {
cswitchOffset[i]->setMinimum(range.min);
cswitchOffset[i]->setMaximum(range.max);
cswitchOffset[i]->setValue(range.step*(model.customSw[i].val2/* TODO+source.getRawOffset(model)*/)+range.offset);
}
break;
case LS_FAMILY_VBOOL:
case LS_FAMILY_STICKY:
mask |= SOURCE1_VISIBLE | SOURCE2_VISIBLE;
populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1));
populateSwitchCB(cswitchSource2[i], RawSwitch(model.customSw[i].val2));
break;
case LS_FAMILY_STAY:
mask |= SOURCE1_VISIBLE | VALUE2_VISIBLE | VALUE3_VISIBLE;
populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1));
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, true);
updateTimerParam(cswitchOffset2[i], model.customSw[i].val2+model.customSw[i].val3, true);
break;
case LS_FAMILY_VCOMP:
mask |= SOURCE1_VISIBLE | SOURCE2_VISIBLE;
populateSourceCB(cswitchSource1[i], RawSource(model.customSw[i].val1), model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
populateSourceCB(cswitchSource2[i], RawSource(model.customSw[i].val2), model, POPULATE_SOURCES | POPULATE_TRIMS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
break;
case LS_FAMILY_TIMER:
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()
{
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) {
lock = true;
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;
updateLine(i);
}
}
@@ -338,36 +360,27 @@ void LogicalSwitchesPanel::cswPaste()
const QMimeData *mimeData = clipboard->mimeData();
if (mimeData->hasFormat("application/x-companion-csw")) {
QByteArray cswData = mimeData->data("application/x-companion-csw");
LogicalSwitchData *csw = &model.customSw[selectedSwitch];
memcpy(csw, cswData.mid(0, sizeof(LogicalSwitchData)).constData(), sizeof(LogicalSwitchData));
emit modified();
updateSelectedSwitch();
updateLine(selectedSwitch);
}
}
void LogicalSwitchesPanel::cswDelete()
{
model.customSw[selectedSwitch].clear();
emit modified();
updateSelectedSwitch();
model.customSw[selectedSwitch].clear();
emit modified();
updateLine(selectedSwitch);
}
void LogicalSwitchesPanel::cswCopy()
{
QByteArray cswData;
cswData.append((char*)&model.customSw[selectedSwitch],sizeof(LogicalSwitchData));
QMimeData *mimeData = new QMimeData;
mimeData->setData("application/x-companion-csw", cswData);
QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard);
}
void LogicalSwitchesPanel::updateSelectedSwitch()
{
lock = true;
populateCSWCB(csw[selectedSwitch], model.customSw[selectedSwitch].func);
setSwitchWidgetVisibility(selectedSwitch);
lock = false;
QByteArray cswData;
cswData.append((char*)&model.customSw[selectedSwitch],sizeof(LogicalSwitchData));
QMimeData *mimeData = new QMimeData;
mimeData->setData("application/x-companion-csw", cswData);
QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard);
}
void LogicalSwitchesPanel::cswCut()
+2 -2
View File
@@ -32,6 +32,7 @@ class LogicalSwitchesPanel : public ModelPanel
QComboBox * csw[C9X_NUM_CSW];
QDoubleSpinBox * cswitchValue[C9X_NUM_CSW];
QDoubleSpinBox * cswitchOffset[C9X_NUM_CSW];
QDoubleSpinBox * cswitchOffset2[C9X_NUM_CSW];
QComboBox * cswitchAnd[C9X_NUM_CSW];
QDoubleSpinBox * cswitchDuration[C9X_NUM_CSW];
QDoubleSpinBox * cswitchDelay[C9X_NUM_CSW];
@@ -40,8 +41,7 @@ class LogicalSwitchesPanel : public ModelPanel
void setSwitchWidgetVisibility(int i);
int selectedSwitch;
void updateSelectedSwitch();
void updateV2(int index);
void updateLine(int index);
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);
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);
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->trimCB->addItem(tr("Rud"), 1);
ui->trimCB->addItem(tr("Ele"), 2);
ui->trimCB->addItem(tr("Thr"), 3);
ui->trimCB->addItem(tr("Ail"), 4);
if (!GetEepromInterface()->getCapability(VirtualInputs)) {
ui->trimCB->addItem(tr("Rud"));
ui->trimCB->addItem(tr("Ele"));
ui->trimCB->addItem(tr("Thr"));
ui->trimCB->addItem(tr("Ail"));
}
ui->trimCB->setCurrentIndex(1 - md->carryTrim);
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()
{
// curDest -> destination channel4
@@ -52,26 +75,13 @@ void MixesPanel::update()
unsigned int curDest = 0;
int i;
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++) {
MixData *md = &model.mixData[i];
if ((md->destCh==0) || (md->destCh>outputs+(unsigned int)GetEepromInterface()->getCapability(ExtraChannels))) continue;
QString str = "";
while (curDest<(md->destCh-1)) {
while (curDest < md->destCh-1) {
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);
}
}
}
str = getChannelLabel(curDest);
qba.clear();
qba.append((quint8)-curDest);
QListWidgetItem *itm = new QListWidgetItem(str);
@@ -79,23 +89,12 @@ void MixesPanel::update()
MixerlistWidget->addItem(itm);
}
if (md->destCh > outputs) {
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);
}
}
}
str = getChannelLabel(md->destCh);
if (curDest != md->destCh) {
curDest = md->destCh;
} else {
}
else {
str.fill(' ');
}
@@ -116,13 +115,11 @@ void MixesPanel::update()
str += " " + tr("Switch(%1)").arg(md->swtch.toString());
}
if (!GetEepromInterface()->getCapability(VirtualInputs)) {
if (md->carryTrim>0) {
str += " " + tr("No Trim");
}
else if (md->carryTrim<0) {
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString();
}
if (md->carryTrim>0) {
str += " " + tr("No Trim");
}
else if (md->carryTrim<0) {
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString();
}
if (md->noExpo) str += " " + tr("No DR/Expo");
@@ -154,21 +151,7 @@ void MixesPanel::update()
while(curDest<outputs+GetEepromInterface()->getCapability(ExtraChannels)) {
curDest++;
QString str;
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);
}
}
}
QString str = getChannelLabel(curDest);
qba.clear();
qba.append((quint8)-curDest);
QListWidgetItem *itm = new QListWidgetItem(str);
+1 -1
View File
@@ -50,7 +50,7 @@ class MixesPanel : public ModelPanel
void mixersDeleteList(QList<int> list);
QList<int> createMixListFromSelected();
void setSelectedByMixList(QList<int> list);
QString getChannelLabel(int curDest);
};
#endif // MIXES_H
+2 -1
View File
@@ -22,6 +22,7 @@ ModelEdit::ModelEdit(RadioData & radioData, int modelId, bool openWizard, bool i
generalSettings(radioData.generalSettings)
{
ui->setupUi(this);
setWindowIcon(CompanionIcon("edit.png"));
restoreGeometry(g.modelEditGeo());
ui->pushButton->setIcon(CompanionIcon("simulate.png"));
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 LogicalSwitchesPanel(this, model), tr("Logical Switches"));
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"));
if (GetEepromInterface()->getCapability(Telemetry) & TM_HASTELEMETRY)
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);
label->setFrameShape(QFrame::Panel);
label->setFrameShadow(QFrame::Raised);
label->setMidLineWidth(0);
label->setAlignment(Qt::AlignCenter);
label->setMargin(3);
label->setMargin(5);
label->setText(text);
if (!minimize)
label->setMinimumWidth(100);
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:
ModelData & model;
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
+51 -13
View File
@@ -112,11 +112,15 @@ ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module
else {
ui->label_trainerMode->hide();
ui->trainerMode->hide();
if (moduleIdx == 0)
label = tr("Internal Radio System");
else
label = tr("External Radio Module");
if (GetEepromInterface()->getCapability(NumModules) > 1) {
if (moduleIdx == 0)
label = tr("Internal Radio System");
else
label = tr("External Radio Module");
}
else {
label = tr("Radio System");
}
}
ui->label_module->setText(label);
@@ -351,14 +355,13 @@ Setup::Setup(QWidget *parent, ModelData & model):
QString path = g.profile[g.id()].sdPath();
path.append("/BMP/");
QDir qd(path);
int vml = GetEepromInterface()->getCapability(VoicesMaxLength)+4;
if (qd.exists()) {
QStringList filters;
filters << "*.bmp" << "*.bmp";
foreach ( QString file, qd.entryList(filters, QDir::Files) ) {
QFileInfo fi(file);
QString temp = fi.completeBaseName();
if (!items.contains(temp) && temp.length() <= vml) {
if (!items.contains(temp) && temp.length() <= 10+4) {
items.append(temp);
}
}
@@ -500,8 +503,10 @@ void Setup::on_trimIncrement_currentIndexChanged(int index)
void Setup::on_throttleSource_currentIndexChanged(int index)
{
model.thrTraceSrc = index;
emit modified();
if (!lock) {
model.thrTraceSrc = ui->throttleSource->itemData(index).toInt();
emit modified();
}
}
void Setup::on_name_editingFinished()
@@ -514,8 +519,8 @@ void Setup::on_name_editingFinished()
void Setup::on_image_currentIndexChanged(int index)
{
if (!lock) {
strncpy(model.bitmap, ui->image->currentText().toAscii(), GetEepromInterface()->getCapability(VoicesMaxLength));
QString path=g.profile[g.id()].sdPath();
strncpy(model.bitmap, ui->image->currentText().toAscii(), 10);
QString path = g.profile[g.id()].sdPath();
path.append("/BMP/");
QDir qd(path);
if (qd.exists()) {
@@ -530,7 +535,7 @@ void Setup::on_image_currentIndexChanged(int index)
image.load(fileName);
}
if (!image.isNull()) {
ui->imagePreview->setPixmap(QPixmap::fromImage(image.scaled( 64,32)));;
ui->imagePreview->setPixmap(QPixmap::fromImage(image.scaled(64, 32)));;
}
else {
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()
{
ui->name->setText(model.name);
ui->throttleReverse->setChecked(model.throttleReversed);
populateTTraceCB(ui->throttleSource, model.thrTraceSrc);
populateThrottleSourceCB();
ui->throttleWarning->setChecked(!model.disableThrottleWarning);
//trim inc, thro trim, thro expo, instatrim
+2
View File
@@ -6,6 +6,7 @@
#include <QCheckBox>
#include <QSlider>
#include <QSpinBox>
#include <QComboBox>
#include <QLabel>
namespace Ui {
@@ -104,6 +105,7 @@ class Setup : public ModelPanel
void updateStartupSwitches();
void updatePotWarnings();
void updateBeepCenter();
void populateThrottleSourceCB();
};
#endif // SETUP_H
+421 -288
View File
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>787</width>
<height>727</height>
<width>840</width>
<height>520</height>
</rect>
</property>
<property name="windowTitle">
@@ -16,175 +16,88 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<layout class="QGridLayout" name="gridLayout_37" columnstretch="0,0,0,0,0,0">
<item row="4" column="1">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="3">
<widget class="QComboBox" name="image"/>
</item>
<item row="0" column="4">
<widget class="QLabel" name="imagePreview">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<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="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 name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
<string>Reverse Throttle</string>
</property>
</widget>
</item>
<item row="0" column="5">
<spacer name="horizontalSpacer_26">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="1" column="1">
<widget class="QCheckBox" name="extendedLimits">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</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">
<string>Model Image</string>
<string>Extended Limits</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLineEdit" name="name">
<widget class="QComboBox" name="throttleSource">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxLength">
<number>10</number>
</widget>
</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>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Model Name</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_timer2">
<property name="text">
<string>Timer2</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Timer1</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_ttrace">
<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>
<item row="0" column="1">
<widget class="QCheckBox" name="throttleTrim">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Throttle Trim</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="throttleWarning">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Throttle Warning</string>
</property>
</widget>
</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>
<item row="1" column="0">
<widget class="QComboBox" name="trimIncrement">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
@@ -219,173 +132,393 @@
</item>
</widget>
</item>
<item>
<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>
<item row="1" column="3">
<widget class="QCheckBox" name="displayText">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Display Checklist</string>
</property>
</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>
</item>
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QComboBox" name="throttleSource">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<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>
<item row="2" column="0" alignment="Qt::AlignRight|Qt::AlignVCenter">
<widget class="QLabel" name="label_timer2">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Pot Warnings</string>
<string>Timer2</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="1">
<layout class="QGridLayout" name="potWarningLayout">
<item row="0" column="0">
<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>
<item row="1" column="0" alignment="Qt::AlignRight|Qt::AlignVCenter">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Timer1</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="0">
<layout class="QVBoxLayout" name="verticalLayout_2">
<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>
</item>
</layout>
</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>
</item>
<item>
<layout class="QVBoxLayout" name="modulesLayout"/>
</item>
<item>
<spacer name="verticalSpacer">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
+168 -122
View File
@@ -6,14 +6,46 @@
<rect>
<x>0</x>
<y>0</y>
<width>694</width>
<height>340</height>
<width>628</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<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>
<widget class="QGroupBox" name="moduleGB">
<property name="sizePolicy">
@@ -35,7 +67,41 @@
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</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">
<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">
<property name="maximumSize">
<size>
@@ -56,7 +122,7 @@
</layout>
</widget>
</item>
<item row="6" column="0">
<item row="5" column="0">
<widget class="QLabel" name="label_failsafeMode">
<property name="maximumSize">
<size>
@@ -72,7 +138,7 @@
</property>
</widget>
</item>
<item row="3" column="2" alignment="Qt::AlignRight">
<item row="2" column="2" alignment="Qt::AlignRight">
<widget class="QLabel" name="label_channelsStart">
<property name="maximumSize">
<size>
@@ -88,7 +154,7 @@
</property>
</widget>
</item>
<item row="3" column="1">
<item row="2" column="1">
<widget class="QComboBox" name="protocol">
<property name="maximumSize">
<size>
@@ -98,7 +164,7 @@
</property>
</widget>
</item>
<item row="4" column="4" alignment="Qt::AlignRight">
<item row="3" column="4" alignment="Qt::AlignRight">
<widget class="QLabel" name="label_ppmDelay">
<property name="maximumSize">
<size>
@@ -114,7 +180,7 @@
</property>
</widget>
</item>
<item row="4" column="5">
<item row="3" column="5">
<widget class="QSpinBox" name="ppmDelay">
<property name="maximumSize">
<size>
@@ -142,7 +208,7 @@
</property>
</widget>
</item>
<item row="4" column="3" alignment="Qt::AlignLeft">
<item row="3" column="3" alignment="Qt::AlignLeft">
<widget class="QComboBox" name="ppmPolarity">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
@@ -168,23 +234,7 @@
</item>
</widget>
</item>
<item row="5" column="0">
<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">
<item row="0" column="1">
<widget class="QComboBox" name="trainerMode">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -210,7 +260,7 @@
</item>
</widget>
</item>
<item row="4" column="2" alignment="Qt::AlignRight">
<item row="3" column="2" alignment="Qt::AlignRight">
<widget class="QLabel" name="label_ppmPolarity">
<property name="maximumSize">
<size>
@@ -226,7 +276,7 @@
</property>
</widget>
</item>
<item row="1" column="0" alignment="Qt::AlignRight">
<item row="0" column="0" alignment="Qt::AlignRight">
<widget class="QLabel" name="label_trainerMode">
<property name="maximumSize">
<size>
@@ -242,38 +292,7 @@
</property>
</widget>
</item>
<item row="5" 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">
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="ppmFrameLength">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -307,33 +326,7 @@
</property>
</widget>
</item>
<item row="4" column="0" alignment="Qt::AlignRight">
<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">
<item row="2" column="5" alignment="Qt::AlignLeft">
<widget class="QSpinBox" name="channelsCount">
<property name="maximumSize">
<size>
@@ -361,35 +354,23 @@
</property>
</widget>
</item>
<item row="3" column="3" alignment="Qt::AlignLeft">
<widget class="QSpinBox" name="channelsStart">
<item row="3" column="0" alignment="Qt::AlignRight">
<widget class="QLabel" name="label_ppmFrameLength">
<property name="maximumSize">
<size>
<width>125</width>
<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>
<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="3" column="4" alignment="Qt::AlignRight">
<item row="2" column="4" alignment="Qt::AlignRight">
<widget class="QLabel" name="label_channelsCount">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@@ -411,7 +392,7 @@
</property>
</widget>
</item>
<item row="6" column="1" alignment="Qt::AlignLeft">
<item row="5" column="1" alignment="Qt::AlignLeft">
<widget class="QComboBox" name="failsafeMode">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -440,9 +421,14 @@
<string>No Pulses</string>
</property>
</item>
<item>
<property name="text">
<string>Receiver</string>
</property>
</item>
</widget>
</item>
<item row="7" column="0" alignment="Qt::AlignRight">
<item row="6" column="0" alignment="Qt::AlignRight">
<widget class="QLabel" name="failsafesLayoutLabel">
<property name="maximumSize">
<size>
@@ -458,20 +444,7 @@
</property>
</widget>
</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="3" column="0" alignment="Qt::AlignRight">
<item row="2" column="0" alignment="Qt::AlignRight">
<widget class="QLabel" name="label_protocol">
<property name="maximumSize">
<size>
@@ -487,6 +460,79 @@
</property>
</widget>
</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>
</widget>
</item>
+72 -19
View File
@@ -28,10 +28,20 @@ TelemetryAnalog::TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog):
update();
ui->UnitCB->setCurrentIndex(analog.type);
ui->alarm1LevelCB->setCurrentIndex(analog.alarms[0].level);
ui->alarm1GreaterCB->setCurrentIndex(analog.alarms[0].greater);
ui->alarm2LevelCB->setCurrentIndex(analog.alarms[1].level);
ui->alarm2GreaterCB->setCurrentIndex(analog.alarms[1].greater);
if (!IS_TARANIS(GetEepromInterface()->getBoard())) {
ui->alarm1LevelCB->setCurrentIndex(analog.alarms[0].level);
ui->alarm1GreaterCB->setCurrentIndex(analog.alarms[0].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)) {
ui->CalibSB->hide();
@@ -281,7 +291,7 @@ TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model,
for (int c=0; c<GetEepromInterface()->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
fieldsCB[l][c] = new QComboBox(this);
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);
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++) {
barsCB[l] = new QComboBox(this);
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)));
ui->screenBarsLayout->addWidget(barsCB[l], l, 0, 1, 1);
@@ -316,6 +326,31 @@ TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model,
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()
{
delete ui;
@@ -347,6 +382,8 @@ void TelemetryCustomScreen::update()
void TelemetryCustomScreen::updateBar(int line)
{
lock = true;
int index = screen.body.bars[line].source;
barsCB[line]->setCurrentIndex(index);
if (index) {
@@ -372,6 +409,8 @@ void TelemetryCustomScreen::updateBar(int line)
minSB[line]->setDisabled(true);
maxSB[line]->setDisabled(true);
}
lock = false;
}
void TelemetryCustomScreen::on_screenType_currentIndexChanged(int index)
@@ -393,13 +432,15 @@ void TelemetryCustomScreen::customFieldChanged(int value)
void TelemetryCustomScreen::barSourceChanged(int index)
{
QComboBox * cb = qobject_cast<QComboBox*>(sender());
int line = cb->property("index").toInt();
screen.body.bars[line].source = index;
screen.body.bars[line].barMin = 0;
screen.body.bars[line].barMax = 0;
updateBar(line);
emit modified();
if (!lock) {
QComboBox * cb = qobject_cast<QComboBox*>(sender());
int line = cb->property("index").toInt();
screen.body.bars[line].source = index;
screen.body.bars[line].barMin = 0;
screen.body.bars[line].barMax = 0;
updateBar(line);
emit modified();
}
}
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));
}
if (IS_ARM(GetEepromInterface()->getBoard())) {
ui->bladesCount->setMinimum(1);
}
setup();
}
@@ -467,8 +512,16 @@ void TelemetryPanel::setup()
}
ui->rssiAlarm1SB->setValue(model.frsky.rssiAlarms[0].value);
ui->rssiAlarm2SB->setValue(model.frsky.rssiAlarms[1].value);
ui->rssiAlarm1CB->setCurrentIndex(model.frsky.rssiAlarms[0].level);
ui->rssiAlarm2CB->setCurrentIndex(model.frsky.rssiAlarms[1].level);
if (!IS_TARANIS(GetEepromInterface()->getBoard())) {
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)) {
ui->AltitudeGPS_ChkB->hide();
@@ -585,7 +638,7 @@ void TelemetryPanel::setup()
ui->frskyProtoCB->setCurrentIndex(model.frsky.usrProto);
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->frskyVoltCB->setCurrentIndex(model.frsky.voltsSource);
@@ -599,13 +652,13 @@ void TelemetryPanel::onAnalogModified()
void TelemetryPanel::on_frskyUnitsCB_currentIndexChanged(int index)
{
model.frsky.imperial=index;
model.frsky.imperial = index;
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();
}
+4 -1
View File
@@ -61,6 +61,9 @@ class TelemetryCustomScreen : public ModelPanel
void barMinChanged(double value);
void barMaxChanged(double value);
protected:
void populateTelemetrySourceCB(QComboBox *b, unsigned int value, bool last, int hubproto);
private:
void updateBar(int line);
Ui::TelemetryCustomScreen * ui;
@@ -86,7 +89,7 @@ class TelemetryPanel : public ModelPanel
void onAnalogModified();
void on_frskyProtoCB_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_frskyVoltCB_currentIndexChanged(int index);
void on_AltitudeToolbar_ChkB_toggled(bool checked);
+313 -124
View File
@@ -6,16 +6,19 @@
<rect>
<x>0</x>
<y>0</y>
<width>692</width>
<width>757</width>
<height>457</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</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>
<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">
<enum>QLayout::SetMinimumSize</enum>
</property>
@@ -33,37 +36,86 @@
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="title">
<string>A1</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="A1Layout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>1</number>
<number>0</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>1</number>
<number>3</number>
</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>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="A2GB">
<property name="title">
<string>A2</string>
<property name="flat">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="A2Layout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>1</number>
<number>0</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>1</number>
<number>3</number>
</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>
</widget>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="RSSIGB">
<property name="sizePolicy">
@@ -72,14 +124,52 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>RSSI</string>
<property name="flat">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<widget class="QLabel" name="label_927">
<property name="leftMargin">
<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">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -98,7 +188,7 @@
</property>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="1">
<widget class="QComboBox" name="rssiAlarm1CB">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
@@ -128,7 +218,7 @@
</item>
</widget>
</item>
<item row="0" column="2">
<item row="1" column="2">
<widget class="QSpinBox" name="rssiAlarm1SB">
<property name="enabled">
<bool>true</bool>
@@ -156,10 +246,10 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_928">
<item row="2" column="0">
<widget class="QLabel" name="rssiAlarm2Label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -175,7 +265,7 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QComboBox" name="rssiAlarm2CB">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
@@ -205,7 +295,7 @@
</item>
</widget>
</item>
<item row="1" column="2">
<item row="2" column="2">
<widget class="QSpinBox" name="rssiAlarm2SB">
<property name="enabled">
<bool>true</bool>
@@ -233,18 +323,18 @@
</property>
</widget>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer_16">
<property name="orientation">
<enum>Qt::Vertical</enum>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
<property name="text">
<string>RSSI</string>
</property>
</spacer>
</widget>
</item>
</layout>
</widget>
@@ -252,7 +342,17 @@
</layout>
</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">
<enum>QLayout::SetMinimumSize</enum>
</property>
@@ -264,19 +364,31 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Serial Protocol</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>1</number>
<number>0</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>1</number>
<number>3</number>
</property>
<item>
<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">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
@@ -289,7 +401,7 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QComboBox" name="frskyUnitsCB">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -309,7 +421,7 @@
</item>
</widget>
</item>
<item row="2" column="2">
<item row="3" column="2">
<widget class="QLabel" name="current_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
@@ -328,7 +440,7 @@
</property>
</widget>
</item>
<item row="0" column="0">
<item row="1" column="0">
<widget class="QLabel" name="label_112">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
@@ -347,7 +459,7 @@
</property>
</widget>
</item>
<item row="2" column="3">
<item row="3" column="3">
<widget class="QComboBox" name="frskyCurrentCB">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -377,7 +489,7 @@
</item>
</widget>
</item>
<item row="0" column="1" colspan="3">
<item row="1" column="1" colspan="3">
<widget class="QComboBox" name="frskyProtoCB">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
@@ -397,7 +509,7 @@
</item>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QComboBox" name="frskyVoltCB">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -427,32 +539,7 @@
</item>
</widget>
</item>
<item row="1" column="3">
<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">
<item row="2" column="0">
<widget class="QLabel" name="label_113">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
@@ -471,7 +558,7 @@
</property>
</widget>
</item>
<item row="1" column="2">
<item row="2" column="2">
<widget class="QLabel" name="blades_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
@@ -484,11 +571,53 @@
</property>
</widget>
</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>
</item>
</layout>
</widget>
</item>
<item>
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="altimetryGB">
<property name="sizePolicy">
@@ -497,19 +626,28 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Altimetry / Vario</string>
</property>
<layout class="QGridLayout" name="gridLayout_39">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>1</number>
<number>0</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>1</number>
<number>3</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_40" rowstretch="1,0,0" columnstretch="0,0">
<item row="0" column="1">
<layout class="QGridLayout" name="gridLayout_40" rowstretch="1,0,0,0" columnstretch="0,0">
<property name="horizontalSpacing">
<number>9</number>
</property>
<item row="1" column="1">
<widget class="QComboBox" name="varioSourceCB">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
@@ -544,7 +682,7 @@
</item>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<layout class="QGridLayout" name="gridLayout_66" columnstretch="1,0,0,0">
<item row="0" column="0">
<widget class="QLabel" name="VarioLabel_1">
@@ -558,7 +696,7 @@
<string>Sink Max</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
@@ -681,7 +819,7 @@
<string>Climb Max</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
@@ -697,7 +835,7 @@
<string>Sink Min</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
@@ -713,27 +851,27 @@
<string>Climb Min</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<item row="1" column="0">
<widget class="QLabel" name="varioSource_label">
<property name="text">
<string>Vario source</string>
</property>
</widget>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QLabel" name="varioLimit_label">
<property name="text">
<string>Vario limits</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_16">
<item>
<widget class="QCheckBox" name="AltitudeGPS_ChkB">
@@ -763,6 +901,19 @@
</item>
</layout>
</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>
</item>
</layout>
@@ -770,6 +921,13 @@
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="variousGB">
<property name="sizePolicy">
@@ -778,19 +936,38 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Various</string>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>1</number>
<number>0</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>1</number>
<number>9</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<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">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -803,34 +980,7 @@
</property>
</widget>
</item>
<item row="0" column="1" alignment="Qt::AlignHCenter">
<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">
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="fasOffset_DSB">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -852,7 +1002,27 @@
</property>
</widget>
</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">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -865,6 +1035,25 @@
</property>
</spacer>
</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>
</item>
</layout>
+19 -4
View File
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>272</width>
<width>276</width>
<height>118</height>
</rect>
</property>
@@ -14,6 +14,21 @@
<string>Form</string>
</property>
<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>
<layout class="QGridLayout" name="gridLayout_11" columnstretch="1,1,1,1" columnminimumwidth="0,0,0,0">
<item row="0" column="0">
@@ -43,7 +58,7 @@
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_919">
<widget class="QLabel" name="alarm1Label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -106,7 +121,7 @@
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_921">
<widget class="QLabel" name="alarm2Label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -260,7 +275,7 @@
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<item row="0" column="1" colspan="3">
<widget class="QComboBox" name="UnitCB">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+1 -4
View File
@@ -277,10 +277,7 @@ void ModelsListWidget::refreshList()
clear();
int msize;
div_t divresult;
QString name = radioData->generalSettings.ownerName;
if(!name.isEmpty())
name.prepend(" - ");
addItem(tr("General Settings") + name);
addItem(tr("General Settings"));
EEPROMInterface *eepromInterface = GetEepromInterface();
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)) {
gvars=1;
}
} else {
}
else {
gvars=1;
}
@@ -519,23 +520,6 @@ void printDialog::printCurves()
int i,r,g,b,c,count;
char buffer[16];
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>";
str.append(tr("Curves"));
@@ -552,16 +536,18 @@ void printDialog::printCurves()
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));
for(i=0; i<numcurves; i++) {
pen.setColor(*qplot_color[i]);
pen.setColor(colors[i]);
painter.setPen(pen);
qplot_color[i]->getRgb(&r,&g,&b);
colors[i].getRgb(&r,&g,&b);
c=r;
c*=256;
c+=g;
c*=256;
c+=b;
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("<tr>");
@@ -576,9 +562,9 @@ void printDialog::printCurves()
str.append(doTC(tr("pt %1").arg(i+1), "", true));
str.append("</tr>");
for(i=0; i<numcurves; i++) {
pen.setColor(*qplot_color[i]);
pen.setColor(colors[i]);
painter.setPen(pen);
qplot_color[i]->getRgb(&r,&g,&b);
colors[i].getRgb(&r,&g,&b);
c=r;
c*=256;
c+=g;
@@ -697,7 +683,7 @@ void printDialog::printFSwitches()
{
int sc=0;
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(doTC(tr("Switch"), "", 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=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("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>");
#if 0
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";
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->left->setStyleSheet(QString("background:url(:/images/9xdl%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_2->value(),
0,
-ui->dialP_3->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
#undef INIT_IMPORT
#ifdef FRSKY
@@ -49,7 +53,7 @@ if (inputs.rotenc) PIOB->PIO_PDSR &= ~0x40; else PIOB->PIO_PDSR |= 0x40;
#undef GETVALUES_IMPORT
memset(outputs.chans, 0, sizeof(outputs.chans));
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)
outputs.vsw[i] = getSwitch(SWSRC_SW1+i);
#else
@@ -21,7 +21,7 @@
struct TxInputs {
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 */
bool keys[6]; /* TODO NUM_KEYS */
bool rotenc;
+17 -2
View File
@@ -101,17 +101,32 @@ int main(int argc, char *argv[])
RegisterFirmwares();
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");
eepromFileName = "eeprom-taranis.bin";
dialog = new SimulatorDialogTaranis();
}
else {
eepromFileName = "eeprom-9x.bin";
dialog = new SimulatorDialog9X();
}
dialog->show();
dialog->start("eeprom.bin");
dialog->start(eepromFileName);
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