Merge branch 'next' of https://github.com/opentx/opentx into kilrah/Switch_and_pot_warnings
Conflicts: companion/src/eeprominterface.h companion/src/firmwares/opentx/opentxeeprom.cpp radio/src/opentx.cpp radio/src/translations/es.h.txt radio/src/translations/fr.h.txt
@@ -19,3 +19,4 @@ Grootwitbaas - 9xforums.com (mac)
|
||||
Adrian Amberg (splash screens)
|
||||
Wallaguest1 - 9xforums.com (splash screens)
|
||||
HC1969 - 9xforums.com (splash screens)
|
||||
|
||||
|
||||
@@ -96,7 +96,6 @@ Michael Collins
|
||||
Michael Manning
|
||||
Craig Lorentz
|
||||
Jonathan Modellismo - jonathan.it
|
||||
Aviomotive - www.aviomotive.com
|
||||
André Lasseret
|
||||
Felipe Alexandre de Oliveira
|
||||
Brian Harris
|
||||
@@ -312,3 +311,10 @@ Dietmar Drees
|
||||
Bradley Murchie
|
||||
Richard Fahie
|
||||
James Kaufman
|
||||
Henry Deucker
|
||||
Christian Fuchs
|
||||
Arold Reinders
|
||||
Robert Miller
|
||||
Aviomotive - www.aviomotive.com
|
||||
Mark Gaskievicz
|
||||
Roland Müller
|
||||
|
||||
@@ -156,6 +156,8 @@ SET( companion_SRCS
|
||||
mountlist.cpp
|
||||
avroutputdialog.cpp
|
||||
preferencesdialog.cpp
|
||||
apppreferencesdialog.cpp
|
||||
fwpreferencesdialog.cpp
|
||||
burnconfigdialog.cpp
|
||||
comparedialog.cpp
|
||||
contributorsdialog.cpp
|
||||
@@ -177,6 +179,8 @@ SET( companion_SRCS
|
||||
SET( companion_MOC_HDRS
|
||||
avroutputdialog.h
|
||||
preferencesdialog.h
|
||||
apppreferencesdialog.h
|
||||
fwpreferencesdialog.h
|
||||
burnconfigdialog.h
|
||||
comparedialog.h
|
||||
printdialog.h
|
||||
@@ -211,6 +215,8 @@ SET( companion_UIS
|
||||
fusesdialog.ui
|
||||
logsdialog.ui
|
||||
preferencesdialog.ui
|
||||
apppreferencesdialog.ui
|
||||
fwpreferencesdialog.ui
|
||||
simulatordialog.ui
|
||||
xsimulatordialog.ui
|
||||
burnconfigdialog.ui
|
||||
|
||||
@@ -0,0 +1,224 @@
|
||||
#include "apppreferencesdialog.h"
|
||||
#include "ui_apppreferencesdialog.h"
|
||||
#include "mainwindow.h"
|
||||
#include "helpers.h"
|
||||
#ifdef JOYSTICKS
|
||||
#include "joystick.h"
|
||||
#include "joystickdialog.h"
|
||||
#endif
|
||||
#include <QDesktopServices>
|
||||
#include <QtGui>
|
||||
|
||||
appPreferencesDialog::appPreferencesDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::appPreferencesDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowIcon(CompanionIcon("preferences.png"));
|
||||
initSettings();
|
||||
connect(this, SIGNAL(accepted()), this, SLOT(writeValues()));
|
||||
#ifndef JOYSTICKS
|
||||
ui->joystickCB->hide();
|
||||
ui->joystickCB->setDisabled(true);
|
||||
ui->joystickcalButton->hide();
|
||||
ui->joystickChkB->hide();
|
||||
ui->label_11->hide();
|
||||
#endif
|
||||
resize(0,0);
|
||||
}
|
||||
|
||||
appPreferencesDialog::~appPreferencesDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void appPreferencesDialog::writeValues()
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("startup_check_companion", ui->startupCheck_companion9x->isChecked());
|
||||
settings.setValue("startup_check_fw", ui->startupCheck_fw->isChecked());
|
||||
settings.setValue("wizardEnable", ui->wizardEnable_ChkB->isChecked());
|
||||
settings.setValue("show_splash", ui->showSplash->isChecked());
|
||||
settings.setValue("simuSW", ui->simuSW->isChecked());
|
||||
settings.setValue("history_size", ui->historySize->value());
|
||||
settings.setValue("backLight", ui->backLightColor->currentIndex());
|
||||
settings.setValue("libraryPath", ui->libraryPath->text());
|
||||
settings.setValue("gePath", ui->ge_lineedit->text());
|
||||
settings.setValue("embedded_splashes", ui->splashincludeCB->currentIndex());
|
||||
settings.setValue("backupEnable", ui->backupEnable->isChecked());
|
||||
|
||||
if (ui->joystickChkB ->isChecked() && ui->joystickCB->isEnabled()) {
|
||||
settings.setValue("js_support", ui->joystickChkB ->isChecked());
|
||||
settings.setValue("js_ctrl", ui->joystickCB ->currentIndex());
|
||||
}
|
||||
else {
|
||||
settings.remove("js_support");
|
||||
settings.remove("js_ctrl");
|
||||
}
|
||||
|
||||
MainWindow * mw = (MainWindow *)this->parent();
|
||||
mw->unloadProfile();
|
||||
}
|
||||
|
||||
void appPreferencesDialog::on_snapshotPathButton_clicked()
|
||||
{
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your snapshot folder"), settings.value("snapshotPath").toString());
|
||||
if (!fileName.isEmpty()) {
|
||||
settings.setValue("snapshotpath", fileName);
|
||||
settings.setValue("snapshot_to_clipboard", false);
|
||||
ui->snapshotPath->setText(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
void appPreferencesDialog::initSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
ui->snapshotClipboardCKB->setChecked(settings.value("snapshot_to_clipboard", false).toBool());
|
||||
|
||||
QString Path=settings.value("snapshotPath", "").toString();
|
||||
if (QDir(Path).exists()) {
|
||||
ui->snapshotPath->setText(Path);
|
||||
ui->snapshotPath->setReadOnly(true);
|
||||
}
|
||||
if (ui->snapshotClipboardCKB->isChecked()) {
|
||||
ui->snapshotPath->setDisabled(true);
|
||||
ui->snapshotPathButton->setDisabled(true);
|
||||
}
|
||||
ui->startupCheck_companion9x->setChecked(settings.value("startup_check_companion", true).toBool());
|
||||
ui->startupCheck_fw->setChecked(settings.value("startup_check_fw", true).toBool());
|
||||
ui->wizardEnable_ChkB->setChecked(settings.value("wizardEnable", true).toBool());
|
||||
ui->showSplash->setChecked(settings.value("show_splash", true).toBool());
|
||||
ui->historySize->setValue(settings.value("history_size", 10).toInt());
|
||||
ui->backLightColor->setCurrentIndex(settings.value("backLight", 0).toInt());
|
||||
ui->simuSW->setChecked(settings.value("simuSW", false).toBool());
|
||||
|
||||
Path=settings.value("libraryPath", "").toString();
|
||||
if (QDir(Path).exists()) {
|
||||
ui->libraryPath->setText(Path);
|
||||
}
|
||||
Path=settings.value("gePath", "").toString();
|
||||
if (QFile(Path).exists()) {
|
||||
ui->ge_lineedit->setText(Path);
|
||||
}
|
||||
Path=settings.value("backupPath", "").toString();
|
||||
if (!Path.isEmpty()) {
|
||||
if (QDir(Path).exists()) {
|
||||
ui->backupPath->setText(Path);
|
||||
ui->backupEnable->setEnabled(true);
|
||||
ui->backupEnable->setChecked(settings.value("backupEnable", true).toBool());
|
||||
} else {
|
||||
ui->backupEnable->setDisabled(true);
|
||||
}
|
||||
} else {
|
||||
ui->backupEnable->setDisabled(true);
|
||||
}
|
||||
ui->splashincludeCB->setCurrentIndex(settings.value("embedded_splashes", 0).toInt());
|
||||
|
||||
#ifdef JOYSTICKS
|
||||
ui->joystickChkB->setChecked(settings.value("js_support", false).toBool());
|
||||
if (ui->joystickChkB->isChecked()) {
|
||||
QStringList joystickNames;
|
||||
joystickNames << tr("No joysticks found");
|
||||
joystick = new Joystick(0,false,0,0);
|
||||
ui->joystickcalButton->setDisabled(true);
|
||||
ui->joystickCB->setDisabled(true);
|
||||
|
||||
if ( joystick ) {
|
||||
if ( joystick->joystickNames.count() > 0 ) {
|
||||
joystickNames = joystick->joystickNames;
|
||||
ui->joystickCB->setEnabled(true);
|
||||
ui->joystickcalButton->setEnabled(true);
|
||||
}
|
||||
joystick->close();
|
||||
}
|
||||
ui->joystickCB->clear();
|
||||
ui->joystickCB->insertItems(0, joystickNames);
|
||||
ui->joystickCB->setCurrentIndex(settings.value("js_ctrl", 0).toInt());
|
||||
}
|
||||
else {
|
||||
ui->joystickCB->clear();
|
||||
ui->joystickCB->setDisabled(true);
|
||||
ui->joystickcalButton->setDisabled(true);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void appPreferencesDialog::on_libraryPathButton_clicked()
|
||||
{
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your library folder"), settings.value("libraryPath").toString());
|
||||
if (!fileName.isEmpty()) {
|
||||
settings.setValue("libraryPath", fileName);
|
||||
ui->libraryPath->setText(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
void appPreferencesDialog::on_snapshotClipboardCKB_clicked()
|
||||
{
|
||||
QSettings settings;
|
||||
if (ui->snapshotClipboardCKB->isChecked()) {
|
||||
ui->snapshotPath->setDisabled(true);
|
||||
ui->snapshotPathButton->setDisabled(true);
|
||||
settings.setValue("snapshot_to_clipboard", true);
|
||||
} else {
|
||||
ui->snapshotPath->setEnabled(true);
|
||||
ui->snapshotPath->setReadOnly(true);
|
||||
ui->snapshotPathButton->setEnabled(true);
|
||||
settings.setValue("snapshot_to_clipboard", false);
|
||||
}
|
||||
}
|
||||
|
||||
void appPreferencesDialog::on_backupPathButton_clicked()
|
||||
{
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your Models and Settings backup folder"), settings.value("backupPath").toString());
|
||||
if (!fileName.isEmpty()) {
|
||||
settings.setValue("backupPath", fileName);
|
||||
ui->backupPath->setText(fileName);
|
||||
}
|
||||
ui->backupEnable->setEnabled(true);
|
||||
}
|
||||
|
||||
void appPreferencesDialog::on_ge_pathButton_clicked()
|
||||
{
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Select Google Earth executable"),ui->ge_lineedit->text());
|
||||
if (!fileName.isEmpty()) {
|
||||
ui->ge_lineedit->setText(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef JOYSTICKS
|
||||
void appPreferencesDialog::on_joystickChkB_clicked() {
|
||||
if (ui->joystickChkB->isChecked()) {
|
||||
QStringList joystickNames;
|
||||
joystickNames << tr("No joysticks found");
|
||||
joystick = new Joystick(0,false,0,0);
|
||||
ui->joystickcalButton->setDisabled(true);
|
||||
ui->joystickCB->setDisabled(true);
|
||||
|
||||
if ( joystick ) {
|
||||
if ( joystick->joystickNames.count() > 0 ) {
|
||||
joystickNames = joystick->joystickNames;
|
||||
ui->joystickCB->setEnabled(true);
|
||||
ui->joystickcalButton->setEnabled(true);
|
||||
}
|
||||
joystick->close();
|
||||
}
|
||||
ui->joystickCB->clear();
|
||||
ui->joystickCB->insertItems(0, joystickNames);
|
||||
}
|
||||
else {
|
||||
ui->joystickCB->clear();
|
||||
ui->joystickCB->setDisabled(true);
|
||||
ui->joystickcalButton->setDisabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void appPreferencesDialog::on_joystickcalButton_clicked() {
|
||||
joystickDialog * jd=new joystickDialog(this, ui->joystickCB->currentIndex());
|
||||
jd->exec();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
#ifndef APPPREFERENCESDIALOG_H
|
||||
#define APPPREFERENCESDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QCheckBox>
|
||||
#include "eeprominterface.h"
|
||||
|
||||
namespace Ui {
|
||||
class appPreferencesDialog;
|
||||
}
|
||||
|
||||
class Joystick;
|
||||
|
||||
class appPreferencesDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit appPreferencesDialog(QWidget *parent = 0);
|
||||
~appPreferencesDialog();
|
||||
Joystick *joystick;
|
||||
|
||||
private:
|
||||
Ui::appPreferencesDialog *ui;
|
||||
void initSettings();
|
||||
|
||||
private slots:
|
||||
void writeValues();
|
||||
void on_libraryPathButton_clicked();
|
||||
void on_snapshotPathButton_clicked();
|
||||
void on_snapshotClipboardCKB_clicked();
|
||||
void on_backupPathButton_clicked();
|
||||
void on_ge_pathButton_clicked();
|
||||
#ifdef JOYSTICKS
|
||||
void on_joystickChkB_clicked();
|
||||
void on_joystickcalButton_clicked();
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // APPPREFERENCESDIALOG_H
|
||||
@@ -0,0 +1,505 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>appPreferencesDialog</class>
|
||||
<widget class="QDialog" name="appPreferencesDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>685</width>
|
||||
<height>456</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>685</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Application Preferences</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="verticalSpacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="20" column="8">
|
||||
<widget class="QPushButton" name="libraryPathButton">
|
||||
<property name="text">
|
||||
<string>Open Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="22" column="1" colspan="8">
|
||||
<widget class="Line" name="line_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="8">
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Joystick</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
<string>Simulator capture folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="1" colspan="7">
|
||||
<widget class="QCheckBox" name="simuSW">
|
||||
<property name="text">
|
||||
<string>Remember simulator switch values</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="20" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>User Splash Screens</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Files to keep</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1" colspan="7">
|
||||
<widget class="QCheckBox" name="wizardEnable_ChkB">
|
||||
<property name="text">
|
||||
<string>Offer to use wizard for new models</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="18" column="1" colspan="8">
|
||||
<widget class="Line" name="line_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="1">
|
||||
<widget class="QComboBox" name="backLightColor">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Blue</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Green</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Red</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Orange</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Yellow</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1" colspan="7">
|
||||
<widget class="QCheckBox" name="startupCheck_companion9x">
|
||||
<property name="text">
|
||||
<string>Automatic check for Companion updates</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1" colspan="8">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1" colspan="7">
|
||||
<widget class="QLineEdit" name="snapshotPath">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="1" colspan="7">
|
||||
<widget class="QCheckBox" name="snapshotClipboardCKB">
|
||||
<property name="text">
|
||||
<string>Only capture to clipboard</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="historySize">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>40</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>15</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1" colspan="8">
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="8">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="7">
|
||||
<widget class="QLineEdit" name="ge_lineedit">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="8">
|
||||
<widget class="QPushButton" name="joystickcalButton">
|
||||
<property name="text">
|
||||
<string>Calibrate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Automatic Backup Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="23" column="7" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="8">
|
||||
<widget class="QPushButton" name="snapshotPathButton">
|
||||
<property name="text">
|
||||
<string>Open Folder</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1" colspan="7">
|
||||
<widget class="QLineEdit" name="backupPath">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="1">
|
||||
<widget class="QComboBox" name="joystickCB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Simulator BackLight</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1" colspan="7">
|
||||
<widget class="QCheckBox" name="backupEnable">
|
||||
<property name="text">
|
||||
<string>Enable automatic backup before writing firmware</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="7">
|
||||
<widget class="QCheckBox" name="showSplash">
|
||||
<property name="text">
|
||||
<string>Show splash screen when Companion starts</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="8">
|
||||
<widget class="QPushButton" name="ge_pathButton">
|
||||
<property name="text">
|
||||
<string>Find Executable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="8">
|
||||
<widget class="QPushButton" name="backupPathButton">
|
||||
<property name="text">
|
||||
<string>Open Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="4" colspan="4">
|
||||
<widget class="QCheckBox" name="joystickChkB">
|
||||
<property name="text">
|
||||
<string>Enable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="ge_label">
|
||||
<property name="text">
|
||||
<string>Google Earth Executable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="7">
|
||||
<widget class="QCheckBox" name="startupCheck_fw">
|
||||
<property name="text">
|
||||
<string>Automatic check for OpenTX firmware updates</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="19" column="1">
|
||||
<widget class="QComboBox" name="splashincludeCB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Include companion splashes</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Only user defined splashes</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="19" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Splash Screen Library</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="20" column="1" colspan="7">
|
||||
<widget class="QLineEdit" name="libraryPath">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>startupCheck_companion9x</zorder>
|
||||
<zorder>backupEnable</zorder>
|
||||
<zorder>line</zorder>
|
||||
<zorder>backupPath</zorder>
|
||||
<zorder>line_2</zorder>
|
||||
<zorder>startupCheck_fw</zorder>
|
||||
<zorder>wizardEnable_ChkB</zorder>
|
||||
<zorder>ge_label</zorder>
|
||||
<zorder>label_5</zorder>
|
||||
<zorder>showSplash</zorder>
|
||||
<zorder>line_3</zorder>
|
||||
<zorder>ge_pathButton</zorder>
|
||||
<zorder>line_4</zorder>
|
||||
<zorder>backupPathButton</zorder>
|
||||
<zorder>label_3</zorder>
|
||||
<zorder>backLightColor</zorder>
|
||||
<zorder>snapshotPath</zorder>
|
||||
<zorder>snapshotPathButton</zorder>
|
||||
<zorder>snapshotClipboardCKB</zorder>
|
||||
<zorder>label_11</zorder>
|
||||
<zorder>joystickCB</zorder>
|
||||
<zorder>joystickcalButton</zorder>
|
||||
<zorder>ge_lineedit</zorder>
|
||||
<zorder>simuSW</zorder>
|
||||
<zorder>buttonBox</zorder>
|
||||
<zorder>line_5</zorder>
|
||||
<zorder>joystickChkB</zorder>
|
||||
<zorder>label_17</zorder>
|
||||
<zorder>label_19</zorder>
|
||||
<zorder>historySize</zorder>
|
||||
<zorder>label_9</zorder>
|
||||
<zorder>libraryPath</zorder>
|
||||
<zorder>libraryPathButton</zorder>
|
||||
<zorder>line_6</zorder>
|
||||
<zorder>splashincludeCB</zorder>
|
||||
<zorder>label_10</zorder>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
<tabstop>ge_lineedit</tabstop>
|
||||
<tabstop>ge_pathButton</tabstop>
|
||||
<tabstop>historySize</tabstop>
|
||||
<tabstop>showSplash</tabstop>
|
||||
<tabstop>startupCheck_fw</tabstop>
|
||||
<tabstop>startupCheck_companion9x</tabstop>
|
||||
<tabstop>wizardEnable_ChkB</tabstop>
|
||||
<tabstop>backupPath</tabstop>
|
||||
<tabstop>backupPathButton</tabstop>
|
||||
<tabstop>backupEnable</tabstop>
|
||||
<tabstop>snapshotPath</tabstop>
|
||||
<tabstop>snapshotPathButton</tabstop>
|
||||
<tabstop>snapshotClipboardCKB</tabstop>
|
||||
<tabstop>simuSW</tabstop>
|
||||
<tabstop>backLightColor</tabstop>
|
||||
<tabstop>joystickCB</tabstop>
|
||||
<tabstop>joystickChkB</tabstop>
|
||||
<tabstop>joystickcalButton</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="companion.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>appPreferencesDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>376</x>
|
||||
<y>596</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>appPreferencesDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>396</x>
|
||||
<y>596</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -325,7 +325,8 @@
|
||||
<file>themes/monochrome/16/print.png</file>
|
||||
<file>themes/monochrome/16/compare.png</file>
|
||||
<file>themes/monochrome/16/saveas.png</file>
|
||||
<file>themes/monochrome/16/preferences.png</file>
|
||||
<file>themes/monochrome/16/apppreferences.png</file>
|
||||
<file>themes/monochrome/16/fwpreferences.png</file>
|
||||
<file>themes/monochrome/16/movedown.png</file>
|
||||
<file>themes/monochrome/16/currentmodel.png</file>
|
||||
<file>themes/monochrome/16/read_flash.png</file>
|
||||
@@ -367,7 +368,8 @@
|
||||
<file>themes/monochrome/24/print.png</file>
|
||||
<file>themes/monochrome/24/compare.png</file>
|
||||
<file>themes/monochrome/24/saveas.png</file>
|
||||
<file>themes/monochrome/24/preferences.png</file>
|
||||
<file>themes/monochrome/24/apppreferences.png</file>
|
||||
<file>themes/monochrome/24/fwpreferences.png</file>
|
||||
<file>themes/monochrome/24/movedown.png</file>
|
||||
<file>themes/monochrome/24/currentmodel.png</file>
|
||||
<file>themes/monochrome/24/read_flash.png</file>
|
||||
@@ -409,7 +411,8 @@
|
||||
<file>themes/monochrome/32/print.png</file>
|
||||
<file>themes/monochrome/32/compare.png</file>
|
||||
<file>themes/monochrome/32/saveas.png</file>
|
||||
<file>themes/monochrome/32/preferences.png</file>
|
||||
<file>themes/monochrome/32/apppreferences.png</file>
|
||||
<file>themes/monochrome/32/fwpreferences.png</file>
|
||||
<file>themes/monochrome/32/movedown.png</file>
|
||||
<file>themes/monochrome/32/currentmodel.png</file>
|
||||
<file>themes/monochrome/32/read_flash.png</file>
|
||||
@@ -451,7 +454,8 @@
|
||||
<file>themes/monochrome/48/print.png</file>
|
||||
<file>themes/monochrome/48/compare.png</file>
|
||||
<file>themes/monochrome/48/saveas.png</file>
|
||||
<file>themes/monochrome/48/preferences.png</file>
|
||||
<file>themes/monochrome/48/apppreferences.png</file>
|
||||
<file>themes/monochrome/48/fwpreferences.png</file>
|
||||
<file>themes/monochrome/48/movedown.png</file>
|
||||
<file>themes/monochrome/48/currentmodel.png</file>
|
||||
<file>themes/monochrome/48/read_flash.png</file>
|
||||
@@ -493,7 +497,8 @@
|
||||
<file>themes/classic/16/print.png</file>
|
||||
<file>themes/classic/16/compare.png</file>
|
||||
<file>themes/classic/16/saveas.png</file>
|
||||
<file>themes/classic/16/preferences.png</file>
|
||||
<file>themes/classic/16/apppreferences.png</file>
|
||||
<file>themes/classic/16/fwpreferences.png</file>
|
||||
<file>themes/classic/16/movedown.png</file>
|
||||
<file>themes/classic/16/currentmodel.png</file>
|
||||
<file>themes/classic/16/read_flash.png</file>
|
||||
@@ -535,7 +540,8 @@
|
||||
<file>themes/classic/24/print.png</file>
|
||||
<file>themes/classic/24/compare.png</file>
|
||||
<file>themes/classic/24/saveas.png</file>
|
||||
<file>themes/classic/24/preferences.png</file>
|
||||
<file>themes/classic/24/apppreferences.png</file>
|
||||
<file>themes/classic/24/fwpreferences.png</file>
|
||||
<file>themes/classic/24/movedown.png</file>
|
||||
<file>themes/classic/24/currentmodel.png</file>
|
||||
<file>themes/classic/24/read_flash.png</file>
|
||||
@@ -577,7 +583,8 @@
|
||||
<file>themes/classic/32/print.png</file>
|
||||
<file>themes/classic/32/compare.png</file>
|
||||
<file>themes/classic/32/saveas.png</file>
|
||||
<file>themes/classic/32/preferences.png</file>
|
||||
<file>themes/classic/32/apppreferences.png</file>
|
||||
<file>themes/classic/32/fwpreferences.png</file>
|
||||
<file>themes/classic/32/movedown.png</file>
|
||||
<file>themes/classic/32/currentmodel.png</file>
|
||||
<file>themes/classic/32/read_flash.png</file>
|
||||
@@ -619,7 +626,8 @@
|
||||
<file>themes/classic/48/print.png</file>
|
||||
<file>themes/classic/48/compare.png</file>
|
||||
<file>themes/classic/48/saveas.png</file>
|
||||
<file>themes/classic/48/preferences.png</file>
|
||||
<file>themes/classic/48/apppreferences.png</file>
|
||||
<file>themes/classic/48/fwpreferences.png</file>
|
||||
<file>themes/classic/48/movedown.png</file>
|
||||
<file>themes/classic/48/currentmodel.png</file>
|
||||
<file>themes/classic/48/read_flash.png</file>
|
||||
@@ -661,7 +669,8 @@
|
||||
<file>themes/monoblue/16/print.png</file>
|
||||
<file>themes/monoblue/16/compare.png</file>
|
||||
<file>themes/monoblue/16/saveas.png</file>
|
||||
<file>themes/monoblue/16/preferences.png</file>
|
||||
<file>themes/monoblue/16/apppreferences.png</file>
|
||||
<file>themes/monoblue/16/fwpreferences.png</file>
|
||||
<file>themes/monoblue/16/movedown.png</file>
|
||||
<file>themes/monoblue/16/currentmodel.png</file>
|
||||
<file>themes/monoblue/16/read_flash.png</file>
|
||||
@@ -703,7 +712,8 @@
|
||||
<file>themes/monoblue/24/print.png</file>
|
||||
<file>themes/monoblue/24/compare.png</file>
|
||||
<file>themes/monoblue/24/saveas.png</file>
|
||||
<file>themes/monoblue/24/preferences.png</file>
|
||||
<file>themes/monoblue/24/apppreferences.png</file>
|
||||
<file>themes/monoblue/24/fwpreferences.png</file>
|
||||
<file>themes/monoblue/24/movedown.png</file>
|
||||
<file>themes/monoblue/24/currentmodel.png</file>
|
||||
<file>themes/monoblue/24/read_flash.png</file>
|
||||
@@ -745,7 +755,8 @@
|
||||
<file>themes/monoblue/32/print.png</file>
|
||||
<file>themes/monoblue/32/compare.png</file>
|
||||
<file>themes/monoblue/32/saveas.png</file>
|
||||
<file>themes/monoblue/32/preferences.png</file>
|
||||
<file>themes/monoblue/32/apppreferences.png</file>
|
||||
<file>themes/monoblue/32/fwpreferences.png</file>
|
||||
<file>themes/monoblue/32/movedown.png</file>
|
||||
<file>themes/monoblue/32/currentmodel.png</file>
|
||||
<file>themes/monoblue/32/read_flash.png</file>
|
||||
@@ -787,7 +798,8 @@
|
||||
<file>themes/monoblue/48/print.png</file>
|
||||
<file>themes/monoblue/48/compare.png</file>
|
||||
<file>themes/monoblue/48/saveas.png</file>
|
||||
<file>themes/monoblue/48/preferences.png</file>
|
||||
<file>themes/monoblue/48/apppreferences.png</file>
|
||||
<file>themes/monoblue/48/fwpreferences.png</file>
|
||||
<file>themes/monoblue/48/movedown.png</file>
|
||||
<file>themes/monoblue/48/currentmodel.png</file>
|
||||
<file>themes/monoblue/48/read_flash.png</file>
|
||||
@@ -829,7 +841,8 @@
|
||||
<file>themes/monowhite/16/print.png</file>
|
||||
<file>themes/monowhite/16/compare.png</file>
|
||||
<file>themes/monowhite/16/saveas.png</file>
|
||||
<file>themes/monowhite/16/preferences.png</file>
|
||||
<file>themes/monowhite/16/apppreferences.png</file>
|
||||
<file>themes/monowhite/16/fwpreferences.png</file>
|
||||
<file>themes/monowhite/16/movedown.png</file>
|
||||
<file>themes/monowhite/16/currentmodel.png</file>
|
||||
<file>themes/monowhite/16/read_flash.png</file>
|
||||
@@ -871,7 +884,8 @@
|
||||
<file>themes/monowhite/24/print.png</file>
|
||||
<file>themes/monowhite/24/compare.png</file>
|
||||
<file>themes/monowhite/24/saveas.png</file>
|
||||
<file>themes/monowhite/24/preferences.png</file>
|
||||
<file>themes/monowhite/24/apppreferences.png</file>
|
||||
<file>themes/monowhite/24/fwpreferences.png</file>
|
||||
<file>themes/monowhite/24/movedown.png</file>
|
||||
<file>themes/monowhite/24/currentmodel.png</file>
|
||||
<file>themes/monowhite/24/read_flash.png</file>
|
||||
@@ -913,7 +927,8 @@
|
||||
<file>themes/monowhite/32/print.png</file>
|
||||
<file>themes/monowhite/32/compare.png</file>
|
||||
<file>themes/monowhite/32/saveas.png</file>
|
||||
<file>themes/monowhite/32/preferences.png</file>
|
||||
<file>themes/monowhite/32/apppreferences.png</file>
|
||||
<file>themes/monowhite/32/fwpreferences.png</file>
|
||||
<file>themes/monowhite/32/movedown.png</file>
|
||||
<file>themes/monowhite/32/currentmodel.png</file>
|
||||
<file>themes/monowhite/32/read_flash.png</file>
|
||||
@@ -955,7 +970,8 @@
|
||||
<file>themes/monowhite/48/print.png</file>
|
||||
<file>themes/monowhite/48/compare.png</file>
|
||||
<file>themes/monowhite/48/saveas.png</file>
|
||||
<file>themes/monowhite/48/preferences.png</file>
|
||||
<file>themes/monowhite/48/apppreferences.png</file>
|
||||
<file>themes/monowhite/48/fwpreferences.png</file>
|
||||
<file>themes/monowhite/48/movedown.png</file>
|
||||
<file>themes/monowhite/48/currentmodel.png</file>
|
||||
<file>themes/monowhite/48/read_flash.png</file>
|
||||
|
||||
@@ -83,7 +83,6 @@ void compareDialog::printDiff()
|
||||
printCurves();
|
||||
printGvars();
|
||||
printSwitches();
|
||||
printSafetySwitches();
|
||||
printFSwitches();
|
||||
printFrSky();
|
||||
te->scrollToAnchor("1");
|
||||
@@ -1040,9 +1039,9 @@ void compareDialog::printSwitches()
|
||||
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
|
||||
str.append("<tr><td><h2>"+tr("Logical Switches")+"</h2></td></tr>");
|
||||
str.append("<tr><td><table border=1 cellspacing=0 cellpadding=1 width=\"100%\">");
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(CustomSwitches); i++) {
|
||||
QString sw1 = getCustomSwitchStr(&g_model1->customSw[i], *g_model1);
|
||||
QString sw2 = getCustomSwitchStr(&g_model2->customSw[i], *g_model2);
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) {
|
||||
QString sw1 = g_model1->customSw[i].toString(*g_model1);
|
||||
QString sw2 = g_model2->customSw[i].toString(*g_model2);
|
||||
if (!(sw1.isEmpty() && sw2.isEmpty())) {
|
||||
str.append("<tr>");
|
||||
color=getColor1(sw1,sw2);
|
||||
@@ -1096,8 +1095,8 @@ void compareDialog::printFSwitches()
|
||||
str.append("<tr>");
|
||||
if (g_model1->funcSw[i].swtch.type) {
|
||||
str.append(doTC(g_model1->funcSw[i].swtch.toString(),color1));
|
||||
str.append(doTC(getFuncName(g_model1->funcSw[i].func),color1));
|
||||
str.append(doTC(FuncParam(g_model1->funcSw[i].func,g_model1->funcSw[i].param,g_model1->funcSw[i].paramarm, g_model1->funcSw[i].adjustMode),color1));
|
||||
str.append(doTC(g_model1->funcSw[i].funcToString(),color1));
|
||||
str.append(doTC(g_model1->funcSw[i].paramToString(),color1));
|
||||
int index=g_model1->funcSw[i].func;
|
||||
if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) {
|
||||
str.append(doTC(QString("%1").arg(g_model1->funcSw[i].repeatParam),color1));
|
||||
@@ -1115,8 +1114,8 @@ void compareDialog::printFSwitches()
|
||||
str.append(doTC(tr("CF")+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(getFuncName(g_model2->funcSw[i].func),color2));
|
||||
str.append(doTC(FuncParam(g_model2->funcSw[i].func,g_model2->funcSw[i].param,g_model2->funcSw[i].paramarm, g_model2->funcSw[i].adjustMode),color2));
|
||||
str.append(doTC(g_model2->funcSw[i].funcToString(),color2));
|
||||
str.append(doTC(g_model2->funcSw[i].paramToString(),color2));
|
||||
int index=g_model2->funcSw[i].func;
|
||||
if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) {
|
||||
str.append(doTC(QString("%1").arg(g_model2->funcSw[i].repeatParam),color2));
|
||||
@@ -1142,55 +1141,6 @@ void compareDialog::printFSwitches()
|
||||
te->append(str);
|
||||
}
|
||||
|
||||
void compareDialog::printSafetySwitches()
|
||||
{
|
||||
QString color1;
|
||||
QString color2;
|
||||
int sc=0;
|
||||
QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-before:always;\" width=\"100%\">";
|
||||
str.append("<tr><td><h2>"+tr("Safety Switches")+"</h2></td></tr>");
|
||||
str.append("<tr><td><table border=1 cellspacing=0 cellpadding=1 width=\"100%\"><tr>");
|
||||
str.append("<td width=\"8%\" align=\"center\"><b>"+tr("Switch")+"</b></td>");
|
||||
str.append("<td width=\"37%\" align=\"center\"><b>"+tr("Value")+"</b></td>");
|
||||
str.append("<td width=\"10%\"> </td>");
|
||||
str.append("<td width=\"8%\" align=\"center\"><b>"+tr("Switch")+"</b></td>");
|
||||
str.append("<td width=\"37%\" align=\"center\"><b>"+tr("Value")+"</b></td>");
|
||||
str.append("</tr>");
|
||||
for(int i=0; i<GetEepromInterface()->getCapability(Outputs); i++)
|
||||
{
|
||||
if ((g_model1->safetySw[i].swtch.type!=SWITCH_TYPE_NONE)||(g_model2->safetySw[i].swtch.type!=SWITCH_TYPE_NONE)) {
|
||||
if ((g_model1->safetySw[i].swtch!=g_model2->safetySw[i].swtch)||(g_model1->safetySw[i].val!=g_model2->safetySw[i].val)) {
|
||||
color1="green";
|
||||
color2="red";
|
||||
} else {
|
||||
color1="grey";
|
||||
color2="grey";
|
||||
}
|
||||
str.append("<tr>");
|
||||
if (g_model1->safetySw[i].swtch.type) {
|
||||
str.append(doTC(g_model1->safetySw[i].swtch.toString(),color1));
|
||||
str.append(doTC(QString::number(g_model1->safetySw[i].val),color1));
|
||||
}
|
||||
else {
|
||||
str.append("<td> </td><td> </td>");
|
||||
}
|
||||
str.append(doTC(tr("CH")+QString("%1").arg(i+1),"",true));
|
||||
if (g_model2->safetySw[i].swtch.type) {
|
||||
str.append(doTC(g_model2->safetySw[i].swtch.toString(),color2));
|
||||
str.append(doTC(QString::number(g_model2->safetySw[i].val),color2));
|
||||
} else {
|
||||
str.append("<td> </td><td> </td>");
|
||||
}
|
||||
str.append("</tr>");
|
||||
sc++;
|
||||
}
|
||||
}
|
||||
str.append("</table></td></tr></table>");
|
||||
str.append("<br>");
|
||||
if (sc!=0)
|
||||
te->append(str);
|
||||
}
|
||||
|
||||
void compareDialog::printFrSky()
|
||||
{
|
||||
QString color;
|
||||
|
||||
@@ -7,14 +7,39 @@
|
||||
#include "splashlibrary.h"
|
||||
#include "flashinterface.h"
|
||||
|
||||
Side::Side(){
|
||||
imageLabel = 0;
|
||||
fileNameEdit = 0;
|
||||
saveButton = 0;
|
||||
source=new Source;
|
||||
*source = UNDEFINED;
|
||||
}
|
||||
|
||||
void Side::copyImage( Side side ){
|
||||
if ((*source!=UNDEFINED) && (*side.source!=UNDEFINED))
|
||||
imageLabel->setPixmap(*side.imageLabel->pixmap());
|
||||
}
|
||||
|
||||
customizeSplashDialog::customizeSplashDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::customizeSplashDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->libraryButton->setIcon(CompanionIcon("library.png"));
|
||||
ui->HowToLabel->clear();
|
||||
ui->HowToLabel->append("<center>" + tr("Select an original firmware file") + "</center>");
|
||||
ui->leftLibraryButton->setIcon(CompanionIcon("library.png"));
|
||||
ui->rightLibraryButton->setIcon(CompanionIcon("library.png"));
|
||||
|
||||
left.imageLabel = ui->leftImageLabel;
|
||||
right.imageLabel = ui->rightImageLabel;
|
||||
left.fileNameEdit = ui->leftFileNameEdit;
|
||||
right.fileNameEdit = ui->rightFileNameEdit;
|
||||
left.saveButton = ui->leftSaveButton;
|
||||
right.saveButton = ui->rightSaveButton;
|
||||
left.libraryButton = ui->leftLibraryButton;
|
||||
right.libraryButton = ui->rightLibraryButton;
|
||||
left.invertButton = ui->leftInvertButton;
|
||||
right.invertButton = ui->rightInvertButton;
|
||||
|
||||
resize(0,0);
|
||||
}
|
||||
|
||||
customizeSplashDialog::~customizeSplashDialog()
|
||||
@@ -22,92 +47,101 @@ customizeSplashDialog::~customizeSplashDialog()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_FlashLoadButton_clicked()
|
||||
void customizeSplashDialog::on_copyRightToLeftButton_clicked() {
|
||||
left.copyImage(right);
|
||||
}
|
||||
void customizeSplashDialog::on_copyLeftToRightButton_clicked() {
|
||||
right.copyImage(left);
|
||||
}
|
||||
|
||||
|
||||
void customizeSplashDialog::on_leftLoadFwButton_clicked() {loadFirmware(left);}
|
||||
void customizeSplashDialog::on_rightLoadFwButton_clicked() {loadFirmware(right);}
|
||||
void customizeSplashDialog::loadFirmware(Side side)
|
||||
{
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), settings.value("lastFlashDir").toString(), FLASH_FILES_FILTER);
|
||||
if (!fileName.isEmpty()) {
|
||||
ui->ImageLoadButton->setDisabled(true);
|
||||
ui->libraryButton->setDisabled(true);
|
||||
ui->SaveFlashButton->setDisabled(true);
|
||||
ui->SaveImageButton->setDisabled(true);
|
||||
ui->ImageFileName->clear();
|
||||
ui->imageLabel->clear();
|
||||
ui->HowToLabel->clear();
|
||||
ui->HowToLabel->setStyleSheet("background:rgb(255, 255, 0)");
|
||||
QFile file(fileName);
|
||||
if (!file.exists()) {
|
||||
ui->FWFileName->clear();
|
||||
ui->HowToLabel->append("<center>" + tr("Select an original firmware file") + "</center>");
|
||||
if (fileName.isEmpty() || !file.exists())
|
||||
return;
|
||||
}
|
||||
if (fileName.isEmpty()) {
|
||||
ui->FWFileName->clear();
|
||||
ui->HowToLabel->append("<center>" + tr("Select an original firmware file") + "</center>");
|
||||
return;
|
||||
}
|
||||
|
||||
ui->FWFileName->setText(fileName);
|
||||
|
||||
FlashInterface flash(fileName);
|
||||
if (flash.hasSplash()) {
|
||||
ui->HowToLabel->append("<center>" + tr("Select an image to customize your splash <br />or save actual firmware splash") + "</center>");
|
||||
ui->ImageLoadButton->setEnabled(true);
|
||||
ui->libraryButton->setEnabled(true);
|
||||
ui->SaveImageButton->setEnabled(true);
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(flash.getSplash()));
|
||||
ui->imageLabel->setFixedSize(flash.getSplashWidth()*2,flash.getSplashHeight()*2);
|
||||
} else {
|
||||
if (!flash.hasSplash()) {
|
||||
QMessageBox::information(this, tr("Error"), tr("Could not find bitmap to replace in file"));
|
||||
return;
|
||||
}
|
||||
|
||||
side.saveButton->setEnabled(true);
|
||||
side.imageLabel->setPixmap(QPixmap::fromImage(flash.getSplash()));
|
||||
side.imageLabel->setFixedSize(flash.getSplashWidth()*2,flash.getSplashHeight()*2);
|
||||
side.fileNameEdit->setText(fileName);
|
||||
settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath());
|
||||
*side.source=FW;
|
||||
side.saveButton->setEnabled(true);
|
||||
side.libraryButton->setEnabled(true);
|
||||
side.invertButton->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_ImageLoadButton_clicked() {
|
||||
void customizeSplashDialog::on_leftLoadPictButton_clicked() {loadPicture(left);}
|
||||
void customizeSplashDialog::on_rightLoadPictButton_clicked() {loadPicture(right);}
|
||||
void customizeSplashDialog::loadPicture(Side side)
|
||||
{
|
||||
QString supportedImageFormats;
|
||||
for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) {
|
||||
supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex];
|
||||
}
|
||||
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
tr("Open Image to load"), settings.value("lastImagesDir").toString(), tr("Images (%1)").arg(supportedImageFormats));
|
||||
|
||||
if (!fileName.isEmpty()) {
|
||||
settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath());
|
||||
QImage image(fileName);
|
||||
if (image.isNull()) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName));
|
||||
return;
|
||||
}
|
||||
ui->HowToLabel->clear();
|
||||
ui->ImageFileName->setText(fileName);
|
||||
if (ui->imageLabel->width()==424) {
|
||||
image=image.convertToFormat(QImage::Format_RGB32);
|
||||
QRgb col;
|
||||
int gray;
|
||||
int width = image.width();
|
||||
int height = image.height();
|
||||
for (int i = 0; i < width; ++i)
|
||||
{
|
||||
for (int j = 0; j < height; ++j)
|
||||
{
|
||||
col = image.pixel(i, j);
|
||||
gray = qGray(col);
|
||||
image.setPixel(i, j, qRgb(gray, gray, gray));
|
||||
}
|
||||
}
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2)));
|
||||
} else {
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2).convertToFormat(QImage::Format_Mono)));
|
||||
}
|
||||
ui->SaveFlashButton->setEnabled(true);
|
||||
ui->HowToLabel->append("<center>" + tr("Save your custimized firmware") + "</center>");
|
||||
if (fileName.isEmpty()){
|
||||
return;
|
||||
}
|
||||
QImage image(fileName);
|
||||
if (image.isNull()) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName));
|
||||
return;
|
||||
}
|
||||
if (side.imageLabel->width()==424) {
|
||||
image=image.convertToFormat(QImage::Format_RGB32);
|
||||
QRgb col;
|
||||
int gray;
|
||||
int width = image.width();
|
||||
int height = image.height();
|
||||
for (int i = 0; i < width; ++i)
|
||||
{
|
||||
for (int j = 0; j < height; ++j)
|
||||
{
|
||||
col = image.pixel(i, j);
|
||||
gray = qGray(col);
|
||||
image.setPixel(i, j, qRgb(gray, gray, gray));
|
||||
}
|
||||
}
|
||||
side.imageLabel->setPixmap(QPixmap::fromImage(image.scaled(side.imageLabel->width()/2, side.imageLabel->height()/2)));
|
||||
} else {
|
||||
side.imageLabel->setPixmap(QPixmap::fromImage(image.scaled(side.imageLabel->width()/2, side.imageLabel->height()/2).convertToFormat(QImage::Format_Mono)));
|
||||
}
|
||||
|
||||
settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath());
|
||||
side.fileNameEdit->setText(fileName);
|
||||
*side.source=PICT;
|
||||
side.saveButton->setEnabled(true);
|
||||
side.libraryButton->setEnabled(true);
|
||||
side.invertButton->setEnabled(true);
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_libraryButton_clicked() {
|
||||
void customizeSplashDialog::on_leftLoadProfileButton_clicked() {loadProfile(left);}
|
||||
void customizeSplashDialog::on_rightLoadProfileButton_clicked() {loadProfile(right);}
|
||||
void customizeSplashDialog::loadProfile(Side side)
|
||||
{
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_leftLibraryButton_clicked(){libraryButton_clicked(left);}
|
||||
void customizeSplashDialog::on_rightLibraryButton_clicked(){libraryButton_clicked(right);}
|
||||
void customizeSplashDialog::libraryButton_clicked( Side side )
|
||||
{
|
||||
QString fileName;
|
||||
|
||||
splashLibrary *ld = new splashLibrary(this,&fileName);
|
||||
@@ -118,9 +152,7 @@ void customizeSplashDialog::on_libraryButton_clicked() {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName));
|
||||
return;
|
||||
}
|
||||
ui->HowToLabel->clear();
|
||||
ui->ImageFileName->setText(fileName);
|
||||
if (ui->imageLabel->width()==424) {
|
||||
if (side.imageLabel->width()==424) {
|
||||
image=image.convertToFormat(QImage::Format_RGB32);
|
||||
QRgb col;
|
||||
int gray;
|
||||
@@ -135,57 +167,52 @@ void customizeSplashDialog::on_libraryButton_clicked() {
|
||||
image.setPixel(i, j, qRgb(gray, gray, gray));
|
||||
}
|
||||
}
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2)));
|
||||
side.imageLabel->setPixmap(QPixmap::fromImage(image.scaled(side.imageLabel->width()/2, side.imageLabel->height()/2)));
|
||||
} else {
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2).convertToFormat(QImage::Format_Mono)));
|
||||
side.imageLabel->setPixmap(QPixmap::fromImage(image.scaled(side.imageLabel->width()/2, side.imageLabel->height()/2).convertToFormat(QImage::Format_Mono)));
|
||||
}
|
||||
ui->SaveFlashButton->setEnabled(true);
|
||||
ui->HowToLabel->append("<center>" + tr("Save your custimized firmware") + "</center>");
|
||||
}
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_SaveFlashButton_clicked()
|
||||
void customizeSplashDialog::on_leftSaveButton_clicked(){saveButton_clicked(left);}
|
||||
void customizeSplashDialog::on_rightSaveButton_clicked(){saveButton_clicked(right);}
|
||||
void customizeSplashDialog::saveButton_clicked(Side side)
|
||||
{
|
||||
QString fileName;
|
||||
QSettings settings;
|
||||
ui->HowToLabel->clear();
|
||||
fileName = QFileDialog::getSaveFileName(this, tr("Write to file"), settings.value("lastFlashDir").toString(), FLASH_FILES_FILTER, 0, QFileDialog::DontConfirmOverwrite);
|
||||
if (fileName.isEmpty()) {
|
||||
return;
|
||||
QString fileName = side.fileNameEdit->text();
|
||||
|
||||
if (*side.source == FW)
|
||||
{
|
||||
FlashInterface flash(fileName);
|
||||
if (!flash.hasSplash()) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not store image in firmware file %1").arg(fileName));
|
||||
return;
|
||||
}
|
||||
QImage image = side.imageLabel->pixmap()->toImage().scaled(flash.getSplashWidth(), flash.getSplashHeight());
|
||||
if (flash.setSplash(image) && (flash.saveFlash(fileName) > 0))
|
||||
settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath());
|
||||
else
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not store image in firmware file %1").arg(fileName));
|
||||
}
|
||||
FlashInterface flash(ui->FWFileName->text());
|
||||
if (!flash.hasSplash()) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Error reading file %1").arg(fileName));
|
||||
return;
|
||||
}
|
||||
settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath());
|
||||
QImage image = ui->imageLabel->pixmap()->toImage().scaled(flash.getSplashWidth(), flash.getSplashHeight());
|
||||
flash.setSplash(image);
|
||||
if (flash.saveFlash(fileName) > 0) {
|
||||
ui->HowToLabel->setStyleSheet("background:rgb(0,255.0);");
|
||||
ui->HowToLabel->append("<center>" + tr("Firmware correctly saved.") + "</center>");
|
||||
} else {
|
||||
ui->HowToLabel->setStyleSheet("background:rgb(255.0.0);");
|
||||
ui->HowToLabel->append("<center>" + tr("Firmware not saved.") + "</center>");
|
||||
else if (*side.source == PICT)
|
||||
{
|
||||
if (!fileName.isEmpty()) {
|
||||
QImage image = side.imageLabel->pixmap()->toImage().scaled(side.imageLabel->width()/2, side.imageLabel->height()/2).convertToFormat(QImage::Format_Indexed8);
|
||||
if (image.save(fileName))
|
||||
settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath());
|
||||
else
|
||||
QMessageBox::critical(this, tr("Error"), tr("The image file %1 could not be stored").arg(fileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_InvertColorButton_clicked()
|
||||
void customizeSplashDialog::on_leftInvertButton_clicked(){invertButton_clicked(left);}
|
||||
void customizeSplashDialog::on_rightInvertButton_clicked(){invertButton_clicked(right);}
|
||||
void customizeSplashDialog::invertButton_clicked(Side side)
|
||||
{
|
||||
QImage image = ui->imageLabel->pixmap()->toImage();
|
||||
QImage image = side.imageLabel->pixmap()->toImage();
|
||||
image.invertPixels();
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image));
|
||||
side.imageLabel->setPixmap(QPixmap::fromImage(image));
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_SaveImageButton_clicked()
|
||||
{
|
||||
QString fileName;
|
||||
QSettings settings;
|
||||
|
||||
fileName = QFileDialog::getSaveFileName(this, tr("Write to file"), settings.value("lastImagesDir").toString(), tr("PNG images (*.png);;"), 0, QFileDialog::DontConfirmOverwrite);
|
||||
if (!fileName.isEmpty()) {
|
||||
settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath());
|
||||
QImage image = ui->imageLabel->pixmap()->toImage().scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2).convertToFormat(QImage::Format_Indexed8);
|
||||
image.save(fileName, "PNG");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,24 +10,61 @@ namespace Ui
|
||||
class customizeSplashDialog;
|
||||
}
|
||||
|
||||
enum Source {FW, PICT, PROFILE, UNDEFINED};
|
||||
|
||||
class Side
|
||||
{
|
||||
public:
|
||||
Side();
|
||||
void copyImage( Side );
|
||||
|
||||
QLabel *imageLabel;
|
||||
QLineEdit *fileNameEdit;
|
||||
QPushButton *saveButton;
|
||||
QPushButton *invertButton;
|
||||
QToolButton *libraryButton;
|
||||
|
||||
Source *source;
|
||||
};
|
||||
|
||||
class customizeSplashDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Side left;
|
||||
Side right;
|
||||
|
||||
public:
|
||||
explicit customizeSplashDialog(QWidget *parent = 0);
|
||||
~customizeSplashDialog();
|
||||
|
||||
private slots:
|
||||
void on_FlashLoadButton_clicked();
|
||||
void on_ImageLoadButton_clicked();
|
||||
void on_libraryButton_clicked();
|
||||
void on_SaveFlashButton_clicked();
|
||||
void on_InvertColorButton_clicked();
|
||||
void on_SaveImageButton_clicked();
|
||||
void on_leftLoadFwButton_clicked();
|
||||
void on_leftLoadPictButton_clicked();
|
||||
void on_leftLoadProfileButton_clicked();
|
||||
void on_leftLibraryButton_clicked();
|
||||
void on_leftSaveButton_clicked();
|
||||
void on_leftInvertButton_clicked();
|
||||
|
||||
void on_rightLoadFwButton_clicked();
|
||||
void on_rightLoadPictButton_clicked();
|
||||
void on_rightLoadProfileButton_clicked();
|
||||
void on_rightLibraryButton_clicked();
|
||||
void on_rightSaveButton_clicked();
|
||||
void on_rightInvertButton_clicked();
|
||||
|
||||
void on_copyRightToLeftButton_clicked();
|
||||
void on_copyLeftToRightButton_clicked();
|
||||
|
||||
private:
|
||||
void loadFirmware( Side );
|
||||
void loadPicture( Side );
|
||||
void loadProfile( Side );
|
||||
void libraryButton_clicked( Side );
|
||||
void saveButton_clicked( Side );
|
||||
void invertButton_clicked( Side );
|
||||
|
||||
Ui::customizeSplashDialog *ui;
|
||||
enum sideEnum { LEFT, RIGHT };
|
||||
};
|
||||
|
||||
#endif // CUSTOMIZESPLASHDIALOG_H
|
||||
|
||||
@@ -2,88 +2,508 @@
|
||||
<ui version="4.0">
|
||||
<class>customizeSplashDialog</class>
|
||||
<widget class="QDialog" name="customizeSplashDialog">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>366</width>
|
||||
<height>303</height>
|
||||
<width>1086</width>
|
||||
<height>285</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Customize Splash</string>
|
||||
<string>Transmitter Splash Screen Editor</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="companion.qrc">
|
||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QLabel" name="imageLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>256</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>424</width>
|
||||
<height>128</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="pixmap">
|
||||
<pixmap resource="companion.qrc">:/images/customize.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
<widget class="Line" name="line_13">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="SaveImageButton">
|
||||
<spacer name="horizontalSpacer_11">
|
||||
<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="QLineEdit" name="leftFileNameEdit">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>424</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>426</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_12">
|
||||
<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_11">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<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="QLabel" name="leftImageLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>424</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>424</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save Image</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<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_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QPushButton" name="leftInvertButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Invert</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>
|
||||
<item>
|
||||
<widget class="QToolButton" name="leftLibraryButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Open Splash Library</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QPushButton" name="leftLoadFwButton">
|
||||
<property name="text">
|
||||
<string>Load FW</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="leftLoadPictButton">
|
||||
<property name="text">
|
||||
<string>Load Pict</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="leftLoadProfileButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load Profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<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>
|
||||
<widget class="QPushButton" name="leftSaveButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_9">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QToolButton" name="copyRightToLeftButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="arrowType">
|
||||
<enum>Qt::LeftArrow</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="copyLeftToRightButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="arrowType">
|
||||
<enum>Qt::RightArrow</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<widget class="Line" name="line_14">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<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>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="rightFileNameEdit">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>426</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>424</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_10">
|
||||
<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_12">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<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="QLabel" name="rightImageLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>424</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>424</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<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_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QPushButton" name="rightInvertButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Invert</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -101,164 +521,120 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="InvertColorButton">
|
||||
<widget class="QToolButton" name="rightLibraryButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Open Splash Library</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Invert Color</string>
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QPushButton" name="rightLoadFwButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load FW</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="rightLoadPictButton">
|
||||
<property name="text">
|
||||
<string>Load Pict</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="rightLoadProfileButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load Profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
<item>
|
||||
<widget class="QPushButton" name="rightSaveButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_10">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<widget class="Line" name="line_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTextEdit" name="HowToLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background:rgb(255, 255, 0);</string>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
|
||||
</property>
|
||||
<property name="acceptRichText">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLineEdit" name="FWFileName">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QPushButton" name="FlashLoadButton">
|
||||
<property name="text">
|
||||
<string>Load Firmware</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="ImageFileName">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="ImageLoadButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load Image</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QToolButton" name="libraryButton">
|
||||
<property name="toolTip">
|
||||
<string>Open Splash Library</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>208</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QPushButton" name="SaveFlashButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save Firmware</string>
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>leftFileNameEdit</tabstop>
|
||||
<tabstop>leftInvertButton</tabstop>
|
||||
<tabstop>leftLoadPictButton</tabstop>
|
||||
<tabstop>leftSaveButton</tabstop>
|
||||
<tabstop>copyLeftToRightButton</tabstop>
|
||||
<tabstop>copyRightToLeftButton</tabstop>
|
||||
<tabstop>rightFileNameEdit</tabstop>
|
||||
<tabstop>rightInvertButton</tabstop>
|
||||
<tabstop>rightLoadFwButton</tabstop>
|
||||
<tabstop>rightLoadPictButton</tabstop>
|
||||
<tabstop>rightSaveButton</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="companion.qrc"/>
|
||||
</resources>
|
||||
|
||||
@@ -93,6 +93,17 @@ class DataField {
|
||||
const char *name;
|
||||
};
|
||||
|
||||
class ProxyField: public DataField {
|
||||
public:
|
||||
ProxyField():
|
||||
DataField("Proxy")
|
||||
{
|
||||
}
|
||||
|
||||
virtual DataField * getField() = 0;
|
||||
|
||||
};
|
||||
|
||||
template<int N>
|
||||
class UnsignedField: public DataField {
|
||||
public:
|
||||
@@ -273,9 +284,10 @@ class SpareBitsField: public UnsignedField<N> {
|
||||
template<int N>
|
||||
class CharField: public DataField {
|
||||
public:
|
||||
CharField(char *field):
|
||||
CharField(char *field, bool truncate=true):
|
||||
DataField("Char"),
|
||||
field(field)
|
||||
field(field),
|
||||
truncate(truncate)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -283,7 +295,7 @@ class CharField: public DataField {
|
||||
{
|
||||
output.resize(N*8);
|
||||
int b = 0;
|
||||
int len = strlen(field);
|
||||
int len = truncate ? strlen(field) : N;
|
||||
for (int i=0; i<N; i++) {
|
||||
int idx = (i>=len ? 0 : field[i]);
|
||||
for (int j=0; j<8; j++, b++) {
|
||||
@@ -313,6 +325,7 @@ class CharField: public DataField {
|
||||
|
||||
protected:
|
||||
char * field;
|
||||
bool truncate;
|
||||
};
|
||||
|
||||
int8_t char2idx(char c);
|
||||
|
||||
@@ -268,62 +268,52 @@ QString RawSwitch::toString()
|
||||
QObject::tr("S21"), QObject::tr("S22"), QObject::tr("S23"), QObject::tr("S24"), QObject::tr("S25"), QObject::tr("S26")
|
||||
};
|
||||
|
||||
switch(type) {
|
||||
case SWITCH_TYPE_SWITCH:
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard()))
|
||||
return index > 0 ? CHECK_IN_ARRAY(switchesX9D, index-1) : QString("!") + CHECK_IN_ARRAY(switchesX9D, -index-1);
|
||||
else
|
||||
return index > 0 ? CHECK_IN_ARRAY(switches9X, index-1) : QString("!") + CHECK_IN_ARRAY(switches9X, -index-1);
|
||||
case SWITCH_TYPE_VIRTUAL:
|
||||
return index > 0 ? CHECK_IN_ARRAY(virtualSwitches, index-1) : QString("!") + CHECK_IN_ARRAY(virtualSwitches, -index-1);
|
||||
case SWITCH_TYPE_MULTIPOS_POT:
|
||||
return CHECK_IN_ARRAY(multiposPots, index);
|
||||
case SWITCH_TYPE_ON:
|
||||
return QObject::tr("ON");
|
||||
case SWITCH_TYPE_ONM:
|
||||
if (index==0) {
|
||||
return QObject::tr("ONE");
|
||||
}
|
||||
else if (index==1) {
|
||||
return QObject::tr("!ONE");
|
||||
}
|
||||
break;
|
||||
case SWITCH_TYPE_TRN:
|
||||
if (index==0) {
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard()))
|
||||
return SwitchDn('H')+"s";
|
||||
else
|
||||
return QObject::tr("TRNs");
|
||||
} else if (index==1) {
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard()))
|
||||
return SwitchDn('H')+"l";
|
||||
else
|
||||
return QObject::tr("TRNl");
|
||||
}
|
||||
break;
|
||||
case SWITCH_TYPE_REA:
|
||||
if (index==0) {
|
||||
if (GetEepromInterface()->getBoard() == BOARD_SKY9X)
|
||||
return QObject::tr("REAs");
|
||||
} else if (index==1) {
|
||||
if (GetEepromInterface()->getBoard() == BOARD_SKY9X)
|
||||
return QObject::tr("REAl");
|
||||
}
|
||||
break;
|
||||
case SWITCH_TYPE_OFF:
|
||||
return QObject::tr("OFF");
|
||||
case SWITCH_TYPE_MOMENT_SWITCH:
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard()))
|
||||
return index > 0 ? CHECK_IN_ARRAY(switchesX9D, index-1)+QString("t") : QString("!")+CHECK_IN_ARRAY(switchesX9D, -index-1)+QString("t");
|
||||
else
|
||||
return index > 0 ? CHECK_IN_ARRAY(switches9X, index-1)+QString("t") : QString("!")+CHECK_IN_ARRAY(switches9X, -index-1)+QString("t");
|
||||
case SWITCH_TYPE_MOMENT_VIRTUAL:
|
||||
return index > 0 ? CHECK_IN_ARRAY(virtualSwitches, index-1)+QString("t") : QString("!")+CHECK_IN_ARRAY(virtualSwitches, -index-1)+QString("t");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
static const QString trimsSwitches[] = {
|
||||
QObject::tr("RudTrim Left"), QObject::tr("RudTrim Right"),
|
||||
QObject::tr("EleTrim Down"), QObject::tr("EleTrim Up"),
|
||||
QObject::tr("ThrTrim Down"), QObject::tr("ThrTrim Up"),
|
||||
QObject::tr("AilTrim Left"), QObject::tr("AilTrim Right")
|
||||
};
|
||||
|
||||
return QObject::tr("----");
|
||||
static const QString rotaryEncoders[] = {
|
||||
QObject::tr("REa"), QObject::tr("REb")
|
||||
};
|
||||
|
||||
static const QString timerModes[] = {
|
||||
QObject::tr("OFF"), QObject::tr("ABS"),
|
||||
QObject::tr("THs"), QObject::tr("TH%"), QObject::tr("THt")
|
||||
};
|
||||
|
||||
if (index < 0) {
|
||||
return QString("!") + RawSwitch(type, -index).toString();
|
||||
}
|
||||
else {
|
||||
switch(type) {
|
||||
case SWITCH_TYPE_SWITCH:
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard()))
|
||||
return CHECK_IN_ARRAY(switchesX9D, index-1);
|
||||
else
|
||||
return CHECK_IN_ARRAY(switches9X, index-1);
|
||||
case SWITCH_TYPE_VIRTUAL:
|
||||
return CHECK_IN_ARRAY(virtualSwitches, index-1);
|
||||
case SWITCH_TYPE_MULTIPOS_POT:
|
||||
return CHECK_IN_ARRAY(multiposPots, index-1);
|
||||
case SWITCH_TYPE_TRIM:
|
||||
return CHECK_IN_ARRAY(trimsSwitches, index-1);
|
||||
case SWITCH_TYPE_ROTARY_ENCODER:
|
||||
return CHECK_IN_ARRAY(rotaryEncoders, index-1);
|
||||
case SWITCH_TYPE_ON:
|
||||
return QObject::tr("ON");
|
||||
case SWITCH_TYPE_OFF:
|
||||
return QObject::tr("OFF");
|
||||
case SWITCH_TYPE_NONE:
|
||||
return QObject::tr("----");
|
||||
case SWITCH_TYPE_TIMER_MODE:
|
||||
return CHECK_IN_ARRAY(timerModes, index);
|
||||
default:
|
||||
return QObject::tr("???");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString CurveReference::toString()
|
||||
@@ -345,6 +335,392 @@ QString CurveReference::toString()
|
||||
}
|
||||
}
|
||||
|
||||
CSFunctionFamily LogicalSwitchData::getFunctionFamily()
|
||||
{
|
||||
if (func == LS_FN_STAY)
|
||||
return LS_FAMILY_STAY;
|
||||
else if (func == LS_FN_TIMER)
|
||||
return LS_FAMILY_TIMER;
|
||||
else if (func == LS_FN_STICKY)
|
||||
return LS_FAMILY_STICKY;
|
||||
else if (func < LS_FN_AND || func > LS_FN_ELESS)
|
||||
return LS_FAMILY_VOFS;
|
||||
else if (func < LS_FN_EQUAL)
|
||||
return LS_FAMILY_VBOOL;
|
||||
else
|
||||
return LS_FAMILY_VCOMP;
|
||||
}
|
||||
|
||||
QString LogicalSwitchData::funcToString()
|
||||
{
|
||||
switch (func) {
|
||||
case LS_FN_OFF:
|
||||
return QObject::tr("---");
|
||||
case LS_FN_VPOS:
|
||||
return QObject::tr("a>x");
|
||||
case LS_FN_VNEG:
|
||||
return QObject::tr("a<x");
|
||||
case LS_FN_APOS:
|
||||
return QObject::tr("|a|>x");
|
||||
case LS_FN_ANEG:
|
||||
return QObject::tr("|a|<x");
|
||||
case LS_FN_AND:
|
||||
return QObject::tr("AND");
|
||||
case LS_FN_OR:
|
||||
return QObject::tr("OR");
|
||||
case LS_FN_XOR:
|
||||
return QObject::tr("XOR");
|
||||
case LS_FN_EQUAL:
|
||||
return QObject::tr("a=b");
|
||||
case LS_FN_NEQUAL:
|
||||
return QObject::tr("a!=b");
|
||||
case LS_FN_GREATER:
|
||||
return QObject::tr("a>b");
|
||||
case LS_FN_LESS:
|
||||
return QObject::tr("a<b");
|
||||
case LS_FN_EGREATER:
|
||||
return QObject::tr("a>=b");
|
||||
case LS_FN_ELESS:
|
||||
return QObject::tr("a<=b");
|
||||
case LS_FN_DPOS:
|
||||
return QObject::tr("d>=x");
|
||||
case LS_FN_DAPOS:
|
||||
return QObject::tr("|d|>=x");
|
||||
case LS_FN_VEQUAL:
|
||||
return QObject::tr("a~x");
|
||||
case LS_FN_TIMER:
|
||||
return QObject::tr("Timer");
|
||||
case LS_FN_STICKY:
|
||||
return QObject::tr("Sticky");
|
||||
case LS_FN_STAY:
|
||||
return QObject::tr("Stay");
|
||||
default:
|
||||
return QObject::tr("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
QString LogicalSwitchData::toString(const ModelData & model)
|
||||
{
|
||||
QString result = "";
|
||||
|
||||
if (!func)
|
||||
return result;
|
||||
|
||||
if (andsw!=0) {
|
||||
result +="( ";
|
||||
}
|
||||
switch (getFunctionFamily()) {
|
||||
case LS_FAMILY_STAY:
|
||||
result = QObject::tr("STAY(%1, [%2:%3])").arg(RawSwitch(val1).toString()).arg(ValToTim(val2)).arg(ValToTim(val2+val3));
|
||||
break;
|
||||
case LS_FAMILY_STICKY:
|
||||
result = QObject::tr("STICKY(%1, %2)").arg(RawSwitch(val1).toString()).arg(RawSwitch(val2).toString());
|
||||
break;
|
||||
case LS_FAMILY_TIMER:
|
||||
result = QObject::tr("TIMER(%1, %2)").arg(ValToTim(val1)).arg(ValToTim(val2));
|
||||
break;
|
||||
case LS_FAMILY_VOFS: {
|
||||
RawSource source = RawSource(val1, &model);
|
||||
RawSourceRange range = source.getRange();
|
||||
if (val1)
|
||||
result += source.toString();
|
||||
else
|
||||
result += "0";
|
||||
result.remove(" ");
|
||||
if (func == LS_FN_APOS || func == LS_FN_ANEG)
|
||||
result = "|" + result + "|";
|
||||
else if (func == LS_FN_DAPOS)
|
||||
result = "|d(" + result + ")|";
|
||||
else if (func == LS_FN_DPOS) result = "d(" + result + ")";
|
||||
if (func == LS_FN_APOS || func == LS_FN_VPOS || func == LS_FN_DAPOS || func == LS_FN_DPOS)
|
||||
result += " > ";
|
||||
else if (func == LS_FN_ANEG || func == LS_FN_VNEG)
|
||||
result += " < ";
|
||||
result += QString::number(range.step * (val2 /*TODO+ source.getRawOffset(model)*/) + range.offset);
|
||||
break;
|
||||
}
|
||||
case LS_FAMILY_VBOOL:
|
||||
result = RawSwitch(val1).toString();
|
||||
switch (func) {
|
||||
case LS_FN_AND:
|
||||
result += " AND ";
|
||||
break;
|
||||
case LS_FN_OR:
|
||||
result += " OR ";
|
||||
break;
|
||||
case LS_FN_XOR:
|
||||
result += " XOR ";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
result += RawSwitch(val2).toString();
|
||||
break;
|
||||
|
||||
case LS_FAMILY_VCOMP:
|
||||
if (val1)
|
||||
result += RawSource(val1).toString();
|
||||
else
|
||||
result += "0";
|
||||
switch (func) {
|
||||
case LS_FN_EQUAL:
|
||||
result += " = ";
|
||||
break;
|
||||
case LS_FN_NEQUAL:
|
||||
result += " != ";
|
||||
break;
|
||||
case LS_FN_GREATER:
|
||||
result += " > ";
|
||||
break;
|
||||
case LS_FN_LESS:
|
||||
result += " < ";
|
||||
break;
|
||||
case LS_FN_EGREATER:
|
||||
result += " >= ";
|
||||
break;
|
||||
case LS_FN_ELESS:
|
||||
result += " <= ";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (val2)
|
||||
result += RawSource(val2).toString();
|
||||
else
|
||||
result += "0";
|
||||
break;
|
||||
}
|
||||
|
||||
if (andsw!=0) {
|
||||
result +=" ) AND ";
|
||||
result += RawSwitch(andsw).toString();
|
||||
}
|
||||
|
||||
if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) {
|
||||
if (delay)
|
||||
result += QObject::tr(" Delay %1 sec").arg(delay/2.0);
|
||||
if (duration)
|
||||
result += QObject::tr(" Duration %1 sec").arg(duration/2.0);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#if 0
|
||||
QStringList FuncSwData::toStringList()
|
||||
{
|
||||
QStringList result;
|
||||
QStringList qs;
|
||||
|
||||
result << swtch.toString();
|
||||
result << funcToString();
|
||||
|
||||
if (func < FuncInstantTrim) {
|
||||
result << QString("%1").arg(param);
|
||||
}
|
||||
else if (func==FuncPlaySound) {
|
||||
qs <<"Beep 1" << "Beep 2" << "Beep 3" << "Warn1" << "Warn2" << "Cheep" << "Ratata" << "Tick" << "Siren" << "Ring" ;
|
||||
qs << "SciFi" << "Robot" << "Chirp" << "Tada" << "Crickt" << "AlmClk" ;
|
||||
if (param>=0 && param<(int)qs.count())
|
||||
result << qs.at(param);
|
||||
else
|
||||
result << QObject::tr("<font color=red><b>Inconsistent parameter</b></font>");
|
||||
}
|
||||
else if (func==FuncPlayHaptic) {
|
||||
qs << "0" << "1" << "2" << "3";
|
||||
if (param>=0 && param<(int)qs.count())
|
||||
result << qs.at(param);
|
||||
else
|
||||
result << QObject::tr("<font color=red><b>Inconsistent parameter</b></font>");
|
||||
}
|
||||
else if (func==FuncReset) {
|
||||
qs.append( QObject::tr("Timer1"));
|
||||
qs.append( QObject::tr("Timer2"));
|
||||
qs.append( QObject::tr("All"));
|
||||
qs.append( QObject::tr("Telemetry"));
|
||||
if (param>=0 && param<(int)qs.count())
|
||||
result << qs.at(param);
|
||||
else
|
||||
result << QObject::tr("<font color=red><b>Inconsistent parameter</b></font>");
|
||||
}
|
||||
else if ((func==FuncVolume)|| (func==FuncPlayValue)) {
|
||||
RawSource item(param);
|
||||
result << item.toString();
|
||||
}
|
||||
else if ((func==FuncPlayPrompt) || (func==FuncPlayBoth)) {
|
||||
if ( GetEepromInterface()->getCapability(VoicesAsNumbers)) {
|
||||
result << QString("%1").arg(param);
|
||||
} else {
|
||||
result << paramarm;
|
||||
}
|
||||
}
|
||||
else if ((func>FuncBackgroundMusicPause) && (func<FuncCount)) {
|
||||
switch (adjustMode) {
|
||||
case 0:
|
||||
result << QObject::tr("Value ")+QString("%1").arg(param);
|
||||
break;
|
||||
case 1:
|
||||
result << RawSource(param).toString();
|
||||
break;
|
||||
case 2:
|
||||
result << RawSource(param).toString();
|
||||
break;
|
||||
case 3:
|
||||
if (param==0) {
|
||||
result << QObject::tr("Decr:")+QString(" -1");
|
||||
}
|
||||
else {
|
||||
result << QObject::tr("Incr:")+QString(" +1");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (func==FuncPlaySound || func==FuncPlayHaptic || func==FuncPlayValue || func==FuncPlayPrompt || func==FuncPlayBoth || func==FuncBackgroundMusic) {
|
||||
str.append(doTC(QString("%1").arg(g_model->funcSw[i].repeatParam),"green"));
|
||||
} else {
|
||||
str.append(doTC( " ","green"));
|
||||
}
|
||||
if ((index<=FuncInstantTrim) || (index>FuncBackgroundMusicPause)) {
|
||||
str.append(doTC((g_model->funcSw[i].enabled ? "ON" : "OFF"),"green"));
|
||||
} else {
|
||||
str.append(doTC( "---","green"));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
QString FuncSwData::funcToString()
|
||||
{
|
||||
if (func >= FuncSafetyCh1 && func <= FuncSafetyCh32)
|
||||
return QObject::tr("Safety %1").arg(RawSource(SOURCE_TYPE_CH, func).toString());
|
||||
else if (func == FuncTrainer)
|
||||
return QObject::tr("Trainer");
|
||||
else if (func == FuncTrainerRUD)
|
||||
return QObject::tr("Trainer RUD");
|
||||
else if (func == FuncTrainerELE)
|
||||
return QObject::tr("Trainer ELE");
|
||||
else if (func == FuncTrainerTHR)
|
||||
return QObject::tr("Trainer THR");
|
||||
else if (func == FuncTrainerAIL)
|
||||
return QObject::tr("Trainer AIL");
|
||||
else if (func == FuncInstantTrim)
|
||||
return QObject::tr("Instant Trim");
|
||||
else if (func == FuncPlaySound)
|
||||
return QObject::tr("Play Sound");
|
||||
else if (func == FuncPlayHaptic)
|
||||
return QObject::tr("Play Haptic");
|
||||
else if (func == FuncReset)
|
||||
return QObject::tr("Reset");
|
||||
else if (func >= FuncSetTimer1 && func <= FuncSetTimer2)
|
||||
return QObject::tr("Set Timer %1").arg(func-FuncSetTimer1+1);
|
||||
else if (func == FuncVario)
|
||||
return QObject::tr("Vario");
|
||||
else if (func == FuncPlayPrompt)
|
||||
return QObject::tr("Play Track");
|
||||
else if (func == FuncPlayBoth)
|
||||
return QObject::tr("Play Both");
|
||||
else if (func == FuncPlayValue)
|
||||
return QObject::tr("Play Value");
|
||||
else if (func == FuncLogs)
|
||||
return QObject::tr("Start Logs");
|
||||
else if (func == FuncVolume)
|
||||
return QObject::tr("Volume");
|
||||
else if (func == FuncBacklight)
|
||||
return QObject::tr("Backlight");
|
||||
else if (func == FuncBackgroundMusic)
|
||||
return QObject::tr("Background Music");
|
||||
else if (func == FuncBackgroundMusicPause)
|
||||
return QObject::tr("Background Music Pause");
|
||||
else if (func >= FuncAdjustGV1 && func <= FuncAdjustGVLast)
|
||||
return QObject::tr("Adjust GV%1").arg(func-FuncAdjustGV1+1);
|
||||
else {
|
||||
return QString("???"); // Highlight unknown functions with output of question marks.(BTW should not happen that we do not know what a function is)
|
||||
}
|
||||
}
|
||||
|
||||
QString FuncSwData::paramToString()
|
||||
{
|
||||
QStringList qs;
|
||||
if (func <= FuncInstantTrim) {
|
||||
return QString("%1").arg(param);
|
||||
}
|
||||
else if (func==FuncPlaySound) {
|
||||
qs <<"Beep 1" << "Beep 2" << "Beep 3" << "Warn1" << "Warn2" << "Cheep" << "Ratata" << "Tick" << "Siren" << "Ring" ;
|
||||
qs << "SciFi" << "Robot" << "Chirp" << "Tada" << "Crickt" << "AlmClk" ;
|
||||
if (param>=0 && param<(int)qs.count())
|
||||
return qs.at(param);
|
||||
else
|
||||
return QObject::tr("<font color=red><b>Inconsistent parameter</b></font>");
|
||||
}
|
||||
else if (func==FuncPlayHaptic) {
|
||||
qs << "0" << "1" << "2" << "3";
|
||||
if (param>=0 && param<(int)qs.count())
|
||||
return qs.at(param);
|
||||
else
|
||||
return QObject::tr("<font color=red><b>Inconsistent parameter</b></font>");
|
||||
}
|
||||
else if (func==FuncReset) {
|
||||
qs.append( QObject::tr("Timer1"));
|
||||
qs.append( QObject::tr("Timer2"));
|
||||
qs.append( QObject::tr("All"));
|
||||
qs.append( QObject::tr("Telemetry"));
|
||||
if (param>=0 && param<(int)qs.count())
|
||||
return qs.at(param);
|
||||
else
|
||||
return QObject::tr("<font color=red><b>Inconsistent parameter</b></font>");
|
||||
}
|
||||
else if ((func==FuncVolume)|| (func==FuncPlayValue)) {
|
||||
RawSource item(param);
|
||||
return item.toString();
|
||||
}
|
||||
else if ((func==FuncPlayPrompt) || (func==FuncPlayBoth)) {
|
||||
if ( GetEepromInterface()->getCapability(VoicesAsNumbers)) {
|
||||
return QString("%1").arg(param);
|
||||
} else {
|
||||
return paramarm;
|
||||
}
|
||||
}
|
||||
else if ((func>FuncBackgroundMusicPause) && (func<FuncCount)) {
|
||||
switch (adjustMode) {
|
||||
case 0:
|
||||
return QObject::tr("Value ")+QString("%1").arg(param);
|
||||
break;
|
||||
case 1:
|
||||
return RawSource(param).toString();
|
||||
break;
|
||||
case 2:
|
||||
return RawSource(param).toString();
|
||||
break;
|
||||
case 3:
|
||||
if (param==0) {
|
||||
return QObject::tr("Decr:")+QString(" -1");
|
||||
}
|
||||
else {
|
||||
return QObject::tr("Incr:")+QString(" +1");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
QString FuncSwData::repeatToString()
|
||||
{
|
||||
if (repeatParam==0) {
|
||||
return QObject::tr("No repeat");
|
||||
}
|
||||
else {
|
||||
unsigned int step = IS_ARM(GetEepromInterface()->getBoard()) ? 5 : 10;
|
||||
return QObject::tr("%1 sec").arg(step*repeatParam);
|
||||
}
|
||||
}
|
||||
|
||||
GeneralSettings::GeneralSettings()
|
||||
{
|
||||
memset(this, 0, sizeof(GeneralSettings));
|
||||
@@ -497,7 +873,8 @@ void ModelData::clear()
|
||||
if (IS_TARANIS(board)) {
|
||||
moduleData[0].protocol=PXX_XJT_X16;
|
||||
moduleData[1].protocol=OFF;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
moduleData[0].protocol=PPM;
|
||||
moduleData[1].protocol=OFF;
|
||||
}
|
||||
@@ -505,20 +882,17 @@ void ModelData::clear()
|
||||
phaseData[i].clear();
|
||||
clearInputs();
|
||||
clearMixes();
|
||||
for(int i=0; i<4; i++){
|
||||
mixData[i].destCh = i+1;
|
||||
mixData[i].srcRaw = RawSource(SOURCE_TYPE_STICK, i);
|
||||
mixData[i].weight = 100;
|
||||
}
|
||||
|
||||
for (int i=0; i<C9X_NUM_CHNOUT; i++)
|
||||
limitData[i].clear();
|
||||
for (int i=0; i<NUM_STICKS; i++)
|
||||
expoData[i].clear();
|
||||
for (int i=0; i<C9X_NUM_CSW; i++)
|
||||
customSw[i].clear();
|
||||
for (int i=0; i<C9X_MAX_CURVES; i++) {
|
||||
for (int i=0; i<C9X_MAX_CURVES; i++)
|
||||
curves[i].clear(5);
|
||||
}
|
||||
for (int i=0; i<2; i++)
|
||||
timers[i].clear();
|
||||
|
||||
swashRingData.clear();
|
||||
frsky.clear();
|
||||
@@ -536,17 +910,57 @@ void ModelData::setDefault(uint8_t id)
|
||||
sprintf(name, "MODEL%02d", id+1);
|
||||
}
|
||||
|
||||
unsigned int ModelData::getTrimFlightPhase(uint8_t idx, int8_t phase)
|
||||
int ModelData::getTrimValue(int phaseIdx, int trimIdx)
|
||||
{
|
||||
// if (phase == -1) phase = getFlightPhase();
|
||||
|
||||
for (uint8_t i=0; i<C9X_MAX_PHASES; i++) {
|
||||
if (phase == 0 || phaseData[phase].trimRef[idx] < 0) return phase;
|
||||
phase = phaseData[phase].trimRef[idx];
|
||||
int result = 0;
|
||||
for (int i=0; i<C9X_MAX_PHASES; i++) {
|
||||
PhaseData & phase = phaseData[phaseIdx];
|
||||
if (phase.trimMode[trimIdx] < 0) {
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
if (phase.trimRef[trimIdx] == phaseIdx || phaseIdx == 0) {
|
||||
return result + phase.trim[trimIdx];
|
||||
}
|
||||
else {
|
||||
phaseIdx = phase.trimRef[trimIdx];
|
||||
if (phase.trimMode[trimIdx] == 0)
|
||||
result = 0;
|
||||
else
|
||||
result += phase.trim[trimIdx];
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ModelData::setTrimValue(int phaseIdx, int trimIdx, int value)
|
||||
{
|
||||
for (uint8_t i=0; i<C9X_MAX_PHASES; i++) {
|
||||
PhaseData & phase = phaseData[phaseIdx];
|
||||
int mode = phase.trimMode[trimIdx];
|
||||
int p = phase.trimRef[trimIdx];
|
||||
int & trim = phase.trim[trimIdx];
|
||||
if (mode < 0)
|
||||
return;
|
||||
if (p == phaseIdx || phaseIdx == 0) {
|
||||
trim = value;
|
||||
break;;
|
||||
}
|
||||
else if (mode == 0) {
|
||||
phaseIdx = p;
|
||||
}
|
||||
else {
|
||||
trim = value - getTrimValue(p, trimIdx);
|
||||
if (trim < -500)
|
||||
trim = -500;
|
||||
if (trim > 500)
|
||||
trim = 500;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ModelData::removeGlobalVar(int & var)
|
||||
{
|
||||
if (var >= 126 && var <= 130)
|
||||
|
||||
@@ -72,7 +72,6 @@ const uint8_t modn12x3[4][4]= {
|
||||
#define C9X_MAX_POINTS 17
|
||||
#define C9X_MAX_GVARS 9
|
||||
#define C9X_MAX_ENCODERS 2
|
||||
#define NUM_SAFETY_CHNOUT 16
|
||||
#define C9X_NUM_CHNOUT 32 // number of real output channels
|
||||
#define C9X_NUM_CSW 32 // number of custom switches
|
||||
#define C9X_MAX_CUSTOM_FUNCTIONS 32 // number of functions assigned to switches
|
||||
@@ -147,44 +146,6 @@ enum EnumKeys {
|
||||
#endif
|
||||
};
|
||||
|
||||
enum CSFunction {
|
||||
CS_FN_OFF,
|
||||
CS_FN_VPOS,
|
||||
CS_FN_VNEG,
|
||||
CS_FN_APOS,
|
||||
CS_FN_ANEG,
|
||||
CS_FN_AND,
|
||||
CS_FN_OR,
|
||||
CS_FN_XOR,
|
||||
CS_FN_EQUAL,
|
||||
CS_FN_NEQUAL,
|
||||
CS_FN_GREATER,
|
||||
CS_FN_LESS,
|
||||
CS_FN_EGREATER,
|
||||
CS_FN_ELESS,
|
||||
CS_FN_DPOS,
|
||||
CS_FN_DAPOS,
|
||||
CS_FN_VEQUAL, // added at the end to avoid everything renumbered
|
||||
CS_FN_TIM,
|
||||
CS_FN_MAXF
|
||||
};
|
||||
|
||||
enum CSFunctionFamily {
|
||||
CS_FAMILY_VOFS,
|
||||
CS_FAMILY_VBOOL,
|
||||
CS_FAMILY_VCOMP,
|
||||
CS_FAMILY_TIMERS
|
||||
};
|
||||
|
||||
inline CSFunctionFamily getCSFunctionFamily(int fn)
|
||||
{
|
||||
if (fn==CS_FN_TIM) {
|
||||
return (CS_FAMILY_TIMERS);
|
||||
} else {
|
||||
return ((fn<CS_FN_AND || fn>CS_FN_ELESS) ? CS_FAMILY_VOFS : (fn<CS_FN_EQUAL ? CS_FAMILY_VBOOL : CS_FAMILY_VCOMP));
|
||||
}
|
||||
}
|
||||
|
||||
#define CHAR_FOR_NAMES " ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-."
|
||||
#define CHAR_FOR_NAMES_REGEX "[ A-Za-z0-9_.-,]*"
|
||||
|
||||
@@ -357,13 +318,11 @@ enum RawSwitchType {
|
||||
SWITCH_TYPE_SWITCH,
|
||||
SWITCH_TYPE_VIRTUAL,
|
||||
SWITCH_TYPE_MULTIPOS_POT,
|
||||
SWITCH_TYPE_MOMENT_SWITCH,
|
||||
SWITCH_TYPE_MOMENT_VIRTUAL,
|
||||
SWITCH_TYPE_TRIM,
|
||||
SWITCH_TYPE_ROTARY_ENCODER,
|
||||
SWITCH_TYPE_ON,
|
||||
SWITCH_TYPE_OFF,
|
||||
SWITCH_TYPE_ONM,
|
||||
SWITCH_TYPE_TRN,
|
||||
SWITCH_TYPE_REA,
|
||||
SWITCH_TYPE_TIMER_MODE
|
||||
};
|
||||
|
||||
class RawSwitch {
|
||||
@@ -617,30 +576,63 @@ class MixData {
|
||||
void clear() { memset(this, 0, sizeof(MixData)); }
|
||||
};
|
||||
|
||||
class CustomSwData { // Custom Switches data
|
||||
public:
|
||||
CustomSwData() { clear(); }
|
||||
int val1; //input
|
||||
int val2; //offset
|
||||
unsigned int func;
|
||||
unsigned int delay;
|
||||
unsigned int duration;
|
||||
unsigned int andsw;
|
||||
void clear() { memset(this, 0, sizeof(CustomSwData)); }
|
||||
enum CSFunction {
|
||||
LS_FN_OFF,
|
||||
LS_FN_VPOS,
|
||||
LS_FN_VNEG,
|
||||
LS_FN_APOS,
|
||||
LS_FN_ANEG,
|
||||
LS_FN_AND,
|
||||
LS_FN_OR,
|
||||
LS_FN_XOR,
|
||||
LS_FN_EQUAL,
|
||||
LS_FN_NEQUAL,
|
||||
LS_FN_GREATER,
|
||||
LS_FN_LESS,
|
||||
LS_FN_EGREATER,
|
||||
LS_FN_ELESS,
|
||||
LS_FN_DPOS,
|
||||
LS_FN_DAPOS,
|
||||
LS_FN_VEQUAL, // added at the end to avoid everything renumbered
|
||||
LS_FN_TIMER,
|
||||
LS_FN_STICKY,
|
||||
LS_FN_STAY,
|
||||
// later ... LS_FN_RANGE,
|
||||
LS_FN_MAX
|
||||
};
|
||||
|
||||
class SafetySwData { // Custom Switches data
|
||||
public:
|
||||
SafetySwData() { clear(); }
|
||||
RawSwitch swtch;
|
||||
int val;
|
||||
enum CSFunctionFamily {
|
||||
LS_FAMILY_VOFS,
|
||||
LS_FAMILY_VBOOL,
|
||||
LS_FAMILY_VCOMP,
|
||||
LS_FAMILY_TIMER,
|
||||
LS_FAMILY_STICKY,
|
||||
LS_FAMILY_STAY,
|
||||
};
|
||||
|
||||
void clear() { memset(this, 0, sizeof(SafetySwData)); }
|
||||
class LogicalSwitchData { // Custom Switches data
|
||||
public:
|
||||
LogicalSwitchData(unsigned int func=0)
|
||||
{
|
||||
clear();
|
||||
this->func = func;
|
||||
}
|
||||
unsigned int func;
|
||||
int val1;
|
||||
int val2;
|
||||
int val3;
|
||||
unsigned int delay;
|
||||
unsigned int duration;
|
||||
int andsw;
|
||||
void clear() { memset(this, 0, sizeof(LogicalSwitchData)); }
|
||||
CSFunctionFamily getFunctionFamily();
|
||||
QString funcToString();
|
||||
QString toString(const ModelData & model);
|
||||
};
|
||||
|
||||
enum AssignFunc {
|
||||
FuncSafetyCh1 = 0,
|
||||
FuncSafetyCh16 = FuncSafetyCh1+15,
|
||||
FuncSafetyCh32 = FuncSafetyCh1+C9X_NUM_CHNOUT-1,
|
||||
FuncTrainer,
|
||||
FuncTrainerRUD,
|
||||
FuncTrainerELE,
|
||||
@@ -650,6 +642,8 @@ enum AssignFunc {
|
||||
FuncPlaySound,
|
||||
FuncPlayHaptic,
|
||||
FuncReset,
|
||||
FuncSetTimer1,
|
||||
FuncSetTimer2,
|
||||
FuncVario,
|
||||
FuncPlayPrompt,
|
||||
FuncPlayBoth,
|
||||
@@ -666,7 +660,7 @@ enum AssignFunc {
|
||||
|
||||
class FuncSwData { // Function Switches data
|
||||
public:
|
||||
FuncSwData() { clear(); }
|
||||
FuncSwData(AssignFunc func=FuncSafetyCh1) { clear(); this->func = func; }
|
||||
RawSwitch swtch;
|
||||
AssignFunc func;
|
||||
int param;
|
||||
@@ -675,12 +669,17 @@ class FuncSwData { // Function Switches data
|
||||
unsigned int adjustMode;
|
||||
int repeatParam;
|
||||
void clear() { memset(this, 0, sizeof(FuncSwData)); }
|
||||
QString funcToString();
|
||||
QString paramToString();
|
||||
QString repeatToString();
|
||||
QStringList toStringList();
|
||||
};
|
||||
|
||||
class PhaseData {
|
||||
public:
|
||||
PhaseData() { clear(); }
|
||||
int trimRef[NUM_STICKS]; //
|
||||
int trimMode[NUM_STICKS];
|
||||
int trimRef[NUM_STICKS];
|
||||
int trim[NUM_STICKS];
|
||||
RawSwitch swtch;
|
||||
char name[10+1];
|
||||
@@ -688,7 +687,7 @@ class PhaseData {
|
||||
unsigned int fadeOut;
|
||||
int rotaryEncoders[2];
|
||||
int gvars[C9X_MAX_GVARS];
|
||||
void clear() { memset(this, 0, sizeof(PhaseData)); for (int i=0; i<NUM_STICKS; i++) trimRef[i] = -1; }
|
||||
void clear() { memset(this, 0, sizeof(PhaseData)); }
|
||||
};
|
||||
|
||||
class SwashRingData { // Swash Ring data
|
||||
@@ -808,32 +807,17 @@ class MavlinkData {
|
||||
void clear() { memset(this, 0, sizeof(MavlinkData)); }
|
||||
};
|
||||
|
||||
enum TimerMode {
|
||||
TMRMODE_OFF=0,
|
||||
TMRMODE_ABS,
|
||||
TMRMODE_THs,
|
||||
TMRMODE_THp,
|
||||
TMRMODE_THt,
|
||||
TMRMODE_FIRST_SWITCH,
|
||||
TMRMODE_FIRST_MOMENT_SWITCH = TMRMODE_FIRST_SWITCH+64,
|
||||
TMRMODE_FIRST_CHPERC = TMRMODE_FIRST_MOMENT_SWITCH+64,
|
||||
|
||||
TMRMODE_FIRST_NEG_SWITCH=-TMRMODE_FIRST_SWITCH,
|
||||
TMRMODE_FIRST_NEG_MOMENT_SWITCH=-TMRMODE_FIRST_MOMENT_SWITCH,
|
||||
/* sw/!sw, !m_sw/!m_sw */
|
||||
};
|
||||
|
||||
class TimerData {
|
||||
public:
|
||||
TimerData() { clear(); }
|
||||
TimerMode mode; // timer trigger source -> off, abs, THs, TH%, THt, sw/!sw, !m_sw/!m_sw
|
||||
RawSwitch mode;
|
||||
bool minuteBeep;
|
||||
unsigned int countdownBeep;
|
||||
bool dir; // 0=>Count Down, 1=>Count Up
|
||||
unsigned int val;
|
||||
bool persistent;
|
||||
int pvalue;
|
||||
void clear() { memset(this, 0, sizeof(TimerData)); }
|
||||
void clear() { memset(this, 0, sizeof(TimerData)); mode = RawSwitch(SWITCH_TYPE_TIMER_MODE, 0); }
|
||||
};
|
||||
|
||||
enum Protocol {
|
||||
@@ -894,13 +878,11 @@ class ModelData {
|
||||
ExpoData expoData[C9X_MAX_EXPOS];
|
||||
|
||||
CurveData curves[C9X_MAX_CURVES];
|
||||
CustomSwData customSw[C9X_NUM_CSW];
|
||||
LogicalSwitchData customSw[C9X_NUM_CSW];
|
||||
FuncSwData funcSw[C9X_MAX_CUSTOM_FUNCTIONS];
|
||||
SafetySwData safetySw[C9X_NUM_CHNOUT];
|
||||
SwashRingData swashRingData;
|
||||
unsigned int thrTraceSrc;
|
||||
int8_t traineron; // 0 disable trainer, 1 allow trainer
|
||||
int8_t t2throttle; // Start timer2 using throttle
|
||||
unsigned int modelId;
|
||||
unsigned int switchWarningStates;
|
||||
unsigned int nSwToWarn;
|
||||
@@ -928,8 +910,9 @@ class ModelData {
|
||||
void clear();
|
||||
bool isempty();
|
||||
void setDefault(uint8_t id);
|
||||
unsigned int getTrimFlightPhase(uint8_t idx, int8_t phase);
|
||||
|
||||
int getTrimValue(int phaseIdx, int trimIdx);
|
||||
void setTrimValue(int phaseIdx, int trimIdx, int value);
|
||||
ModelData removeGlobalVars();
|
||||
|
||||
void clearMixes();
|
||||
@@ -965,10 +948,10 @@ enum Capability {
|
||||
Pots,
|
||||
Switches,
|
||||
SwitchesPositions,
|
||||
CustomSwitches,
|
||||
LogicalSwitches,
|
||||
CustomAndSwitches,
|
||||
HasNegAndSwitches,
|
||||
CustomSwitchesExt,
|
||||
LogicalSwitchesExt,
|
||||
RotaryEncoders,
|
||||
Outputs,
|
||||
ChannelsName,
|
||||
@@ -1018,7 +1001,6 @@ enum Capability {
|
||||
GvarsInCS,
|
||||
GvarsAreNamed,
|
||||
GvarsFlightPhases,
|
||||
GvarsHaveSources,
|
||||
GvarsName,
|
||||
NoTelemetryProtocol,
|
||||
TelemetryCustomScreens,
|
||||
@@ -1104,10 +1086,6 @@ class EEPROMInterface
|
||||
|
||||
virtual int isAvailable(Protocol proto, int port=0) = 0;
|
||||
|
||||
virtual bool isAvailable(const RawSwitch & swtch, UseContext context) { return true; }
|
||||
|
||||
virtual bool isAvailable(const RawSource & source, UseContext context) { return true; }
|
||||
|
||||
virtual SimulatorInterface * getSimulator() = 0;
|
||||
|
||||
virtual const int getEEpromSize() = 0;
|
||||
@@ -1189,14 +1167,14 @@ inline void applyStickModeToModel(ModelData &model, unsigned int mode)
|
||||
// virtual switches
|
||||
for (int i=0; i<C9X_NUM_CSW; i++) {
|
||||
RawSource source;
|
||||
switch (getCSFunctionFamily(model.customSw[i].func)) {
|
||||
case CS_FAMILY_VCOMP:
|
||||
switch (model.customSw[i].getFunctionFamily()) {
|
||||
case LS_FAMILY_VCOMP:
|
||||
source = RawSource(model.customSw[i].val2);
|
||||
if (source.type == SOURCE_TYPE_STICK)
|
||||
source.index = applyStickMode(source.index + 1, mode) - 1;
|
||||
model.customSw[i].val2 = source.toValue();
|
||||
// no break
|
||||
case CS_FAMILY_VOFS:
|
||||
case LS_FAMILY_VOFS:
|
||||
source = RawSource(model.customSw[i].val1);
|
||||
if (source.type == SOURCE_TYPE_STICK)
|
||||
source.index = applyStickMode(source.index + 1, mode) - 1;
|
||||
|
||||
@@ -17,9 +17,9 @@ RawSwitch er9xToSwitch(int8_t sw)
|
||||
else if (sw == -22)
|
||||
return RawSwitch(SWITCH_TYPE_OFF);
|
||||
else if (swa <= 22+9)
|
||||
return RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, sw > 0 ? sw-22 : sw+22);
|
||||
return RawSwitch(SWITCH_TYPE_SWITCH, sw > 0 ? sw-22 : sw+22);
|
||||
else
|
||||
return RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, sw > 0 ? sw-22-9 : sw+22+9);
|
||||
return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-22-9 : sw+22+9);
|
||||
}
|
||||
|
||||
t_Er9xTrainerMix::t_Er9xTrainerMix()
|
||||
@@ -269,22 +269,22 @@ RawSource er9xToSource(int8_t value)
|
||||
}
|
||||
}
|
||||
|
||||
Er9xCustomSwData::operator CustomSwData ()
|
||||
Er9xLogicalSwitchData::operator LogicalSwitchData ()
|
||||
{
|
||||
CustomSwData c9x;
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = er9xToSource(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_EQUAL) {
|
||||
if (c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val2 = er9xToSource(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = er9xToSwitch(v1).toValue();
|
||||
c9x.val2 = er9xToSwitch(v2).toValue();
|
||||
}
|
||||
@@ -298,14 +298,6 @@ t_Er9xSafetySwData::t_Er9xSafetySwData()
|
||||
memset(this, 0, sizeof(t_Er9xSafetySwData));
|
||||
}
|
||||
|
||||
t_Er9xSafetySwData::operator SafetySwData ()
|
||||
{
|
||||
SafetySwData c9x;
|
||||
c9x.swtch = er9xToSwitch(swtch);
|
||||
c9x.val = val;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Er9xFrSkyChannelData::t_Er9xFrSkyChannelData()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Er9xFrSkyChannelData));
|
||||
@@ -343,10 +335,11 @@ t_Er9xFrSkyData::operator FrSkyData ()
|
||||
return c9x;
|
||||
}
|
||||
|
||||
TimerMode getEr9xTimerMode(int mode)
|
||||
RawSwitch getEr9xTimerMode(int mode)
|
||||
{
|
||||
/*
|
||||
if (mode <= -33)
|
||||
return TimerMode(TMRMODE_FIRST_NEG_MOMENT_SWITCH+(mode+33));
|
||||
return TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+33));
|
||||
else if (mode <= -1)
|
||||
return TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+1));
|
||||
else if (mode < 16)
|
||||
@@ -354,7 +347,9 @@ TimerMode getEr9xTimerMode(int mode)
|
||||
else if (mode < 16+21)
|
||||
return TimerMode(TMRMODE_FIRST_SWITCH+(mode-16));
|
||||
else
|
||||
return TimerMode(TMRMODE_FIRST_MOMENT_SWITCH+(mode-16-21));
|
||||
return TimerMode(TMRMODE_FIRST_SWITCH+(mode-16-21));
|
||||
*/
|
||||
return RawSwitch();
|
||||
}
|
||||
|
||||
t_Er9xModelData::operator ModelData ()
|
||||
@@ -381,7 +376,7 @@ t_Er9xModelData::operator ModelData ()
|
||||
break;
|
||||
}
|
||||
c9x.traineron= traineron;
|
||||
c9x.t2throttle = t2throttle;
|
||||
// c9x.t2throttle = t2throttle;
|
||||
c9x.moduleData[0].ppmFrameLength=ppmFrameLength;
|
||||
c9x.moduleData[0].channelsCount = 8 + 2 * ppmNCH;
|
||||
c9x.thrTrim = thrTrim;
|
||||
@@ -471,8 +466,8 @@ t_Er9xModelData::operator ModelData ()
|
||||
for (int i=0; i<ER9X_NUM_CSW; i++)
|
||||
c9x.customSw[i] = customSw[i];
|
||||
|
||||
for (int i=0; i<ER9X_NUM_CHNOUT; i++)
|
||||
c9x.safetySw[i] = safetySw[i];
|
||||
// for (int i=0; i<ER9X_NUM_CHNOUT; i++)
|
||||
// c9x.safetySw[i] = safetySw[i];
|
||||
|
||||
c9x.frsky = frsky;
|
||||
c9x.frsky.usrProto=FrSkyUsrProto;
|
||||
|
||||
@@ -154,21 +154,20 @@ PACK(typedef struct t_Er9xMixData {
|
||||
}) Er9xMixData;
|
||||
|
||||
|
||||
PACK(typedef struct t_Er9xCustomSwData { // Custom Switches data
|
||||
PACK(typedef struct t_Er9xLogicalSwitchData { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func:4;
|
||||
uint8_t andsw:4;
|
||||
|
||||
operator CustomSwData();
|
||||
t_Er9xCustomSwData() { memset(this, 0, sizeof(t_Er9xCustomSwData)); }
|
||||
}) Er9xCustomSwData;
|
||||
operator LogicalSwitchData();
|
||||
t_Er9xLogicalSwitchData() { memset(this, 0, sizeof(t_Er9xLogicalSwitchData)); }
|
||||
}) Er9xLogicalSwitchData;
|
||||
|
||||
PACK(typedef struct t_Er9xSafetySwData { // Custom Switches data
|
||||
int8_t swtch;
|
||||
int8_t val;
|
||||
|
||||
operator SafetySwData();
|
||||
t_Er9xSafetySwData();
|
||||
}) Er9xSafetySwData;
|
||||
|
||||
@@ -242,7 +241,7 @@ PACK(typedef struct t_Er9xModelData {
|
||||
int8_t trim[4];
|
||||
int8_t curves5[ER9X_MAX_CURVE5][5];
|
||||
int8_t curves9[ER9X_MAX_CURVE9][9];
|
||||
Er9xCustomSwData customSw[ER9X_NUM_CSW];
|
||||
Er9xLogicalSwitchData customSw[ER9X_NUM_CSW];
|
||||
uint8_t frSkyVoltThreshold ;
|
||||
int8_t tmrModeB;
|
||||
uint8_t numVoice;
|
||||
|
||||
@@ -75,11 +75,11 @@ inline void applyStickModeToModel(Er9xModelData & model, unsigned int mode)
|
||||
for (int i=0; i<ER9X_MAX_MIXERS; i++)
|
||||
model.mixData[i].srcRaw = applyStickMode(model.mixData[i].srcRaw, mode);
|
||||
for (int i=0; i<ER9X_NUM_CSW; i++) {
|
||||
switch (getCSFunctionFamily(model.customSw[i].func)) {
|
||||
case CS_FAMILY_VCOMP:
|
||||
switch (LogicalSwitchData(model.customSw[i].func).getFunctionFamily()) {
|
||||
case LS_FAMILY_VCOMP:
|
||||
model.customSw[i].v2 = applyStickMode(model.customSw[i].v2, mode);
|
||||
// no break
|
||||
case CS_FAMILY_VOFS:
|
||||
case LS_FAMILY_VOFS:
|
||||
model.customSw[i].v1 = applyStickMode(model.customSw[i].v1, mode);
|
||||
break;
|
||||
default:
|
||||
@@ -239,7 +239,7 @@ int Er9xInterface::getCapability(const Capability capability)
|
||||
return 9;
|
||||
case CustomFunctions:
|
||||
return 0;
|
||||
case CustomSwitches:
|
||||
case LogicalSwitches:
|
||||
return 12;
|
||||
case CustomAndSwitches:
|
||||
return 5;
|
||||
@@ -281,8 +281,6 @@ int Er9xInterface::getCapability(const Capability capability)
|
||||
case ModelVoice:
|
||||
case Gvars:
|
||||
return 7;
|
||||
case GvarsHaveSources:
|
||||
return 1;
|
||||
case GetThrSwitch:
|
||||
return DSW_THR;
|
||||
default:
|
||||
|
||||
@@ -5,14 +5,12 @@
|
||||
|
||||
extern RawSwitch er9xToSwitch(int8_t sw);
|
||||
|
||||
TimerMode getErSky9xTimerMode(int mode)
|
||||
RawSwitch getErSky9xTimerMode(int mode)
|
||||
{
|
||||
if (mode<4)
|
||||
return TimerMode(mode);
|
||||
else if (mode < 20)
|
||||
return TimerMode(TMRMODE_FIRST_CHPERC+(mode-4));
|
||||
return RawSwitch(SWITCH_TYPE_TIMER_MODE, mode);
|
||||
else
|
||||
return TimerMode(0);
|
||||
return RawSwitch();
|
||||
}
|
||||
|
||||
RawSwitch ersky9xToSwitch(int8_t sw)
|
||||
@@ -29,9 +27,9 @@ RawSwitch ersky9xToSwitch(int8_t sw)
|
||||
else if (sw == -34)
|
||||
return RawSwitch(SWITCH_TYPE_OFF);
|
||||
else if (swa <= 34+9)
|
||||
return RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, sw > 0 ? sw-34 : sw+34);
|
||||
return RawSwitch(SWITCH_TYPE_SWITCH, sw > 0 ? sw-34 : sw+34);
|
||||
else
|
||||
return RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, sw > 0 ? sw-34-9 : sw+34+9);
|
||||
return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-34-9 : sw+34+9);
|
||||
}
|
||||
|
||||
t_Ersky9xTrainerMix::t_Ersky9xTrainerMix()
|
||||
@@ -355,22 +353,22 @@ RawSource ersky9xToSource_v11(int8_t value)
|
||||
}
|
||||
}
|
||||
|
||||
Ersky9xCustomSwData_v10::operator CustomSwData ()
|
||||
Ersky9xLogicalSwitchData_v10::operator LogicalSwitchData ()
|
||||
{
|
||||
CustomSwData c9x;
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = ersky9xToSource_v10(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_EQUAL) {
|
||||
if (c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val2 = ersky9xToSource_v10(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = er9xToSwitch(v1).toValue();
|
||||
c9x.val2 = er9xToSwitch(v2).toValue();
|
||||
}
|
||||
@@ -378,22 +376,22 @@ Ersky9xCustomSwData_v10::operator CustomSwData ()
|
||||
return c9x;
|
||||
}
|
||||
|
||||
Ersky9xCustomSwData_v11::operator CustomSwData ()
|
||||
Ersky9xLogicalSwitchData_v11::operator LogicalSwitchData ()
|
||||
{
|
||||
CustomSwData c9x;
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = ersky9xToSource_v11(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_EQUAL) {
|
||||
if (c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val2 = ersky9xToSource_v11(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = er9xToSwitch(v1).toValue();
|
||||
c9x.val2 = er9xToSwitch(v2).toValue();
|
||||
}
|
||||
@@ -406,27 +404,11 @@ t_Ersky9xSafetySwData_v10::t_Ersky9xSafetySwData_v10()
|
||||
memset(this, 0, sizeof(t_Ersky9xSafetySwData_v10));
|
||||
}
|
||||
|
||||
t_Ersky9xSafetySwData_v10::operator SafetySwData ()
|
||||
{
|
||||
SafetySwData c9x;
|
||||
c9x.swtch = er9xToSwitch(swtch);
|
||||
c9x.val = val;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Ersky9xSafetySwData_v11::t_Ersky9xSafetySwData_v11()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Ersky9xSafetySwData_v11));
|
||||
}
|
||||
|
||||
t_Ersky9xSafetySwData_v11::operator SafetySwData ()
|
||||
{
|
||||
SafetySwData c9x;
|
||||
c9x.swtch = ersky9xToSwitch(opt.ss.swtch);
|
||||
c9x.val = opt.ss.val;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Ersky9xFrSkyChannelData_v10::t_Ersky9xFrSkyChannelData_v10()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Ersky9xFrSkyChannelData_v10));
|
||||
@@ -612,8 +594,8 @@ t_Ersky9xModelData_v10::operator ModelData ()
|
||||
for (int i=0; i<ERSKY9X_NUM_CSW_V10; i++)
|
||||
c9x.customSw[i] = customSw[i];
|
||||
|
||||
for (int i=0; i<ERSKY9X_NUM_CHNOUT_V10; i++)
|
||||
c9x.safetySw[i] = safetySw[i];
|
||||
// for (int i=0; i<ERSKY9X_NUM_CHNOUT_V10; i++)
|
||||
// c9x.safetySw[i] = safetySw[i];
|
||||
|
||||
c9x.frsky = frsky;
|
||||
c9x.frsky.usrProto=FrSkyUsrProto;
|
||||
@@ -733,8 +715,8 @@ t_Ersky9xModelData_v11::operator ModelData ()
|
||||
for (int i=0; i<ERSKY9X_NUM_CSW_V11; i++)
|
||||
c9x.customSw[i] = customSw[i];
|
||||
|
||||
for (int i=0; i<ERSKY9X_NUM_CHNOUT_V11; i++)
|
||||
c9x.safetySw[i] = safetySw[i];
|
||||
// for (int i=0; i<ERSKY9X_NUM_CHNOUT_V11; i++)
|
||||
// c9x.safetySw[i] = safetySw[i];
|
||||
|
||||
c9x.frsky = frsky;
|
||||
c9x.frsky.usrProto=FrSkyUsrProto;
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
#include <inttypes.h>
|
||||
#include "eeprominterface.h"
|
||||
|
||||
extern TimerMode getEr9xTimerMode(int mode);
|
||||
extern int setEr9xTimerMode(TimerMode mode);
|
||||
extern RawSwitch getEr9xTimerMode(int mode);
|
||||
|
||||
//eeprom data
|
||||
#define ERSKY9X_MAX_MIXERS_V10 32
|
||||
@@ -186,31 +185,30 @@ PACK(typedef struct t_Ersky9xMixData_v11 {
|
||||
t_Ersky9xMixData_v11();
|
||||
}) Ersky9xMixData_v11;
|
||||
|
||||
PACK(typedef struct t_Ersky9xCustomSwData_v10 { // Custom Switches data
|
||||
PACK(typedef struct t_Ersky9xLogicalSwitchData_v10 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
|
||||
operator CustomSwData();
|
||||
t_Ersky9xCustomSwData_v10() { memset(this, 0, sizeof(t_Ersky9xCustomSwData_v10)); }
|
||||
}) Ersky9xCustomSwData_v10;
|
||||
operator LogicalSwitchData();
|
||||
t_Ersky9xLogicalSwitchData_v10() { memset(this, 0, sizeof(t_Ersky9xLogicalSwitchData_v10)); }
|
||||
}) Ersky9xLogicalSwitchData_v10;
|
||||
|
||||
PACK(typedef struct t_Ersky9xCustomSwData_v11 { // Custom Switches data
|
||||
PACK(typedef struct t_Ersky9xLogicalSwitchData_v11 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
uint8_t andsw;
|
||||
uint8_t res ;
|
||||
|
||||
operator CustomSwData();
|
||||
t_Ersky9xCustomSwData_v11() { memset(this, 0, sizeof(t_Ersky9xCustomSwData_v11)); }
|
||||
}) Ersky9xCustomSwData_v11;
|
||||
operator LogicalSwitchData();
|
||||
t_Ersky9xLogicalSwitchData_v11() { memset(this, 0, sizeof(t_Ersky9xLogicalSwitchData_v11)); }
|
||||
}) Ersky9xLogicalSwitchData_v11;
|
||||
|
||||
PACK(typedef struct t_Ersky9xSafetySwData_v10 { // Custom Switches data
|
||||
int8_t swtch;
|
||||
int8_t val;
|
||||
|
||||
operator SafetySwData();
|
||||
t_Ersky9xSafetySwData_v10();
|
||||
}) Ersky9xSafetySwData_v10;
|
||||
|
||||
@@ -230,7 +228,6 @@ PACK(typedef struct t_Ersky9xSafetySwData_v11 { // Custom Switches data
|
||||
} vs ;
|
||||
} opt ;
|
||||
|
||||
operator SafetySwData();
|
||||
t_Ersky9xSafetySwData_v11();
|
||||
}) Ersky9xSafetySwData_v11;
|
||||
|
||||
@@ -363,7 +360,7 @@ PACK(typedef struct t_Ersky9xModelData_v10 {
|
||||
int8_t trim[4];
|
||||
int8_t curves5[ERSKY9X_MAX_CURVE5][5];
|
||||
int8_t curves9[ERSKY9X_MAX_CURVE9][9];
|
||||
Ersky9xCustomSwData_v10 customSw[ERSKY9X_NUM_CSW_V10];
|
||||
Ersky9xLogicalSwitchData_v10 customSw[ERSKY9X_NUM_CSW_V10];
|
||||
uint8_t frSkyVoltThreshold ;
|
||||
uint8_t res3[2];
|
||||
Ersky9xSafetySwData_v10 safetySw[ERSKY9X_NUM_CHNOUT_V10];
|
||||
@@ -412,7 +409,7 @@ PACK(typedef struct t_Ersky9xModelData_v11 {
|
||||
int8_t curves5[ERSKY9X_MAX_CURVE5][5];
|
||||
int8_t curves9[ERSKY9X_MAX_CURVE9][9];
|
||||
int8_t curvexy[18];
|
||||
Ersky9xCustomSwData_v11 customSw[ERSKY9X_NUM_CSW_V11];
|
||||
Ersky9xLogicalSwitchData_v11 customSw[ERSKY9X_NUM_CSW_V11];
|
||||
uint8_t frSkyVoltThreshold ;
|
||||
uint8_t bt_telemetry;
|
||||
uint8_t numVoice; // 0-16, rest are Safety switches
|
||||
|
||||
@@ -74,11 +74,11 @@ inline void applyStickModeToModel(Ersky9xModelData_v10 & model, unsigned int mod
|
||||
for (int i=0; i<ERSKY9X_MAX_MIXERS_V10; i++)
|
||||
model.mixData[i].srcRaw = applyStickMode(model.mixData[i].srcRaw, mode);
|
||||
for (int i=0; i<ERSKY9X_NUM_CSW_V10; i++) {
|
||||
switch (getCSFunctionFamily(model.customSw[i].func)) {
|
||||
case CS_FAMILY_VCOMP:
|
||||
switch (LogicalSwitchData(model.customSw[i].func).getFunctionFamily()) {
|
||||
case LS_FAMILY_VCOMP:
|
||||
model.customSw[i].v2 = applyStickMode(model.customSw[i].v2, mode);
|
||||
// no break
|
||||
case CS_FAMILY_VOFS:
|
||||
case LS_FAMILY_VOFS:
|
||||
model.customSw[i].v1 = applyStickMode(model.customSw[i].v1, mode);
|
||||
break;
|
||||
default:
|
||||
@@ -106,11 +106,11 @@ inline void applyStickModeToModel(Ersky9xModelData_v11 & model, unsigned int mod
|
||||
for (int i=0; i<ERSKY9X_MAX_MIXERS_V11; i++)
|
||||
model.mixData[i].srcRaw = applyStickMode(model.mixData[i].srcRaw, mode);
|
||||
for (int i=0; i<ERSKY9X_NUM_CSW_V11; i++) {
|
||||
switch (getCSFunctionFamily(model.customSw[i].func)) {
|
||||
case CS_FAMILY_VCOMP:
|
||||
switch (LogicalSwitchData(model.customSw[i].func).getFunctionFamily()) {
|
||||
case LS_FAMILY_VCOMP:
|
||||
model.customSw[i].v2 = applyStickMode(model.customSw[i].v2, mode);
|
||||
// no break
|
||||
case CS_FAMILY_VOFS:
|
||||
case LS_FAMILY_VOFS:
|
||||
model.customSw[i].v1 = applyStickMode(model.customSw[i].v1, mode);
|
||||
break;
|
||||
default:
|
||||
@@ -285,7 +285,7 @@ int Ersky9xInterface::getCapability(const Capability capability)
|
||||
return 9;
|
||||
case CustomFunctions:
|
||||
return 0;
|
||||
case CustomSwitches:
|
||||
case LogicalSwitches:
|
||||
return ERSKY9X_NUM_CSW_V11;
|
||||
case CustomAndSwitches:
|
||||
return 1;
|
||||
@@ -317,8 +317,6 @@ int Ersky9xInterface::getCapability(const Capability capability)
|
||||
return 125;
|
||||
case MaxVolume:
|
||||
return 23;
|
||||
case GvarsHaveSources:
|
||||
return 1;
|
||||
case TelemetryMaxMultiplier:
|
||||
return 2;
|
||||
case LCDWidth:
|
||||
|
||||
@@ -301,22 +301,22 @@ RawSource gruvin9xToSource(int8_t value)
|
||||
}
|
||||
}
|
||||
|
||||
Gruvin9xCustomSwData::operator CustomSwData ()
|
||||
Gruvin9xLogicalSwitchData::operator LogicalSwitchData ()
|
||||
{
|
||||
CustomSwData c9x;
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = gruvin9xToSource(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_EQUAL) {
|
||||
if (c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val2 = gruvin9xToSource(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = gruvin9xToSwitch(v1).toValue();
|
||||
c9x.val2 = gruvin9xToSwitch(v2).toValue();
|
||||
}
|
||||
@@ -332,14 +332,6 @@ Gruvin9xFuncSwData::operator FuncSwData ()
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Gruvin9xSafetySwData::operator SafetySwData ()
|
||||
{
|
||||
SafetySwData c9x;
|
||||
c9x.swtch = gruvin9xToSwitch(swtch);
|
||||
c9x.val = val;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Gruvin9xSwashRingData::t_Gruvin9xSwashRingData()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Gruvin9xSwashRingData));
|
||||
@@ -381,7 +373,7 @@ t_Gruvin9xPhaseData_v106::operator PhaseData ()
|
||||
return c9x;
|
||||
}
|
||||
|
||||
extern TimerMode getEr9xTimerMode(int mode);
|
||||
extern RawSwitch getEr9xTimerMode(int mode);
|
||||
|
||||
t_Gruvin9xTimerData::operator TimerData ()
|
||||
{
|
||||
@@ -489,8 +481,8 @@ t_Gruvin9xModelData_v102::operator ModelData ()
|
||||
|
||||
for (int i=0; i<G9X_NUM_CSW; i++)
|
||||
c9x.customSw[i] = customSw[i];
|
||||
for (int i=0; i<G9X_NUM_CHNOUT; i++)
|
||||
c9x.safetySw[i] = safetySw[i];
|
||||
// for (int i=0; i<G9X_NUM_CHNOUT; i++)
|
||||
// c9x.safetySw[i] = safetySw[i];
|
||||
c9x.swashRingData = swashR;
|
||||
c9x.frsky = frsky;
|
||||
return c9x;
|
||||
@@ -560,8 +552,8 @@ t_Gruvin9xModelData_v103::operator ModelData ()
|
||||
|
||||
for (int i=0; i<G9X_NUM_CSW; i++)
|
||||
c9x.customSw[i] = customSw[i];
|
||||
for (int i=0; i<G9X_NUM_CHNOUT; i++)
|
||||
c9x.safetySw[i] = safetySw[i];
|
||||
// for (int i=0; i<G9X_NUM_CHNOUT; i++)
|
||||
// c9x.safetySw[i] = safetySw[i];
|
||||
c9x.swashRingData = swashR;
|
||||
c9x.frsky = frsky;
|
||||
return c9x;
|
||||
@@ -650,8 +642,8 @@ t_Gruvin9xModelData_v105::operator ModelData ()
|
||||
c9x.customSw[i] = customSw[i];
|
||||
for (int i=0; i<G9X_NUM_FSW; i++)
|
||||
c9x.funcSw[i] = funcSw[i];
|
||||
for (int i=0; i<G9X_NUM_CHNOUT; i++)
|
||||
c9x.safetySw[i] = safetySw[i];
|
||||
// for (int i=0; i<G9X_NUM_CHNOUT; i++)
|
||||
// c9x.safetySw[i] = safetySw[i];
|
||||
c9x.swashRingData = swashR;
|
||||
c9x.frsky = frsky;
|
||||
|
||||
@@ -734,8 +726,8 @@ t_Gruvin9xModelData_v106::operator ModelData ()
|
||||
c9x.customSw[i] = customSw[i];
|
||||
for (int i=0; i<G9X_NUM_FSW; i++)
|
||||
c9x.funcSw[i] = funcSw[i];
|
||||
for (int i=0; i<G9X_NUM_CHNOUT; i++)
|
||||
c9x.safetySw[i] = safetySw[i];
|
||||
// for (int i=0; i<G9X_NUM_CHNOUT; i++)
|
||||
// c9x.safetySw[i] = safetySw[i];
|
||||
c9x.swashRingData = swashR;
|
||||
c9x.frsky = frsky;
|
||||
|
||||
|
||||
@@ -186,20 +186,19 @@ PACK(typedef struct t_Gruvin9xMixData {
|
||||
t_Gruvin9xMixData();
|
||||
}) Gruvin9xMixData;
|
||||
|
||||
PACK(typedef struct t_Gruvin9xCustomSwData { // Custom Switches data
|
||||
PACK(typedef struct t_Gruvin9xLogicalSwitchData { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
|
||||
operator CustomSwData();
|
||||
t_Gruvin9xCustomSwData() { memset(this, 0, sizeof(t_Gruvin9xCustomSwData)); }
|
||||
}) Gruvin9xCustomSwData;
|
||||
operator LogicalSwitchData();
|
||||
t_Gruvin9xLogicalSwitchData() { memset(this, 0, sizeof(t_Gruvin9xLogicalSwitchData)); }
|
||||
}) Gruvin9xLogicalSwitchData;
|
||||
|
||||
PACK(typedef struct t_Gruvin9xSafetySwData { // Safety Switches data
|
||||
int8_t swtch;
|
||||
int8_t val;
|
||||
|
||||
operator SafetySwData();
|
||||
t_Gruvin9xSafetySwData() { memset(this, 0, sizeof(t_Gruvin9xSafetySwData)); }
|
||||
}) Gruvin9xSafetySwData;
|
||||
|
||||
@@ -310,7 +309,7 @@ PACK(typedef struct t_Gruvin9xModelData_v102 {
|
||||
Gruvin9xExpoData expoData[G9X_MAX_EXPOS];
|
||||
int8_t curves5[G9X_MAX_CURVE5][5];
|
||||
int8_t curves9[G9X_MAX_CURVE9][9];
|
||||
Gruvin9xCustomSwData customSw[G9X_NUM_CSW];
|
||||
Gruvin9xLogicalSwitchData customSw[G9X_NUM_CSW];
|
||||
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
|
||||
Gruvin9xSwashRingData swashR;
|
||||
Gruvin9xPhaseData_v102 phaseData[G9X_MAX_PHASES];
|
||||
@@ -342,7 +341,7 @@ PACK(typedef struct t_Gruvin9xModelData_v103 {
|
||||
Gruvin9xExpoData expoData[G9X_MAX_EXPOS];
|
||||
int8_t curves5[G9X_MAX_CURVE5][5];
|
||||
int8_t curves9[G9X_MAX_CURVE9][9];
|
||||
Gruvin9xCustomSwData customSw[G9X_NUM_CSW];
|
||||
Gruvin9xLogicalSwitchData customSw[G9X_NUM_CSW];
|
||||
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
|
||||
Gruvin9xSwashRingData swashR;
|
||||
Gruvin9xPhaseData_v102 phaseData[G9X_MAX_PHASES];
|
||||
@@ -374,7 +373,7 @@ PACK(typedef struct t_Gruvin9xModelData_v105 {
|
||||
Gruvin9xExpoData expoData[G9X_MAX_EXPOS];
|
||||
int8_t curves5[G9X_MAX_CURVE5][5];
|
||||
int8_t curves9[G9X_MAX_CURVE9][9];
|
||||
Gruvin9xCustomSwData customSw[G9X_NUM_CSW];
|
||||
Gruvin9xLogicalSwitchData customSw[G9X_NUM_CSW];
|
||||
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
|
||||
Gruvin9xFuncSwData funcSw[G9X_NUM_FSW];
|
||||
Gruvin9xSwashRingData swashR;
|
||||
@@ -406,7 +405,7 @@ PACK(typedef struct t_Gruvin9xModelData_v106 {
|
||||
Gruvin9xExpoData expoData[G9X_MAX_EXPOS];
|
||||
int8_t curves5[G9X_MAX_CURVE5][5];
|
||||
int8_t curves9[G9X_MAX_CURVE9][9];
|
||||
Gruvin9xCustomSwData customSw[G9X_NUM_CSW];
|
||||
Gruvin9xLogicalSwitchData customSw[G9X_NUM_CSW];
|
||||
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
|
||||
Gruvin9xFuncSwData funcSw[G9X_NUM_FSW];
|
||||
Gruvin9xSwashRingData swashR;
|
||||
|
||||
@@ -237,7 +237,7 @@ int Gruvin9xInterface::getCapability(const Capability capability)
|
||||
return 9;
|
||||
case CustomFunctions:
|
||||
return 12;
|
||||
case CustomSwitches:
|
||||
case LogicalSwitches:
|
||||
return 12;
|
||||
case CSFunc:
|
||||
return 13;
|
||||
|
||||
@@ -293,22 +293,22 @@ RawSource open9xV4209ToSource(int8_t value)
|
||||
}
|
||||
}
|
||||
|
||||
Open9xGruvin9xCustomSwData_v207::operator CustomSwData ()
|
||||
Open9xGruvin9xLogicalSwitchData_v207::operator LogicalSwitchData ()
|
||||
{
|
||||
CustomSwData c9x;
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = open9xV4207ToSource(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_EQUAL) {
|
||||
if (c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val2 = open9xV4207ToSource(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = open9xStockToSwitch(v1).toValue();
|
||||
c9x.val2 = open9xStockToSwitch(v2).toValue();
|
||||
}
|
||||
@@ -316,22 +316,22 @@ Open9xGruvin9xCustomSwData_v207::operator CustomSwData ()
|
||||
return c9x;
|
||||
}
|
||||
|
||||
Open9xGruvin9xCustomSwData_v209::operator CustomSwData ()
|
||||
Open9xGruvin9xLogicalSwitchData_v209::operator LogicalSwitchData ()
|
||||
{
|
||||
CustomSwData c9x;
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = open9xV4209ToSource(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_EQUAL && c9x.func <= CS_FN_ELESS) {
|
||||
if (c9x.func >= LS_FN_EQUAL && c9x.func <= LS_FN_ELESS) {
|
||||
c9x.val2 = open9xV4209ToSource(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = open9xStockToSwitch(v1).toValue();
|
||||
c9x.val2 = open9xStockToSwitch(v2).toValue();
|
||||
}
|
||||
|
||||
@@ -110,27 +110,27 @@ PACK(typedef struct t_Open9xGruvin9xMixData_v211 {
|
||||
t_Open9xGruvin9xMixData_v211() { memset(this, 0, sizeof(t_Open9xGruvin9xMixData_v211)); }
|
||||
}) Open9xGruvin9xMixData_v211;
|
||||
|
||||
PACK(typedef struct t_Open9xGruvin9xCustomSwData_v207 { // Custom Switches data
|
||||
PACK(typedef struct t_Open9xGruvin9xLogicalSwitchData_v207 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
|
||||
operator CustomSwData();
|
||||
t_Open9xGruvin9xCustomSwData_v207() { memset(this, 0, sizeof(t_Open9xGruvin9xCustomSwData_v207)); }
|
||||
operator LogicalSwitchData();
|
||||
t_Open9xGruvin9xLogicalSwitchData_v207() { memset(this, 0, sizeof(t_Open9xGruvin9xLogicalSwitchData_v207)); }
|
||||
int8_t fromSource(RawSource source);
|
||||
RawSource toSource(int8_t value);
|
||||
}) Open9xGruvin9xCustomSwData_v207;
|
||||
}) Open9xGruvin9xLogicalSwitchData_v207;
|
||||
|
||||
PACK(typedef struct t_Open9xGruvin9xCustomSwData_v209 { // Custom Switches data
|
||||
PACK(typedef struct t_Open9xGruvin9xLogicalSwitchData_v209 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
|
||||
operator CustomSwData();
|
||||
t_Open9xGruvin9xCustomSwData_v209() { memset(this, 0, sizeof(t_Open9xGruvin9xCustomSwData_v209)); }
|
||||
operator LogicalSwitchData();
|
||||
t_Open9xGruvin9xLogicalSwitchData_v209() { memset(this, 0, sizeof(t_Open9xGruvin9xLogicalSwitchData_v209)); }
|
||||
int8_t fromSource(RawSource source);
|
||||
RawSource toSource(int8_t value);
|
||||
}) Open9xGruvin9xCustomSwData_v209;
|
||||
}) Open9xGruvin9xLogicalSwitchData_v209;
|
||||
|
||||
PACK(typedef struct t_Open9xGruvin9xFuncSwData_v203 { // Function Switches data
|
||||
int8_t swtch; // input
|
||||
@@ -194,7 +194,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v207 {
|
||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xGruvin9xCustomSwData_v207 customSw[O9X_NUM_CSW];
|
||||
Open9xGruvin9xLogicalSwitchData_v207 customSw[O9X_NUM_CSW];
|
||||
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
||||
Open9xGruvin9xSwashRingData_v208 swashR;
|
||||
Open9xGruvin9xPhaseData_v207 phaseData[O9X_MAX_PHASES];
|
||||
@@ -228,7 +228,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v208 {
|
||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xGruvin9xCustomSwData_v207 customSw[O9X_NUM_CSW];
|
||||
Open9xGruvin9xLogicalSwitchData_v207 customSw[O9X_NUM_CSW];
|
||||
Open9xGruvin9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
||||
Open9xGruvin9xSwashRingData_v208 swashR;
|
||||
Open9xGruvin9xPhaseData_v208 phaseData[O9X_MAX_PHASES];
|
||||
@@ -267,7 +267,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v209 {
|
||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xGruvin9xCustomSwData_v209 customSw[O9X_NUM_CSW];
|
||||
Open9xGruvin9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
|
||||
Open9xGruvin9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
||||
Open9xGruvin9xSwashRingData_v209 swashR;
|
||||
Open9xGruvin9xPhaseData_v208 phaseData[O9X_MAX_PHASES];
|
||||
@@ -307,7 +307,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v210 {
|
||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves[O9X_MAX_CURVES];
|
||||
int8_t points[O9X_NUM_POINTS];
|
||||
Open9xGruvin9xCustomSwData_v209 customSw[O9X_NUM_CSW];
|
||||
Open9xGruvin9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
|
||||
Open9xGruvin9xFuncSwData_v210 funcSw[O9X_NUM_FSW];
|
||||
Open9xGruvin9xSwashRingData_v209 swashR;
|
||||
Open9xGruvin9xPhaseData_v208 phaseData[O9X_MAX_PHASES];
|
||||
@@ -345,7 +345,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v211 {
|
||||
Open9xExpoData_v211 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves[O9X_MAX_CURVES];
|
||||
int8_t points[O9X_NUM_POINTS];
|
||||
Open9xGruvin9xCustomSwData_v209 customSw[O9X_NUM_CSW];
|
||||
Open9xGruvin9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
|
||||
Open9xGruvin9xFuncSwData_v210 funcSw[O9X_NUM_FSW];
|
||||
Open9xGruvin9xSwashRingData_v209 swashR;
|
||||
Open9xGruvin9xPhaseData_v208 phaseData[O9X_MAX_PHASES];
|
||||
|
||||
@@ -19,13 +19,13 @@ RawSwitch open9xArmToSwitch(int8_t sw)
|
||||
else if (sw == 42)
|
||||
return RawSwitch(SWITCH_TYPE_ON);
|
||||
else if (sw == 84)
|
||||
return RawSwitch(SWITCH_TYPE_ONM);
|
||||
return RawSwitch(SWITCH_TYPE_ON);
|
||||
else if (sw == -42)
|
||||
return RawSwitch(SWITCH_TYPE_OFF);
|
||||
else if (swa <= 42+9)
|
||||
return RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, sw > 0 ? sw-42 : sw+42);
|
||||
return RawSwitch(SWITCH_TYPE_SWITCH, sw > 0 ? sw-42 : sw+42);
|
||||
else
|
||||
return RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, sw > 0 ? sw-42-9 : sw+42+9);
|
||||
return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-42-9 : sw+42+9);
|
||||
}
|
||||
|
||||
RawSource open9xArm208ToSource(int8_t value)
|
||||
@@ -124,9 +124,9 @@ RawSource open9xArm210ToSource(int8_t value)
|
||||
t_Open9xArmTimerData_v202::operator TimerData ()
|
||||
{
|
||||
TimerData c9x;
|
||||
|
||||
/*
|
||||
if (mode <= -42)
|
||||
c9x.mode = TimerMode(TMRMODE_FIRST_NEG_MOMENT_SWITCH+(mode+22));
|
||||
c9x.mode = TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+22));
|
||||
else if (mode <= -1)
|
||||
c9x.mode = TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+1));
|
||||
else if (mode < 5)
|
||||
@@ -134,8 +134,8 @@ t_Open9xArmTimerData_v202::operator TimerData ()
|
||||
else if (mode < 5+41)
|
||||
c9x.mode = TimerMode(TMRMODE_FIRST_SWITCH+(mode-5));
|
||||
else
|
||||
c9x.mode = TimerMode(TMRMODE_FIRST_MOMENT_SWITCH+(mode-5-21));
|
||||
|
||||
c9x.mode = TimerMode(TMRMODE_FIRST_SWITCH+(mode-5-21));
|
||||
*/
|
||||
c9x.val = val;
|
||||
c9x.persistent = false;
|
||||
c9x.dir = (val == 0);
|
||||
@@ -501,22 +501,22 @@ t_Open9xArmMixData_v212::operator MixData ()
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Open9xArmCustomSwData_v208::operator CustomSwData ()
|
||||
t_Open9xArmLogicalSwitchData_v208::operator LogicalSwitchData ()
|
||||
{
|
||||
CustomSwData c9x;
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = open9xArm208ToSource(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_EQUAL) {
|
||||
if (c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val2 = open9xArm208ToSource(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = open9xArmToSwitch(v1).toValue();
|
||||
c9x.val2 = open9xArmToSwitch(v2).toValue();
|
||||
}
|
||||
@@ -524,22 +524,22 @@ t_Open9xArmCustomSwData_v208::operator CustomSwData ()
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Open9xArmCustomSwData_v209::operator CustomSwData ()
|
||||
t_Open9xArmLogicalSwitchData_v209::operator LogicalSwitchData ()
|
||||
{
|
||||
CustomSwData c9x;
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = open9xArm209ToSource(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_EQUAL) {
|
||||
if (c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val2 = open9xArm209ToSource(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = open9xArmToSwitch(v1).toValue();
|
||||
c9x.val2 = open9xArmToSwitch(v2).toValue();
|
||||
}
|
||||
@@ -547,24 +547,24 @@ t_Open9xArmCustomSwData_v209::operator CustomSwData ()
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Open9xArmCustomSwData_v210::operator CustomSwData ()
|
||||
t_Open9xArmLogicalSwitchData_v210::operator LogicalSwitchData ()
|
||||
{
|
||||
CustomSwData c9x;
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
c9x.delay = delay;
|
||||
c9x.duration = duration;
|
||||
|
||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = open9xArm210ToSource(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_EQUAL && c9x.func <= CS_FN_ELESS) {
|
||||
if (c9x.func >= LS_FN_EQUAL && c9x.func <= LS_FN_ELESS) {
|
||||
c9x.val2 = open9xArm210ToSource(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = open9xArmToSwitch(v1).toValue();
|
||||
c9x.val2 = open9xArmToSwitch(v2).toValue();
|
||||
}
|
||||
@@ -577,7 +577,7 @@ t_Open9xArmFuncSwData_v208::operator FuncSwData ()
|
||||
FuncSwData c9x;
|
||||
c9x.swtch = open9xArmToSwitch(swtch);
|
||||
c9x.func = (AssignFunc)(func);
|
||||
if (c9x.func <= FuncSafetyCh16) {
|
||||
if (c9x.func <= FuncSafetyCh32) {
|
||||
c9x.enabled=param & 0x01;
|
||||
c9x.param = (param>>1)<<1;
|
||||
}
|
||||
|
||||
@@ -190,34 +190,34 @@ PACK(typedef struct t_Open9xArmPhaseData_v212 {
|
||||
t_Open9xArmPhaseData_v212() { memset(this, 0, sizeof(t_Open9xArmPhaseData_v212)); }
|
||||
}) Open9xArmPhaseData_v212;
|
||||
|
||||
PACK(typedef struct t_Open9xArmCustomSwData_v208 { // Custom Switches data
|
||||
PACK(typedef struct t_Open9xArmLogicalSwitchData_v208 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
|
||||
operator CustomSwData();
|
||||
t_Open9xArmCustomSwData_v208() { memset(this, 0, sizeof(t_Open9xArmCustomSwData_v208)); }
|
||||
}) Open9xArmCustomSwData_v208;
|
||||
operator LogicalSwitchData();
|
||||
t_Open9xArmLogicalSwitchData_v208() { memset(this, 0, sizeof(t_Open9xArmLogicalSwitchData_v208)); }
|
||||
}) Open9xArmLogicalSwitchData_v208;
|
||||
|
||||
PACK(typedef struct t_Open9xArmCustomSwData_v209 { // Custom Switches data
|
||||
PACK(typedef struct t_Open9xArmLogicalSwitchData_v209 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
|
||||
operator CustomSwData();
|
||||
t_Open9xArmCustomSwData_v209() { memset(this, 0, sizeof(t_Open9xArmCustomSwData_v209)); }
|
||||
}) Open9xArmCustomSwData_v209;
|
||||
operator LogicalSwitchData();
|
||||
t_Open9xArmLogicalSwitchData_v209() { memset(this, 0, sizeof(t_Open9xArmLogicalSwitchData_v209)); }
|
||||
}) Open9xArmLogicalSwitchData_v209;
|
||||
|
||||
PACK(typedef struct t_Open9xArmCustomSwData_v210 { // Custom Switches data
|
||||
PACK(typedef struct t_Open9xArmLogicalSwitchData_v210 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
uint8_t delay;
|
||||
uint8_t duration;
|
||||
|
||||
operator CustomSwData();
|
||||
t_Open9xArmCustomSwData_v210() { memset(this, 0, sizeof(t_Open9xArmCustomSwData_v210)); }
|
||||
}) Open9xArmCustomSwData_v210;
|
||||
operator LogicalSwitchData();
|
||||
t_Open9xArmLogicalSwitchData_v210() { memset(this, 0, sizeof(t_Open9xArmLogicalSwitchData_v210)); }
|
||||
}) Open9xArmLogicalSwitchData_v210;
|
||||
|
||||
PACK(typedef struct t_Open9xArmFuncSwData_v208 { // Function Switches data
|
||||
int8_t swtch; // input
|
||||
@@ -343,7 +343,7 @@ PACK(typedef struct t_Open9xArmModelData_v208 {
|
||||
Open9xArmExpoData_v208 expoData[O9X_ARM_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xArmCustomSwData_v208 customSw[O9X_ARM_NUM_CSW];
|
||||
Open9xArmLogicalSwitchData_v208 customSw[O9X_ARM_NUM_CSW];
|
||||
Open9xArmFuncSwData_v208 funcSw[O9X_ARM_NUM_FSW];
|
||||
Open9xArmSwashRingData_v208 swashR;
|
||||
Open9xArmPhaseData_v208 phaseData[O9X_ARM_MAX_PHASES];
|
||||
@@ -382,7 +382,7 @@ PACK(typedef struct t_Open9xArmModelData_v209 {
|
||||
Open9xArmExpoData_v208 expoData[O9X_ARM_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xArmCustomSwData_v209 customSw[O9X_ARM_NUM_CSW];
|
||||
Open9xArmLogicalSwitchData_v209 customSw[O9X_ARM_NUM_CSW];
|
||||
Open9xArmFuncSwData_v208 funcSw[O9X_ARM_NUM_FSW];
|
||||
Open9xArmSwashRingData_v209 swashR;
|
||||
Open9xArmPhaseData_v208 phaseData[O9X_ARM_MAX_PHASES];
|
||||
@@ -422,7 +422,7 @@ PACK(typedef struct t_Open9xArmModelData_v210 {
|
||||
Open9xArmExpoData_v210 expoData[O9X_ARM_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xArmCustomSwData_v210 customSw[O9X_ARM_NUM_CSW];
|
||||
Open9xArmLogicalSwitchData_v210 customSw[O9X_ARM_NUM_CSW];
|
||||
Open9xArmFuncSwData_v210 funcSw[O9X_ARM_NUM_FSW];
|
||||
Open9xArmSwashRingData_v209 swashR;
|
||||
Open9xArmPhaseData_v208 phaseData[O9X_ARM_MAX_PHASES];
|
||||
@@ -461,7 +461,7 @@ PACK(typedef struct t_Open9xArmModelData_v211 {
|
||||
Open9xArmExpoData_v210 expoData[O9X_ARM_MAX_EXPOS];
|
||||
int16_t curves[O9X_ARM_MAX_CURVES];
|
||||
int8_t points[O9X_ARM_NUM_POINTS];
|
||||
Open9xArmCustomSwData_v210 customSw[O9X_ARM_NUM_CSW];
|
||||
Open9xArmLogicalSwitchData_v210 customSw[O9X_ARM_NUM_CSW];
|
||||
Open9xArmFuncSwData_v211 funcSw[O9X_ARM_NUM_FSW];
|
||||
Open9xArmSwashRingData_v209 swashR;
|
||||
Open9xArmPhaseData_v208 phaseData[O9X_ARM_MAX_PHASES];
|
||||
@@ -499,7 +499,7 @@ PACK(typedef struct t_Open9xArmModelData_v212 {
|
||||
Open9xArmExpoData_v212 expoData[O9X_ARM_MAX_EXPOS];
|
||||
int16_t curves[O9X_ARM_MAX_CURVES];
|
||||
int8_t points[O9X_ARM_NUM_POINTS];
|
||||
Open9xArmCustomSwData_v210 customSw[O9X_ARM_NUM_CSW];
|
||||
Open9xArmLogicalSwitchData_v210 customSw[O9X_ARM_NUM_CSW];
|
||||
Open9xArmFuncSwData_v211 funcSw[O9X_ARM_NUM_FSW];
|
||||
Open9xArmSwashRingData_v210 swashR;
|
||||
Open9xArmPhaseData_v212 phaseData[O9X_ARM_MAX_PHASES];
|
||||
|
||||
@@ -74,13 +74,13 @@ RawSwitch open9xStockToSwitch(int8_t sw)
|
||||
else if (sw == 22)
|
||||
return RawSwitch(SWITCH_TYPE_ON);
|
||||
else if (sw == 44)
|
||||
return RawSwitch(SWITCH_TYPE_ONM);
|
||||
return RawSwitch(SWITCH_TYPE_ON);
|
||||
else if (sw == -22)
|
||||
return RawSwitch(SWITCH_TYPE_OFF);
|
||||
else if (swa <= 22+9)
|
||||
return RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, sw > 0 ? sw-22 : sw+22);
|
||||
return RawSwitch(SWITCH_TYPE_SWITCH, sw > 0 ? sw-22 : sw+22);
|
||||
else
|
||||
return RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, sw > 0 ? sw-22-9 : sw+22+9);
|
||||
return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-22-9 : sw+22+9);
|
||||
}
|
||||
|
||||
t_Open9xExpoData_v201::operator ExpoData ()
|
||||
@@ -518,22 +518,22 @@ RawSource open9xStock209ToSource(int8_t value)
|
||||
}
|
||||
}
|
||||
|
||||
Open9xCustomSwData_v208::operator CustomSwData ()
|
||||
Open9xLogicalSwitchData_v208::operator LogicalSwitchData ()
|
||||
{
|
||||
CustomSwData c9x;
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = open9x208ToSource(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_EQUAL) {
|
||||
if (c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val2 = open9x208ToSource(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = open9xStockToSwitch(v1).toValue();
|
||||
c9x.val2 = open9xStockToSwitch(v2).toValue();
|
||||
}
|
||||
@@ -541,22 +541,22 @@ Open9xCustomSwData_v208::operator CustomSwData ()
|
||||
return c9x;
|
||||
}
|
||||
|
||||
Open9xCustomSwData_v209::operator CustomSwData ()
|
||||
Open9xLogicalSwitchData_v209::operator LogicalSwitchData ()
|
||||
{
|
||||
CustomSwData c9x;
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = open9xStock209ToSource(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_EQUAL && c9x.func <= CS_FN_ELESS) {
|
||||
if (c9x.func >= LS_FN_EQUAL && c9x.func <= LS_FN_ELESS) {
|
||||
c9x.val2 = open9xStock209ToSource(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = open9xStockToSwitch(v1).toValue();
|
||||
c9x.val2 = open9xStockToSwitch(v2).toValue();
|
||||
}
|
||||
@@ -662,14 +662,6 @@ t_Open9xFuncSwData_v210::operator FuncSwData ()
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Open9xSafetySwData::operator SafetySwData ()
|
||||
{
|
||||
SafetySwData c9x;
|
||||
c9x.swtch = open9xStockToSwitch(swtch);
|
||||
c9x.val = val;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Open9xSwashRingData_v208::operator SwashRingData ()
|
||||
{
|
||||
SwashRingData c9x;
|
||||
@@ -709,7 +701,7 @@ t_Open9xPhaseData_v201::operator PhaseData ()
|
||||
t_Open9xTimerData_v201::operator TimerData ()
|
||||
{
|
||||
TimerData c9x;
|
||||
c9x.mode = TMRMODE_OFF;
|
||||
// c9x.mode = TMRMODE_OFF;
|
||||
c9x.val = val;
|
||||
c9x.persistent = persistent;
|
||||
c9x.dir = dir;
|
||||
@@ -719,9 +711,9 @@ t_Open9xTimerData_v201::operator TimerData ()
|
||||
t_Open9xTimerData_v202::operator TimerData ()
|
||||
{
|
||||
TimerData c9x;
|
||||
|
||||
/*
|
||||
if (mode <= -22)
|
||||
c9x.mode = TimerMode(TMRMODE_FIRST_NEG_MOMENT_SWITCH+(mode+22));
|
||||
c9x.mode = TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+22));
|
||||
else if (mode <= -1)
|
||||
c9x.mode = TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+1));
|
||||
else if (mode < 5)
|
||||
@@ -729,8 +721,8 @@ t_Open9xTimerData_v202::operator TimerData ()
|
||||
else if (mode < 5+21)
|
||||
c9x.mode = TimerMode(TMRMODE_FIRST_SWITCH+(mode-5));
|
||||
else
|
||||
c9x.mode = TimerMode(TMRMODE_FIRST_MOMENT_SWITCH+(mode-5-21));
|
||||
|
||||
c9x.mode = TimerMode(TMRMODE_FIRST_SWITCH+(mode-5-21));
|
||||
*/
|
||||
c9x.val = val;
|
||||
c9x.persistent = false;
|
||||
c9x.dir = (val == 0);
|
||||
@@ -993,8 +985,8 @@ t_Open9xModelData_v201::operator ModelData ()
|
||||
c9x.customSw[i] = customSw[i];
|
||||
for (int i=0; i<12; i++)
|
||||
c9x.funcSw[i] = funcSw[i];
|
||||
for (int i=0; i<O9X_NUM_CHNOUT; i++)
|
||||
c9x.safetySw[i] = safetySw[i];
|
||||
// for (int i=0; i<O9X_NUM_CHNOUT; i++)
|
||||
// c9x.safetySw[i] = safetySw[i];
|
||||
c9x.swashRingData = swashR;
|
||||
c9x.frsky = frsky;
|
||||
|
||||
@@ -1067,8 +1059,8 @@ t_Open9xModelData_v202::operator ModelData ()
|
||||
c9x.customSw[i] = customSw[i];
|
||||
for (int i=0; i<12; i++)
|
||||
c9x.funcSw[i] = funcSw[i];
|
||||
for (int i=0; i<O9X_NUM_CHNOUT; i++)
|
||||
c9x.safetySw[i] = safetySw[i];
|
||||
// for (int i=0; i<O9X_NUM_CHNOUT; i++)
|
||||
// c9x.safetySw[i] = safetySw[i];
|
||||
c9x.swashRingData = swashR;
|
||||
c9x.frsky = frsky;
|
||||
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
|
||||
|
||||
@@ -221,30 +221,29 @@ PACK(typedef struct t_Open9xMixData_v211 {
|
||||
t_Open9xMixData_v211() { memset(this, 0, sizeof(t_Open9xMixData_v211)); }
|
||||
}) Open9xMixData_v211;
|
||||
|
||||
PACK(typedef struct t_Open9xCustomSwData_v208 { // Custom Switches data
|
||||
PACK(typedef struct t_Open9xLogicalSwitchData_v208 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
|
||||
operator CustomSwData();
|
||||
t_Open9xCustomSwData_v208() { memset(this, 0, sizeof(t_Open9xCustomSwData_v208)); }
|
||||
t_Open9xCustomSwData_v208(CustomSwData&);
|
||||
}) Open9xCustomSwData_v208;
|
||||
operator LogicalSwitchData();
|
||||
t_Open9xLogicalSwitchData_v208() { memset(this, 0, sizeof(t_Open9xLogicalSwitchData_v208)); }
|
||||
t_Open9xLogicalSwitchData_v208(LogicalSwitchData&);
|
||||
}) Open9xLogicalSwitchData_v208;
|
||||
|
||||
PACK(typedef struct t_Open9xCustomSwData_v209 { // Custom Switches data
|
||||
PACK(typedef struct t_Open9xLogicalSwitchData_v209 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
|
||||
operator CustomSwData();
|
||||
t_Open9xCustomSwData_v209() { memset(this, 0, sizeof(t_Open9xCustomSwData_v209)); }
|
||||
}) Open9xCustomSwData_v209;
|
||||
operator LogicalSwitchData();
|
||||
t_Open9xLogicalSwitchData_v209() { memset(this, 0, sizeof(t_Open9xLogicalSwitchData_v209)); }
|
||||
}) Open9xLogicalSwitchData_v209;
|
||||
|
||||
PACK(typedef struct t_Open9xSafetySwData { // Safety Switches data
|
||||
int8_t swtch;
|
||||
int8_t val;
|
||||
|
||||
operator SafetySwData();
|
||||
t_Open9xSafetySwData() { memset(this, 0, sizeof(t_Open9xSafetySwData)); }
|
||||
}) Open9xSafetySwData;
|
||||
|
||||
@@ -517,7 +516,7 @@ PACK(typedef struct t_Open9xModelData_v201 {
|
||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xCustomSwData_v208 customSw[O9X_NUM_CSW];
|
||||
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
|
||||
Open9xSafetySwData safetySw[O9X_NUM_CHNOUT];
|
||||
Open9xFuncSwData_v201 funcSw[12];
|
||||
Open9xSwashRingData_v208 swashR;
|
||||
@@ -548,7 +547,7 @@ PACK(typedef struct t_Open9xModelData_v202 {
|
||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xCustomSwData_v208 customSw[O9X_NUM_CSW];
|
||||
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
|
||||
Open9xSafetySwData safetySw[O9X_NUM_CHNOUT];
|
||||
Open9xFuncSwData_v201 funcSw[12];
|
||||
Open9xSwashRingData_v208 swashR;
|
||||
@@ -582,7 +581,7 @@ PACK(typedef struct t_Open9xModelData_v203 {
|
||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xCustomSwData_v208 customSw[O9X_NUM_CSW];
|
||||
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
|
||||
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
||||
Open9xSwashRingData_v208 swashR;
|
||||
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
||||
@@ -615,7 +614,7 @@ PACK(typedef struct t_Open9xModelData_v204 {
|
||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xCustomSwData_v208 customSw[O9X_NUM_CSW];
|
||||
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
|
||||
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
||||
Open9xSwashRingData_v208 swashR;
|
||||
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
||||
@@ -648,7 +647,7 @@ PACK(typedef struct t_Open9xModelData_v205 {
|
||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xCustomSwData_v208 customSw[O9X_NUM_CSW];
|
||||
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
|
||||
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
||||
Open9xSwashRingData_v208 swashR;
|
||||
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
||||
@@ -683,7 +682,7 @@ PACK(typedef struct t_Open9xModelData_v208 {
|
||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xCustomSwData_v208 customSw[O9X_NUM_CSW];
|
||||
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
|
||||
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
||||
Open9xSwashRingData_v208 swashR;
|
||||
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
||||
@@ -722,7 +721,7 @@ PACK(typedef struct t_Open9xModelData_v209 {
|
||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xCustomSwData_v209 customSw[O9X_NUM_CSW];
|
||||
Open9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
|
||||
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
||||
Open9xSwashRingData_v209 swashR;
|
||||
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
||||
@@ -762,7 +761,7 @@ PACK(typedef struct t_Open9xModelData_v210 {
|
||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves[O9X_MAX_CURVES];
|
||||
int8_t points[O9X_NUM_POINTS];
|
||||
Open9xCustomSwData_v209 customSw[O9X_NUM_CSW];
|
||||
Open9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
|
||||
Open9xFuncSwData_v210 funcSw[O9X_NUM_FSW];
|
||||
Open9xSwashRingData_v209 swashR;
|
||||
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
||||
@@ -800,7 +799,7 @@ PACK(typedef struct t_Open9xModelData_v211 {
|
||||
Open9xExpoData_v211 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves[O9X_MAX_CURVES];
|
||||
int8_t points[O9X_NUM_POINTS];
|
||||
Open9xCustomSwData_v209 customSw[O9X_NUM_CSW];
|
||||
Open9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
|
||||
Open9xFuncSwData_v210 funcSw[O9X_NUM_FSW];
|
||||
Open9xSwashRingData_v209 swashR;
|
||||
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
||||
|
||||
@@ -64,6 +64,7 @@ class Open9xGeneralDataNew: public TransformedField {
|
||||
StructField internalField;
|
||||
GeneralSettings & generalData;
|
||||
BoardEnum board;
|
||||
unsigned int version;
|
||||
int inputsCount;
|
||||
unsigned int chkSum;
|
||||
};
|
||||
|
||||
@@ -57,19 +57,19 @@ const char * Open9xInterface::getName()
|
||||
{
|
||||
switch (board) {
|
||||
case BOARD_STOCK:
|
||||
return "openTx for 9X board";
|
||||
return "OpenTX for 9X board";
|
||||
case BOARD_M128:
|
||||
return "openTx for M128 / 9X board";
|
||||
return "OpenTX for M128 / 9X board";
|
||||
case BOARD_GRUVIN9X:
|
||||
return "openTx for Gruvin9x board / 9X";
|
||||
return "OpenTX for Gruvin9x board / 9X";
|
||||
case BOARD_TARANIS:
|
||||
return "openTx for FrSky Taranis";
|
||||
return "OpenTX for FrSky Taranis";
|
||||
case BOARD_TARANIS_REV4a:
|
||||
return "openTx for FrSky Taranis Rev4a";
|
||||
return "OpenTX for FrSky Taranis Rev4a";
|
||||
case BOARD_SKY9X:
|
||||
return "openTx for Sky9x board / 9X";
|
||||
return "OpenTX for Sky9x board / 9X";
|
||||
default:
|
||||
return "openTx for an unknown board";
|
||||
return "OpenTX for an unknown board";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -526,7 +526,7 @@ int Open9xInterface::getCapability(const Capability capability)
|
||||
return 24;
|
||||
else
|
||||
return 16;
|
||||
case CustomSwitches:
|
||||
case LogicalSwitches:
|
||||
if (IS_ARM(board))
|
||||
return 32;
|
||||
else if (board==BOARD_GRUVIN9X||board==BOARD_M128)
|
||||
@@ -535,10 +535,10 @@ int Open9xInterface::getCapability(const Capability capability)
|
||||
return 12;
|
||||
case CustomAndSwitches:
|
||||
if (IS_ARM(board))
|
||||
return getCapability(CustomSwitches);
|
||||
return getCapability(LogicalSwitches);
|
||||
else
|
||||
return 15/*4bits*/-9/*sw positions*/;
|
||||
case CustomSwitchesExt:
|
||||
case LogicalSwitchesExt:
|
||||
return (IS_ARM(board) ? true : false);
|
||||
case RotaryEncoders:
|
||||
if (board == BOARD_GRUVIN9X)
|
||||
@@ -1015,7 +1015,7 @@ void RegisterOpen9xFirmwares()
|
||||
Option extr_options[] = { { "frsky", QObject::tr("Support for frsky telemetry mod"), FRSKY_VARIANT }, { "jeti", QObject::tr("Support for jeti telemetry mod"), 0 }, { "ardupilot", QObject::tr("Support for receiving ardupilot data"), 0 }, { "nmea", QObject::tr("Support for receiving NMEA data"), 0 }, { "mavlink", QObject::tr("Support for MAVLINK devices"), MAVLINK_VARIANT }, { NULL } };
|
||||
Option fai_options[] = { { "faichoice", QObject::tr("Possibility to enable FAI MODE at field") }, { "faimode", QObject::tr("FAI MODE always enabled") }, { NULL } };
|
||||
/* 9x board */
|
||||
open9x = new Open9xFirmware("opentx-9x", QObject::tr("openTx for 9X board"), new Open9xInterface(BOARD_STOCK), geturl(BOARD_STOCK), getstamp(BOARD_STOCK), getrnurl(BOARD_STOCK), false);
|
||||
open9x = new Open9xFirmware("opentx-9x", QObject::tr("OpenTX for 9X board"), new Open9xInterface(BOARD_STOCK), geturl(BOARD_STOCK), getstamp(BOARD_STOCK), getrnurl(BOARD_STOCK), false);
|
||||
open9x->addOptions(ext_options);
|
||||
open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
|
||||
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
|
||||
@@ -1052,7 +1052,7 @@ void RegisterOpen9xFirmwares()
|
||||
firmwares.push_back(open9x);
|
||||
|
||||
/* 9x board with M128 chip */
|
||||
open9x = new Open9xFirmware("opentx-9x128", QObject::tr("openTx for M128 / 9X board"), new Open9xInterface(BOARD_M128), geturl(BOARD_M128), getstamp(BOARD_M128),getrnurl(BOARD_M128), false);
|
||||
open9x = new Open9xFirmware("opentx-9x128", QObject::tr("OpenTX for M128 / 9X board"), new Open9xInterface(BOARD_M128), geturl(BOARD_M128), getstamp(BOARD_M128),getrnurl(BOARD_M128), false);
|
||||
open9x->addOptions(ext_options);
|
||||
open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
|
||||
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
|
||||
@@ -1084,7 +1084,7 @@ void RegisterOpen9xFirmwares()
|
||||
firmwares.push_back(open9x);
|
||||
|
||||
/* 9XR board */
|
||||
open9x = new Open9xFirmware("opentx-9xr", QObject::tr("openTx for 9XR"), new Open9xInterface(BOARD_STOCK), geturl(BOARD_STOCK), getstamp(BOARD_STOCK),getrnurl(BOARD_STOCK), false);
|
||||
open9x = new Open9xFirmware("opentx-9xr", QObject::tr("OpenTX for 9XR"), new Open9xInterface(BOARD_STOCK), geturl(BOARD_STOCK), getstamp(BOARD_STOCK),getrnurl(BOARD_STOCK), false);
|
||||
open9x->addOptions(extr_options);
|
||||
open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
|
||||
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
|
||||
@@ -1118,7 +1118,7 @@ void RegisterOpen9xFirmwares()
|
||||
firmwares.push_back(open9x);
|
||||
|
||||
/* 9XR board with M128 chip */
|
||||
open9x = new Open9xFirmware("opentx-9xr128", QObject::tr("openTx for 9XR with M128 chip"), new Open9xInterface(BOARD_M128), geturl(BOARD_M128), getstamp(BOARD_M128),getrnurl(BOARD_M128), false);
|
||||
open9x = new Open9xFirmware("opentx-9xr128", QObject::tr("OpenTX for 9XR with M128 chip"), new Open9xInterface(BOARD_M128), geturl(BOARD_M128), getstamp(BOARD_M128),getrnurl(BOARD_M128), false);
|
||||
open9x->addOptions(extr_options);
|
||||
open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
|
||||
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
|
||||
@@ -1148,7 +1148,7 @@ void RegisterOpen9xFirmwares()
|
||||
firmwares.push_back(open9x);
|
||||
|
||||
/* Gruvin9x board */
|
||||
open9x = new Open9xFirmware("opentx-gruvin9x", QObject::tr("openTx for Gruvin9x board / 9X"), new Open9xInterface(BOARD_GRUVIN9X), geturl(BOARD_GRUVIN9X), getstamp(BOARD_GRUVIN9X),getrnurl(BOARD_GRUVIN9X), false);
|
||||
open9x = new Open9xFirmware("opentx-gruvin9x", QObject::tr("OpenTX for Gruvin9x board / 9X"), new Open9xInterface(BOARD_GRUVIN9X), geturl(BOARD_GRUVIN9X), getstamp(BOARD_GRUVIN9X),getrnurl(BOARD_GRUVIN9X), false);
|
||||
open9x->setVariantBase(FRSKY_VARIANT);
|
||||
open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
|
||||
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
|
||||
@@ -1178,7 +1178,7 @@ void RegisterOpen9xFirmwares()
|
||||
|
||||
#ifndef __APPLE__
|
||||
/* SKY9X board */
|
||||
open9x = new Open9xFirmware("opentx-sky9x", QObject::tr("openTx for Sky9x board / 9X"), new Open9xInterface(BOARD_SKY9X), geturl(BOARD_SKY9X), getstamp(BOARD_SKY9X),getrnurl(BOARD_SKY9X), true);
|
||||
open9x = new Open9xFirmware("opentx-sky9x", QObject::tr("OpenTX for Sky9x board / 9X"), new Open9xInterface(BOARD_SKY9X), geturl(BOARD_SKY9X), getstamp(BOARD_SKY9X),getrnurl(BOARD_SKY9X), true);
|
||||
open9x->setVariantBase(FRSKY_VARIANT);
|
||||
open9x->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
|
||||
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
|
||||
@@ -1203,7 +1203,7 @@ void RegisterOpen9xFirmwares()
|
||||
#endif
|
||||
|
||||
/* Taranis board */
|
||||
open9x = new Open9xFirmware("opentx-taranis", QObject::tr("openTx for FrSky Taranis"), new Open9xInterface(BOARD_TARANIS), geturl(BOARD_TARANIS), getstamp(BOARD_TARANIS),getrnurl(BOARD_TARANIS), true);
|
||||
open9x = new Open9xFirmware("opentx-taranis", QObject::tr("OpenTX for FrSky Taranis"), new Open9xInterface(BOARD_TARANIS), geturl(BOARD_TARANIS), getstamp(BOARD_TARANIS),getrnurl(BOARD_TARANIS), true);
|
||||
open9x->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support"));
|
||||
open9x->addOption("notemplates", QObject::tr("Disable TEMPLATES menu"));
|
||||
open9x->addOption("nogvars", QObject::tr("Disable Global variables"));
|
||||
@@ -1215,7 +1215,7 @@ void RegisterOpen9xFirmwares()
|
||||
QSettings settings;
|
||||
int rev4a = settings.value("rev4asupport",0).toInt();
|
||||
if (rev4a) {
|
||||
open9x = new Open9xFirmware("opentx-taranisrev4a", QObject::tr("openTx for FrSky Taranis Rev4a"), new Open9xInterface(BOARD_TARANIS_REV4a), geturl(BOARD_TARANIS_REV4a), getstamp(BOARD_TARANIS_REV4a),getrnurl(BOARD_TARANIS), true);
|
||||
open9x = new Open9xFirmware("opentx-taranisrev4a", QObject::tr("OpenTX for FrSky Taranis Rev4a"), new Open9xInterface(BOARD_TARANIS_REV4a), geturl(BOARD_TARANIS_REV4a), getstamp(BOARD_TARANIS_REV4a),getrnurl(BOARD_TARANIS), true);
|
||||
open9x->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support"));
|
||||
open9x->addOption("notemplates", QObject::tr("Disable TEMPLATES menu"));
|
||||
open9x->addOption("nogvars", QObject::tr("Disable Global variables"));
|
||||
|
||||
@@ -2,18 +2,6 @@
|
||||
#include "helpers.h"
|
||||
#include "th9xeeprom.h"
|
||||
|
||||
int8_t th9xFromSwitch(const RawSwitch & sw)
|
||||
{
|
||||
switch (sw.type) {
|
||||
case SWITCH_TYPE_SWITCH:
|
||||
return sw.index;
|
||||
case SWITCH_TYPE_VIRTUAL:
|
||||
return sw.index > 0 ? (9 + sw.index) : (-9 -sw.index);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
RawSwitch th9xToSwitch(int8_t sw)
|
||||
{
|
||||
if (sw == 0)
|
||||
@@ -181,22 +169,22 @@ t_Th9xMixData::operator MixData ()
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Th9xCustomSwData::operator CustomSwData ()
|
||||
t_Th9xLogicalSwitchData::operator LogicalSwitchData ()
|
||||
{
|
||||
CustomSwData c9x;
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = opCmp;
|
||||
c9x.val1 = val1;
|
||||
c9x.val2 = val2;
|
||||
|
||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = toSource(val1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_EQUAL) {
|
||||
if (c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val2 = toSource(val2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = th9xToSwitch(val1).toValue();
|
||||
c9x.val2 = th9xToSwitch(val2).toValue();
|
||||
}
|
||||
@@ -204,7 +192,7 @@ t_Th9xCustomSwData::operator CustomSwData ()
|
||||
return c9x;
|
||||
}
|
||||
|
||||
int8_t t_Th9xCustomSwData::fromSource(RawSource source)
|
||||
int8_t t_Th9xLogicalSwitchData::fromSource(RawSource source)
|
||||
{
|
||||
int v1 = 0;
|
||||
if (source.type == SOURCE_TYPE_STICK)
|
||||
@@ -228,7 +216,7 @@ int8_t t_Th9xCustomSwData::fromSource(RawSource source)
|
||||
return v1;
|
||||
}
|
||||
|
||||
RawSource t_Th9xCustomSwData::toSource(int8_t value)
|
||||
RawSource t_Th9xLogicalSwitchData::toSource(int8_t value)
|
||||
{
|
||||
if (value == 0) {
|
||||
return RawSource(SOURCE_TYPE_NONE);
|
||||
@@ -266,7 +254,7 @@ t_Th9xModelData::operator ModelData ()
|
||||
ModelData c9x;
|
||||
c9x.used = true;
|
||||
getEEPROMString(c9x.name, name, sizeof(name));
|
||||
switch(tmrMode) {
|
||||
/*switch(tmrMode) {
|
||||
case 1:
|
||||
c9x.timers[0].mode = TMRMODE_ABS;
|
||||
break;
|
||||
@@ -279,7 +267,7 @@ t_Th9xModelData::operator ModelData ()
|
||||
default:
|
||||
c9x.timers[0].mode = TMRMODE_OFF;
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
// c9x.timers[0].dir = tmrDir;
|
||||
c9x.timers[0].val = tmrVal;
|
||||
/*c9x.protocol = (Protocol)protocol;
|
||||
|
||||
@@ -138,18 +138,18 @@ PACK(typedef struct t_Th9xMixData {
|
||||
t_Th9xMixData();
|
||||
}) Th9xMixData;
|
||||
|
||||
PACK(typedef struct t_Th9xCustomSwData {
|
||||
PACK(typedef struct t_Th9xLogicalSwitchData {
|
||||
uint8_t sw:3; // 0..7
|
||||
uint8_t opCmp:2; // < & | ^
|
||||
uint8_t opRes:3; // 0 => 1=> 0=> !=> & | ^
|
||||
int8_t val1;
|
||||
int8_t val2;
|
||||
|
||||
operator CustomSwData();
|
||||
t_Th9xCustomSwData() { memset(this, 0, sizeof(t_Th9xCustomSwData)); }
|
||||
operator LogicalSwitchData();
|
||||
t_Th9xLogicalSwitchData() { memset(this, 0, sizeof(t_Th9xLogicalSwitchData)); }
|
||||
int8_t fromSource(RawSource source);
|
||||
RawSource toSource(int8_t value);
|
||||
}) Th9xCustomSwData;
|
||||
}) Th9xLogicalSwitchData;
|
||||
|
||||
PACK(typedef struct t_Th9xTrimData {
|
||||
int8_t itrim:6; //trim index
|
||||
@@ -173,7 +173,7 @@ PACK(typedef struct t_Th9xModelData {
|
||||
int8_t curves3[TH9X_MAX_CURVES3][3]; // 9 new143
|
||||
int8_t curves5[TH9X_MAX_CURVES5][5]; // 10
|
||||
int8_t curves9[TH9X_MAX_CURVES9][9]; // 18
|
||||
Th9xCustomSwData switchTab[TH9X_MAX_SWITCHES];//
|
||||
Th9xLogicalSwitchData switchTab[TH9X_MAX_SWITCHES];//
|
||||
Th9xTrimData trimData[NUM_STICKS]; // 3*4 -> 1*4
|
||||
operator ModelData();
|
||||
t_Th9xModelData();
|
||||
|
||||
@@ -157,7 +157,7 @@ int Th9xInterface::getCapability(const Capability capability)
|
||||
return 9;
|
||||
case CustomFunctions:
|
||||
return 0;
|
||||
case CustomSwitches:
|
||||
case LogicalSwitches:
|
||||
return TH9X_MAX_SWITCHES;
|
||||
case Outputs:
|
||||
return 8;
|
||||
|
||||
@@ -0,0 +1,507 @@
|
||||
#include "fwpreferencesdialog.h"
|
||||
#include "ui_fwpreferencesdialog.h"
|
||||
#include "mainwindow.h"
|
||||
#include "eeprominterface.h"
|
||||
#include "helpers.h"
|
||||
#include <QDesktopServices>
|
||||
#include <QtGui>
|
||||
|
||||
fwPreferencesDialog::fwPreferencesDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::fwPreferencesDialog),
|
||||
updateLock(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowIcon(CompanionIcon("preferences.png"));
|
||||
|
||||
QCheckBox * OptionCheckBox[]= {
|
||||
ui->optionCheckBox_1, ui->optionCheckBox_2, ui->optionCheckBox_3, ui->optionCheckBox_4, ui->optionCheckBox_5, ui->optionCheckBox_6, ui->optionCheckBox_7,
|
||||
ui->optionCheckBox_8, ui->optionCheckBox_9, ui->optionCheckBox_10, ui->optionCheckBox_11, ui->optionCheckBox_12, ui->optionCheckBox_13, ui->optionCheckBox_14,
|
||||
ui->optionCheckBox_15,ui->optionCheckBox_16, ui->optionCheckBox_17, ui->optionCheckBox_18, ui->optionCheckBox_19, ui->optionCheckBox_20, ui->optionCheckBox_21,
|
||||
ui->optionCheckBox_22, ui->optionCheckBox_23, ui->optionCheckBox_24, ui->optionCheckBox_25, ui->optionCheckBox_26, ui->optionCheckBox_27, ui->optionCheckBox_28,
|
||||
ui->optionCheckBox_29, ui->optionCheckBox_30, ui->optionCheckBox_31, ui->optionCheckBox_32, ui->optionCheckBox_33, ui->optionCheckBox_34, ui->optionCheckBox_35,
|
||||
ui->optionCheckBox_36, ui->optionCheckBox_37, ui->optionCheckBox_38, ui->optionCheckBox_39, ui->optionCheckBox_40, ui->optionCheckBox_41, ui->optionCheckBox_42,
|
||||
NULL };
|
||||
|
||||
voice=NULL;
|
||||
|
||||
connect(ui->langCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(firmwareLangChanged()));
|
||||
connect(ui->voiceCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(firmwareLangChanged()));
|
||||
|
||||
for (int i=0; OptionCheckBox[i]; i++) {
|
||||
optionsCheckBoxes.push_back(OptionCheckBox[i]);
|
||||
connect(OptionCheckBox[i], SIGNAL(toggled(bool)), this, SLOT(firmwareOptionChanged(bool)));
|
||||
}
|
||||
|
||||
initSettings();
|
||||
|
||||
connect(ui->downloadVerCB, SIGNAL(currentIndexChanged(int)), this, SLOT(baseFirmwareChanged()));
|
||||
connect(this, SIGNAL(accepted()), this, SLOT(writeValues()));
|
||||
|
||||
resize(0,0);
|
||||
}
|
||||
|
||||
|
||||
fwPreferencesDialog::~fwPreferencesDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::baseFirmwareChanged()
|
||||
{
|
||||
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
|
||||
voice=NULL;
|
||||
foreach(FirmwareInfo * firmware, firmwares) {
|
||||
if (firmware->id == selected_firmware) {
|
||||
if (firmware->voice) {
|
||||
ui->voiceLabel->show();
|
||||
ui->voiceCombo->show();
|
||||
ui->voice_dnld->show();
|
||||
ui->sdPathButton->show();
|
||||
ui->sdPath->show();
|
||||
ui->sdPathLabel->show();
|
||||
ui->voiceLabel->setEnabled(true);
|
||||
ui->voiceCombo->setEnabled(true);
|
||||
ui->voice_dnld->setEnabled(true);
|
||||
ui->sdPathButton->setEnabled(true);
|
||||
ui->sdPath->setEnabled(true);
|
||||
} else {
|
||||
ui->voiceLabel->hide();
|
||||
ui->voiceCombo->hide();
|
||||
ui->voice_dnld->hide();
|
||||
ui->sdPathButton->hide();
|
||||
ui->sdPath->hide();
|
||||
ui->sdPathLabel->hide();
|
||||
}
|
||||
populateFirmwareOptions(firmware);
|
||||
break;
|
||||
}
|
||||
}
|
||||
firmwareChanged();
|
||||
}
|
||||
|
||||
FirmwareVariant fwPreferencesDialog::getFirmwareVariant()
|
||||
{
|
||||
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
|
||||
bool voice=false;
|
||||
foreach(FirmwareInfo * firmware, firmwares) {
|
||||
if (firmware->id == selected_firmware) {
|
||||
QString id = firmware->id;
|
||||
foreach(QCheckBox *cb, optionsCheckBoxes) {
|
||||
if (cb->isChecked()) {
|
||||
if (cb->text()=="voice" && cb->isChecked())
|
||||
voice=true;
|
||||
id += QString("-") + cb->text();
|
||||
}
|
||||
}
|
||||
if (! firmware->eepromInterface->getCapability(MultiLangVoice)) {
|
||||
if (ui->voiceCombo->count() && (voice || firmware->voice))
|
||||
id += QString("-tts") + ui->voiceCombo->currentText();
|
||||
}
|
||||
if (ui->langCombo->count())
|
||||
id += QString("-") + ui->langCombo->currentText();
|
||||
|
||||
return GetFirmwareVariant(id);
|
||||
}
|
||||
}
|
||||
|
||||
// Should never occur...
|
||||
return default_firmware_variant;
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::firmwareLangChanged()
|
||||
{
|
||||
firmwareChanged();
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::firmwareOptionChanged(bool state)
|
||||
{
|
||||
QCheckBox *cb = qobject_cast<QCheckBox*>(sender());
|
||||
FirmwareInfo * firmware=NULL;
|
||||
if (cb && state) {
|
||||
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
|
||||
foreach(firmware, firmwares) {
|
||||
if (firmware->id == selected_firmware) {
|
||||
foreach(QList<Option> opts, firmware->opts) {
|
||||
foreach(Option opt, opts) {
|
||||
if (cb->text() == opt.name) {
|
||||
foreach(Option other, opts) {
|
||||
if (other.name != opt.name) {
|
||||
foreach(QCheckBox *ocb, optionsCheckBoxes) {
|
||||
if (ocb->text() == other.name)
|
||||
ocb->setChecked(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (voice) {
|
||||
if (voice->isChecked()) {
|
||||
ui->voiceLabel->setEnabled(true);
|
||||
ui->voiceCombo->setEnabled(true);
|
||||
ui->voice_dnld->setEnabled(true);
|
||||
ui->sdPathButton->setEnabled(true);
|
||||
ui->sdPath->setEnabled(true);
|
||||
} else {
|
||||
ui->voiceLabel->setDisabled(true);
|
||||
ui->voiceCombo->setDisabled(true);
|
||||
ui->voice_dnld->setDisabled(true);
|
||||
ui->sdPathButton->setDisabled(true);
|
||||
ui->sdPath->setDisabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
return firmwareChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (cb && !state) {
|
||||
if (cb->text()=="voice") {
|
||||
ui->voiceLabel->setDisabled(true);
|
||||
ui->voiceCombo->setDisabled(true);
|
||||
ui->voice_dnld->setDisabled(true);
|
||||
ui->sdPathButton->setEnabled(true);
|
||||
ui->sdPath->setEnabled(true);
|
||||
}
|
||||
}
|
||||
if (voice ) {
|
||||
if (voice->isChecked()) {
|
||||
ui->voiceLabel->setEnabled(true);
|
||||
ui->voiceCombo->setEnabled(true);
|
||||
ui->voice_dnld->setEnabled(true);
|
||||
} else {
|
||||
ui->voiceLabel->setDisabled(true);
|
||||
ui->voiceCombo->setDisabled(true);
|
||||
ui->voice_dnld->setDisabled(true);
|
||||
ui->sdPathButton->setDisabled(true);
|
||||
ui->sdPath->setDisabled(true);
|
||||
}
|
||||
} else if (firmware) {
|
||||
if (firmware->voice) {
|
||||
ui->voiceLabel->setEnabled(true);
|
||||
ui->voiceCombo->setEnabled(true);
|
||||
ui->voice_dnld->setEnabled(true);
|
||||
ui->sdPathButton->setEnabled(true);
|
||||
ui->sdPath->setEnabled(true);
|
||||
}
|
||||
}
|
||||
return firmwareChanged();
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::firmwareChanged()
|
||||
{
|
||||
if (updateLock)
|
||||
return;
|
||||
|
||||
FirmwareVariant variant = getFirmwareVariant();
|
||||
QString stamp;
|
||||
stamp.append(variant.firmware->stamp);
|
||||
ui->fw_dnld->setEnabled(!variant.firmware->getUrl(variant.id).isNull());
|
||||
QString url=variant.firmware->getUrl(variant.id);
|
||||
// B-Plan
|
||||
if (false) {
|
||||
ui->CPU_ID_LE->show();
|
||||
ui->CPU_ID_LABEL->show();
|
||||
} else {
|
||||
ui->CPU_ID_LE->hide();
|
||||
ui->CPU_ID_LABEL->hide();
|
||||
}
|
||||
QSettings settings;
|
||||
settings.beginGroup("FwRevisions");
|
||||
int fwrev = settings.value(variant.id, -1).toInt();
|
||||
settings.endGroup();
|
||||
if (fwrev != -1) {
|
||||
ui->FwInfo->setText(tr("Last downloaded release: %1").arg(fwrev));
|
||||
if (!stamp.isEmpty()) {
|
||||
ui->checkFWUpdates->show();
|
||||
} else {
|
||||
ui->checkFWUpdates->hide();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (ui->fw_dnld->isEnabled()) {
|
||||
ui->FwInfo->setText(tr("The selected firmware has never been downloaded by Companion."));
|
||||
ui->checkFWUpdates->hide();
|
||||
}
|
||||
else {
|
||||
ui->FwInfo->setText(tr("The selected firmware cannot be downloaded by Companion."));
|
||||
ui->checkFWUpdates->hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::writeValues()
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("default_channel_order", ui->channelorderCB->currentIndex());
|
||||
settings.setValue("default_mode", ui->stickmodeCB->currentIndex());
|
||||
settings.setValue("cpu_id", ui->CPU_ID_LE->text());
|
||||
settings.setValue("rename_firmware_files", ui->renameFirmware->isChecked());
|
||||
settings.setValue("burnFirmware", ui->burnFirmware->isChecked());
|
||||
current_firmware_variant = getFirmwareVariant();
|
||||
settings.setValue("firmware", current_firmware_variant.id);
|
||||
settings.setValue("profileId", ui->ProfSlot_SB->value());
|
||||
settings.setValue("sdPath", ui->sdPath->text());
|
||||
settings.setValue("SplashFileName", ui->SplashFileName->text());
|
||||
if (!ui->SplashFileName->text().isEmpty())
|
||||
settings.setValue("SplashImage", "");
|
||||
|
||||
MainWindow * mw = (MainWindow *)this->parent();
|
||||
mw->unloadProfile();
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::populateFirmwareOptions(const FirmwareInfo * firmware)
|
||||
{
|
||||
const FirmwareInfo * parent = firmware->parent ? firmware->parent : firmware;
|
||||
|
||||
updateLock = true;
|
||||
|
||||
ui->langCombo->clear();
|
||||
foreach(const char *lang, parent->languages) {
|
||||
ui->langCombo->addItem(lang);
|
||||
if (current_firmware_variant.id.endsWith(lang))
|
||||
ui->langCombo->setCurrentIndex(ui->langCombo->count() - 1);
|
||||
}
|
||||
ui->voiceCombo->clear();
|
||||
foreach(const char *lang, parent->ttslanguages) {
|
||||
ui->voiceCombo->addItem(lang);
|
||||
if (current_firmware_variant.id.contains(QString("-tts%1").arg(lang)))
|
||||
ui->voiceCombo->setCurrentIndex(ui->voiceCombo->count() - 1);
|
||||
}
|
||||
|
||||
if (ui->langCombo->count()) {
|
||||
ui->langCombo->show();
|
||||
ui->langLabel->show();
|
||||
}
|
||||
else {
|
||||
ui->langCombo->hide();
|
||||
ui->langLabel->hide();
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
foreach(QList<Option> opts, parent->opts) {
|
||||
foreach(Option opt, opts) {
|
||||
if (index >= optionsCheckBoxes.size()) {
|
||||
qDebug() << "This firmware needs more options checkboxes!";
|
||||
}
|
||||
else {
|
||||
QCheckBox *cb = optionsCheckBoxes.at(index++);
|
||||
if (cb) {
|
||||
cb->show();
|
||||
cb->setText(opt.name);
|
||||
cb->setToolTip(opt.tooltip);
|
||||
cb->setCheckState(current_firmware_variant.id.contains(opt.name) ? Qt::Checked : Qt::Unchecked);
|
||||
|
||||
if (opt.name==QString("voice")) {
|
||||
voice=cb;
|
||||
ui->voiceLabel->show();
|
||||
ui->voiceCombo->show();
|
||||
ui->voice_dnld->show();
|
||||
ui->sdPathButton->show();
|
||||
ui->sdPath->show();
|
||||
ui->sdPathLabel->show();
|
||||
if (current_firmware_variant.id.contains(opt.name) ||firmware->voice) {
|
||||
ui->voiceLabel->setEnabled(true);
|
||||
ui->voiceCombo->setEnabled(true);
|
||||
ui->voice_dnld->setEnabled(true);
|
||||
ui->sdPathButton->setEnabled(true);
|
||||
ui->sdPath->setEnabled(true);
|
||||
} else {
|
||||
ui->voiceLabel->setDisabled(true);
|
||||
ui->voiceCombo->setDisabled(true);
|
||||
ui->voice_dnld->setDisabled(true);
|
||||
ui->sdPathButton->setDisabled(true);
|
||||
ui->sdPath->setDisabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (; index<optionsCheckBoxes.size(); index++) {
|
||||
QCheckBox *cb = optionsCheckBoxes.at(index);
|
||||
cb->hide();
|
||||
cb->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
|
||||
updateLock = false;
|
||||
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::initSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
ui->channelorderCB->setCurrentIndex(settings.value("default_channel_order", 0).toInt());
|
||||
ui->stickmodeCB->setCurrentIndex(settings.value("default_mode", 1).toInt());
|
||||
ui->renameFirmware->setChecked(settings.value("rename_firmware_files", false).toBool());
|
||||
ui->burnFirmware->setChecked(settings.value("burnFirmware", true).toBool());
|
||||
ui->CPU_ID_LE->setText(settings.value("cpu_id", "").toString());
|
||||
QString Path=settings.value("sdPath", "").toString();
|
||||
if (QDir(Path).exists()) {
|
||||
ui->sdPath->setText(Path);
|
||||
}
|
||||
|
||||
FirmwareInfo * current_firmware = GetCurrentFirmware();
|
||||
|
||||
foreach(FirmwareInfo * firmware, firmwares) {
|
||||
ui->downloadVerCB->addItem(firmware->name, firmware->id);
|
||||
if (current_firmware == firmware) {
|
||||
ui->downloadVerCB->setCurrentIndex(ui->downloadVerCB->count() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
baseFirmwareChanged();
|
||||
|
||||
ui->ProfSlot_SB->setValue(settings.value("profileId", 1).toInt());
|
||||
on_ProfSlot_SB_valueChanged();
|
||||
QString fileName=settings.value("SplashFileName","").toString();
|
||||
if (!fileName.isEmpty()) {
|
||||
QFile file(fileName);
|
||||
if (file.exists()){
|
||||
ui->SplashFileName->setText(fileName);
|
||||
}
|
||||
}
|
||||
firmwareChanged();
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::on_fw_dnld_clicked()
|
||||
{
|
||||
MainWindow * mw = (MainWindow *)this->parent();
|
||||
FirmwareVariant variant = getFirmwareVariant();
|
||||
writeValues();
|
||||
if (!variant.firmware->getUrl(variant.id).isNull()) {
|
||||
if (ui->burnFirmware->isChecked()) {
|
||||
QSettings settings;
|
||||
current_firmware_variant = getFirmwareVariant();
|
||||
settings.setValue("firmware", current_firmware_variant.id);
|
||||
}
|
||||
mw->downloadLatestFW(current_firmware_variant.firmware, current_firmware_variant.id);
|
||||
}
|
||||
firmwareChanged();
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::on_voice_dnld_clicked()
|
||||
{
|
||||
ui->ProfSave_PB->setEnabled(true);
|
||||
QString url="http://fw.opentx.it/voices/";
|
||||
FirmwareVariant variant = getFirmwareVariant();
|
||||
url.append(QString("%1/%2/").arg(variant.firmware->id).arg(ui->voiceCombo->currentText()));
|
||||
QDesktopServices::openUrl(url);
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::on_sdPathButton_clicked()
|
||||
{
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select the folder replicating your SD structure"), settings.value("sdPath").toString());
|
||||
if (!fileName.isEmpty()) {
|
||||
ui->sdPath->setText(fileName);
|
||||
}
|
||||
ui->ProfSave_PB->setEnabled(true);
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::on_ProfSlot_SB_valueChanged()
|
||||
{
|
||||
QSettings settings;
|
||||
settings.beginGroup("Profiles");
|
||||
QString profile=QString("profile%1").arg(ui->ProfSlot_SB->value());
|
||||
settings.beginGroup(profile);
|
||||
QString name=settings.value("Name","").toString();
|
||||
ui->ProfName_LE->setText(name);
|
||||
/* if (!(name.isEmpty())) {
|
||||
QString firmwarename=settings.value("firmware", default_firmware_id).toString();
|
||||
FirmwareInfo * fw = getFirmware(firmwarename);
|
||||
int i=0;
|
||||
foreach(FirmwareInfo * firmware, firmwares) {
|
||||
if (fw == firmware) {
|
||||
qDebug() << fw->id;
|
||||
qDebug() << firmware->id;
|
||||
qDebug() << i;
|
||||
ui->downloadVerCB->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
baseFirmwareChanged();
|
||||
populateFirmwareOptions(fw);
|
||||
}*/
|
||||
settings.endGroup();
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::on_ProfSave_PB_clicked()
|
||||
{
|
||||
QSettings settings;
|
||||
settings.beginGroup("Profiles");
|
||||
QString profile=QString("profile%1").arg(ui->ProfSlot_SB->value());
|
||||
QString name=ui->ProfName_LE->text();
|
||||
if (name.isEmpty()) {
|
||||
int ret = QMessageBox::question(this, "Companion",
|
||||
tr("Profile name is empty, profile slot %1 will be deleted.<br>Are you sure ?").arg(ui->ProfSlot_SB->value()) ,
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (ret==QMessageBox::Yes) {
|
||||
settings.remove(profile);
|
||||
} else {
|
||||
settings.beginGroup(profile);
|
||||
ui->ProfName_LE->setText(settings.value("Name","").toString());
|
||||
}
|
||||
} else {
|
||||
settings.beginGroup(profile);
|
||||
settings.setValue("Name",name);
|
||||
settings.setValue("default_channel_order", ui->channelorderCB->currentIndex());
|
||||
settings.setValue("default_mode", ui->stickmodeCB->currentIndex());
|
||||
settings.setValue("burnFirmware", ui->burnFirmware->isChecked());
|
||||
settings.setValue("rename_firmware_files", ui->renameFirmware->isChecked());
|
||||
settings.setValue("sdPath", ui->sdPath->text());
|
||||
settings.setValue("SplashFileName", ui->SplashFileName->text());
|
||||
current_firmware_variant = getFirmwareVariant();
|
||||
settings.setValue("firmware", current_firmware_variant.id);
|
||||
settings.endGroup();
|
||||
settings.endGroup();
|
||||
}
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::on_SplashSelect_clicked()
|
||||
{
|
||||
QString supportedImageFormats;
|
||||
for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) {
|
||||
supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex];
|
||||
}
|
||||
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
tr("Open Image to load"), settings.value("lastImagesDir").toString(), tr("Images (%1)").arg(supportedImageFormats));
|
||||
|
||||
if (!fileName.isEmpty()) {
|
||||
settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath());
|
||||
QImage image(fileName);
|
||||
if (image.isNull()) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName));
|
||||
return;
|
||||
}
|
||||
ui->SplashFileName->setText(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void fwPreferencesDialog::on_clearImageButton_clicked() {
|
||||
ui->SplashFileName->clear();
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::on_checkFWUpdates_clicked()
|
||||
{
|
||||
FirmwareVariant variant = getFirmwareVariant();
|
||||
if (ui->burnFirmware->isChecked()) {
|
||||
QSettings settings;
|
||||
current_firmware_variant = variant;
|
||||
settings.setValue("firmware", variant.id);
|
||||
}
|
||||
MainWindow * mw = (MainWindow *)this->parent();
|
||||
mw->checkForUpdates(true, variant.id);
|
||||
firmwareChanged();
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::shrink()
|
||||
{
|
||||
resize(0,0);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
#ifndef FWPREFERENCESDIALOG_H
|
||||
#define FWPREFERENCESDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QCheckBox>
|
||||
#include "eeprominterface.h"
|
||||
|
||||
namespace Ui {
|
||||
class fwPreferencesDialog;
|
||||
}
|
||||
|
||||
class Joystick;
|
||||
|
||||
class fwPreferencesDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit fwPreferencesDialog(QWidget *parent = 0);
|
||||
~fwPreferencesDialog();
|
||||
|
||||
private:
|
||||
Ui::fwPreferencesDialog *ui;
|
||||
QList<QCheckBox *> optionsCheckBoxes;
|
||||
bool updateLock;
|
||||
|
||||
void populateLocale();
|
||||
void populateFirmwareOptions(const FirmwareInfo *);
|
||||
FirmwareVariant getFirmwareVariant();
|
||||
void initSettings();
|
||||
QCheckBox * voice;
|
||||
|
||||
private slots:
|
||||
void shrink();
|
||||
void writeValues();
|
||||
void firmwareLangChanged();
|
||||
void baseFirmwareChanged();
|
||||
void firmwareOptionChanged(bool state);
|
||||
void firmwareChanged();
|
||||
void on_fw_dnld_clicked();
|
||||
void on_voice_dnld_clicked();
|
||||
void on_sdPathButton_clicked();
|
||||
void on_checkFWUpdates_clicked();
|
||||
void on_ProfSlot_SB_valueChanged();
|
||||
void on_ProfSave_PB_clicked();
|
||||
void on_SplashSelect_clicked();
|
||||
void on_clearImageButton_clicked();
|
||||
};
|
||||
|
||||
#endif // FWPREFERENCESDIALOG_H
|
||||
@@ -117,165 +117,6 @@ void populateCustomScreenFieldCB(QComboBox *b, unsigned int value, bool last=fal
|
||||
b->setMaxVisibleItems(10);
|
||||
}
|
||||
|
||||
QString getRepeatString(unsigned int val)
|
||||
{
|
||||
if (val==0) {
|
||||
return QObject::tr("No repeat");
|
||||
} else {
|
||||
unsigned int step = IS_ARM(GetEepromInterface()->getBoard()) ? 5 : 10;
|
||||
return QObject::tr("%1 sec").arg(step*val);
|
||||
}
|
||||
}
|
||||
|
||||
QString getFuncName(unsigned int val)
|
||||
{
|
||||
if (val < NUM_SAFETY_CHNOUT) {
|
||||
return QObject::tr("Safety %1").arg(RawSource(SOURCE_TYPE_CH, val).toString());
|
||||
}
|
||||
else if (val == FuncTrainer)
|
||||
return QObject::tr("Trainer");
|
||||
else if (val == FuncTrainerRUD)
|
||||
return QObject::tr("Trainer RUD");
|
||||
else if (val == FuncTrainerELE)
|
||||
return QObject::tr("Trainer ELE");
|
||||
else if (val == FuncTrainerTHR)
|
||||
return QObject::tr("Trainer THR");
|
||||
else if (val == FuncTrainerAIL)
|
||||
return QObject::tr("Trainer AIL");
|
||||
else if (val == FuncInstantTrim)
|
||||
return QObject::tr("Instant Trim");
|
||||
else if (val == FuncPlaySound)
|
||||
return QObject::tr("Play Sound");
|
||||
else if (val == FuncPlayHaptic)
|
||||
return QObject::tr("Play Haptic");
|
||||
else if (val == FuncReset)
|
||||
return QObject::tr("Reset");
|
||||
else if (val == FuncVario)
|
||||
return QObject::tr("Vario");
|
||||
else if (val == FuncPlayPrompt)
|
||||
return QObject::tr("Play Track");
|
||||
else if (val == FuncPlayBoth)
|
||||
return QObject::tr("Play Both");
|
||||
else if (val == FuncPlayValue)
|
||||
return QObject::tr("Play Value");
|
||||
else if (val == FuncLogs)
|
||||
return QObject::tr("Start Logs");
|
||||
else if (val == FuncVolume)
|
||||
return QObject::tr("Volume");
|
||||
else if (val == FuncBacklight)
|
||||
return QObject::tr("Backlight");
|
||||
else if (val == FuncBackgroundMusic)
|
||||
return QObject::tr("Background Music");
|
||||
else if (val == FuncBackgroundMusicPause)
|
||||
return QObject::tr("Background Music Pause");
|
||||
else if (val >= FuncAdjustGV1 && val <= FuncAdjustGVLast)
|
||||
return QObject::tr("Adjust GV%1").arg(val-FuncAdjustGV1+1);
|
||||
else {
|
||||
return QString("???"); // Highlight unknown functions with output of question marks.(BTW should not happen that we do not know what a function is)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO should be a toString() method in CustoSwData ...
|
||||
QString getCustomSwitchStr(CustomSwData * customSw, const ModelData & model)
|
||||
{
|
||||
QString result = "";
|
||||
|
||||
if (!customSw->func)
|
||||
return result;
|
||||
if (customSw->andsw!=0) {
|
||||
result +="( ";
|
||||
}
|
||||
switch (getCSFunctionFamily(customSw->func)) {
|
||||
case CS_FAMILY_TIMERS:
|
||||
result = QString("TIM(%1 , %2)").arg(ValToTim(customSw->val1)).arg(ValToTim(customSw->val2));
|
||||
break;
|
||||
case CS_FAMILY_VOFS: {
|
||||
RawSource source = RawSource(customSw->val1, &model);
|
||||
RawSourceRange range = source.getRange();
|
||||
if (customSw->val1)
|
||||
result += source.toString();
|
||||
else
|
||||
result += "0";
|
||||
result.remove(" ");
|
||||
if (customSw->func == CS_FN_APOS || customSw->func == CS_FN_ANEG)
|
||||
result = "|" + result + "|";
|
||||
else if (customSw->func == CS_FN_DAPOS)
|
||||
result = "|d(" + result + ")|";
|
||||
else if (customSw->func == CS_FN_DPOS) result = "d(" + result + ")";
|
||||
if (customSw->func == CS_FN_APOS || customSw->func == CS_FN_VPOS || customSw->func == CS_FN_DAPOS || customSw->func == CS_FN_DPOS)
|
||||
result += " > ";
|
||||
else if (customSw->func == CS_FN_ANEG || customSw->func == CS_FN_VNEG)
|
||||
result += " < ";
|
||||
result += QString::number(range.step * (customSw->val2 /*TODO+ source.getRawOffset(model)*/) + range.offset);
|
||||
break;
|
||||
}
|
||||
case CS_FAMILY_VBOOL:
|
||||
result = RawSwitch(customSw->val1).toString();
|
||||
switch (customSw->func) {
|
||||
case CS_FN_AND:
|
||||
result += " AND ";
|
||||
break;
|
||||
case CS_FN_OR:
|
||||
result += " OR ";
|
||||
break;
|
||||
case CS_FN_XOR:
|
||||
result += " XOR ";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
result += RawSwitch(customSw->val2).toString();
|
||||
break;
|
||||
|
||||
case CS_FAMILY_VCOMP:
|
||||
if (customSw->val1)
|
||||
result += RawSource(customSw->val1).toString();
|
||||
else
|
||||
result += "0";
|
||||
switch (customSw->func) {
|
||||
case CS_FN_EQUAL:
|
||||
result += " = ";
|
||||
break;
|
||||
case CS_FN_NEQUAL:
|
||||
result += " != ";
|
||||
break;
|
||||
case CS_FN_GREATER:
|
||||
result += " > ";
|
||||
break;
|
||||
case CS_FN_LESS:
|
||||
result += " < ";
|
||||
break;
|
||||
case CS_FN_EGREATER:
|
||||
result += " >= ";
|
||||
break;
|
||||
case CS_FN_ELESS:
|
||||
result += " <= ";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (customSw->val2)
|
||||
result += RawSource(customSw->val2).toString();
|
||||
else
|
||||
result += "0";
|
||||
break;
|
||||
}
|
||||
|
||||
if (customSw->andsw!=0) {
|
||||
result +=" ) AND ";
|
||||
result += RawSwitch(customSw->andsw).toString();
|
||||
}
|
||||
|
||||
if (GetEepromInterface()->getCapability(CustomSwitchesExt)) {
|
||||
if (customSw->delay)
|
||||
result += QObject::tr(" Delay %1 sec").arg(customSw->delay/2.0);
|
||||
if (customSw->duration)
|
||||
result += QObject::tr(" Duration %1 sec").arg(customSw->duration/2.0);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
QString getProtocolStr(const int proto)
|
||||
{
|
||||
static const char *strings[] = { "OFF",
|
||||
@@ -290,186 +131,6 @@ QString getProtocolStr(const int proto)
|
||||
return CHECK_IN_ARRAY(strings, proto);
|
||||
}
|
||||
|
||||
void populateFuncCB(QComboBox *b, unsigned int value)
|
||||
{
|
||||
b->clear();
|
||||
for (unsigned int i = 0; i < FuncCount; i++) {
|
||||
b->addItem(getFuncName(i));
|
||||
if (!GetEepromInterface()->getCapability(HasVolume)) {
|
||||
if (i==FuncVolume || i==FuncBackgroundMusic || i==FuncBackgroundMusicPause) {
|
||||
QModelIndex index = b->model()->index(i, 0);
|
||||
QVariant v(0);
|
||||
b->model()->setData(index, v, Qt::UserRole - 1);
|
||||
}
|
||||
}
|
||||
if ((i==FuncPlayHaptic) && !GetEepromInterface()->getCapability(Haptic)) {
|
||||
QModelIndex index = b->model()->index(i, 0);
|
||||
QVariant v(0);
|
||||
b->model()->setData(index, v, Qt::UserRole - 1);
|
||||
}
|
||||
if ((i==FuncPlayBoth) && !GetEepromInterface()->getCapability(HasBeeper)) {
|
||||
QModelIndex index = b->model()->index(i, 0);
|
||||
QVariant v(0);
|
||||
b->model()->setData(index, v, Qt::UserRole - 1);
|
||||
}
|
||||
if ((i==FuncLogs) && !GetEepromInterface()->getCapability(HasSDLogs)) {
|
||||
QModelIndex index = b->model()->index(i, 0);
|
||||
QVariant v(0);
|
||||
b->model()->setData(index, v, Qt::UserRole - 1);
|
||||
}
|
||||
}
|
||||
b->setCurrentIndex(value);
|
||||
b->setMaxVisibleItems(10);
|
||||
}
|
||||
|
||||
QString FuncParam(uint function, int value, QString paramT,unsigned int adjustmode)
|
||||
{
|
||||
QStringList qs;
|
||||
if (function <= FuncInstantTrim) {
|
||||
return QString("%1").arg(value);
|
||||
}
|
||||
else if (function==FuncPlaySound) {
|
||||
qs <<"Beep 1" << "Beep 2" << "Beep 3" << "Warn1" << "Warn2" << "Cheep" << "Ratata" << "Tick" << "Siren" << "Ring" ;
|
||||
qs << "SciFi" << "Robot" << "Chirp" << "Tada" << "Crickt" << "AlmClk" ;
|
||||
if (value>=0 && value<(int)qs.count())
|
||||
return qs.at(value);
|
||||
else
|
||||
return QObject::tr("<font color=red><b>Inconsistent parameter</b></font>");
|
||||
}
|
||||
else if (function==FuncPlayHaptic) {
|
||||
qs << "0" << "1" << "2" << "3";
|
||||
if (value>=0 && value<(int)qs.count())
|
||||
return qs.at(value);
|
||||
else
|
||||
return QObject::tr("<font color=red><b>Inconsistent parameter</b></font>");
|
||||
}
|
||||
else if (function==FuncReset) {
|
||||
qs.append( QObject::tr("Timer1"));
|
||||
qs.append( QObject::tr("Timer2"));
|
||||
qs.append( QObject::tr("All"));
|
||||
qs.append( QObject::tr("Telemetry"));
|
||||
if (value>=0 && value<(int)qs.count())
|
||||
return qs.at(value);
|
||||
else
|
||||
return QObject::tr("<font color=red><b>Inconsistent parameter</b></font>");
|
||||
}
|
||||
else if ((function==FuncVolume)|| (function==FuncPlayValue)) {
|
||||
RawSource item(value);
|
||||
return item.toString();
|
||||
}
|
||||
else if ((function==FuncPlayPrompt) || (function==FuncPlayBoth)) {
|
||||
if ( GetEepromInterface()->getCapability(VoicesAsNumbers)) {
|
||||
return QString("%1").arg(value);
|
||||
} else {
|
||||
return paramT;
|
||||
}
|
||||
} else if ((function>FuncBackgroundMusicPause) && (function<FuncCount)) {
|
||||
switch (adjustmode) {
|
||||
case 0:
|
||||
return QObject::tr("Value ")+QString("%1").arg(value);
|
||||
break;
|
||||
case 1:
|
||||
return RawSource(value).toString();
|
||||
break;
|
||||
case 2:
|
||||
return RawSource(value).toString();
|
||||
break;
|
||||
case 3:
|
||||
if (value==0) {
|
||||
return QObject::tr("Decr:")+QString(" -1");
|
||||
} else {
|
||||
return QObject::tr("Incr:")+QString(" +1");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
void populateFuncParamArmTCB(QComboBox *b, ModelData * g_model, char * value, QStringList & paramsList)
|
||||
{
|
||||
b->clear();
|
||||
b->addItem("----");
|
||||
|
||||
QString currentvalue(value);
|
||||
foreach ( QString entry, paramsList ) {
|
||||
b->addItem(entry);
|
||||
if (entry==currentvalue) {
|
||||
b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void populateFuncParamCB(QComboBox *b, const ModelData & model, uint function, unsigned int value, unsigned int adjustmode)
|
||||
{
|
||||
QStringList qs;
|
||||
b->clear();
|
||||
if (function==FuncPlaySound) {
|
||||
qs <<"Beep 1" << "Beep 2" << "Beep 3" << "Warn1" << "Warn2" << "Cheep" << "Ratata" << "Tick" << "Siren" << "Ring" ;
|
||||
qs << "SciFi" << "Robot" << "Chirp" << "Tada" << "Crickt" << "AlmClk" ;
|
||||
b->addItems(qs);
|
||||
b->setCurrentIndex(value);
|
||||
}
|
||||
else if (function==FuncPlayHaptic) {
|
||||
qs << "0" << "1" << "2" << "3";
|
||||
b->addItems(qs);
|
||||
b->setCurrentIndex(value);
|
||||
}
|
||||
else if (function==FuncReset) {
|
||||
qs.append( QObject::tr("Timer1"));
|
||||
qs.append( QObject::tr("Timer2"));
|
||||
qs.append( QObject::tr("All"));
|
||||
qs.append( QObject::tr("Telemetry"));
|
||||
int reCount = GetEepromInterface()->getCapability(RotaryEncoders);
|
||||
if (reCount == 1) {
|
||||
qs.append( QObject::tr("Rotary Encoder"));
|
||||
}
|
||||
else if (reCount == 2) {
|
||||
qs.append( QObject::tr("REa"));
|
||||
qs.append( QObject::tr("REb"));
|
||||
}
|
||||
b->addItems(qs);
|
||||
b->setCurrentIndex(value);
|
||||
}
|
||||
else if (function==FuncVolume) {
|
||||
populateSourceCB(b, RawSource(value), model, POPULATE_SOURCES|POPULATE_TRIMS);
|
||||
}
|
||||
else if (function==FuncPlayValue) {
|
||||
populateSourceCB(b, RawSource(value), model, POPULATE_SOURCES|POPULATE_VIRTUAL_INPUTS|POPULATE_SWITCHES|POPULATE_GVARS|POPULATE_TRIMS|POPULATE_TELEMETRYEXT);
|
||||
}
|
||||
else if (function>=FuncAdjustGV1 && function<=FuncAdjustGVLast) {
|
||||
switch (adjustmode) {
|
||||
case 1:
|
||||
populateSourceCB(b, RawSource(value), model, POPULATE_SOURCES|POPULATE_TRIMS|POPULATE_SWITCHES);
|
||||
break;
|
||||
case 2:
|
||||
populateSourceCB(b, RawSource(value), model, POPULATE_GVARS);
|
||||
break;
|
||||
case 3:
|
||||
b->clear();
|
||||
b->addItem("-1", 0);
|
||||
b->addItem("+1", 1);
|
||||
b->setCurrentIndex(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
b->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void populateGVmodeCB(QComboBox *b, unsigned int value)
|
||||
{
|
||||
b->clear();
|
||||
b->addItem(QObject::tr("Value"));
|
||||
b->addItem(QObject::tr("Source"));
|
||||
b->addItem(QObject::tr("GVAR"));
|
||||
b->addItem(QObject::tr("Increment"));
|
||||
b->setCurrentIndex(value);
|
||||
}
|
||||
|
||||
void populatePhasesCB(QComboBox *b, int value)
|
||||
{
|
||||
for (int i=-GetEepromInterface()->getCapability(FlightPhases); i<=GetEepromInterface()->getCapability(FlightPhases); i++) {
|
||||
@@ -684,19 +345,6 @@ void CurveGroup::valuesChanged()
|
||||
}
|
||||
}
|
||||
|
||||
void populateTrimUseCB(QComboBox *b, unsigned int phase)
|
||||
{
|
||||
b->addItem(QObject::tr("Own trim"));
|
||||
unsigned int num_phases = GetEepromInterface()->getCapability(FlightPhases);
|
||||
if (num_phases>0) {
|
||||
for (unsigned int i = 0; i < num_phases; i++) {
|
||||
if (i != phase) {
|
||||
b->addItem(QObject::tr("Flight mode %1 trim").arg(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void populateGvarUseCB(QComboBox *b, unsigned int phase)
|
||||
{
|
||||
b->addItem(QObject::tr("Own value"));
|
||||
@@ -707,88 +355,6 @@ void populateGvarUseCB(QComboBox *b, unsigned int phase)
|
||||
}
|
||||
}
|
||||
|
||||
void populateTimerSwitchCB(QComboBox *b, int value)
|
||||
{
|
||||
b->clear();
|
||||
uint8_t count=0;
|
||||
for (int i=-128; i<128; i++) {
|
||||
QString timerMode = getTimerMode(i);
|
||||
if (!timerMode.isEmpty()) {
|
||||
b->addItem(getTimerMode(i), i);
|
||||
if (i==value)
|
||||
b->setCurrentIndex(b->count()-1);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
b->setMaxVisibleItems(10);
|
||||
}
|
||||
|
||||
QString getTimerMode(int tm) {
|
||||
|
||||
QString stt = "OFFABSTHsTH%THt";
|
||||
|
||||
QString s;
|
||||
|
||||
if (tm >= 0 && tm <= TMRMODE_THt) {
|
||||
return stt.mid(abs(tm)*3, 3);
|
||||
}
|
||||
|
||||
int tma = abs(tm);
|
||||
|
||||
if (tma >= TMRMODE_FIRST_SWITCH && tma < TMRMODE_FIRST_SWITCH + GetEepromInterface()->getCapability(SwitchesPositions)) {
|
||||
s = RawSwitch(SWITCH_TYPE_SWITCH, tma - TMRMODE_FIRST_SWITCH + 1).toString();
|
||||
if (tm < 0) s.prepend("!");
|
||||
return s;
|
||||
}
|
||||
|
||||
if (tma >= TMRMODE_FIRST_SWITCH + GetEepromInterface()->getCapability(SwitchesPositions) && tma < TMRMODE_FIRST_SWITCH + GetEepromInterface()->getCapability(SwitchesPositions) + GetEepromInterface()->getCapability(CustomSwitches)) {
|
||||
s = RawSwitch(SWITCH_TYPE_VIRTUAL, tma - TMRMODE_FIRST_SWITCH - GetEepromInterface()->getCapability(SwitchesPositions) + 1).toString();
|
||||
if (tm < 0) s.prepend("!");
|
||||
return s;
|
||||
}
|
||||
|
||||
if (tma >= TMRMODE_FIRST_MOMENT_SWITCH && tma < TMRMODE_FIRST_MOMENT_SWITCH + GetEepromInterface()->getCapability(SwitchesPositions)) {
|
||||
s = RawSwitch(SWITCH_TYPE_SWITCH, tma - TMRMODE_FIRST_MOMENT_SWITCH + 1).toString()+"t";
|
||||
if (tm < 0) s.prepend("!");
|
||||
return s;
|
||||
}
|
||||
|
||||
if (tma >= TMRMODE_FIRST_MOMENT_SWITCH + GetEepromInterface()->getCapability(SwitchesPositions) && tma < TMRMODE_FIRST_MOMENT_SWITCH + GetEepromInterface()->getCapability(SwitchesPositions) + GetEepromInterface()->getCapability(CustomSwitches)) {
|
||||
s = RawSwitch(SWITCH_TYPE_VIRTUAL, tma - TMRMODE_FIRST_MOMENT_SWITCH - GetEepromInterface()->getCapability(SwitchesPositions) + 1).toString()+"t";
|
||||
if (tm < 0) s.prepend("!");
|
||||
return s;
|
||||
}
|
||||
if (tma >=TMRMODE_FIRST_CHPERC && tma <TMRMODE_FIRST_CHPERC+16) {
|
||||
s = QString("CH%1%").arg(tma-TMRMODE_FIRST_CHPERC+1);
|
||||
return s;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
QString getTimerModeB(int tm) {
|
||||
|
||||
QString stt = "---THRRUDELEIDOID1ID2AILGEATRN";
|
||||
|
||||
QString s;
|
||||
int tma = abs(tm);
|
||||
if (tma>33) {
|
||||
tma-=32;
|
||||
}
|
||||
if (tma < 10) {
|
||||
s=stt.mid(abs(tma)*3, 3);
|
||||
} else if (tma <19) {
|
||||
s=QString("SW%1").arg(tma-9);
|
||||
} else {
|
||||
s=QString("SW")+QChar('A'+tma-19);
|
||||
}
|
||||
if (tm<0) {
|
||||
s.prepend("!");
|
||||
} else if (tm>33) {
|
||||
s.append("m");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
void populateBacklightCB(QComboBox *b, const uint8_t value)
|
||||
{
|
||||
QString strings[] = { QObject::tr("OFF"), QObject::tr("Keys"), QObject::tr("Sticks"), QObject::tr("Keys + Sticks"), QObject::tr("ON"), NULL };
|
||||
@@ -801,119 +367,117 @@ void populateBacklightCB(QComboBox *b, const uint8_t value)
|
||||
}
|
||||
}
|
||||
|
||||
void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr, UseContext context)
|
||||
void populateAndSwitchCB(QComboBox *b, const RawSwitch & value)
|
||||
{
|
||||
if (IS_ARM(GetEepromInterface()->getBoard())) {
|
||||
populateSwitchCB(b, value);
|
||||
}
|
||||
else {
|
||||
RawSwitch item;
|
||||
|
||||
b->clear();
|
||||
|
||||
item = RawSwitch(SWITCH_TYPE_NONE);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
|
||||
for (int i=1; i<=GetEepromInterface()->getCapability(SwitchesPositions); i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_SWITCH, i);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
for (int i=1; i<=6; i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr)
|
||||
{
|
||||
RawSwitch item;
|
||||
|
||||
b->clear();
|
||||
|
||||
if (attr & POPULATE_AND_SWITCHES) {
|
||||
if (GetEepromInterface()->getCapability(HasNegAndSwitches)) {
|
||||
for (int i=-GetEepromInterface()->getCapability(CustomAndSwitches); i<=-1; i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
for (int i=-GetEepromInterface()->getCapability(SwitchesPositions); i<=-1; i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_SWITCH, i);
|
||||
if (GetEepromInterface()->isAvailable(item, context)) {
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
item = RawSwitch(SWITCH_TYPE_NONE);
|
||||
if (GetEepromInterface()->isAvailable(item, context)) {
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
for (int i=1; i<=GetEepromInterface()->getCapability(SwitchesPositions); i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_SWITCH, i);
|
||||
if (GetEepromInterface()->isAvailable(item, context)) {
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
}
|
||||
for (int i=1; i<=GetEepromInterface()->getCapability(CustomAndSwitches); i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// TODO check ... I removed negative toggle switches in the FW, no?
|
||||
if (attr & POPULATE_MSWITCHES) {
|
||||
if (attr & POPULATE_ONOFF) {
|
||||
item = RawSwitch(SWITCH_TYPE_ONM, 1);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
for (int i=-GetEepromInterface()->getCapability(CustomSwitches); i<0; i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, i);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
for (int i=-GetEepromInterface()->getCapability(SwitchesPositions); i<0; i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, i);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (attr & POPULATE_ONOFF) {
|
||||
item = RawSwitch(SWITCH_TYPE_OFF);
|
||||
if (GetEepromInterface()->isAvailable(item, context)) {
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
for (int i=-GetEepromInterface()->getCapability(CustomSwitches); i<0; i++) {
|
||||
for (int i=-GetEepromInterface()->getCapability(LogicalSwitches); i<0; i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
|
||||
if (GetEepromInterface()->isAvailable(item, context)) {
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
for (int i=-GetEepromInterface()->getCapability(RotaryEncoders); i<0; i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_ROTARY_ENCODER, i);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
for (int i=-8; i<0; i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_TRIM, i);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
for (int i=-GetEepromInterface()->getCapability(MultiposPots) * GetEepromInterface()->getCapability(MultiposPotsPositions); i<0; i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
for (int i=-GetEepromInterface()->getCapability(SwitchesPositions); i<0; i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_SWITCH, i);
|
||||
if (GetEepromInterface()->isAvailable(item, context)) {
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
if (attr & POPULATE_TIMER_MODES) {
|
||||
for (int i=0; i<5; i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_TIMER_MODE, i);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
}
|
||||
|
||||
item = RawSwitch(SWITCH_TYPE_NONE);
|
||||
if (GetEepromInterface()->isAvailable(item, context)) {
|
||||
else {
|
||||
item = RawSwitch(SWITCH_TYPE_NONE);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
for (int i=1; i<=GetEepromInterface()->getCapability(SwitchesPositions); i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_SWITCH, i);
|
||||
if (GetEepromInterface()->isAvailable(item, context)) {
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=1; i<=GetEepromInterface()->getCapability(CustomSwitches); i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(MultiposPots) * GetEepromInterface()->getCapability(MultiposPotsPositions); i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
for (int i=1; i<=GetEepromInterface()->getCapability(MultiposPots) * GetEepromInterface()->getCapability(MultiposPotsPositions); i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
for (int i=1; i<=8; i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_TRIM, i);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
for (int i=1; i<=GetEepromInterface()->getCapability(RotaryEncoders); i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_ROTARY_ENCODER, i);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
for (int i=1; i<=GetEepromInterface()->getCapability(LogicalSwitches); i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
if (attr & POPULATE_ONOFF) {
|
||||
@@ -922,52 +486,6 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr,
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
if (attr & POPULATE_MSWITCHES) {
|
||||
for (int i=1; i<=GetEepromInterface()->getCapability(SwitchesPositions); i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, i);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
for (int i=1; i<=GetEepromInterface()->getCapability(CustomSwitches); i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, i);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
}
|
||||
|
||||
if (attr & POPULATE_MSWITCHES) {
|
||||
if (attr & POPULATE_ONOFF) {
|
||||
item = RawSwitch(SWITCH_TYPE_ONM);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
if (IS_ARM(GetEepromInterface()->getBoard())) {
|
||||
item = RawSwitch(SWITCH_TYPE_TRN,0);
|
||||
if (GetEepromInterface()->isAvailable(item, context)) {
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
item = RawSwitch(SWITCH_TYPE_TRN,1);
|
||||
if (GetEepromInterface()->isAvailable(item, context)) {
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
}
|
||||
if (GetEepromInterface()->getBoard()==BOARD_SKY9X) {
|
||||
item = RawSwitch(SWITCH_TYPE_REA,0);
|
||||
if (GetEepromInterface()->isAvailable(item, context)) {
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
item = RawSwitch(SWITCH_TYPE_REA,1);
|
||||
if (GetEepromInterface()->isAvailable(item, context)) {
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
b->setMaxVisibleItems(10);
|
||||
}
|
||||
|
||||
@@ -1064,7 +582,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
|
||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(CustomSwitches); i++) {
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) {
|
||||
item = RawSource(SOURCE_TYPE_CUSTOM_SWITCH, i);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
||||
@@ -1117,35 +635,6 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
|
||||
b->setMaxVisibleItems(10);
|
||||
}
|
||||
|
||||
#define CSWITCH_STR "---- a~x a>x a<x |a|>x |a|<x AND OR XOR a=b a!=b a>b a<b a>=b a<=b d>=x |d|>=xTIM "
|
||||
#define CSW_NUM_FUNC 18 // TODO enum
|
||||
#define CSW_LEN_FUNC 6
|
||||
int csw_values[]={
|
||||
CS_FN_OFF,
|
||||
CS_FN_VEQUAL, // added at the end to avoid everything renumbered
|
||||
CS_FN_VPOS,
|
||||
CS_FN_VNEG,
|
||||
CS_FN_APOS,
|
||||
CS_FN_ANEG,
|
||||
CS_FN_AND,
|
||||
CS_FN_OR,
|
||||
CS_FN_XOR,
|
||||
CS_FN_EQUAL,
|
||||
CS_FN_NEQUAL,
|
||||
CS_FN_GREATER,
|
||||
CS_FN_LESS,
|
||||
CS_FN_EGREATER,
|
||||
CS_FN_ELESS,
|
||||
CS_FN_DPOS,
|
||||
CS_FN_DAPOS,
|
||||
CS_FN_TIM
|
||||
};
|
||||
|
||||
QString getCSWFunc(int val)
|
||||
{
|
||||
return QString(CSWITCH_STR).mid(val*CSW_LEN_FUNC, CSW_LEN_FUNC);
|
||||
}
|
||||
|
||||
float ValToTim(int value)
|
||||
{
|
||||
return ((value < -109 ? 129+value : (value < 7 ? (113+value)*5 : (53+value)*10))/10.0);
|
||||
@@ -1166,14 +655,39 @@ int TimToVal(float value)
|
||||
|
||||
void populateCSWCB(QComboBox *b, int value)
|
||||
{
|
||||
int order[] = {
|
||||
LS_FN_OFF,
|
||||
LS_FN_VEQUAL, // added at the end to avoid everything renumbered
|
||||
LS_FN_VPOS,
|
||||
LS_FN_VNEG,
|
||||
// LS_FN_RANGE,
|
||||
LS_FN_APOS,
|
||||
LS_FN_ANEG,
|
||||
LS_FN_AND,
|
||||
LS_FN_OR,
|
||||
LS_FN_XOR,
|
||||
LS_FN_STAY,
|
||||
LS_FN_EQUAL,
|
||||
LS_FN_NEQUAL,
|
||||
LS_FN_GREATER,
|
||||
LS_FN_LESS,
|
||||
LS_FN_EGREATER,
|
||||
LS_FN_ELESS,
|
||||
LS_FN_DPOS,
|
||||
LS_FN_DAPOS,
|
||||
LS_FN_TIMER,
|
||||
LS_FN_STICKY
|
||||
};
|
||||
|
||||
b->clear();
|
||||
for (int i = 0; i < CSW_NUM_FUNC; i++) {
|
||||
b->addItem(getCSWFunc(i),csw_values[i]);
|
||||
if (i>GetEepromInterface()->getCapability(CSFunc)) {
|
||||
QModelIndex index = b->model()->index(i, 0);
|
||||
QVariant v(0);
|
||||
}
|
||||
if (value == csw_values[i]) {
|
||||
for (int i=0; i<LS_FN_MAX; i++) {
|
||||
int func = order[i];
|
||||
b->addItem(LogicalSwitchData(func).funcToString(), func);
|
||||
// if (i>GetEepromInterface()->getCapability(CSFunc)) {
|
||||
// QModelIndex index = b->model()->index(i, 0);
|
||||
// QVariant v(0);
|
||||
// }
|
||||
if (value == func) {
|
||||
b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
}
|
||||
@@ -1341,7 +855,7 @@ QString getTrimInc(ModelData * g_model)
|
||||
QString getTimerStr(TimerData & timer)
|
||||
{
|
||||
QString str = ", " + (timer.dir ? QObject::tr("Count Up") : QObject::tr("Count Down"));
|
||||
return QObject::tr("%1:%2, ").arg(timer.val/60, 2, 10, QChar('0')).arg(timer.val%60, 2, 10, QChar('0')) + getTimerMode(timer.mode) + str;
|
||||
return QObject::tr("%1:%2, ").arg(timer.val/60, 2, 10, QChar('0')).arg(timer.val%60, 2, 10, QChar('0')) + timer.mode.toString() + str;
|
||||
}
|
||||
|
||||
QString getProtocol(ModelData * g_model)
|
||||
@@ -1382,13 +896,6 @@ QString getPhasesStr(unsigned int phases, ModelData & model)
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
QString getCenterBeep(ModelData * g_model)
|
||||
{
|
||||
//RETA123
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <QtGui>
|
||||
#include "eeprominterface.h"
|
||||
|
||||
#define TMR_NUM_OPTION (TMR_VAROFS+2*9+2*GetEepromInterface()->getCapability(CustomSwitches)-1)
|
||||
#define TMR_NUM_OPTION (TMR_VAROFS+2*9+2*GetEepromInterface()->getCapability(LogicalSwitches)-1)
|
||||
|
||||
//convert from mode 1 to mode generalSettings.stickMode
|
||||
//NOTICE! => 1..4 -> 1..4
|
||||
@@ -23,6 +23,8 @@
|
||||
#define TRIM_OFF 1
|
||||
#define TRIM_OFFSET 2
|
||||
|
||||
#define TRIM_MODE_NONE 0x1F // 0b11111
|
||||
|
||||
void populateGvSourceCB(QComboBox *b, int value);
|
||||
void populateVoiceLangCB(QComboBox *b, QString language);
|
||||
void populateTTraceCB(QComboBox *b, int value);
|
||||
@@ -80,20 +82,13 @@ class CurveGroup : public QObject {
|
||||
};
|
||||
|
||||
#define POPULATE_ONOFF 0x01
|
||||
#define POPULATE_MSWITCHES 0x02
|
||||
#define POPULATE_AND_SWITCHES 0x04
|
||||
void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr=0, UseContext context=DefaultContext);
|
||||
void populateFuncCB(QComboBox *b, unsigned int value);
|
||||
void populateGVmodeCB(QComboBox *b, unsigned int value);
|
||||
QString FuncParam(uint function, int value, QString paramT="",unsigned int adjustmode=0);
|
||||
void populateFuncParamCB(QComboBox *b, const ModelData & model, uint function, unsigned int value, unsigned int adjustmode=0);
|
||||
void populateFuncParamArmTCB(QComboBox *b, ModelData * g_model, char * value, QStringList & paramsList);
|
||||
#define POPULATE_TIMER_MODES 0x02
|
||||
void populateAndSwitchCB(QComboBox *b, const RawSwitch & value);
|
||||
void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr=0);
|
||||
|
||||
void populatePhasesCB(QComboBox *b, int value);
|
||||
void populateTrimUseCB(QComboBox *b, unsigned int phase);
|
||||
void populateGvarUseCB(QComboBox *b, unsigned int phase);
|
||||
void populateCustomScreenFieldCB(QComboBox *b, unsigned int value, bool last, int hubproto);
|
||||
void populateTimerSwitchCB(QComboBox *b, int value);
|
||||
QString getCustomSwitchStr(CustomSwData * customSw, const ModelData & model);
|
||||
QString getProtocolStr(const int proto);
|
||||
QString getPhasesStr(unsigned int phases, ModelData & model);
|
||||
|
||||
@@ -112,13 +107,8 @@ QString getPhasesStr(unsigned int phases, ModelData & model);
|
||||
void populateGVCB(QComboBox *b, int value);
|
||||
void populateSourceCB(QComboBox *b, const RawSource &source, const ModelData & model, unsigned int flags);
|
||||
void populateCSWCB(QComboBox *b, int value);
|
||||
QString getTimerMode(int tm);
|
||||
QString getTimerModeB(int tm);
|
||||
QString getPhaseName(int val, char * phasename=NULL);
|
||||
QString getInputStr(ModelData & model, int index);
|
||||
QString getCSWFunc(int val);
|
||||
QString getFuncName(unsigned int val);
|
||||
QString getRepeatString(unsigned int val);
|
||||
QString getSignedStr(int value);
|
||||
QString getGVarString(int16_t val, bool sign=false);
|
||||
QString image2qstring(QImage image);
|
||||
@@ -138,7 +128,6 @@ QString getFrSkyProtocol(int protocol);
|
||||
QString getFrSkyMeasure(int units);
|
||||
QString getFrSkySrc(int index);
|
||||
|
||||
float c9xexpou(float point, float coeff);
|
||||
float ValToTim(int value);
|
||||
int TimToVal(float value);
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 381 B After Width: | Height: | Size: 477 B |
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 852 B After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 534 B After Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 731 B After Width: | Height: | Size: 731 B |
|
After Width: | Height: | Size: 482 B |
|
After Width: | Height: | Size: 705 B |
|
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 65 KiB |
@@ -0,0 +1,481 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>preferencesDialog</class>
|
||||
<widget class="QDialog" name="preferencesDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>685</width>
|
||||
<height>418</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>685</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Preferences</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4" columnstretch="1">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMinimumSize</enum>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="snapshotPath">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Simu BackLight</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
<string>Simulator capture folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Joystick</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Remember simulator switches</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="simuSW">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QComboBox" name="joystickCB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="joystickChkB">
|
||||
<property name="text">
|
||||
<string>Enable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="snapshotClipboardCKB">
|
||||
<property name="text">
|
||||
<string>Use clipboard only</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="joystickcalButton">
|
||||
<property name="text">
|
||||
<string>Calibrate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="backLightColor">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Blue</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Green</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Red</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Orange</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Yellow</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<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="3" column="2">
|
||||
<widget class="QPushButton" name="snapshotPathButton">
|
||||
<property name="text">
|
||||
<string>Open Folder</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Personal splash library</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="libraryPath">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="libraryPathButton">
|
||||
<property name="text">
|
||||
<string>Open Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QComboBox" name="splashincludeCB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Include companion splashes</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Only user defined splashes</string>
|
||||
</property>
|
||||
</item>
|
||||
</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="2" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Splash library behaviour</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Custom TX splash screen</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="SplashFileName">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="SplashSelect">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open Image</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QToolButton" name="splashLibraryButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="clearImageButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="InvertPixels">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Invert Pixels</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="imageLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>128</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>128</width>
|
||||
<height>64</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>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<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>
|
||||
<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>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="companion.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>preferencesDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>370</x>
|
||||
<y>49</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>preferencesDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>390</x>
|
||||
<y>55</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <QtGui>
|
||||
#include <QNetworkProxyFactory>
|
||||
#include <QFileInfo>
|
||||
#include <QDesktopServices>
|
||||
#include "mainwindow.h"
|
||||
#include "mdichild.h"
|
||||
#include "burnconfigdialog.h"
|
||||
@@ -49,6 +50,8 @@
|
||||
#include "comparedialog.h"
|
||||
#include "logsdialog.h"
|
||||
#include "preferencesdialog.h"
|
||||
#include "apppreferencesdialog.h"
|
||||
#include "fwpreferencesdialog.h"
|
||||
#include "flashinterface.h"
|
||||
#include "fusesdialog.h"
|
||||
#include "downloaddialog.h"
|
||||
@@ -641,6 +644,42 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::setLanguage(QString langString)
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("locale", langString );
|
||||
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(tr("The selected language will be used the next time you start Companion."));
|
||||
msgBox.setIcon(QMessageBox::Information);
|
||||
msgBox.addButton(tr("OK"), QMessageBox::AcceptRole);
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
void MainWindow::setTheme(int index)
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("theme", index );
|
||||
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(tr("The new theme will be loaded the next time you start Companion."));
|
||||
msgBox.setIcon(QMessageBox::Information);
|
||||
msgBox.addButton(tr("OK"), QMessageBox::AcceptRole);
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
void MainWindow::setIconThemeSize(int index)
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("icon_size", index );
|
||||
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(tr("The icon size will be used the next time you start Companion."));
|
||||
msgBox.setIcon(QMessageBox::Information);
|
||||
msgBox.addButton(tr("OK"), QMessageBox::AcceptRole);
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
void MainWindow::newFile()
|
||||
{
|
||||
MdiChild *child = createMdiChild();
|
||||
@@ -648,6 +687,12 @@ void MainWindow::newFile()
|
||||
child->show();
|
||||
}
|
||||
|
||||
void MainWindow::openDocumentURL()
|
||||
{
|
||||
QString link = "http://www.open-tx.org/documents.html";
|
||||
QDesktopServices::openUrl(QUrl(link));
|
||||
}
|
||||
|
||||
void MainWindow::openFile()
|
||||
{
|
||||
QSettings settings;
|
||||
@@ -782,6 +827,32 @@ void MainWindow::preferences()
|
||||
updateMenus();
|
||||
}
|
||||
|
||||
void MainWindow::appPreferences()
|
||||
{
|
||||
appPreferencesDialog *pd = new appPreferencesDialog(this);
|
||||
pd->exec();
|
||||
updateMenus();
|
||||
}
|
||||
|
||||
void MainWindow::fwPreferences()
|
||||
{
|
||||
fwPreferencesDialog *pd = new fwPreferencesDialog(this);
|
||||
pd->exec();
|
||||
FirmwareInfo *firmware = GetCurrentFirmware();
|
||||
if (ActiveProfile) {
|
||||
setWindowTitle(tr("Companion - Models and Settings Editor - %1 - profile %2").arg(firmware->name).arg(ActiveProfileName));
|
||||
}
|
||||
else {
|
||||
setWindowTitle(tr("Companion - Models and Settings Editor - %1").arg(firmware->name));
|
||||
}
|
||||
|
||||
foreach (QMdiSubWindow *window, mdiArea->subWindowList()) {
|
||||
MdiChild *mdiChild = qobject_cast<MdiChild *>(window->widget());
|
||||
mdiChild->eepromInterfaceChanged();
|
||||
}
|
||||
updateMenus();
|
||||
}
|
||||
|
||||
void MainWindow::contributors()
|
||||
{
|
||||
contributorsDialog *cd = new contributorsDialog(this,0);
|
||||
@@ -1630,10 +1701,18 @@ void MainWindow::createActions()
|
||||
logsAct->setStatusTip(tr("Open log file"));
|
||||
connect(logsAct, SIGNAL(triggered()), this, SLOT(logFile()));
|
||||
|
||||
preferencesAct = new QAction(CompanionIcon("preferences.png"), tr("&Preferences..."), this);
|
||||
preferencesAct->setStatusTip(tr("Edit general preferences"));
|
||||
preferencesAct = new QAction(tr("&Old Preferences Dialog..."), this);
|
||||
preferencesAct->setStatusTip(tr("Used the old Preferences Dialog"));
|
||||
connect(preferencesAct, SIGNAL(triggered()), this, SLOT(preferences()));
|
||||
|
||||
appPreferencesAct = new QAction(CompanionIcon("apppreferences.png"), tr("&Application Preferences..."), this);
|
||||
appPreferencesAct->setStatusTip(tr("Edit application preferences"));
|
||||
connect(appPreferencesAct, SIGNAL(triggered()), this, SLOT(appPreferences()));
|
||||
|
||||
fwPreferencesAct = new QAction(CompanionIcon("fwpreferences.png"), tr("&Downloads and Profiles..."), this);
|
||||
fwPreferencesAct->setStatusTip(tr("Firmware and voice file downloads as well as profile definition."));
|
||||
connect(fwPreferencesAct, SIGNAL(triggered()), this, SLOT(fwPreferences()));
|
||||
|
||||
checkForUpdatesAct = new QAction(CompanionIcon("update.png"), tr("&Check for updates..."), this);
|
||||
checkForUpdatesAct->setStatusTip(tr("Check for new version of Companion"));
|
||||
connect(checkForUpdatesAct, SIGNAL(triggered()), this, SLOT(doUpdates()));
|
||||
@@ -1655,7 +1734,7 @@ void MainWindow::createActions()
|
||||
compareAct->setEnabled(false);
|
||||
connect(compareAct, SIGNAL(triggered()), this, SLOT(compare()));
|
||||
|
||||
customizeSplashAct = new QAction(CompanionIcon("paintbrush.png"), tr("Customize your &TX..."), this);
|
||||
customizeSplashAct = new QAction(CompanionIcon("paintbrush.png"), tr("Configure transmitter start screen..."), this);
|
||||
customizeSplashAct->setStatusTip(tr("Customize the splash screen of your TX"));
|
||||
connect(customizeSplashAct, SIGNAL(triggered()), this, SLOT(customizeSplash()));
|
||||
|
||||
@@ -1708,7 +1787,7 @@ void MainWindow::createActions()
|
||||
burnFromFlashAct->setStatusTip(tr("Read firmware from transmitter"));
|
||||
connect(burnFromFlashAct,SIGNAL(triggered()),this,SLOT(burnFromFlash()));
|
||||
|
||||
burnConfigAct = new QAction(CompanionIcon("configure.png"), tr("&Configure..."), this);
|
||||
burnConfigAct = new QAction(CompanionIcon("configure.png"), tr("&Configure connection software..."), this);
|
||||
burnConfigAct->setStatusTip(tr("Configure software for reading from and writing to the transmitter"));
|
||||
connect(burnConfigAct,SIGNAL(triggered()),this,SLOT(burnConfig()));
|
||||
EEPROMInterface *eepromInterface = GetEepromInterface();
|
||||
@@ -1754,6 +1833,84 @@ void MainWindow::createActions()
|
||||
connect(profileActs[i], SIGNAL(triggered()), this, SLOT(loadProfile()));
|
||||
}
|
||||
updateProfilesActions();
|
||||
|
||||
classicThemeAct = new QAction(tr("Classic"), this);
|
||||
classicThemeAct->setStatusTip(tr("The multicolor classical Companion icon theme"));
|
||||
connect(classicThemeAct, SIGNAL(triggered()), this, SLOT(setClassicTheme()));
|
||||
monoThemeAct = new QAction("Monochrome",this);
|
||||
monoThemeAct->setStatusTip(tr("A monochrome black icon theme"));
|
||||
connect(monoThemeAct, SIGNAL(triggered()), this, SLOT(setMonochromeTheme()));
|
||||
monoWhiteThemeAct = new QAction("MonoWhite",this);
|
||||
monoWhiteThemeAct->setStatusTip(tr("A monochrome white icon theme"));
|
||||
connect(monoWhiteThemeAct, SIGNAL(triggered()), this, SLOT(setMonoWhiteTheme()));
|
||||
monoBlueThemeAct = new QAction("MonoBlue",this);
|
||||
monoBlueThemeAct->setStatusTip(tr("A monochrome blue icon theme"));
|
||||
connect(monoBlueThemeAct, SIGNAL(triggered()), this, SLOT(setMonoBlueTheme()));
|
||||
|
||||
smallIconAct = new QAction(tr("Small"),this);
|
||||
smallIconAct->setStatusTip(tr("Use small toolbar icons"));
|
||||
connect(smallIconAct, SIGNAL(triggered()), this, SLOT(setSmallIconThemeSize()));
|
||||
normalIconAct = new QAction(this);
|
||||
normalIconAct->setStatusTip(tr("Use normal size toolbar icons"));
|
||||
normalIconAct->setText(tr("Normal"));
|
||||
connect(normalIconAct, SIGNAL(triggered()), this, SLOT(setNormalIconThemeSize()));
|
||||
bigIconAct = new QAction(this);
|
||||
bigIconAct->setStatusTip(tr("Use big toolbar icons"));
|
||||
bigIconAct->setText(tr("Big"));
|
||||
connect(bigIconAct, SIGNAL(triggered()), this, SLOT(setBigIconThemeSize()));
|
||||
hugeIconAct = new QAction(this);
|
||||
hugeIconAct->setStatusTip(tr("Use huge toolbar icons"));
|
||||
hugeIconAct->setText(tr("Huge"));
|
||||
connect(hugeIconAct, SIGNAL(triggered()), this, SLOT(setHugeIconThemeSize()));
|
||||
|
||||
defaultLanguageAct = new QAction(tr("System default language"),this);
|
||||
defaultLanguageAct->setStatusTip(tr("Use system default language in menus"));
|
||||
connect(defaultLanguageAct, SIGNAL(triggered()), this, SLOT(setDefaultLanguage()));
|
||||
|
||||
czechLanguageAct = new QAction(tr("Czech"),this);
|
||||
czechLanguageAct->setStatusTip(tr("Use Czech in menus"));
|
||||
connect(czechLanguageAct, SIGNAL(triggered()), this, SLOT(setCZLanguage()));
|
||||
|
||||
germanLanguageAct = new QAction(tr("German"),this);
|
||||
germanLanguageAct->setStatusTip(tr("Use German in menus"));
|
||||
connect(germanLanguageAct, SIGNAL(triggered()), this, SLOT(setDELanguage()));
|
||||
|
||||
englishLanguageAct = new QAction(tr("English"),this);
|
||||
englishLanguageAct->setStatusTip(tr("Use English in menus"));
|
||||
connect(englishLanguageAct, SIGNAL(triggered()), this, SLOT(setENLanguage()));
|
||||
|
||||
frenchLanguageAct = new QAction(tr("French"),this);
|
||||
frenchLanguageAct->setStatusTip(tr("Use French in menus"));
|
||||
connect(frenchLanguageAct, SIGNAL(triggered()), this, SLOT(setFRLanguage()));
|
||||
|
||||
italianLanguageAct = new QAction(tr("Italian"),this);
|
||||
italianLanguageAct->setStatusTip(tr("Use Italian in menus"));
|
||||
connect(italianLanguageAct, SIGNAL(triggered()), this, SLOT(setITLanguage()));
|
||||
|
||||
hebrewLanguageAct = new QAction(tr("Hebrew"),this);
|
||||
hebrewLanguageAct->setStatusTip(tr("Use Hebrew in menus"));
|
||||
connect(hebrewLanguageAct, SIGNAL(triggered()), this, SLOT(setHELanguage()));
|
||||
|
||||
polishLanguageAct = new QAction(tr("Polish"),this);
|
||||
polishLanguageAct->setStatusTip(tr("Use Polish in menus"));
|
||||
connect(polishLanguageAct, SIGNAL(triggered()), this, SLOT(setPLLanguage()));
|
||||
|
||||
portugueseLanguageAct = new QAction(tr("Portuguese"),this);
|
||||
portugueseLanguageAct->setStatusTip(tr("Use Portuguese in menus"));
|
||||
connect(portugueseLanguageAct, SIGNAL(triggered()), this, SLOT(setPTLanguage()));
|
||||
|
||||
swedishLanguageAct = new QAction(tr("Swedish"),this);
|
||||
swedishLanguageAct->setStatusTip(tr("Use Swedish in menus"));
|
||||
connect(swedishLanguageAct, SIGNAL(triggered()), this, SLOT(setSELanguage()));
|
||||
|
||||
russianLanguageAct = new QAction(tr("Russian"),this);
|
||||
russianLanguageAct->setStatusTip(tr("Use Russian in menus"));
|
||||
connect(russianLanguageAct, SIGNAL(triggered()), this, SLOT(setRULanguage()));
|
||||
|
||||
openDocumentURLAct = new QAction(tr("Manuals and other Documents"),this);
|
||||
openDocumentURLAct->setStatusTip(tr("Open the OpenTX document page in a web browser"));
|
||||
connect(openDocumentURLAct, SIGNAL(triggered()), this, SLOT(openDocumentURL()));
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::createMenus()
|
||||
@@ -1761,6 +1918,9 @@ void MainWindow::createMenus()
|
||||
{
|
||||
QMenu *recentFileMenu=new QMenu(tr("Recent Files"));
|
||||
QMenu *profilesMenu=new QMenu(tr("Firmware Profiles"));
|
||||
QMenu *languageMenu=new QMenu(tr("Set Menu Language"));
|
||||
QMenu *themeMenu=new QMenu(tr("Set Icon Theme"));
|
||||
QMenu *iconThemeSizeMenu=new QMenu(tr("Set Icon Size"));
|
||||
|
||||
fileMenu = menuBar()->addMenu(tr("&File"));
|
||||
fileMenu->addAction(newAct);
|
||||
@@ -1778,7 +1938,7 @@ void MainWindow::createMenus()
|
||||
fileMenu->addAction(printAct);
|
||||
fileMenu->addAction(compareAct);
|
||||
fileMenu->addSeparator();
|
||||
fileMenu->addAction(preferencesAct);
|
||||
fileMenu->addAction(fwPreferencesAct);
|
||||
fileMenu->addMenu(profilesMenu);
|
||||
|
||||
profilesMenu->setIcon(CompanionIcon("profiles.png"));
|
||||
@@ -1791,6 +1951,35 @@ void MainWindow::createMenus()
|
||||
editMenu->addAction(copyAct);
|
||||
editMenu->addAction(pasteAct);
|
||||
|
||||
settingsMenu = menuBar()->addMenu(tr("&Settings"));
|
||||
settingsMenu->addMenu(languageMenu);
|
||||
languageMenu->addAction(defaultLanguageAct);
|
||||
languageMenu->addAction(englishLanguageAct);
|
||||
languageMenu->addAction(czechLanguageAct);
|
||||
languageMenu->addAction(germanLanguageAct);
|
||||
languageMenu->addAction(frenchLanguageAct);
|
||||
languageMenu->addAction(hebrewLanguageAct);
|
||||
languageMenu->addAction(italianLanguageAct);
|
||||
languageMenu->addAction(polishLanguageAct);
|
||||
languageMenu->addAction(portugueseLanguageAct);
|
||||
languageMenu->addAction(swedishLanguageAct);
|
||||
languageMenu->addAction(russianLanguageAct);
|
||||
settingsMenu->addMenu(themeMenu);
|
||||
themeMenu->addAction(classicThemeAct);
|
||||
themeMenu->addAction(monoThemeAct);
|
||||
themeMenu->addAction(monoBlueThemeAct);
|
||||
themeMenu->addAction(monoWhiteThemeAct);
|
||||
settingsMenu->addMenu(iconThemeSizeMenu);
|
||||
iconThemeSizeMenu->addAction(smallIconAct);
|
||||
iconThemeSizeMenu->addAction(normalIconAct);
|
||||
iconThemeSizeMenu->addAction(bigIconAct);
|
||||
iconThemeSizeMenu->addAction(hugeIconAct);
|
||||
settingsMenu->addSeparator();
|
||||
settingsMenu->addAction(appPreferencesAct);
|
||||
settingsMenu->addAction(customizeSplashAct);
|
||||
settingsMenu->addAction(preferencesAct);
|
||||
settingsMenu->addAction(burnConfigAct);
|
||||
|
||||
burnMenu = menuBar()->addMenu(tr("&Read/Write"));
|
||||
burnMenu->addAction(burnToAct);
|
||||
burnMenu->addAction(burnFromAct);
|
||||
@@ -1801,9 +1990,7 @@ void MainWindow::createMenus()
|
||||
burnMenu->addAction(burnToFlashAct);
|
||||
burnMenu->addAction(burnFromFlashAct);
|
||||
burnMenu->addSeparator();
|
||||
burnMenu->addAction(customizeSplashAct);
|
||||
burnMenu->addSeparator();
|
||||
burnMenu->addAction(burnConfigAct);
|
||||
EEPROMInterface *eepromInterface = GetEepromInterface();
|
||||
if (!IS_ARM(eepromInterface->getBoard())) {
|
||||
burnMenu->addAction(burnFusesAct);
|
||||
@@ -1816,6 +2003,7 @@ void MainWindow::createMenus()
|
||||
helpMenu->addAction(checkForUpdatesAct);
|
||||
helpMenu->addSeparator();
|
||||
helpMenu->addAction(aboutAct);
|
||||
helpMenu->addAction(openDocumentURLAct);
|
||||
helpMenu->addSeparator();
|
||||
helpMenu->addAction(changelogAct);
|
||||
helpMenu->addAction(fwchangelogAct);
|
||||
@@ -1872,7 +2060,9 @@ void MainWindow::createToolBars()
|
||||
fileToolBar->addAction(saveAct);
|
||||
fileToolBar->addAction(logsAct);
|
||||
fileToolBar->addSeparator();
|
||||
fileToolBar->addAction(preferencesAct);
|
||||
fileToolBar->addAction(appPreferencesAct);
|
||||
fileToolBar->addAction(fwPreferencesAct);
|
||||
fileToolBar->addAction(customizeSplashAct);
|
||||
profileButton = new QToolButton;
|
||||
profileButton->setPopupMode(QToolButton::InstantPopup);
|
||||
profileButton->setMenu(createProfilesMenu());
|
||||
@@ -1968,14 +2158,6 @@ QMdiSubWindow *MainWindow::findMdiChild(const QString &fileName)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MainWindow::switchLayoutDirection()
|
||||
{
|
||||
if (layoutDirection() == Qt::LeftToRight)
|
||||
qApp->setLayoutDirection(Qt::RightToLeft);
|
||||
else
|
||||
qApp->setLayoutDirection(Qt::LeftToRight);
|
||||
}
|
||||
|
||||
void MainWindow::setActiveSubWindow(QWidget *window)
|
||||
{
|
||||
if (!window)
|
||||
@@ -2143,3 +2325,5 @@ void MainWindow::autoClose()
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ QT_END_NAMESPACE
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
friend class preferencesDialog;
|
||||
friend class fwPreferencesDialog;
|
||||
friend class MdiChild; // TODO GetAvrdudeArgs could be external to this class
|
||||
|
||||
Q_OBJECT
|
||||
@@ -82,6 +83,33 @@ public slots:
|
||||
void unloadProfile();
|
||||
|
||||
private slots:
|
||||
void openDocumentURL();
|
||||
|
||||
void setLanguage(QString langString);
|
||||
void setDefaultLanguage() {setLanguage("");};
|
||||
void setCZLanguage() {setLanguage("cs_CZ");};
|
||||
void setDELanguage() {setLanguage("de_DE");};
|
||||
void setENLanguage() {setLanguage("en");};
|
||||
void setFRLanguage() {setLanguage("fr_FR");};
|
||||
void setITLanguage() {setLanguage("it_IT");};
|
||||
void setHELanguage() {setLanguage("he_IL");};
|
||||
void setPLLanguage() {setLanguage("pl_PL");};
|
||||
void setPTLanguage() {setLanguage("pt_PT");};
|
||||
void setRULanguage() {setLanguage("ru_RU");};
|
||||
void setSELanguage() {setLanguage("sv_SE");};
|
||||
|
||||
void setTheme(int index);
|
||||
void setClassicTheme() {setTheme(0);};
|
||||
void setMonochromeTheme(){setTheme(1);};
|
||||
void setMonoWhiteTheme() {setTheme(2);};
|
||||
void setMonoBlueTheme() {setTheme(3);};
|
||||
|
||||
void setIconThemeSize(int index);
|
||||
void setSmallIconThemeSize() {setIconThemeSize(0);};
|
||||
void setNormalIconThemeSize() {setIconThemeSize(1);};
|
||||
void setBigIconThemeSize() {setIconThemeSize(2);};
|
||||
void setHugeIconThemeSize() {setIconThemeSize(3);};
|
||||
|
||||
void checkForUpdates(bool ignoreSettings, QString & fwId);
|
||||
void checkForUpdateFinished(QNetworkReply * reply);
|
||||
void displayWarnings();
|
||||
@@ -119,14 +147,15 @@ private slots:
|
||||
void print();
|
||||
void loadBackup();
|
||||
void preferences();
|
||||
void appPreferences();
|
||||
void fwPreferences();
|
||||
void updateMenus();
|
||||
MdiChild *createMdiChild();
|
||||
void switchLayoutDirection();
|
||||
void setActiveSubWindow(QWidget *window);
|
||||
QMenu * createRecentFileMenu();
|
||||
QMenu * createProfilesMenu();
|
||||
void autoClose();
|
||||
|
||||
|
||||
private:
|
||||
void createActions();
|
||||
void createMenus();
|
||||
@@ -153,7 +182,6 @@ private:
|
||||
QStringList GetSendFlashCommand(const QString &filename);
|
||||
int getEpromVersion(QString fileName);
|
||||
|
||||
|
||||
bool convertEEPROM(QString backupFile, QString restoreFile, QString flashFile);
|
||||
bool isValidEEPROM(QString eepromfile);
|
||||
|
||||
@@ -183,6 +211,7 @@ private:
|
||||
|
||||
QMenu *fileMenu;
|
||||
QMenu *editMenu;
|
||||
QMenu *settingsMenu;
|
||||
QMenu *burnMenu;
|
||||
QMenu *helpMenu;
|
||||
QToolBar *fileToolBar;
|
||||
@@ -196,6 +225,8 @@ private:
|
||||
QAction *saveAsAct;
|
||||
QAction *exitAct;
|
||||
QAction *preferencesAct;
|
||||
QAction *appPreferencesAct;
|
||||
QAction *fwPreferencesAct;
|
||||
QAction *checkForUpdatesAct;
|
||||
QAction *contributorsAct;
|
||||
QAction *changelogAct;
|
||||
@@ -222,6 +253,26 @@ private:
|
||||
QAction *logsAct;
|
||||
QAction *recentFileActs[MAX_RECENT];
|
||||
QAction *profileActs[MAX_PROFILES];
|
||||
QAction *classicThemeAct;
|
||||
QAction *monoThemeAct;
|
||||
QAction *monoBlueThemeAct;
|
||||
QAction *monoWhiteThemeAct;
|
||||
QAction *smallIconAct;
|
||||
QAction *normalIconAct;
|
||||
QAction *bigIconAct;
|
||||
QAction *hugeIconAct;
|
||||
QAction *defaultLanguageAct;
|
||||
QAction *englishLanguageAct;
|
||||
QAction *czechLanguageAct;
|
||||
QAction *germanLanguageAct;
|
||||
QAction *frenchLanguageAct;
|
||||
QAction *italianLanguageAct;
|
||||
QAction *hebrewLanguageAct;
|
||||
QAction *polishLanguageAct;
|
||||
QAction *portugueseLanguageAct;
|
||||
QAction *swedishLanguageAct;
|
||||
QAction *russianLanguageAct;
|
||||
QAction *openDocumentURLAct;
|
||||
QString fwToUpdate;
|
||||
QToolButton * profileButton;
|
||||
};
|
||||
|
||||
@@ -495,6 +495,13 @@ void ModelEdit::on_ca_ctype_CB_currentIndexChanged()
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
@@ -36,6 +36,16 @@ void RepeatComboBox::onIndexChanged(int index)
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void RepeatComboBox::update()
|
||||
{
|
||||
unsigned int step = IS_ARM(GetEepromInterface()->getBoard()) ? 1 : 10;
|
||||
int value = repeatParam/step;
|
||||
if (step == 1) {
|
||||
value++;
|
||||
}
|
||||
setCurrentIndex(value);
|
||||
}
|
||||
|
||||
CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings):
|
||||
ModelPanel(parent, model),
|
||||
generalSettings(generalSettings),
|
||||
@@ -52,7 +62,6 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
|
||||
lock = true;
|
||||
int num_fsw = GetEepromInterface()->getCapability(CustomFunctions);
|
||||
|
||||
QStringList paramarmList;
|
||||
if (!GetEepromInterface()->getCapability(VoicesAsNumbers)) {
|
||||
for (int i=0; i<num_fsw; i++) {
|
||||
if (model.funcSw[i].func==FuncPlayPrompt || model.funcSw[i].func==FuncBackgroundMusic) {
|
||||
@@ -90,12 +99,21 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
|
||||
for (int i=0; i<num_fsw; i++) {
|
||||
AssignFunc func = model.funcSw[i].func;
|
||||
|
||||
// The label
|
||||
QLabel * label = new QLabel(this);
|
||||
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);
|
||||
connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(fsw_customContextMenuRequested(QPoint)));
|
||||
|
||||
// The switch
|
||||
fswtchSwtch[i] = new QComboBox(this);
|
||||
fswtchSwtch[i]->setProperty("index", i);
|
||||
connect(fswtchSwtch[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
|
||||
gridLayout->addWidget(fswtchSwtch[i], i+1, 1);
|
||||
populateSwitchCB(fswtchSwtch[i], model.funcSw[i].swtch, POPULATE_MSWITCHES|POPULATE_ONOFF);
|
||||
populateSwitchCB(fswtchSwtch[i], model.funcSw[i].swtch, POPULATE_ONOFF);
|
||||
|
||||
// The function
|
||||
fswtchFunc[i] = new QComboBox(this);
|
||||
@@ -135,7 +153,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
|
||||
|
||||
fswtchParamArmT[i] = new QComboBox(this);
|
||||
fswtchParamArmT[i]->setProperty("index", i);
|
||||
populateFuncParamArmTCB(fswtchParamArmT[i],&model, model.funcSw[i].paramarm, paramarmList);
|
||||
populateFuncParamArmTCB(fswtchParamArmT[i], model.funcSw[i].paramarm, paramarmList);
|
||||
fswtchParamArmT[i]->setEditable(true);
|
||||
paramLayout->addWidget(fswtchParamArmT[i]);
|
||||
|
||||
@@ -286,7 +304,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
|
||||
int index = fswtchFunc[i]->currentIndex();
|
||||
|
||||
if (index>=FuncSafetyCh1 && index<=FuncSafetyCh16) {
|
||||
if (index>=FuncSafetyCh1 && index<=FuncSafetyCh32) {
|
||||
fswtchParam[i]->setDecimals(0);
|
||||
fswtchParam[i]->setSingleStep(1);
|
||||
fswtchParam[i]->setMinimum(-125);
|
||||
@@ -329,6 +347,15 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
populateFuncParamCB(fswtchParamT[i], model, index, model.funcSw[i].param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM | CUSTOM_FUNCTION_ENABLE;
|
||||
}
|
||||
else if (index>=FuncSetTimer1 && index<=FuncSetTimer2) {
|
||||
if (modified) model.funcSw[i].param = fswtchParam[i]->value();
|
||||
fswtchParam[i]->setDecimals(0);
|
||||
fswtchParam[i]->setSingleStep(1);
|
||||
fswtchParam[i]->setMinimum(0);
|
||||
fswtchParam[i]->setMaximum(59*60+59);
|
||||
fswtchParam[i]->setValue(model.funcSw[i].param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM + CUSTOM_FUNCTION_ENABLE;
|
||||
}
|
||||
else if (index==FuncVolume) {
|
||||
if (modified) model.funcSw[i].param = fswtchParamT[i]->itemData(fswtchParamT[i]->currentIndex()).toInt();
|
||||
populateFuncParamCB(fswtchParamT[i], model, index, model.funcSw[i].param);
|
||||
@@ -337,6 +364,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
else if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) {
|
||||
if (index != FuncBackgroundMusic && GetEepromInterface()->getCapability(HasFuncRepeat)) {
|
||||
widgetsMask |= CUSTOM_FUNCTION_REPEAT;
|
||||
fswtchRepeat[i]->update();
|
||||
}
|
||||
if (index==FuncPlayValue) {
|
||||
if (modified) model.funcSw[i].param = fswtchParamT[i]->itemData(fswtchParamT[i]->currentIndex()).toInt();
|
||||
@@ -381,14 +409,20 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM;
|
||||
if (modified) {
|
||||
memset(model.funcSw[i].paramarm, 0, sizeof(model.funcSw[i].paramarm));
|
||||
int vml=GetEepromInterface()->getCapability(VoicesMaxLength);
|
||||
int vml = GetEepromInterface()->getCapability(VoicesMaxLength);
|
||||
if (fswtchParamArmT[i]->currentText() != "----") {
|
||||
widgetsMask |= CUSTOM_FUNCTION_PLAY;
|
||||
for (int j=0; j<std::min(fswtchParamArmT[i]->currentText().length(),vml); j++) {
|
||||
for (int j=0; j<std::min(fswtchParamArmT[i]->currentText().length(), vml); j++) {
|
||||
model.funcSw[i].paramarm[j] = fswtchParamArmT[i]->currentText().toAscii().at(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
populateFuncParamArmTCB(fswtchParamArmT[i], model.funcSw[i].paramarm, paramarmList);
|
||||
if (fswtchParamArmT[i]->currentText() != "----") {
|
||||
widgetsMask |= CUSTOM_FUNCTION_PLAY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (index==FuncBackgroundMusic) {
|
||||
@@ -453,13 +487,13 @@ void CustomFunctionsPanel::fswPaste()
|
||||
const QMimeData *mimeData = clipboard->mimeData();
|
||||
if (mimeData->hasFormat("application/x-companion-fsw")) {
|
||||
QByteArray fswData = mimeData->data("application/x-companion-fsw");
|
||||
|
||||
FuncSwData *fsw = &model.funcSw[selectedFunction];
|
||||
memcpy(fsw, fswData.mid(0, sizeof(FuncSwData)).constData(), sizeof(FuncSwData));
|
||||
// TODO update switch and func
|
||||
populateSwitchCB(fswtchSwtch[selectedFunction], model.funcSw[selectedFunction].swtch, POPULATE_MSWITCHES|POPULATE_ONOFF);
|
||||
lock = true;
|
||||
populateSwitchCB(fswtchSwtch[selectedFunction], model.funcSw[selectedFunction].swtch, POPULATE_ONOFF);
|
||||
populateFuncCB(fswtchFunc[selectedFunction], model.funcSw[selectedFunction].func);
|
||||
refreshCustomFunction(selectedFunction);
|
||||
lock = false;
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
@@ -468,7 +502,7 @@ void CustomFunctionsPanel::fswDelete()
|
||||
{
|
||||
model.funcSw[selectedFunction].clear();
|
||||
// TODO update switch and func
|
||||
populateSwitchCB(fswtchSwtch[selectedFunction], model.funcSw[selectedFunction].swtch, POPULATE_MSWITCHES|POPULATE_ONOFF);
|
||||
populateSwitchCB(fswtchSwtch[selectedFunction], model.funcSw[selectedFunction].swtch, POPULATE_ONOFF);
|
||||
populateFuncCB(fswtchFunc[selectedFunction], model.funcSw[selectedFunction].func);
|
||||
refreshCustomFunction(selectedFunction);
|
||||
emit modified();
|
||||
@@ -476,17 +510,17 @@ void CustomFunctionsPanel::fswDelete()
|
||||
|
||||
void CustomFunctionsPanel::fswCopy()
|
||||
{
|
||||
QByteArray fswData;
|
||||
fswData.append((char*)&model.funcSw[selectedFunction],sizeof(FuncSwData));
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
mimeData->setData("application/x-companion-fsw", fswData);
|
||||
QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard);
|
||||
QByteArray fswData;
|
||||
fswData.append((char*)&model.funcSw[selectedFunction], sizeof(FuncSwData));
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
mimeData->setData("application/x-companion-fsw", fswData);
|
||||
QApplication::clipboard()->setMimeData(mimeData, QClipboard::Clipboard);
|
||||
}
|
||||
|
||||
void CustomFunctionsPanel::fswCut()
|
||||
{
|
||||
fswCopy();
|
||||
fswDelete();
|
||||
fswCopy();
|
||||
fswDelete();
|
||||
}
|
||||
|
||||
void CustomFunctionsPanel::fsw_customContextMenuRequested(QPoint pos)
|
||||
@@ -508,3 +542,124 @@ void CustomFunctionsPanel::fsw_customContextMenuRequested(QPoint pos)
|
||||
|
||||
contextMenu.exec(globalPos);
|
||||
}
|
||||
|
||||
void CustomFunctionsPanel::populateFuncCB(QComboBox *b, unsigned int value)
|
||||
{
|
||||
b->clear();
|
||||
for (unsigned int i=0; i<FuncCount; i++) {
|
||||
b->addItem(FuncSwData(AssignFunc(i)).funcToString());
|
||||
if (!GetEepromInterface()->getCapability(HasVolume)) {
|
||||
if (i==FuncVolume || i==FuncBackgroundMusic || i==FuncBackgroundMusicPause) {
|
||||
QModelIndex index = b->model()->index(i, 0);
|
||||
QVariant v(0);
|
||||
b->model()->setData(index, v, Qt::UserRole - 1);
|
||||
}
|
||||
}
|
||||
if ((i==FuncPlayHaptic) && !GetEepromInterface()->getCapability(Haptic)) {
|
||||
QModelIndex index = b->model()->index(i, 0);
|
||||
QVariant v(0);
|
||||
b->model()->setData(index, v, Qt::UserRole - 1);
|
||||
}
|
||||
if ((i==FuncPlayBoth) && !GetEepromInterface()->getCapability(HasBeeper)) {
|
||||
QModelIndex index = b->model()->index(i, 0);
|
||||
QVariant v(0);
|
||||
b->model()->setData(index, v, Qt::UserRole - 1);
|
||||
}
|
||||
if ((i==FuncLogs) && !GetEepromInterface()->getCapability(HasSDLogs)) {
|
||||
QModelIndex index = b->model()->index(i, 0);
|
||||
QVariant v(0);
|
||||
b->model()->setData(index, v, Qt::UserRole - 1);
|
||||
}
|
||||
}
|
||||
b->setCurrentIndex(value);
|
||||
b->setMaxVisibleItems(10);
|
||||
}
|
||||
|
||||
void CustomFunctionsPanel::populateGVmodeCB(QComboBox *b, unsigned int value)
|
||||
{
|
||||
b->clear();
|
||||
b->addItem(QObject::tr("Value"));
|
||||
b->addItem(QObject::tr("Source"));
|
||||
b->addItem(QObject::tr("GVAR"));
|
||||
b->addItem(QObject::tr("Increment"));
|
||||
b->setCurrentIndex(value);
|
||||
}
|
||||
|
||||
void CustomFunctionsPanel::populateFuncParamArmTCB(QComboBox *b, char * value, QStringList & paramsList)
|
||||
{
|
||||
b->clear();
|
||||
b->addItem("----");
|
||||
|
||||
bool added = false;
|
||||
QString currentvalue(value);
|
||||
foreach ( QString entry, paramsList ) {
|
||||
b->addItem(entry);
|
||||
if (entry==currentvalue) {
|
||||
b->setCurrentIndex(b->count()-1);
|
||||
added = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!added && strlen(value)) {
|
||||
b->addItem(value);
|
||||
b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
}
|
||||
|
||||
void CustomFunctionsPanel::populateFuncParamCB(QComboBox *b, const ModelData & model, uint function, unsigned int value, unsigned int adjustmode)
|
||||
{
|
||||
QStringList qs;
|
||||
b->clear();
|
||||
if (function==FuncPlaySound) {
|
||||
qs <<"Beep 1" << "Beep 2" << "Beep 3" << "Warn1" << "Warn2" << "Cheep" << "Ratata" << "Tick" << "Siren" << "Ring" ;
|
||||
qs << "SciFi" << "Robot" << "Chirp" << "Tada" << "Crickt" << "AlmClk" ;
|
||||
b->addItems(qs);
|
||||
b->setCurrentIndex(value);
|
||||
}
|
||||
else if (function==FuncPlayHaptic) {
|
||||
qs << "0" << "1" << "2" << "3";
|
||||
b->addItems(qs);
|
||||
b->setCurrentIndex(value);
|
||||
}
|
||||
else if (function==FuncReset) {
|
||||
qs.append( QObject::tr("Timer1"));
|
||||
qs.append( QObject::tr("Timer2"));
|
||||
qs.append( QObject::tr("All"));
|
||||
qs.append( QObject::tr("Telemetry"));
|
||||
int reCount = GetEepromInterface()->getCapability(RotaryEncoders);
|
||||
if (reCount == 1) {
|
||||
qs.append( QObject::tr("Rotary Encoder"));
|
||||
}
|
||||
else if (reCount == 2) {
|
||||
qs.append( QObject::tr("REa"));
|
||||
qs.append( QObject::tr("REb"));
|
||||
}
|
||||
b->addItems(qs);
|
||||
b->setCurrentIndex(value);
|
||||
}
|
||||
else if (function==FuncVolume) {
|
||||
populateSourceCB(b, RawSource(value), model, POPULATE_SOURCES|POPULATE_TRIMS);
|
||||
}
|
||||
else if (function==FuncPlayValue) {
|
||||
populateSourceCB(b, RawSource(value), model, POPULATE_SOURCES|POPULATE_VIRTUAL_INPUTS|POPULATE_SWITCHES|POPULATE_GVARS|POPULATE_TRIMS|POPULATE_TELEMETRYEXT);
|
||||
}
|
||||
else if (function>=FuncAdjustGV1 && function<=FuncAdjustGVLast) {
|
||||
switch (adjustmode) {
|
||||
case 1:
|
||||
populateSourceCB(b, RawSource(value), model, POPULATE_SOURCES|POPULATE_TRIMS|POPULATE_SWITCHES);
|
||||
break;
|
||||
case 2:
|
||||
populateSourceCB(b, RawSource(value), model, POPULATE_GVARS);
|
||||
break;
|
||||
case 3:
|
||||
b->clear();
|
||||
b->addItem("-1", 0);
|
||||
b->addItem("+1", 1);
|
||||
b->setCurrentIndex(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
b->hide();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ class RepeatComboBox: public QComboBox
|
||||
|
||||
public:
|
||||
RepeatComboBox(QWidget *parent, int & repeatParam);
|
||||
void update();
|
||||
|
||||
signals:
|
||||
void modified();
|
||||
@@ -55,7 +56,13 @@ class CustomFunctionsPanel : public ModelPanel
|
||||
void fswCut();
|
||||
|
||||
private:
|
||||
void populateFuncCB(QComboBox *b, unsigned int value);
|
||||
void populateGVmodeCB(QComboBox *b, unsigned int value);
|
||||
void populateFuncParamCB(QComboBox *b, const ModelData & model, uint function, unsigned int value, unsigned int adjustmode=0);
|
||||
void populateFuncParamArmTCB(QComboBox *b, char * value, QStringList & paramsList);
|
||||
|
||||
GeneralSettings & generalSettings;
|
||||
QStringList paramarmList;
|
||||
bool phononLock;
|
||||
QComboBox * fswtchSwtch[C9X_MAX_CUSTOM_FUNCTIONS];
|
||||
QComboBox * fswtchFunc[C9X_MAX_CUSTOM_FUNCTIONS];
|
||||
@@ -65,7 +72,7 @@ class CustomFunctionsPanel : public ModelPanel
|
||||
QComboBox * fswtchParamT[C9X_MAX_CUSTOM_FUNCTIONS];
|
||||
QComboBox * fswtchParamArmT[C9X_MAX_CUSTOM_FUNCTIONS];
|
||||
QCheckBox * fswtchEnable[C9X_MAX_CUSTOM_FUNCTIONS];
|
||||
QComboBox * fswtchRepeat[C9X_MAX_CUSTOM_FUNCTIONS];
|
||||
RepeatComboBox * fswtchRepeat[C9X_MAX_CUSTOM_FUNCTIONS];
|
||||
QComboBox * fswtchGVmode[C9X_MAX_CUSTOM_FUNCTIONS];
|
||||
#ifdef PHONON
|
||||
Phonon::MediaObject *clickObject;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <QDoubleSpinBox>
|
||||
#include "helpers.h"
|
||||
|
||||
CustomSwitchesPanel::CustomSwitchesPanel(QWidget * parent, ModelData & model):
|
||||
LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model):
|
||||
ModelPanel(parent, model),
|
||||
selectedSwitch(0)
|
||||
{
|
||||
@@ -18,13 +18,13 @@ CustomSwitchesPanel::CustomSwitchesPanel(QWidget * parent, ModelData & model):
|
||||
addLabel(gridLayout, tr("V1"), col++);
|
||||
addLabel(gridLayout, tr("V2"), col++);
|
||||
addLabel(gridLayout, tr("AND"), col++);
|
||||
if (GetEepromInterface()->getCapability(CustomSwitchesExt)) {
|
||||
if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) {
|
||||
addLabel(gridLayout, tr("Duration"), col++);
|
||||
addLabel(gridLayout, tr("Delay"), col++);
|
||||
}
|
||||
|
||||
lock = true;
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(CustomSwitches); i++) {
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) {
|
||||
// The label
|
||||
QLabel * label = new QLabel(this);
|
||||
label->setProperty("index", i);
|
||||
@@ -46,7 +46,7 @@ CustomSwitchesPanel::CustomSwitchesPanel(QWidget * parent, ModelData & model):
|
||||
// V1
|
||||
cswitchSource1[i] = new QComboBox(this);
|
||||
cswitchSource1[i]->setProperty("index",i);
|
||||
connect(cswitchSource1[i], SIGNAL(currentIndexChanged(int)), this, SLOT(edited()));
|
||||
connect(cswitchSource1[i], SIGNAL(currentIndexChanged(int)), this, SLOT(v1Edited(int)));
|
||||
gridLayout->addWidget(cswitchSource1[i], i+1, 2);
|
||||
cswitchSource1[i]->setVisible(false);
|
||||
cswitchValue[i] = new QDoubleSpinBox(this);
|
||||
@@ -62,7 +62,7 @@ CustomSwitchesPanel::CustomSwitchesPanel(QWidget * parent, ModelData & model):
|
||||
// V2
|
||||
cswitchSource2[i] = new QComboBox(this);
|
||||
cswitchSource2[i]->setProperty("index", i);
|
||||
connect(cswitchSource2[i], SIGNAL(currentIndexChanged(int)), this, SLOT(edited()));
|
||||
connect(cswitchSource2[i], SIGNAL(currentIndexChanged(int)), this, SLOT(v2Edited(int)));
|
||||
gridLayout->addWidget(cswitchSource2[i], i+1, 3);
|
||||
cswitchSource2[i]->setVisible(false);
|
||||
cswitchOffset[i] = new QDoubleSpinBox(this);
|
||||
@@ -78,11 +78,10 @@ CustomSwitchesPanel::CustomSwitchesPanel(QWidget * parent, ModelData & model):
|
||||
// AND
|
||||
cswitchAnd[i] = new QComboBox(this);
|
||||
cswitchAnd[i]->setProperty("index", i);
|
||||
connect(cswitchAnd[i], SIGNAL(currentIndexChanged(int)), this, SLOT(edited()));
|
||||
connect(cswitchAnd[i], SIGNAL(currentIndexChanged(int)), this, SLOT(andEdited(int)));
|
||||
gridLayout->addWidget(cswitchAnd[i], i+1, 4);
|
||||
cswitchAnd[i]->setVisible(false);
|
||||
|
||||
if (GetEepromInterface()->getCapability(CustomSwitchesExt)) {
|
||||
if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) {
|
||||
// Duration
|
||||
cswitchDuration[i] = new QDoubleSpinBox(this);
|
||||
cswitchDuration[i]->setProperty("index", i);
|
||||
@@ -91,9 +90,8 @@ CustomSwitchesPanel::CustomSwitchesPanel(QWidget * parent, ModelData & model):
|
||||
cswitchDuration[i]->setMinimum(0);
|
||||
cswitchDuration[i]->setAccelerated(true);
|
||||
cswitchDuration[i]->setDecimals(1);
|
||||
connect(cswitchDuration[i],SIGNAL(editingFinished()), this, SLOT(edited()));
|
||||
connect(cswitchDuration[i], SIGNAL(valueChanged(double)), this, SLOT(durationEdited(double)));
|
||||
gridLayout->addWidget(cswitchDuration[i], i+1, 5);
|
||||
cswitchDuration[i]->setVisible(false);
|
||||
|
||||
// Delay
|
||||
cswitchDelay[i] = new QDoubleSpinBox(this);
|
||||
@@ -103,75 +101,114 @@ CustomSwitchesPanel::CustomSwitchesPanel(QWidget * parent, ModelData & model):
|
||||
cswitchDelay[i]->setMinimum(0);
|
||||
cswitchDelay[i]->setAccelerated(true);
|
||||
cswitchDelay[i]->setDecimals(1);
|
||||
connect(cswitchDelay[i], SIGNAL(editingFinished()), this, SLOT(edited()));
|
||||
connect(cswitchDelay[i], SIGNAL(valueChanged(double)), this, SLOT(delayEdited(double)));
|
||||
gridLayout->addWidget(cswitchDelay[i], i+1, 6);
|
||||
cswitchDelay[i]->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
lock = false;
|
||||
}
|
||||
|
||||
CustomSwitchesPanel::~CustomSwitchesPanel()
|
||||
LogicalSwitchesPanel::~LogicalSwitchesPanel()
|
||||
{
|
||||
}
|
||||
|
||||
void CustomSwitchesPanel::edited()
|
||||
void LogicalSwitchesPanel::v1Edited(int value)
|
||||
{
|
||||
if (!lock) {
|
||||
int i = sender()->property("index").toInt();
|
||||
model.customSw[i].val1 = cswitchSource1[i]->itemData(value).toInt();
|
||||
if (model.customSw[i].getFunctionFamily() == LS_FAMILY_VOFS) {
|
||||
RawSource source = RawSource(model.customSw[i].val1, &model);
|
||||
if (source.type == SOURCE_TYPE_TELEMETRY) {
|
||||
if (model.customSw[i].func > LS_FN_ELESS && model.customSw[i].func < LS_FN_VEQUAL) {
|
||||
model.customSw[i].val2 = 0;
|
||||
}
|
||||
else {
|
||||
model.customSw[i].val2 = -128;
|
||||
}
|
||||
}
|
||||
else {
|
||||
RawSourceRange range = source.getRange();
|
||||
if (model.customSw[i].func > LS_FN_ELESS && model.customSw[i].func < LS_FN_VEQUAL) {
|
||||
model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step);
|
||||
}
|
||||
else {
|
||||
model.customSw[i].val2 = (cswitchOffset[i]->value() - range.offset) / range.step/* TODO - source.getRawOffset(model)*/;
|
||||
}
|
||||
}
|
||||
setSwitchWidgetVisibility(i);
|
||||
}
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void LogicalSwitchesPanel::v2Edited(int value)
|
||||
{
|
||||
if (!lock) {
|
||||
int i = sender()->property("index").toInt();
|
||||
model.customSw[i].val2 = cswitchSource2[i]->itemData(value).toInt();
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void LogicalSwitchesPanel::andEdited(int value)
|
||||
{
|
||||
if (!lock) {
|
||||
int index = sender()->property("index").toInt();
|
||||
model.customSw[index].andsw = cswitchAnd[index]->itemData(value).toInt();
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void LogicalSwitchesPanel::durationEdited(double duration)
|
||||
{
|
||||
int index = sender()->property("index").toInt();
|
||||
model.customSw[index].duration = (uint8_t)round(duration*2);
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void LogicalSwitchesPanel::delayEdited(double delay)
|
||||
{
|
||||
int index = sender()->property("index").toInt();
|
||||
model.customSw[index].delay = (uint8_t)round(delay*2);
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void LogicalSwitchesPanel::edited()
|
||||
{
|
||||
if (!lock) {
|
||||
lock = true;
|
||||
int i = sender()->property("index").toInt();
|
||||
bool chAr;
|
||||
float value, step;
|
||||
int newval;
|
||||
chAr = (getCSFunctionFamily(model.customSw[i].func) != getCSFunctionFamily(csw[i]->itemData(csw[i]->currentIndex()).toInt()));
|
||||
model.customSw[i].func = csw[i]->itemData(csw[i]->currentIndex()).toInt();
|
||||
if(chAr) {
|
||||
if (getCSFunctionFamily(model.customSw[i].func)==CS_FAMILY_TIMERS) {
|
||||
int newFunc = csw[i]->itemData(csw[i]->currentIndex()).toInt();
|
||||
bool chAr = (model.customSw[i].getFunctionFamily() != LogicalSwitchData(newFunc).getFunctionFamily());
|
||||
model.customSw[i].func = newFunc;
|
||||
if (chAr) {
|
||||
if (model.customSw[i].getFunctionFamily() == LS_FAMILY_TIMER) {
|
||||
model.customSw[i].val1 = -119;
|
||||
model.customSw[i].val2 = -119;
|
||||
} else {
|
||||
}
|
||||
else if (model.customSw[i].getFunctionFamily() == LS_FAMILY_STAY) {
|
||||
model.customSw[i].val1 = 0;
|
||||
model.customSw[i].val2 = -129;
|
||||
model.customSw[i].val3 = 0;
|
||||
}
|
||||
else {
|
||||
model.customSw[i].val1 = 0;
|
||||
model.customSw[i].val2 = 0;
|
||||
}
|
||||
model.customSw[i].andsw = 0;
|
||||
setSwitchWidgetVisibility(i);
|
||||
}
|
||||
if (GetEepromInterface()->getCapability(CustomSwitchesExt)) {
|
||||
model.customSw[i].duration= (uint8_t)round(cswitchDuration[i]->value()*2);
|
||||
model.customSw[i].delay= (uint8_t)round(cswitchDelay[i]->value()*2);
|
||||
}
|
||||
|
||||
RawSource source;
|
||||
switch (getCSFunctionFamily(model.customSw[i].func))
|
||||
switch (model.customSw[i].getFunctionFamily())
|
||||
{
|
||||
case (CS_FAMILY_VOFS):
|
||||
if (model.customSw[i].val1 != cswitchSource1[i]->itemData(cswitchSource1[i]->currentIndex()).toInt()) {
|
||||
source = RawSource(model.customSw[i].val1, &model);
|
||||
model.customSw[i].val1 = cswitchSource1[i]->itemData(cswitchSource1[i]->currentIndex()).toInt();
|
||||
RawSource newSource = RawSource(model.customSw[i].val1, &model);
|
||||
if (newSource.type == SOURCE_TYPE_TELEMETRY) {
|
||||
if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) {
|
||||
model.customSw[i].val2 = 0;
|
||||
}
|
||||
else {
|
||||
model.customSw[i].val2 = -128;
|
||||
}
|
||||
}
|
||||
else {
|
||||
RawSourceRange range = source.getRange();
|
||||
if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) {
|
||||
model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step);
|
||||
}
|
||||
else {
|
||||
model.customSw[i].val2 = (cswitchOffset[i]->value() - range.offset) / range.step/* TODO - source.getRawOffset(model)*/;
|
||||
}
|
||||
}
|
||||
setSwitchWidgetVisibility(i);
|
||||
}
|
||||
else {
|
||||
case LS_FAMILY_VOFS:
|
||||
{
|
||||
source = RawSource(model.customSw[i].val1, &model);
|
||||
RawSourceRange range = source.getRange();
|
||||
if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) {
|
||||
if (model.customSw[i].func>LS_FN_ELESS && model.customSw[i].func<LS_FN_VEQUAL) {
|
||||
model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step);
|
||||
cswitchOffset[i]->setValue(model.customSw[i].val2*range.step);
|
||||
}
|
||||
@@ -181,84 +218,50 @@ void CustomSwitchesPanel::edited()
|
||||
}
|
||||
}
|
||||
break;
|
||||
case (CS_FAMILY_TIMERS): {
|
||||
value = cswitchOffset[i]->value();
|
||||
newval=TimToVal(value);
|
||||
if (newval>model.customSw[i].val2) {
|
||||
if (value >=60) {
|
||||
value=round(value);
|
||||
step=1;
|
||||
} else if (value>=2) {
|
||||
value=(round(value*2.0)/2);
|
||||
step=0.5;
|
||||
} else {
|
||||
step=0.1;
|
||||
}
|
||||
} else {
|
||||
if (value <=2) {
|
||||
step=0.1;
|
||||
} else if (value<=60) {
|
||||
value=(round(value*2.0)/2);
|
||||
step=0.5;
|
||||
} else {
|
||||
value=round(value);
|
||||
step=1;
|
||||
}
|
||||
}
|
||||
model.customSw[i].val2=TimToVal(value);
|
||||
value=ValToTim(model.customSw[i].val2);
|
||||
cswitchOffset[i]->setValue(value);
|
||||
cswitchOffset[i]->setSingleStep(step);
|
||||
|
||||
value=cswitchValue[i]->value();
|
||||
newval=TimToVal(value);
|
||||
if (newval>model.customSw[i].val1) {
|
||||
if (value >=60) {
|
||||
value=round(value);
|
||||
step=1;
|
||||
} else if (value>=2) {
|
||||
value=(round(value*2.0)/2);
|
||||
step=0.5;
|
||||
} else {
|
||||
step=0.1;
|
||||
}
|
||||
} else {
|
||||
if (value <=2) {
|
||||
step=0.1;
|
||||
} else if (value<=60) {
|
||||
value=(round(value*2.0)/2);
|
||||
step=0.5;
|
||||
} else {
|
||||
value=round(value);
|
||||
step=1;
|
||||
}
|
||||
}
|
||||
model.customSw[i].val1=TimToVal(value);
|
||||
value=ValToTim(model.customSw[i].val1);
|
||||
cswitchValue[i]->setValue(value);
|
||||
cswitchValue[i]->setSingleStep(step);
|
||||
case LS_FAMILY_TIMER:
|
||||
model.customSw[i].val1 = TimToVal(cswitchValue[i]->value());
|
||||
model.customSw[i].val2 = TimToVal(cswitchOffset[i]->value());
|
||||
updateTimerParam(cswitchValue[i], model.customSw[i].val1);
|
||||
updateTimerParam(cswitchOffset[i], model.customSw[i].val2);
|
||||
break;
|
||||
}
|
||||
case (CS_FAMILY_VBOOL):
|
||||
case (CS_FAMILY_VCOMP):
|
||||
model.customSw[i].val1 = cswitchSource1[i]->itemData(cswitchSource1[i]->currentIndex()).toInt();
|
||||
model.customSw[i].val2 = cswitchSource2[i]->itemData(cswitchSource2[i]->currentIndex()).toInt();
|
||||
case LS_FAMILY_STAY:
|
||||
model.customSw[i].val2 = TimToVal(cswitchOffset[i]->value());
|
||||
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
model.customSw[i].andsw = cswitchAnd[i]->itemData(cswitchAnd[i]->currentIndex()).toInt();
|
||||
emit modified();
|
||||
lock = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CustomSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||
void LogicalSwitchesPanel::updateTimerParam(QDoubleSpinBox *sb, int timer, bool allowZero)
|
||||
{
|
||||
sb->setVisible(true);
|
||||
sb->setDecimals(1);
|
||||
sb->setMinimum(allowZero ? 0.0 : 0.1);
|
||||
sb->setMaximum(175);
|
||||
float value = ValToTim(timer);
|
||||
if (value>60)
|
||||
sb->setSingleStep(1);
|
||||
else if (value>2)
|
||||
sb->setSingleStep(0.5);
|
||||
else
|
||||
sb->setSingleStep(0.1);
|
||||
sb->setValue(value);
|
||||
}
|
||||
|
||||
void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||
{
|
||||
lock = true;
|
||||
|
||||
RawSource source = RawSource(model.customSw[i].val1, &model);
|
||||
RawSourceRange range = source.getRange();
|
||||
|
||||
switch (getCSFunctionFamily(model.customSw[i].func))
|
||||
switch (model.customSw[i].getFunctionFamily())
|
||||
{
|
||||
case CS_FAMILY_VOFS:
|
||||
case LS_FAMILY_VOFS:
|
||||
cswitchSource1[i]->setVisible(true);
|
||||
cswitchSource2[i]->setVisible(false);
|
||||
cswitchValue[i]->setVisible(false);
|
||||
@@ -266,17 +269,19 @@ void CustomSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||
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>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) {
|
||||
if (model.customSw[i].func>LS_FN_ELESS && model.customSw[i].func<LS_FN_VEQUAL) {
|
||||
cswitchOffset[i]->setMinimum(range.step*-127);
|
||||
cswitchOffset[i]->setMaximum(range.step*127);
|
||||
cswitchOffset[i]->setValue(range.step*model.customSw[i].val2);
|
||||
} else {
|
||||
}
|
||||
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 CS_FAMILY_VBOOL:
|
||||
case LS_FAMILY_VBOOL:
|
||||
case LS_FAMILY_STICKY:
|
||||
cswitchSource1[i]->setVisible(true);
|
||||
cswitchSource2[i]->setVisible(true);
|
||||
cswitchValue[i]->setVisible(false);
|
||||
@@ -284,7 +289,14 @@ void CustomSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||
populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1));
|
||||
populateSwitchCB(cswitchSource2[i], RawSwitch(model.customSw[i].val2));
|
||||
break;
|
||||
case CS_FAMILY_VCOMP:
|
||||
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);
|
||||
@@ -292,87 +304,65 @@ void CustomSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||
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 CS_FAMILY_TIMERS:
|
||||
case LS_FAMILY_TIMER:
|
||||
cswitchSource1[i]->setVisible(false);
|
||||
cswitchSource2[i]->setVisible(false);
|
||||
cswitchValue[i]->setVisible(true);
|
||||
cswitchOffset[i]->setVisible(true);
|
||||
cswitchOffset[i]->setDecimals(1);
|
||||
cswitchOffset[i]->setMinimum(0.1);
|
||||
cswitchOffset[i]->setMaximum(175);
|
||||
float value=ValToTim(model.customSw[i].val2);
|
||||
cswitchOffset[i]->setSingleStep(0.1);
|
||||
if (value>60) {
|
||||
cswitchOffset[i]->setSingleStep(1);
|
||||
} else if (value>2) {
|
||||
cswitchOffset[i]->setSingleStep(0.5);
|
||||
}
|
||||
cswitchOffset[i]->setValue(value);
|
||||
|
||||
cswitchValue[i]->setDecimals(1);
|
||||
cswitchValue[i]->setMinimum(0.1);
|
||||
cswitchValue[i]->setMaximum(175);
|
||||
value=ValToTim(model.customSw[i].val1);
|
||||
cswitchValue[i]->setSingleStep(0.1);
|
||||
if (value>60) {
|
||||
cswitchValue[i]->setSingleStep(1);
|
||||
} else if (value>2) {
|
||||
cswitchValue[i]->setSingleStep(0.5);
|
||||
}
|
||||
cswitchValue[i]->setValue(value);
|
||||
updateTimerParam(cswitchValue[i], model.customSw[i].val1);
|
||||
updateTimerParam(cswitchOffset[i], model.customSw[i].val2);
|
||||
break;
|
||||
}
|
||||
cswitchAnd[i]->setVisible(true);
|
||||
populateSwitchCB(cswitchAnd[i], RawSwitch(model.customSw[i].andsw), POPULATE_AND_SWITCHES);
|
||||
if (GetEepromInterface()->getCapability(CustomSwitchesExt)) {
|
||||
cswitchDuration[i]->setVisible(true);
|
||||
|
||||
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/2.0);
|
||||
cswitchDelay[i]->setVisible(true);
|
||||
cswitchDelay[i]->setValue(model.customSw[i].delay/2.0);
|
||||
}
|
||||
}
|
||||
|
||||
void CustomSwitchesPanel::update()
|
||||
{
|
||||
lock = true;
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(CustomSwitches); i++) {
|
||||
populateCSWCB(csw[i], model.customSw[i].func);
|
||||
setSwitchWidgetVisibility(i);
|
||||
lock = false;
|
||||
}
|
||||
lock = false;
|
||||
}
|
||||
|
||||
void CustomSwitchesPanel::cswPaste()
|
||||
void LogicalSwitchesPanel::cswPaste()
|
||||
{
|
||||
const QClipboard *clipboard = QApplication::clipboard();
|
||||
const QMimeData *mimeData = clipboard->mimeData();
|
||||
if (mimeData->hasFormat("application/x-companion-csw")) {
|
||||
QByteArray cswData = mimeData->data("application/x-companion-csw");
|
||||
|
||||
CustomSwData *csw = &model.customSw[selectedSwitch];
|
||||
memcpy(csw, cswData.mid(0, sizeof(CustomSwData)).constData(), sizeof(CustomSwData));
|
||||
LogicalSwitchData *csw = &model.customSw[selectedSwitch];
|
||||
memcpy(csw, cswData.mid(0, sizeof(LogicalSwitchData)).constData(), sizeof(LogicalSwitchData));
|
||||
emit modified();
|
||||
updateSelectedSwitch();
|
||||
}
|
||||
}
|
||||
|
||||
void CustomSwitchesPanel::cswDelete()
|
||||
void LogicalSwitchesPanel::cswDelete()
|
||||
{
|
||||
model.customSw[selectedSwitch].clear();
|
||||
emit modified();
|
||||
updateSelectedSwitch();
|
||||
}
|
||||
|
||||
void CustomSwitchesPanel::cswCopy()
|
||||
void LogicalSwitchesPanel::cswCopy()
|
||||
{
|
||||
QByteArray cswData;
|
||||
cswData.append((char*)&model.customSw[selectedSwitch],sizeof(CustomSwData));
|
||||
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 CustomSwitchesPanel::updateSelectedSwitch()
|
||||
void LogicalSwitchesPanel::updateSelectedSwitch()
|
||||
{
|
||||
lock = true;
|
||||
populateCSWCB(csw[selectedSwitch], model.customSw[selectedSwitch].func);
|
||||
@@ -380,14 +370,14 @@ void CustomSwitchesPanel::updateSelectedSwitch()
|
||||
lock = false;
|
||||
}
|
||||
|
||||
void CustomSwitchesPanel::cswCut()
|
||||
void LogicalSwitchesPanel::cswCut()
|
||||
{
|
||||
cswCopy();
|
||||
cswDelete();
|
||||
}
|
||||
|
||||
// TODO make something generic here!
|
||||
void CustomSwitchesPanel::csw_customContextMenuRequested(QPoint pos)
|
||||
void LogicalSwitchesPanel::csw_customContextMenuRequested(QPoint pos)
|
||||
{
|
||||
QLabel *label = (QLabel *)sender();
|
||||
selectedSwitch = label->property("index").toInt();
|
||||
|
||||
@@ -5,18 +5,23 @@
|
||||
#include <QComboBox>
|
||||
#include <QDoubleSpinBox>
|
||||
|
||||
class CustomSwitchesPanel : public ModelPanel
|
||||
class LogicalSwitchesPanel : public ModelPanel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CustomSwitchesPanel(QWidget *parent, ModelData & model);
|
||||
virtual ~CustomSwitchesPanel();
|
||||
LogicalSwitchesPanel(QWidget *parent, ModelData & model);
|
||||
virtual ~LogicalSwitchesPanel();
|
||||
|
||||
virtual void update();
|
||||
|
||||
private slots:
|
||||
void edited();
|
||||
void v1Edited(int value);
|
||||
void v2Edited(int value);
|
||||
void andEdited(int value);
|
||||
void durationEdited(double duration);
|
||||
void delayEdited(double delay);
|
||||
void csw_customContextMenuRequested(QPoint pos);
|
||||
void cswDelete();
|
||||
void cswCopy();
|
||||
@@ -36,6 +41,8 @@ class CustomSwitchesPanel : public ModelPanel
|
||||
int selectedSwitch;
|
||||
|
||||
void updateSelectedSwitch();
|
||||
void updateV2(int index);
|
||||
void updateTimerParam(QDoubleSpinBox *sb, int timer, bool allowZero=false);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -17,9 +17,11 @@ FlightMode::FlightMode(QWidget * parent, ModelData & model, int phaseIdx, Genera
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
int modesCount = GetEepromInterface()->getCapability(FlightPhases);
|
||||
|
||||
// Phase name
|
||||
QRegExp rx(CHAR_FOR_NAMES_REGEX);
|
||||
if (GetEepromInterface()->getCapability(FlightPhases)) {
|
||||
if (modesCount) {
|
||||
ui->name->setValidator(new QRegExpValidator(rx, this));
|
||||
ui->name->setMaxLength(GetEepromInterface()->getCapability(FlightModesName));
|
||||
connect(ui->name, SIGNAL(editingFinished()), this, SLOT(phaseName_editingFinished()));
|
||||
@@ -66,14 +68,19 @@ FlightMode::FlightMode(QWidget * parent, ModelData & model, int phaseIdx, Genera
|
||||
for (int i=0; i<4; i++) {
|
||||
trimsLabel[i]->setText(labels[CONVERT_MODE(i+1)-1]);
|
||||
|
||||
if (phaseIdx > 0) {
|
||||
trimsUse[i]->setProperty("index", i);
|
||||
populateTrimUseCB(trimsUse[i], phaseIdx);
|
||||
connect(trimsUse[i], SIGNAL(currentIndexChanged(int)), this, SLOT(phaseTrimUse_currentIndexChanged(int)));
|
||||
}
|
||||
else {
|
||||
trimsUse[i]->hide();
|
||||
QComboBox * cb = trimsUse[i];
|
||||
cb->setProperty("index", i);
|
||||
cb->addItem(QObject::tr("Trim disabled"), -1);
|
||||
for (int m=0; m<modesCount; m++) {
|
||||
if (m == phaseIdx) {
|
||||
cb->addItem(QObject::tr("Own Trim"), m*2);
|
||||
}
|
||||
else if (phaseIdx > 0) {
|
||||
cb->addItem(QObject::tr("Use Trim from Flight mode %1").arg(m), m*2);
|
||||
cb->addItem(QObject::tr("Use Trim from Flight mode %1 + Own Trim as an offset").arg(m), m*2+1);
|
||||
}
|
||||
}
|
||||
connect(cb, SIGNAL(currentIndexChanged(int)), this, SLOT(phaseTrimUse_currentIndexChanged(int)));
|
||||
|
||||
trimsValue[i]->setProperty("index", i);
|
||||
connect(trimsValue[i], SIGNAL(valueChanged(int)), this, SLOT(phaseTrim_valueChanged()));
|
||||
@@ -123,17 +130,6 @@ FlightMode::FlightMode(QWidget * parent, ModelData & model, int phaseIdx, Genera
|
||||
QLabel *label = new QLabel(ui->gvGB);
|
||||
label->setText(tr("GVAR%1").arg(i+1));
|
||||
gvLayout->addWidget(label, i, col++, 1, 1);
|
||||
#if 0
|
||||
// TODO remove this capability?
|
||||
// GVar source (er9x/ersky9x)
|
||||
if (GetEepromInterface()->getCapability(GvarsHaveSources)) {
|
||||
QComboBox *source = new QComboBox(ui->gvGB);
|
||||
source->setProperty("index", i);
|
||||
populateGvSourceCB(source, model.gvsource[i]);
|
||||
// connect(source, SIGNAL(currentIndexChanged(int)), this, SLOT(phaseGVSource_currentIndexChanged(int)));
|
||||
gvLayout->addWidget(source, i, col++, 1, 1);
|
||||
}
|
||||
#endif
|
||||
// GVar name
|
||||
int nameLen = GetEepromInterface()->getCapability(GvarsName);
|
||||
if (nameLen > 0) {
|
||||
@@ -193,7 +189,6 @@ void FlightMode::update()
|
||||
int chn = CONVERT_MODE(i+1)-1;
|
||||
if (chn == 2/*TODO constant*/ && model.throttleReversed)
|
||||
trimsSlider[i]->setInvertedAppearance(true);
|
||||
|
||||
trimUpdate(i);
|
||||
}
|
||||
|
||||
@@ -262,23 +257,22 @@ void FlightMode::phaseFadeOut_editingFinished()
|
||||
|
||||
void FlightMode::trimUpdate(unsigned int trim)
|
||||
{
|
||||
lock = true;
|
||||
int chn = CONVERT_MODE(trim+1)-1;
|
||||
int value = phase.trim[chn];
|
||||
if (phaseIdx > 0 && phase.trimRef[chn] >= 0) {
|
||||
trimsUse[trim]->setCurrentIndex(1 + phase.trimRef[chn] - (phase.trimRef[chn] >= phaseIdx ? 1 : 0));
|
||||
value = model.phaseData[model.getTrimFlightPhase(chn, phaseIdx)].trim[chn];
|
||||
trimsValue[trim]->setEnabled(false);
|
||||
trimsSlider[trim]->setEnabled(false);
|
||||
}
|
||||
else {
|
||||
if (phaseIdx > 0) trimsUse[trim]->setCurrentIndex(0);
|
||||
trimsValue[trim]->setEnabled(true);
|
||||
trimsSlider[trim]->setEnabled(true);
|
||||
}
|
||||
trimsSlider[trim]->setValue(value);
|
||||
trimsValue[trim]->setValue(value);
|
||||
lock = false;
|
||||
lock = true;
|
||||
int chn = CONVERT_MODE(trim+1)-1;
|
||||
int value = model.getTrimValue(phaseIdx, chn);
|
||||
trimsSlider[trim]->setValue(value);
|
||||
trimsValue[trim]->setValue(value);
|
||||
if (phase.trimMode[chn] < 0) {
|
||||
trimsUse[trim]->setCurrentIndex(0);
|
||||
trimsValue[trim]->setEnabled(false);
|
||||
trimsSlider[trim]->setEnabled(false);
|
||||
}
|
||||
else {
|
||||
trimsUse[trim]->setCurrentIndex(1 + 2*phase.trimRef[chn] + phase.trimMode[chn] - (phase.trimRef[chn] > phaseIdx ? 1 : 0));
|
||||
trimsValue[trim]->setEnabled(true);
|
||||
trimsSlider[trim]->setEnabled(true);
|
||||
}
|
||||
lock = false;
|
||||
}
|
||||
|
||||
void FlightMode::phaseGVValue_editingFinished()
|
||||
@@ -380,15 +374,17 @@ void FlightMode::phaseTrimUse_currentIndexChanged(int index)
|
||||
QComboBox *comboBox = qobject_cast<QComboBox*>(sender());
|
||||
int trim = comboBox->property("index").toInt();
|
||||
int chn = CONVERT_MODE(trim+1)-1;
|
||||
if (index == 0) {
|
||||
phase.trim[chn] = model.phaseData[model.getTrimFlightPhase(chn, phaseIdx)].trim[chn];
|
||||
phase.trimRef[chn] = -1;
|
||||
int data = comboBox->itemData(index).toInt();
|
||||
if (data < 0) {
|
||||
phase.trimMode[chn] = -1;
|
||||
phase.trimRef[chn] = 0;
|
||||
phase.trim[chn] = 0;
|
||||
}
|
||||
else {
|
||||
phase.trimMode[chn] = data % 2;
|
||||
phase.trimRef[chn] = data / 2;
|
||||
phase.trim[chn] = 0;
|
||||
phase.trimRef[chn] = index - 1 + (index > (int)phaseIdx ? 1 : 0);
|
||||
}
|
||||
|
||||
trimUpdate(trim);
|
||||
emit modified();
|
||||
}
|
||||
@@ -401,7 +397,7 @@ void FlightMode::phaseTrim_valueChanged()
|
||||
int trim = spinBox->property("index").toInt();
|
||||
int chn = CONVERT_MODE(trim+1)-1;
|
||||
int value = spinBox->value();
|
||||
phase.trim[chn] = value;
|
||||
model.setTrimValue(phaseIdx, chn, value);
|
||||
lock = true;
|
||||
trimsSlider[trim]->setValue(value);
|
||||
lock = false;
|
||||
@@ -416,7 +412,7 @@ void FlightMode::phaseTrimSlider_valueChanged()
|
||||
int trim = slider->property("index").toInt();
|
||||
int chn = CONVERT_MODE(trim+1)-1;
|
||||
int value = slider->value();
|
||||
phase.trim[chn] = value;
|
||||
model.setTrimValue(phaseIdx, chn, value);
|
||||
lock = true;
|
||||
trimsValue[trim]->setValue(value);
|
||||
lock = false;
|
||||
|
||||
@@ -30,7 +30,7 @@ ModelEdit::ModelEdit(RadioData & radioData, int modelId, bool openWizard, bool i
|
||||
addTab(new InputsPanel(this, model, radioData.generalSettings), tr("Inputs"));
|
||||
addTab(new MixesPanel(this, model, radioData.generalSettings), tr("Mixes"));
|
||||
addTab(new Channels(this, model), tr("Channels"));
|
||||
addTab(new CustomSwitchesPanel(this, model), tr("Logical Switches"));
|
||||
addTab(new LogicalSwitchesPanel(this, model), tr("Logical Switches"));
|
||||
if (GetEepromInterface()->getCapability(CustomFunctions))
|
||||
addTab(new CustomFunctionsPanel(this, model, radioData.generalSettings), tr("Switch Assignment"));
|
||||
addTab(new Curves(this, model), tr("Curves"));
|
||||
|
||||
@@ -11,8 +11,10 @@ TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer):
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
lock = true;
|
||||
|
||||
// Mode
|
||||
populateTimerSwitchCB(ui->mode, timer.mode);
|
||||
populateSwitchCB(ui->mode, timer.mode, POPULATE_TIMER_MODES);
|
||||
|
||||
if (!GetEepromInterface()->getCapability(PermTimers)) {
|
||||
ui->persistent->hide();
|
||||
@@ -23,6 +25,8 @@ TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer):
|
||||
ui->countdownBeep->addItem(tr("Beeps"));
|
||||
if (IS_ARM(GetEepromInterface()->getBoard()) || IS_2560(GetEepromInterface()->getBoard()))
|
||||
ui->countdownBeep->addItem(tr("Countdown"));
|
||||
|
||||
lock = false;
|
||||
}
|
||||
|
||||
TimerPanel::~TimerPanel()
|
||||
@@ -63,8 +67,10 @@ void TimerPanel::on_value_editingFinished()
|
||||
|
||||
void TimerPanel::on_mode_currentIndexChanged(int index)
|
||||
{
|
||||
timer.mode = TimerMode(ui->mode->itemData(index).toInt());
|
||||
emit modified();
|
||||
if (!lock) {
|
||||
timer.mode = RawSwitch(ui->mode->itemData(index).toInt());
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void TimerPanel::on_persistent_toggled(bool checked)
|
||||
@@ -123,20 +129,20 @@ ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module
|
||||
|
||||
if (GetEepromInterface()->getCapability(HasFailsafe)) {
|
||||
for (int i=0; i<16; i++) {
|
||||
QSlider * slider = new QSlider(this);
|
||||
slider->setMinimumSize(QSize(30, 50));
|
||||
slider->setRange(-100, 100);
|
||||
QSpinBox * spinbox = new QSpinBox(this);
|
||||
QLabel * label = new QLabel(this);
|
||||
label->setText(QString::number(i+1));
|
||||
QDoubleSpinBox * spinbox = new QDoubleSpinBox(this);
|
||||
spinbox->setMinimumSize(QSize(20, 0));
|
||||
spinbox->setRange(-100, 100);
|
||||
slider->setProperty("index", i);
|
||||
spinbox->setSingleStep(0.1);
|
||||
spinbox->setDecimals(1);
|
||||
spinbox->setValue(((double)module.failsafeChannels[i]*100)/1024);
|
||||
label->setProperty("index", i);
|
||||
spinbox->setProperty("index", i);
|
||||
failsafeSliders << slider;
|
||||
failsafeSpins << spinbox;
|
||||
ui->failsafesLayout->addWidget(slider, 2*(i/8), i%8, Qt::AlignHCenter);
|
||||
ui->failsafesLayout->addWidget(label, 2*(i/8), i%8, Qt::AlignHCenter);
|
||||
ui->failsafesLayout->addWidget(spinbox, 1+2*(i/8), i%8, Qt::AlignHCenter);
|
||||
connect(slider, SIGNAL(valueChanged(int)), this, SLOT(onFailsafeChannelChanged(int)));
|
||||
connect(slider, SIGNAL(valueChanged(int)), this, SLOT(onFailsafeChannelChanged(int)));
|
||||
connect(spinbox, SIGNAL(valueChanged(double)), this, SLOT(onFailsafeSpinChanged(double)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,10 +223,6 @@ void ModulePanel::update()
|
||||
ui->failsafeMode->setVisible(mask & MASK_FAILSAFES);
|
||||
ui->failsafeMode->setCurrentIndex(module.failsafeMode);
|
||||
ui->failsafesFrame->setEnabled(module.failsafeMode == 1);
|
||||
for (int i=0; i<failsafeSliders.size(); i++) {
|
||||
failsafeSliders[i]->setValue(module.failsafeChannels[i]);
|
||||
failsafeSpins[i]->setValue(module.failsafeChannels[i]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
mask = 0;
|
||||
@@ -302,16 +304,12 @@ void ModulePanel::on_failsafeMode_currentIndexChanged(int value)
|
||||
}
|
||||
}
|
||||
|
||||
void ModulePanel::onFailsafeChannelChanged(int value)
|
||||
void ModulePanel::onFailsafeSpinChanged(double value)
|
||||
{
|
||||
if (!lock) {
|
||||
lock = true;
|
||||
int index = sender()->property("index").toInt();
|
||||
module.failsafeChannels[index] = value;
|
||||
failsafeSpins[index]->setValue(value);
|
||||
failsafeSliders[index]->setValue(value);
|
||||
module.failsafeChannels[index] = (value*1024)/100;
|
||||
emit modified();
|
||||
lock = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,14 +56,13 @@ class ModulePanel : public ModelPanel
|
||||
void on_ppmFrameLength_editingFinished();
|
||||
void on_rxNumber_editingFinished();
|
||||
void on_failsafeMode_currentIndexChanged(int value);
|
||||
void onFailsafeChannelChanged(int value);
|
||||
void onFailsafeSpinChanged(double value);
|
||||
|
||||
private:
|
||||
ModuleData & module;
|
||||
int moduleIdx;
|
||||
Ui::Module *ui;
|
||||
QVector<QSpinBox *> failsafeSpins;
|
||||
QVector<QSlider *> failsafeSliders;
|
||||
QVector<QDoubleSpinBox *> failsafeSpins;
|
||||
};
|
||||
|
||||
class Setup : public ModelPanel
|
||||
|
||||
@@ -352,7 +352,7 @@ void TelemetryCustomScreen::updateBar(int line)
|
||||
RawSource source = RawSource(SOURCE_TYPE_TELEMETRY, index-1, &model);
|
||||
RawSourceRange range = source.getRange(true);
|
||||
int max = round((range.max - range.min) / range.step);
|
||||
if (255-screen.body.bars[line].barMax > max)
|
||||
if (int(255-screen.body.bars[line].barMax) > max)
|
||||
screen.body.bars[line].barMax = 255 - max;
|
||||
minSB[line]->setEnabled(true);
|
||||
minSB[line]->setDecimals(range.decimals);
|
||||
|
||||
@@ -584,8 +584,8 @@ void Templates::applyTemplate(uint8_t idx)
|
||||
md=setDest(14); md->srcRaw=RawSource(SOURCE_TYPE_CH, 13); md->weight= 100; md->swtch=RawSwitch();
|
||||
md=setDest(14); md->srcRaw=RawSource(SOURCE_TYPE_MAX); md->weight=-100; md->swtch=RawSwitch(SWITCH_TYPE_VIRTUAL, 11); md->mltpx=MLTPX_REP;
|
||||
md=setDest(14); md->srcRaw=RawSource(SOURCE_TYPE_MAX); md->weight= 100; md->swtch=RawSwitch(SWITCH_TYPE_SWITCH,thrsw); md->mltpx=MLTPX_REP;
|
||||
setSwitch(0xB, CS_FN_VNEG, RawSource(SOURCE_TYPE_STICK, 2).toValue(), -99);
|
||||
setSwitch(0xC, CS_FN_VPOS, RawSource(SOURCE_TYPE_CH, 13).toValue(), 0);
|
||||
setSwitch(0xB, LS_FN_VNEG, RawSource(SOURCE_TYPE_STICK, 2).toValue(), -99);
|
||||
setSwitch(0xC, LS_FN_VPOS, RawSource(SOURCE_TYPE_CH, 13).toValue(), 0);
|
||||
updateSwitchesTab();
|
||||
}
|
||||
|
||||
@@ -841,9 +841,9 @@ void Templates::applyTemplate(uint8_t idx)
|
||||
md=setDest(16); md->srcRaw=RawSource(SOURCE_TYPE_CUSTOM_SWITCH, 0); md->weight= 110; md->swtch=RawSwitch();
|
||||
md=setDest(16); md->srcRaw=RawSource(SOURCE_TYPE_MAX); md->weight=-110; md->swtch=RawSwitch(SWITCH_TYPE_VIRTUAL, 2); md->mltpx=MLTPX_REP;
|
||||
md=setDest(16); md->srcRaw=RawSource(SOURCE_TYPE_MAX); md->weight= 110; md->swtch=RawSwitch(SWITCH_TYPE_VIRTUAL, 3); md->mltpx=MLTPX_REP;
|
||||
setSwitch(1, CS_FN_LESS, RawSource(SOURCE_TYPE_CH, 14).toValue(), RawSource(SOURCE_TYPE_CH, 15).toValue());
|
||||
setSwitch(2, CS_FN_VPOS, RawSource(SOURCE_TYPE_CH, 14).toValue(), 105);
|
||||
setSwitch(3, CS_FN_VNEG, RawSource(SOURCE_TYPE_CH, 14).toValue(), -105);
|
||||
setSwitch(1, LS_FN_LESS, RawSource(SOURCE_TYPE_CH, 14).toValue(), RawSource(SOURCE_TYPE_CH, 15).toValue());
|
||||
setSwitch(2, LS_FN_VPOS, RawSource(SOURCE_TYPE_CH, 14).toValue(), 105);
|
||||
setSwitch(3, LS_FN_VNEG, RawSource(SOURCE_TYPE_CH, 14).toValue(), -105);
|
||||
|
||||
// redraw switches tab
|
||||
updateSwitchesTab();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "eeprominterface.h"
|
||||
#include "splashlibrary.h"
|
||||
#include "helpers.h"
|
||||
#ifdef JOYSTICKS
|
||||
#ifdef JOYSTICKS
|
||||
#include "joystick.h"
|
||||
#include "joystickdialog.h"
|
||||
#endif
|
||||
@@ -40,7 +40,6 @@ preferencesDialog::preferencesDialog(QWidget *parent) :
|
||||
connect(OptionCheckBox[i], SIGNAL(toggled(bool)), this, SLOT(firmwareOptionChanged(bool)));
|
||||
}
|
||||
|
||||
populateLocale();
|
||||
initSettings();
|
||||
connect(ui->downloadVerCB, SIGNAL(currentIndexChanged(int)), this, SLOT(baseFirmwareChanged()));
|
||||
connect(this, SIGNAL(accepted()), this, SLOT(writeValues()));
|
||||
@@ -254,11 +253,6 @@ void preferencesDialog::firmwareChanged()
|
||||
void preferencesDialog::writeValues()
|
||||
{
|
||||
QSettings settings;
|
||||
if (ui->locale_QB->currentIndex() > 0)
|
||||
settings.setValue("locale", ui->locale_QB->itemData(ui->locale_QB->currentIndex()));
|
||||
else
|
||||
settings.remove("locale");
|
||||
|
||||
settings.setValue("default_channel_order", ui->channelorderCB->currentIndex());
|
||||
settings.setValue("default_mode", ui->stickmodeCB->currentIndex());
|
||||
settings.setValue("cpu_id", ui->CPU_ID_LE->text());
|
||||
@@ -267,8 +261,6 @@ void preferencesDialog::writeValues()
|
||||
settings.setValue("rename_firmware_files", ui->renameFirmware->isChecked());
|
||||
settings.setValue("wizardEnable", ui->wizardEnable_ChkB->isChecked());
|
||||
settings.setValue("show_splash", ui->showSplash->isChecked());
|
||||
settings.setValue("theme", ui->theme_CB->currentIndex());
|
||||
settings.setValue("icon_size", ui->iconSize_CB->currentIndex());
|
||||
settings.setValue("simuSW", ui->simuSW->isChecked());
|
||||
settings.setValue("history_size", ui->historySize->value());
|
||||
settings.setValue("burnFirmware", ui->burnFirmware->isChecked());
|
||||
@@ -387,9 +379,6 @@ void preferencesDialog::populateFirmwareOptions(const FirmwareInfo * firmware)
|
||||
void preferencesDialog::initSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
int i = ui->locale_QB->findData(settings.value("locale"));
|
||||
if (i < 0) i = 0;
|
||||
ui->locale_QB->setCurrentIndex(i);
|
||||
ui->snapshotClipboardCKB->setChecked(settings.value("snapshot_to_clipboard", false).toBool());
|
||||
if (ui->snapshotClipboardCKB->isChecked()) {
|
||||
ui->snapshotPath->setDisabled(true);
|
||||
@@ -408,8 +397,6 @@ void preferencesDialog::initSettings()
|
||||
ui->renameFirmware->setChecked(settings.value("rename_firmware_files", false).toBool());
|
||||
ui->wizardEnable_ChkB->setChecked(settings.value("wizardEnable", true).toBool());
|
||||
ui->showSplash->setChecked(settings.value("show_splash", true).toBool());
|
||||
ui->theme_CB->setCurrentIndex(settings.value("theme", 1).toInt());
|
||||
ui->iconSize_CB->setCurrentIndex(settings.value("icon_size", 2).toInt());
|
||||
ui->historySize->setValue(settings.value("history_size", 10).toInt());
|
||||
ui->backLightColor->setCurrentIndex(settings.value("backLight", 0).toInt());
|
||||
ui->startupCheck_fw->setChecked(settings.value("startup_check_fw", true).toBool());
|
||||
@@ -501,25 +488,6 @@ void preferencesDialog::initSettings()
|
||||
firmwareChanged();
|
||||
}
|
||||
|
||||
void preferencesDialog::populateLocale()
|
||||
{
|
||||
ui->ProfSave_PB->setEnabled(true);
|
||||
ui->locale_QB->clear();
|
||||
ui->locale_QB->addItem("System default language", "");
|
||||
ui->locale_QB->addItem("English", "en");
|
||||
|
||||
QStringList strl = QApplication::arguments();
|
||||
if (!strl.count()) return;
|
||||
|
||||
QDir directory = QDir(":/");
|
||||
QStringList files = directory.entryList(QStringList("companion_*.qm"), QDir::Files | QDir::NoSymLinks);
|
||||
|
||||
foreach(QString file, files) {
|
||||
QLocale loc(file.mid(10, 2));
|
||||
ui->locale_QB->addItem(QLocale::languageToString(loc.language()), loc.name());
|
||||
}
|
||||
}
|
||||
|
||||
void preferencesDialog::on_fw_dnld_clicked()
|
||||
{
|
||||
MainWindow * mw = (MainWindow *)this->parent();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <QCheckBox>
|
||||
#include "eeprominterface.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui {
|
||||
class preferencesDialog;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<property name="windowTitle">
|
||||
<string>Preferences</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4" columnstretch="1,0,0,1,0">
|
||||
<layout class="QGridLayout" name="gridLayout_4" columnstretch="1,0,0,0,0">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMinimumSize</enum>
|
||||
</property>
|
||||
@@ -35,7 +35,84 @@
|
||||
<property name="margin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="3" column="1" colspan="4">
|
||||
<item row="31" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="stickmodeCB">
|
||||
<property name="whatsThis">
|
||||
<string>Mode selection:
|
||||
|
||||
Mode 1:
|
||||
Left stick: Elevator, Rudder
|
||||
Right stick: Throttle, Aileron
|
||||
|
||||
Mode 2:
|
||||
Left stick: Throttle, Rudder
|
||||
Right stick: Elevator, Aileron
|
||||
|
||||
Mode 3:
|
||||
Left stick: Elevator, Aileron
|
||||
Right stick: Throttle, Rudder
|
||||
|
||||
Mode 4:
|
||||
Left stick: Throttle, Aileron
|
||||
Right stick: Elevator, Rudder
|
||||
|
||||
</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Mode 1 (RUD ELE THR AIL)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Mode 2 (RUD THR ELE AIL)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Mode 3 (AIL ELE THR RUD)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Mode 4 (AIL THR ELE RUD)</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="1">
|
||||
<widget class="QComboBox" name="backLightColor">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Blue</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Green</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Red</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Orange</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Yellow</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="4">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="backupPath">
|
||||
@@ -60,7 +137,14 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Automatic Backup Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
@@ -73,7 +157,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="1" colspan="4">
|
||||
<item row="15" column="1" colspan="4">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="joystickChkB">
|
||||
@@ -101,14 +185,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Automatic Backup Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="4">
|
||||
<item row="1" column="1" colspan="4">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QSpinBox" name="historySize">
|
||||
@@ -151,14 +228,14 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="5">
|
||||
<item row="5" column="0" colspan="5">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="0">
|
||||
<item row="14" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
@@ -174,7 +251,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="4" rowspan="7">
|
||||
<item row="6" column="4" rowspan="7">
|
||||
<layout class="QGridLayout" name="gridLayout_3" columnstretch="0,0">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="imageLabel">
|
||||
@@ -229,43 +306,14 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="15" column="2" colspan="2">
|
||||
<item row="14" column="2" colspan="2">
|
||||
<widget class="QCheckBox" name="simuSW">
|
||||
<property name="text">
|
||||
<string>Remember switches in simulator</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="1">
|
||||
<widget class="QComboBox" name="backLightColor">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Blue</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Green</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Red</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Orange</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Yellow</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1" colspan="3">
|
||||
<item row="6" column="1" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
@@ -302,27 +350,21 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="17" column="0">
|
||||
<item row="16" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
<string>Simulator capture folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Language (requires restart)</string>
|
||||
<item row="17" column="0" colspan="5">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="32" column="4">
|
||||
<item row="31" column="4">
|
||||
<widget class="QComboBox" name="channelorderCB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
@@ -466,7 +508,7 @@ This is used by the templated to determine which channel goes to what number out
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
@@ -479,7 +521,7 @@ This is used by the templated to determine which channel goes to what number out
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1" colspan="3">
|
||||
<item row="12" column="1" colspan="3">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="verticalSpacing">
|
||||
<number>1</number>
|
||||
@@ -503,7 +545,7 @@ This is used by the templated to determine which channel goes to what number out
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="25" column="1" colspan="4">
|
||||
<item row="24" column="1" colspan="4">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="FwInfo">
|
||||
@@ -527,7 +569,7 @@ This is used by the templated to determine which channel goes to what number out
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
@@ -540,7 +582,7 @@ This is used by the templated to determine which channel goes to what number out
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="38" column="0" colspan="5">
|
||||
<item row="37" column="0" colspan="5">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
@@ -583,7 +625,7 @@ This is used by the templated to determine which channel goes to what number out
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="27" column="1" colspan="4">
|
||||
<item row="26" column="1" colspan="4">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6" stretch="1,0">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_12">
|
||||
@@ -610,7 +652,7 @@ This is used by the templated to determine which channel goes to what number out
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="33" column="1" colspan="4">
|
||||
<item row="32" column="1" colspan="4">
|
||||
<layout class="QGridLayout" name="gridLayout_6" columnstretch="0,0,1,0,0">
|
||||
<item row="1" column="4">
|
||||
<widget class="QPushButton" name="export_PB">
|
||||
@@ -658,7 +700,7 @@ This is used by the templated to determine which channel goes to what number out
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="17" column="1" colspan="4">
|
||||
<item row="16" column="1" colspan="4">
|
||||
<layout class="QGridLayout" name="gridLayout_8">
|
||||
<property name="verticalSpacing">
|
||||
<number>1</number>
|
||||
@@ -689,7 +731,7 @@ This is used by the templated to determine which channel goes to what number out
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="32" column="0">
|
||||
<item row="31" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
@@ -702,7 +744,7 @@ This is used by the templated to determine which channel goes to what number out
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="32" column="3">
|
||||
<item row="31" column="3">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
@@ -718,62 +760,14 @@ This is used by the templated to determine which channel goes to what number out
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="32" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="stickmodeCB">
|
||||
<property name="whatsThis">
|
||||
<string>Mode selection:
|
||||
|
||||
Mode 1:
|
||||
Left stick: Elevator, Rudder
|
||||
Right stick: Throttle, Aileron
|
||||
|
||||
Mode 2:
|
||||
Left stick: Throttle, Rudder
|
||||
Right stick: Elevator, Aileron
|
||||
|
||||
Mode 3:
|
||||
Left stick: Elevator, Aileron
|
||||
Right stick: Throttle, Rudder
|
||||
|
||||
Mode 4:
|
||||
Left stick: Throttle, Aileron
|
||||
Right stick: Elevator, Rudder
|
||||
|
||||
</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Mode 1 (RUD ELE THR AIL)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Mode 2 (RUD THR ELE AIL)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Mode 3 (AIL ELE THR RUD)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Mode 4 (AIL THR ELE RUD)</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="33" column="0">
|
||||
<item row="32" column="0">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>Profile slot</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="28" column="1" colspan="4">
|
||||
<item row="27" column="1" colspan="4">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -789,7 +783,7 @@ Mode 4:
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="26" column="1" colspan="4">
|
||||
<item row="25" column="1" colspan="4">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11" stretch="1,0">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_18">
|
||||
@@ -816,7 +810,7 @@ Mode 4:
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="22" column="1" colspan="4">
|
||||
<item row="21" column="1" colspan="4">
|
||||
<layout class="QGridLayout" name="gridLayout_5" columnstretch="1,0,0,0,0">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
@@ -907,7 +901,7 @@ May be different from firmware language</string>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="22" column="0">
|
||||
<item row="21" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
@@ -947,7 +941,7 @@ May be different from firmware language</string>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
@@ -960,14 +954,7 @@ May be different from firmware language</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="18" column="0" colspan="5">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="24" column="1" colspan="4">
|
||||
<item row="23" column="1" colspan="4">
|
||||
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0,0,0,0,0">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
@@ -1520,7 +1507,7 @@ May be different from firmware language</string>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
@@ -1533,7 +1520,7 @@ May be different from firmware language</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1" colspan="3">
|
||||
<item row="9" column="1" colspan="3">
|
||||
<widget class="QComboBox" name="splashincludeCB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
@@ -1554,116 +1541,6 @@ May be different from firmware language</string>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="4">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QComboBox" name="locale_QB"/>
|
||||
</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>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Theme</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="theme_CB">
|
||||
<property name="toolTip">
|
||||
<string>Requires restart</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Classic</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Monochrome</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>MonoWhite</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>MonoBlue</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Icon size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="iconSize_CB">
|
||||
<property name="toolTip">
|
||||
<string>Requires restart</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Small</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Normal</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Big</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Huge</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="4">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7" stretch="0,0,0,0">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="showSplash">
|
||||
@@ -1710,7 +1587,7 @@ May be different from firmware language</string>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="16" column="0">
|
||||
<item row="15" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
|
||||
@@ -1723,14 +1600,14 @@ May be different from firmware language</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="ge_label">
|
||||
<property name="text">
|
||||
<string>Google Earth Executable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="4">
|
||||
<item row="3" column="1" colspan="4">
|
||||
<layout class="QHBoxLayout" name="ge_layout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="ge_lineedit">
|
||||
|
||||
@@ -54,7 +54,6 @@ printDialog::printDialog(QWidget *parent, GeneralSettings *gg, ModelData *gm, QS
|
||||
printCurves();
|
||||
printGvars();
|
||||
printSwitches();
|
||||
printSafetySwitches();
|
||||
printFSwitches();
|
||||
printFrSky();
|
||||
|
||||
@@ -643,7 +642,7 @@ void printDialog::printSwitches()
|
||||
str.append("<tr><td><h2>"+tr("Logical Switches")+"</h2></td></tr>");
|
||||
str.append("<tr><td><table border=0 cellspacing=0 cellpadding=3>");
|
||||
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(CustomSwitches); i++) {
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) {
|
||||
if (g_model->customSw[i].func) {
|
||||
str.append("<tr>");
|
||||
if (i<9) {
|
||||
@@ -651,7 +650,7 @@ void printDialog::printSwitches()
|
||||
} else {
|
||||
str.append("<td width=\"60\" align=\"center\"><b>"+tr("LS")+('A'+(i-9))+"</b></td>");
|
||||
}
|
||||
QString tstr = getCustomSwitchStr(&g_model->customSw[i], *g_model);
|
||||
QString tstr = g_model->customSw[i].toString(*g_model);
|
||||
str.append(doTC(tstr,"green"));
|
||||
str.append("</tr>");
|
||||
sc++;
|
||||
@@ -693,33 +692,6 @@ void printDialog::printGvars()
|
||||
}
|
||||
}
|
||||
|
||||
void printDialog::printSafetySwitches()
|
||||
{
|
||||
int sc=0;
|
||||
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
|
||||
str.append("<tr><td><h2>"+tr("Safety Switches")+"</h2></td></tr>");
|
||||
str.append("<tr><td><table border=0 cellspacing=0 cellpadding=3><tr>");
|
||||
str.append("<td width=\"60\"> </td>");
|
||||
str.append(doTC(tr("Switch"), "", true));
|
||||
str.append(doTL(tr("Value"), "", true));
|
||||
str.append("</tr>");
|
||||
for(int i=0; i<GetEepromInterface()->getCapability(Outputs); i++)
|
||||
{
|
||||
if (g_model->safetySw[i].swtch.type) {
|
||||
str.append("<tr>");
|
||||
str.append(doTC(tr("CH")+QString("%1").arg(i+1),"",true));
|
||||
str.append(doTC(g_model->safetySw[i].swtch.toString(),"green"));
|
||||
str.append(doTC(QString::number(g_model->safetySw[i].val),"green"));
|
||||
str.append("</tr>");
|
||||
sc++;
|
||||
}
|
||||
}
|
||||
str.append("</table></td></tr></table>");
|
||||
str.append("<br>");
|
||||
if (sc!=0)
|
||||
te->append(str);
|
||||
}
|
||||
|
||||
void printDialog::printFSwitches()
|
||||
{
|
||||
int sc=0;
|
||||
@@ -736,8 +708,8 @@ void printDialog::printFSwitches()
|
||||
if (g_model->funcSw[i].swtch.type!=SWITCH_TYPE_NONE) {
|
||||
str.append("<tr>");
|
||||
str.append(doTC(g_model->funcSw[i].swtch.toString(),"green"));
|
||||
str.append(doTC(getFuncName(g_model->funcSw[i].func),"green"));
|
||||
str.append(doTC(FuncParam(g_model->funcSw[i].func,g_model->funcSw[i].param,g_model->funcSw[i].paramarm, g_model->funcSw[i].adjustMode),"green"));
|
||||
str.append(doTC(g_model->funcSw[i].funcToString(),"green"));
|
||||
str.append(doTC(g_model->funcSw[i].paramToString(),"green"));
|
||||
int index=g_model->funcSw[i].func;
|
||||
if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) {
|
||||
str.append(doTC(QString("%1").arg(g_model->funcSw[i].repeatParam),"green"));
|
||||
|
||||
@@ -356,7 +356,7 @@ void simulatorDialog::loadParams(RadioData &radioData, const int model_idx)
|
||||
|
||||
beepVal = 0;
|
||||
beepShow = 0;
|
||||
switches=txInterface->getCapability(CustomSwitches);
|
||||
switches=txInterface->getCapability(LogicalSwitches);
|
||||
if ( switches < 13) {
|
||||
ui->cswitch_13->hide();
|
||||
ui->labelCSW_13->hide();
|
||||
@@ -497,6 +497,8 @@ void simulatorDialog::setValues()
|
||||
{
|
||||
TxOutputs outputs;
|
||||
simulator->getValues(outputs);
|
||||
Trims trims;
|
||||
simulator->getTrims(trims);
|
||||
|
||||
ui->chnout_1->setValue(chVal(outputs.chans[0]));
|
||||
ui->chnout_2->setValue(chVal(outputs.chans[1]));
|
||||
@@ -536,11 +538,11 @@ void simulatorDialog::setValues()
|
||||
ui->chnoutV_16->setText(QString("%1").arg((qreal)outputs.chans[15]*100/1024, 0, 'f', 1));
|
||||
}
|
||||
|
||||
ui->leftXPerc->setText(QString("X %1%").arg((qreal)nodeLeft->getX()*100, 2, 'f', 0));
|
||||
ui->leftYPerc->setText(QString("Y %1%").arg((qreal)nodeLeft->getY()*-100, 2, 'f', 0));
|
||||
ui->leftXPerc->setText(QString("X %1%").arg((qreal)nodeLeft->getX()*100+trims.values[0]/5, 2, 'f', 0));
|
||||
ui->leftYPerc->setText(QString("Y %1%").arg((qreal)nodeLeft->getY()*-100+trims.values[1]/5, 2, 'f', 0));
|
||||
|
||||
ui->rightXPerc->setText(QString("X %1%").arg((qreal)nodeRight->getX()*100, 2, 'f', 0));
|
||||
ui->rightYPerc->setText(QString("Y %1%").arg((qreal)nodeRight->getY()*-100, 2, 'f', 0));
|
||||
ui->rightXPerc->setText(QString("X %1%").arg((qreal)nodeRight->getX()*100+trims.values[2]/5, 2, 'f', 0));
|
||||
ui->rightYPerc->setText(QString("Y %1%").arg((qreal)nodeRight->getY()*-100+trims.values[3]/5, 2, 'f', 0));
|
||||
|
||||
#define CSWITCH_ON "QLabel { background-color: #4CC417 }"
|
||||
#define CSWITCH_OFF "QLabel { }"
|
||||
|
||||
|
Before Width: | Height: | Size: 876 B After Width: | Height: | Size: 463 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 733 B |
|
Before Width: | Height: | Size: 661 B After Width: | Height: | Size: 999 B |
|
Before Width: | Height: | Size: 877 B After Width: | Height: | Size: 309 B |
|
Before Width: | Height: | Size: 961 B After Width: | Height: | Size: 668 B |
|
Before Width: | Height: | Size: 947 B After Width: | Height: | Size: 511 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 783 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 736 B |
|
Before Width: | Height: | Size: 930 B After Width: | Height: | Size: 912 B |
|
Before Width: | Height: | Size: 998 B After Width: | Height: | Size: 500 B |