StartupSwitches and BeepCenter in ModelSetup rewritten

This commit is contained in:
Bertrand Songis
2013-12-20 19:59:47 +01:00
parent 350e910a57
commit 5b7654e475
7 changed files with 226 additions and 1100 deletions
+23 -22
View File
@@ -10,6 +10,9 @@
QString EEPROMWarnings;
const char * switches9X[] = { "3POS", "THR", "RUD", "ELE", "AIL", "GEA", "TRN" };
const char * switchesX9D[] = { "SA", "SB", "SC", "SD", "SE", "SF", "SG", "SH" };
void setEEPROMString(char *dst, const char *src, int size)
{
memcpy(dst, src, size);
@@ -244,27 +247,28 @@ double RawSource::getStep(const ModelData & Model)
}
}
QString AnalogString(int index)
{
static const QString sticks[] = { QObject::tr("Rud"), QObject::tr("Ele"), QObject::tr("Thr"), QObject::tr("Ail") };
static const QString pots9X[] = { QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3") };
static const QString potsX9D[] = { QObject::tr("S1"), QObject::tr("S2"), QObject::tr("LS"), QObject::tr("RS") };
if (index < 4)
return CHECK_IN_ARRAY(sticks, index);
else
return (IS_TARANIS(GetEepromInterface()->getBoard()) ? CHECK_IN_ARRAY(potsX9D, index-4) : CHECK_IN_ARRAY(pots9X, index-4));
}
QString RotaryEncoderString(int index)
{
static const QString rotary[] = { QObject::tr("REa"), QObject::tr("REb") };
return CHECK_IN_ARRAY(rotary, index);
}
QString RawSource::toString()
{
static const QString sticks[] = { QObject::tr("Rud"), QObject::tr("Ele"), QObject::tr("Thr"), QObject::tr("Ail") };
static const QString trims[] = { QObject::tr("TrmR"), QObject::tr("TrmE"), QObject::tr("TrmT"), QObject::tr("TrmA")};
static const QString pots9X[] = { QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3") };
static const QString potsX9D[] = { QObject::tr("S1"), QObject::tr("S2"), QObject::tr("LS"), QObject::tr("RS") };
static const QString rotary[] = { QObject::tr("REa"), QObject::tr("REb") };
static const QString switches9X[] = { QObject::tr("3POS"),
QObject::tr("THR"), QObject::tr("RUD"), QObject::tr("ELE"),
QObject::tr("AIL"), QObject::tr("GEA"), QObject::tr("TRN"),
};
static const QString switchesX9D[] = { QObject::tr("SA"), QObject::tr("SB"), QObject::tr("SC"), QObject::tr("SD"),
QObject::tr("SE"), QObject::tr("SF"), QObject::tr("SG"), QObject::tr("SH"),
};
static const QString telemetry[] = { QObject::tr("Batt"), QObject::tr("Timer1"), QObject::tr("Timer2"),
(IS_TARANIS(GetEepromInterface()->getBoard()) ? QObject::tr("SWR") : QObject::tr("Tx")), (IS_TARANIS(GetEepromInterface()->getBoard()) ? QObject::tr("RSSI") : QObject::tr("Rx")), QObject::tr("A1"), QObject::tr("A2"), QObject::tr("Alt"), QObject::tr("Rpm"), QObject::tr("Fuel"), QObject::tr("T1"),
QObject::tr("T2"), QObject::tr("Speed"), QObject::tr("Dist"), QObject::tr("GPS Alt"), QObject::tr("Cell"), QObject::tr("Cels"), QObject::tr("Vfas"), QObject::tr("Curr"),
@@ -284,14 +288,11 @@ QString RawSource::toString()
}
switch(type) {
case SOURCE_TYPE_STICK:
if (index < 4)
return CHECK_IN_ARRAY(sticks, index);
else
return (IS_TARANIS(GetEepromInterface()->getBoard()) ? CHECK_IN_ARRAY(potsX9D, index-4) : CHECK_IN_ARRAY(pots9X, index-4));
return AnalogString(index);
case SOURCE_TYPE_TRIM:
return CHECK_IN_ARRAY(trims, index);
case SOURCE_TYPE_ROTARY_ENCODER:
return CHECK_IN_ARRAY(rotary, index);
return RotaryEncoderString(index);
case SOURCE_TYPE_MAX:
return QObject::tr("MAX");
case SOURCE_TYPE_SWITCH:
+11 -4
View File
@@ -50,8 +50,8 @@ enum BoardEnum {
BOARD_TARANIS_REV4a
};
#define IS_STOCK(board) (board==BOARD_STOCK || board==BOARD_M128)
#define IS_ARM(board) (board==BOARD_SKY9X || board==BOARD_TARANIS || board==BOARD_TARANIS_REV4a)
#define IS_TARANIS(board) (board==BOARD_TARANIS || board==BOARD_TARANIS_REV4a)
#define IS_ARM(board) (board==BOARD_SKY9X || board==BOARD_TARANIS || board==BOARD_TARANIS_REV4a)
#define IS_TARANIS(board) (board==BOARD_TARANIS || board==BOARD_TARANIS_REV4a)
const uint8_t modn12x3[4][4]= {
{1, 2, 3, 4},
@@ -198,10 +198,13 @@ enum HeliSwashTypes {
#define NUM_CAL_PPM 4
#define NUM_PPM 8
#define NUM_CYC 3
#define C9X_NUM_SWITCHES 10
#define C9X_NUM_KEYS 6
#define C9X_NUM_SWITCHES 10
#define C9X_NUM_KEYS 6
#define C9X_MAX_TIMERS 2
extern const char * switches9X[];
extern const char * switchesX9D[];
enum TelemetrySource {
TELEMETRY_SOURCE_TX_BATT,
TELEMETRY_SOURCE_TIMER1,
@@ -267,8 +270,12 @@ enum RawSourceType {
SOURCE_TYPE_TELEMETRY,
MAX_SOURCE_TYPE
};
class ModelData;
QString AnalogString(int index);
QString RotaryEncoderString(int index);
class RawSource {
public:
RawSource():
-6
View File
@@ -1138,12 +1138,6 @@ int findmult(float value, float base)
return mult;
}
bool checkbit(int value, int bit)
{
return ((value & (1<<bit))==(1<<bit));
}
QString getFrSkyAlarmType(int alarm)
{
switch (alarm) {
+1 -1
View File
@@ -77,7 +77,6 @@ QString getGVarString(int16_t val, bool sign=false);
QString image2qstring(QImage image);
QImage qstring2image(QString imagestr);
int findmult(float value, float base);
bool checkbit(int value, int bit);
QString getTrimInc(ModelData * g_model);
QString getTimerStr(TimerData & timer);
@@ -95,4 +94,5 @@ float getBarValue(int barId, int value, FrSkyData *fd);
float c9xexpou(float point, float coeff);
float ValToTim(int value);
int TimToVal(float value);
#endif // HELPERS_H
+122 -277
View File
@@ -18,10 +18,7 @@ Setup::~Setup()
void Setup::tabModelEditSetup()
{
lock = true;
//name
QLabel * pmsl[] = {ui->swwarn_label, ui->swwarn0_label, ui->swwarn4_label, NULL};
QCheckBox * pmchkb[] = {ui->swwarn1_ChkB,ui->swwarn2_ChkB,ui->swwarn3_ChkB,ui->swwarn5_ChkB,ui->swwarn6_ChkB, NULL};
QSlider * tpmsld[] = {ui->chkSA, ui->chkSB, ui->chkSC, ui->chkSD, ui->chkSE, ui->chkSF, ui->chkSG, NULL};
QSlider * fssld1[] = { ui->fsm1SL_1, ui->fsm1SL_2,ui->fsm1SL_3,ui->fsm1SL_4,ui->fsm1SL_5,ui->fsm1SL_6,ui->fsm1SL_7,ui->fsm1SL_8,
ui->fsm1SL_9, ui->fsm1SL_10,ui->fsm1SL_11,ui->fsm1SL_12,ui->fsm1SL_13,ui->fsm1SL_14,ui->fsm1SL_15,ui->fsm1SL_16, NULL };
QSlider * fssld2[] = { ui->fsm2SL_1, ui->fsm2SL_2,ui->fsm2SL_3,ui->fsm2SL_4,ui->fsm2SL_5,ui->fsm2SL_6,ui->fsm2SL_7,ui->fsm2SL_8,
@@ -133,74 +130,50 @@ void Setup::tabModelEditSetup()
}
}
}
}
if (!GetEepromInterface()->getCapability(pmSwitchMask)) {
for (int i=0; pmsl[i]; i++) {
pmsl[i]->hide();
}
for (int i=0; pmchkb[i]; i++) {
pmchkb[i]->hide();
}
ui->tswwarn0_CB->hide();
for (int i=0; tpmsld[i]; i++) {
tpmsld[i]->hide();
}
ui->swwarn0_line->hide();
ui->swwarn0_line->hide();
ui->swwarn0_CB->hide();
ui->swwarn4_CB->hide();
ui->swwarn_line0->hide();
ui->swwarn_line1->hide();
ui->swwarn_line2->hide();
ui->swwarn_line3->hide();
ui->swwarn_line4->hide();
ui->swwarn_line5->hide();
ui->tswwarn0_label->hide();
ui->tswwarn1_label->hide();
ui->tswwarn2_label->hide();
ui->tswwarn3_label->hide();
ui->tswwarn4_label->hide();
ui->tswwarn5_label->hide();
ui->tswwarn6_label->hide();
ui->tswwarn7_label->hide();
} else {
if (GetEepromInterface()->getCapability(Pots)==3) {
ui->swwarn0_CB->setCurrentIndex(model.switchWarningStates & 0x01);
ui->swwarn1_ChkB->setChecked(checkbit(model.switchWarningStates, 1));
ui->swwarn2_ChkB->setChecked(checkbit(model.switchWarningStates, 2));
ui->swwarn3_ChkB->setChecked(checkbit(model.switchWarningStates, 3));
ui->swwarn4_CB->setCurrentIndex((model.switchWarningStates & 0x30)>>4);
ui->swwarn5_ChkB->setChecked(checkbit(model.switchWarningStates, 6));
ui->swwarn6_ChkB->setChecked(checkbit(model.switchWarningStates, 7));
for (int i=0; pmchkb[i]; i++) {
connect(pmchkb[i], SIGNAL(stateChanged(int)),this,SLOT(startupSwitchEdited()));
}
connect(ui->swwarn0_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(startupSwitchEdited()));
connect(ui->swwarn4_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(startupSwitchEdited()));
} else {
ui->tswwarn0_CB->setCurrentIndex(model.switchWarningStates & 0x01);
uint16_t switchstate=(model.switchWarningStates>>1);
ui->chkSA->setValue(switchstate & 0x3);
switchstate >>= 2;
ui->chkSB->setValue(switchstate & 0x3);
switchstate >>= 2;
ui->chkSC->setValue(switchstate & 0x3);
switchstate >>= 2;
ui->chkSD->setValue(switchstate & 0x3);
switchstate >>= 2;
ui->chkSE->setValue(switchstate & 0x3);
switchstate >>= 2;
ui->chkSF->setValue((switchstate & 0x3)/2);
switchstate >>= 2;
ui->chkSG->setValue(switchstate & 0x3);
connect(ui->tswwarn0_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(startupSwitchEdited()));
for (int i=0; tpmsld[i]; i++) {
connect(tpmsld[i], SIGNAL(valueChanged(int)),this,SLOT(startupSwitchEdited()));
}
}
// Beep Center checkboxes
int analogs = 4 + GetEepromInterface()->getCapability(Pots);
for (int i=0; i<analogs+GetEepromInterface()->getCapability(RotaryEncoders); i++) {
QCheckBox * checkbox = new QCheckBox(this);
checkbox->setProperty("index", i);
checkbox->setText(i<analogs ? AnalogString(i) : RotaryEncoderString(i-analogs));
ui->centerBeepLayout->addWidget(checkbox, 0, i+1);
connect(checkbox, SIGNAL(toggled(bool)), this, SLOT(onBeepCenterToggled(bool)));
centerBeepCheckboxes << checkbox;
}
ui->switchesStartupLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, analogs+GetEepromInterface()->getCapability(RotaryEncoders));
// Startup switches warnings
ui->switchesStartupWarning_CB->setProperty("index", 0);
connect(ui->switchesStartupWarning_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(startupSwitchEdited(int)));
for (int i=0; i<GetEepromInterface()->getCapability(Switches)-1; i++) {
QLabel * label = new QLabel();
QSlider * slider = new QSlider();
slider->setProperty("index", i+1);
slider->setOrientation(Qt::Vertical);
slider->setMinimum(0);
slider->setSingleStep(1);
slider->setInvertedAppearance(true);
slider->setTickPosition(QSlider::TicksBothSides);
slider->setTickInterval(1);
slider->setMinimumSize(QSize(30, 50));
slider->setMaximumSize(QSize(50, 50));
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
label->setText(switchesX9D[i]);
slider->setMaximum(i==5 ? 1 : 2);
}
else {
label->setText(switches9X[i]);
slider->setMaximum(i==0 ? 2 : 1);
}
ui->switchesStartupLayout->addWidget(label, 0, i+1);
ui->switchesStartupLayout->addWidget(slider, 1, i+1);
connect(slider, SIGNAL(valueChanged(int)), this, SLOT(startupSwitchEdited(int)));
startupSwitchesSliders << slider;
}
ui->switchesStartupLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, GetEepromInterface()->getCapability(Switches));
int ppmmax=GetEepromInterface()->getCapability(PPMFrameLength);
if (ppmmax>0) {
ui->ppmFrameLengthDSB->setMaximum(ppmmax);
@@ -243,52 +216,6 @@ void Setup::tabModelEditSetup()
} else {
populateTTraceCB(ui->ttraceCB,model.thrTraceSrc);
}
if (GetEepromInterface()->getCapability(RotaryEncoders)==0) {
ui->bcREaChkB->hide();
ui->bcREbChkB->hide();
}
if (GetEepromInterface()->getCapability(Pots)==3) {
ui->tswwarn0_CB->hide();
ui->tswwarn0_label->hide();
ui->tswwarn1_label->hide();
ui->tswwarn2_label->hide();
ui->tswwarn3_label->hide();
ui->tswwarn4_label->hide();
ui->tswwarn5_label->hide();
ui->tswwarn6_label->hide();
ui->tswwarn7_label->hide();
ui->chkSA->hide();
ui->chkSB->hide();
ui->chkSC->hide();
ui->chkSD->hide();
ui->chkSE->hide();
ui->chkSF->hide();
ui->chkSG->hide();
this->layout()->removeItem(ui->TaranisSwitchStartup);
ui->bcP4ChkB->hide();
} else {
ui->swwarn0_CB->hide();
ui->swwarn0_label->hide();
ui->swwarn0_line->hide();
ui->swwarn1_ChkB->hide();
ui->swwarn1_line->hide();
ui->swwarn2_ChkB->hide();
ui->swwarn3_ChkB->hide();
ui->swwarn4_CB->hide();
ui->swwarn4_label->hide();
ui->swwarn5_ChkB->hide();
ui->swwarn6_ChkB->hide();
ui->swwarn_line0->hide();
ui->swwarn_line1->hide();
ui->swwarn_line2->hide();
ui->swwarn_line3->hide();
ui->swwarn_line4->hide();
ui->swwarn_line5->hide();
this->layout()->removeItem(ui->StockSwitchStartup);
ui->bcP1ChkB->setText(tr("S1"));
ui->bcP2ChkB->setText(tr("S2"));
ui->bcP3ChkB->setText(tr("LS"));
}
if (!GetEepromInterface()->getCapability(PerModelThrottleWarning)) {
ui->thrwarnChkB->setDisabled(true);
@@ -471,18 +398,6 @@ void Setup::tabModelEditSetup()
ui->thrExpoChkB->setChecked(model.thrExpo);
ui->thrTrimChkB->setChecked(model.thrTrim);
//center beep
ui->bcRUDChkB->setChecked(model.beepANACenter & BC_BIT_RUD);
ui->bcELEChkB->setChecked(model.beepANACenter & BC_BIT_ELE);
ui->bcTHRChkB->setChecked(model.beepANACenter & BC_BIT_THR);
ui->bcAILChkB->setChecked(model.beepANACenter & BC_BIT_AIL);
ui->bcP1ChkB->setChecked(model.beepANACenter & BC_BIT_P1);
ui->bcP2ChkB->setChecked(model.beepANACenter & BC_BIT_P2);
ui->bcP3ChkB->setChecked(model.beepANACenter & BC_BIT_P3);
ui->bcP4ChkB->setChecked(model.beepANACenter & BC_BIT_P4);
ui->bcREaChkB->setChecked(model.beepANACenter & BC_BIT_REA);
ui->bcREbChkB->setChecked(model.beepANACenter & BC_BIT_REB);
// PPM settings fields
ui->ppmDelaySB->setEnabled(model.moduleData[0].protocol == PPM);
ui->pulsePolCB->setCurrentIndex(model.moduleData[0].ppmPulsePol);
@@ -996,8 +911,6 @@ void Setup::fssbEdited()
emit modified();
}
void Setup::on_modelVoice_SB_editingFinished()
{
model.modelVoice=ui->modelVoice_SB->value()-260;
@@ -1316,66 +1229,86 @@ void Setup::on_modelImage_CB_currentIndexChanged(int index)
}
}
void Setup::startupSwitchEdited()
void Setup::update()
{
if (GetEepromInterface()->getCapability(Pots)==3) {
uint8_t i= 0;
i|=(uint8_t)ui->swwarn0_CB->currentIndex();
if (i==1) {
ui->swwarn1_ChkB->setDisabled(true) ;
ui->swwarn2_ChkB->setDisabled(true) ;
ui->swwarn3_ChkB->setDisabled(true) ;
ui->swwarn4_CB->setDisabled(true) ;
ui->swwarn5_ChkB->setDisabled(true) ;
ui->swwarn6_ChkB->setDisabled(true) ;
updateBeepCenter();
updateStartupSwitches();
}
void Setup::updateBeepCenter()
{
for (int i=0; i<centerBeepCheckboxes.size(); i++) {
centerBeepCheckboxes[i]->setChecked(model.beepANACenter & (0x01 << i));
}
}
void Setup::updateStartupSwitches()
{
lock = true;
unsigned int switchStates = model.switchWarningStates;
bool enabled = !(switchStates & 0x01);
ui->switchesStartupWarning_CB->setCurrentIndex(switchStates & 0x01);
switchStates >>= 1;
for (int i=0; i<GetEepromInterface()->getCapability(Switches)-1; i++) {
QSlider * slider = startupSwitchesSliders[i];
slider->setEnabled(enabled);
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
slider->setValue(i==5 ? (switchStates & 0x3)/2 : switchStates & 0x3);
switchStates >>= 2;
}
else {
ui->swwarn1_ChkB->setEnabled(true) ;
ui->swwarn2_ChkB->setEnabled(true) ;
ui->swwarn3_ChkB->setEnabled(true) ;
ui->swwarn4_CB->setEnabled(true) ;
ui->swwarn5_ChkB->setEnabled(true) ;
ui->swwarn6_ChkB->setEnabled(true) ;
i|=(ui->swwarn1_ChkB->isChecked() ? 1 : 0)<<1;
i|=(ui->swwarn2_ChkB->isChecked() ? 1 : 0)<<2;
i|=(ui->swwarn3_ChkB->isChecked() ? 1 : 0)<<3;
i|=((uint8_t)ui->swwarn4_CB->currentIndex() & 0x03)<<4;
i|=(ui->swwarn5_ChkB->isChecked() ? 1 : 0)<<6;
i|=(ui->swwarn6_ChkB->isChecked() ? 1 : 0)<<7;
slider->setValue(i==0 ? switchStates & 0x3 : switchStates & 0x1);
switchStates >>= (i==0 ? 2 : 1);
}
model.switchWarningStates=i;
}
else {
uint16_t i= 0;
i|=(uint16_t)ui->tswwarn0_CB->currentIndex();
if (i==1) {
ui->chkSA->setDisabled(true);
ui->chkSB->setDisabled(true);
ui->chkSC->setDisabled(true);
ui->chkSD->setDisabled(true);
ui->chkSE->setDisabled(true);
ui->chkSF->setDisabled(true);
ui->chkSG->setDisabled(true);
lock = false;
}
void Setup::startupSwitchEdited(int value)
{
if (!lock) {
int shift = 0;
unsigned int mask;
int index = sender()->property("index").toInt();
if (index == 0) {
mask = 0x01;
}
else if (IS_TARANIS(GetEepromInterface()->getBoard())) {
if (index == 6)
mask = 0x02 << (index*2 - 1);
else {
shift = index*2 - 1;
mask = 0x03 << shift;
}
}
else {
ui->chkSA->setEnabled(true);
ui->chkSB->setEnabled(true);
ui->chkSC->setEnabled(true);
ui->chkSD->setEnabled(true);
ui->chkSE->setEnabled(true);
ui->chkSF->setEnabled(true);
ui->chkSG->setEnabled(true);
i|=(((uint16_t)ui->chkSA->value())<<1);
i|=(((uint16_t)ui->chkSB->value())<<3);
i|=(((uint16_t)ui->chkSC->value())<<5);
i|=(((uint16_t)ui->chkSD->value())<<7);
i|=(((uint16_t)ui->chkSE->value())<<9);
i|=(((uint16_t)ui->chkSF->value())<<12);
i|=(((uint16_t)ui->chkSG->value())<<13);
if (index == 1) {
shift = 1;
mask = 0x03 << shift;
}
else {
mask = 0x01 << (index+1);
}
}
model.switchWarningStates=i;
model.switchWarningStates &= ~mask;
if (value) {
if (shift == 0) {
model.switchWarningStates |= mask;
}
else {
model.switchWarningStates |= (value << shift);
}
}
updateStartupSwitches();
emit modified();
}
emit modified();
}
void Setup::on_thrTrimChkB_toggled(bool checked)
@@ -1390,103 +1323,15 @@ void Setup::on_thrExpoChkB_toggled(bool checked)
emit modified();
}
void Setup::on_bcRUDChkB_toggled(bool checked)
void Setup::onBeepCenterToggled(bool checked)
{
if(checked) {
model.beepANACenter |= BC_BIT_RUD;
} else {
model.beepANACenter &= ~BC_BIT_RUD;
}
if (!lock) {
int index = sender()->property("index").toInt();
unsigned int mask = (0x01 << index);
if (checked)
model.beepANACenter |= mask;
else
model.beepANACenter &= ~mask;
emit modified();
}
}
void Setup::on_bcELEChkB_toggled(bool checked)
{
if(checked) {
model.beepANACenter |= BC_BIT_ELE;
} else {
model.beepANACenter &= ~BC_BIT_ELE;
}
emit modified();
}
void Setup::on_bcTHRChkB_toggled(bool checked)
{
if(checked) {
model.beepANACenter |= BC_BIT_THR;
} else {
model.beepANACenter &= ~BC_BIT_THR;
}
emit modified();
}
void Setup::on_bcAILChkB_toggled(bool checked)
{
if(checked) {
model.beepANACenter |= BC_BIT_AIL;
} else {
model.beepANACenter &= ~BC_BIT_AIL;
}
emit modified();
}
void Setup::on_bcP1ChkB_toggled(bool checked)
{
if(checked) {
model.beepANACenter |= BC_BIT_P1;
} else {
model.beepANACenter &= ~BC_BIT_P1;
}
emit modified();
}
void Setup::on_bcP2ChkB_toggled(bool checked)
{
if(checked) {
model.beepANACenter |= BC_BIT_P2;
} else {
model.beepANACenter &= ~BC_BIT_P2;
}
emit modified();
}
void Setup::on_bcP3ChkB_toggled(bool checked)
{
if(checked) {
model.beepANACenter |= BC_BIT_P3;
} else {
model.beepANACenter &= ~BC_BIT_P3;
}
emit modified();
}
void Setup::on_bcP4ChkB_toggled(bool checked)
{
if(checked) {
model.beepANACenter |= BC_BIT_P4;
} else {
model.beepANACenter &= ~BC_BIT_P4;
}
emit modified();
}
void Setup::on_bcREaChkB_toggled(bool checked)
{
if(checked) {
model.beepANACenter |= BC_BIT_REA;
} else {
model.beepANACenter &= ~BC_BIT_REA;
}
emit modified();
}
void Setup::on_bcREbChkB_toggled(bool checked)
{
if(checked) {
model.beepANACenter |= BC_BIT_REB;
} else {
model.beepANACenter &= ~BC_BIT_REB;
}
emit modified();
}
+11 -13
View File
@@ -2,6 +2,9 @@
#define SETUP_H
#include "modelpanel.h"
#include <QVector>
#include <QCheckBox>
#include <QSlider>
namespace Ui {
class Setup;
@@ -15,6 +18,8 @@ class Setup : public ModelPanel
Setup(QWidget *parent, ModelData & model);
virtual ~Setup();
virtual void update();
private slots:
void on_protocolCB_currentIndexChanged(int index);
void on_protocolCB_2_currentIndexChanged(int index);
@@ -74,23 +79,16 @@ class Setup : public ModelPanel
void on_timer2ModeBCB_currentIndexChanged(int index);
void on_modelNameLE_editingFinished();
void on_modelImage_CB_currentIndexChanged(int index);
void on_bcRUDChkB_toggled(bool checked);
void on_bcELEChkB_toggled(bool checked);
void on_bcTHRChkB_toggled(bool checked);
void on_bcAILChkB_toggled(bool checked);
void on_bcP1ChkB_toggled(bool checked);
void on_bcP2ChkB_toggled(bool checked);
void on_bcP3ChkB_toggled(bool checked);
void on_bcP4ChkB_toggled(bool checked);
void on_bcREaChkB_toggled(bool checked);
void on_bcREbChkB_toggled(bool checked);
void startupSwitchEdited();
void onBeepCenterToggled(bool checked);
void startupSwitchEdited(int value);
private:
Ui::Setup *ui;
QVector<QSlider *> startupSwitchesSliders;
QVector<QCheckBox *> centerBeepCheckboxes;
void tabModelEditSetup();
void updateStartupSwitches();
void updateBeepCenter();
};
#endif // SETUP_H
+58 -777
View File
@@ -8,6 +8,14 @@
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>968</width>
<height>660</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
@@ -225,784 +233,8 @@
</property>
</widget>
</item>
<item row="13" column="1" colspan="9">
<layout class="QGridLayout" name="StockSwitchStartup">
<property name="topMargin">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="0" column="9" rowspan="2">
<widget class="Line" name="swwarn_line4">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="1" rowspan="2">
<widget class="Line" name="swwarn_line0">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="7" rowspan="2">
<widget class="Line" name="swwarn_line3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="8">
<widget class="QLabel" name="swwarn4_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>3POS</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="swwarn0_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Check</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="swwarn1_ChkB">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>THR</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QComboBox" name="swwarn0_CB">
<item>
<property name="text">
<string>ON</string>
</property>
</item>
<item>
<property name="text">
<string>OFF</string>
</property>
</item>
</widget>
</item>
<item row="1" column="4">
<widget class="QCheckBox" name="swwarn2_ChkB">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>RUD</string>
</property>
</widget>
</item>
<item row="1" column="6">
<widget class="QCheckBox" name="swwarn3_ChkB">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>ELE</string>
</property>
</widget>
</item>
<item row="1" column="10">
<widget class="QCheckBox" name="swwarn5_ChkB">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>AIL</string>
</property>
</widget>
</item>
<item row="1" column="12">
<widget class="QCheckBox" name="swwarn6_ChkB">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>GEA</string>
</property>
</widget>
</item>
<item row="1" column="8">
<widget class="QComboBox" name="swwarn4_CB">
<property name="frame">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>ID0</string>
</property>
</item>
<item>
<property name="text">
<string>ID1</string>
</property>
</item>
<item>
<property name="text">
<string>ID2</string>
</property>
</item>
</widget>
</item>
<item row="0" column="11" rowspan="2">
<widget class="Line" name="swwarn_line5">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="3" rowspan="2">
<widget class="Line" name="swwarn_line1">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="5" rowspan="2">
<widget class="Line" name="swwarn_line2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="14" column="1" colspan="9">
<layout class="QGridLayout" name="TaranisSwitchStartup" rowstretch="0,0" columnstretch="0,0,0,0,0,0,0,0,0">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<item row="1" column="0">
<widget class="QComboBox" name="tswwarn0_CB">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>ON</string>
</property>
</item>
<item>
<property name="text">
<string>OFF</string>
</property>
</item>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="tswwarn2_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>SB</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="tswwarn4_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>SD</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="tswwarn1_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>SA</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="tswwarn0_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Check</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSlider" name="chkSB">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>50</height>
</size>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>2</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="invertedAppearance">
<bool>true</bool>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBothSides</enum>
</property>
<property name="tickInterval">
<number>1</number>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QSlider" name="chkSC">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>50</height>
</size>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>2</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="invertedAppearance">
<bool>true</bool>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBothSides</enum>
</property>
<property name="tickInterval">
<number>1</number>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="tswwarn3_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>SC</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QSlider" name="chkSD">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>50</height>
</size>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>2</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="invertedAppearance">
<bool>true</bool>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBothSides</enum>
</property>
<property name="tickInterval">
<number>1</number>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QLabel" name="tswwarn7_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>SG</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QLabel" name="tswwarn5_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>SE</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="5">
<widget class="QSlider" name="chkSE">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>50</height>
</size>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>2</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="invertedAppearance">
<bool>true</bool>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBothSides</enum>
</property>
<property name="tickInterval">
<number>1</number>
</property>
</widget>
</item>
<item row="1" column="7">
<widget class="QSlider" name="chkSG">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>50</height>
</size>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>2</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="invertedAppearance">
<bool>true</bool>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBothSides</enum>
</property>
<property name="tickInterval">
<number>1</number>
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="QLabel" name="tswwarn6_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>SF</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSlider" name="chkSA">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>50</height>
</size>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>2</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="invertedAppearance">
<bool>true</bool>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBothSides</enum>
</property>
<property name="tickInterval">
<number>1</number>
</property>
</widget>
</item>
<item row="1" column="8">
<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 row="1" column="6">
<widget class="QSlider" name="chkSF">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>50</height>
</size>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>1</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="invertedAppearance">
<bool>true</bool>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBothSides</enum>
</property>
<property name="tickInterval">
<number>1</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="16" column="1" colspan="9">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="8">
<widget class="QCheckBox" name="bcREaChkB">
<property name="text">
<string>REa</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="bcRUDChkB">
<property name="text">
<string>RUD</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="bcELEChkB">
<property name="text">
<string>ELE</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="bcTHRChkB">
<property name="text">
<string>THR</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QCheckBox" name="bcAILChkB">
<property name="text">
<string>AIL</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QCheckBox" name="bcP1ChkB">
<property name="text">
<string>P1</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QCheckBox" name="bcP2ChkB">
<property name="text">
<string>P2</string>
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="QCheckBox" name="bcP3ChkB">
<property name="text">
<string>P3</string>
</property>
</widget>
</item>
<item row="0" column="9">
<widget class="QCheckBox" name="bcREbChkB">
<property name="text">
<string>REb</string>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QCheckBox" name="bcP4ChkB">
<property name="text">
<string>RS</string>
</property>
</widget>
</item>
</layout>
<layout class="QGridLayout" name="centerBeepLayout"/>
</item>
<item row="4" column="3">
<widget class="QCheckBox" name="thrTrimChkB">
@@ -2405,6 +1637,55 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi
</item>
</layout>
</item>
<item row="14" column="1" colspan="9">
<layout class="QGridLayout" name="switchesStartupLayout" rowstretch="0,0" columnstretch="0">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<item row="1" column="0">
<widget class="QComboBox" name="switchesStartupWarning_CB">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>ON</string>
</property>
</item>
<item>
<property name="text">
<string>OFF</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="switchesStartupWarning_Label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Check</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="Failsafe">