diff --git a/companion/src/simulation/simulatordialog-9x.ui b/companion/src/simulation/simulatordialog-9x.ui
index 2a7a730d4..9ec0c01a9 100644
--- a/companion/src/simulation/simulatordialog-9x.ui
+++ b/companion/src/simulation/simulatordialog-9x.ui
@@ -1232,7 +1232,7 @@ QPushButton:checked {
- 0
+ 2
@@ -1440,6 +1440,19 @@ QPushButton:checked {
+
+
+ Outputs2
+
+
+ -
+
+
+ -
+
+
+
+
Gvars
diff --git a/companion/src/simulation/simulatordialog-taranis.ui b/companion/src/simulation/simulatordialog-taranis.ui
index c2caf638f..4ede426e7 100644
--- a/companion/src/simulation/simulatordialog-taranis.ui
+++ b/companion/src/simulation/simulatordialog-taranis.ui
@@ -70,7 +70,7 @@
- 0
+ 2
@@ -240,6 +240,19 @@
+
+
+ Outputs2
+
+
+ -
+
+
+ -
+
+
+
+
Gvars
diff --git a/companion/src/simulation/simulatordialog.cpp b/companion/src/simulation/simulatordialog.cpp
index b3a6580a1..7b6faf948 100644
--- a/companion/src/simulation/simulatordialog.cpp
+++ b/companion/src/simulation/simulatordialog.cpp
@@ -356,14 +356,28 @@ void SimulatorDialog::initUi(T * ui)
setTrims();
- int outputs = std::min(16, GetCurrentFirmware()->getCapability(Outputs));
+ int outputs = std::min(32,GetCurrentFirmware()->getCapability(Outputs));
+ if (outputs <= 16) {
+ int idx = tabWidget->indexOf(ui->outputs2);
+ tabWidget->removeTab(idx);
+ }
+ else {
+ tabWidget->setTabText(tabWidget->indexOf(ui->outputs), tr("Outputs") + QString(" 1-%1").arg(16));
+ tabWidget->setTabText(tabWidget->indexOf(ui->outputs2), tr("Outputs") + QString(" 17-%1").arg(outputs));
+ }
for (int i=0; ichannelsLayout;
+ int column = i / (std::min(16,outputs)/2);
+ int line = i % (std::min(16,outputs)/2);
+ if (i >= 16 ) {
+ dest = ui->channelsLayout2;
+ column = (i-16) / (8);
+ line = (i-16) % (8);
+ }
QLabel * label = new QLabel(tabWidget);
ModelData model;
label->setText(RawSource(SOURCE_TYPE_CH, i).toString(model));
- channelsLayout->addWidget(label, line, column == 0 ? 0 : 5, 1, 1);
+ dest->addWidget(label, line, column == 0 ? 0 : 5, 1, 1);
QSlider * slider = new QSlider(tabWidget);
slider->setEnabled(false);
@@ -389,30 +403,24 @@ void SimulatorDialog::initUi(T * ui)
slider->setInvertedAppearance(false);
slider->setTickPosition(QSlider::TicksBelow);
channelSliders << slider;
- channelsLayout->addWidget(slider, line, column == 0 ? 1 : 4, 1, 1);
+ dest->addWidget(slider, line, column == 0 ? 1 : 4, 1, 1);
QLabel * value = new QLabel(tabWidget);
value->setMinimumSize(QSize(50, 0));
value->setAlignment(Qt::AlignCenter);
channelValues << value;
- channelsLayout->addWidget(value, line, column == 0 ? 2 : 3, 1, 1);
+ dest->addWidget(value, line, column == 0 ? 2 : 3, 1, 1);
}
int switches = GetCurrentFirmware()->getCapability(LogicalSwitches);
for (int i=0; isetAutoFillBackground(true);
- swtch->setFrameShape(QFrame::Panel);
- swtch->setFrameShadow(QFrame::Raised);
- swtch->setLineWidth(2);
- QVBoxLayout * layout = new QVBoxLayout(swtch);
- layout->setContentsMargins(2, 2, 2, 2);
- QLabel * label = new QLabel(swtch);
- label->setText(RawSwitch(SWITCH_TYPE_VIRTUAL, i+1).toString());
- label->setAlignment(Qt::AlignCenter);
- logicalSwitchLabels << label;
- layout->addWidget(label);
- logicalSwitchesLayout->addWidget(swtch, i / (switches/2), i % (switches/2), 1, 1);
+ QFrame * swtch1 = createLogicalSwitch(tabWidget, i, logicalSwitchLabels);
+ logicalSwitchesLayout->addWidget(swtch1, i / (switches/2), i % (switches/2), 1, 1);
+ if (outputs > 16) {
+ // repeat logical switches on second outputs tab
+ QFrame * swtch2 = createLogicalSwitch(tabWidget, i, logicalSwitchLabels2);
+ ui->logicalSwitchesLayout2->addWidget(swtch2, i / (switches/2), i % (switches/2), 1, 1);
+ }
}
int fmodes = GetCurrentFirmware()->getCapability(FlightModes);
@@ -443,6 +451,23 @@ void SimulatorDialog::initUi(T * ui)
}
}
+QFrame * SimulatorDialog::createLogicalSwitch(QWidget * parent, int switchNo, QVector & labels)
+{
+ QFrame * swtch = new QFrame(tabWidget);
+ swtch->setAutoFillBackground(true);
+ swtch->setFrameShape(QFrame::Panel);
+ swtch->setFrameShadow(QFrame::Raised);
+ swtch->setLineWidth(2);
+ QVBoxLayout * layout = new QVBoxLayout(swtch);
+ layout->setContentsMargins(2, 2, 2, 2);
+ QLabel * label = new QLabel(swtch);
+ label->setText(RawSwitch(SWITCH_TYPE_VIRTUAL, switchNo+1).toString());
+ label->setAlignment(Qt::AlignCenter);
+ labels << label;
+ layout->addWidget(label);
+ return swtch;
+}
+
void SimulatorDialog::onButtonPressed(int value)
{
if (value == Qt::Key_Print) {
@@ -814,9 +839,11 @@ void SimulatorDialog::setValues()
Trims trims;
simulator->getTrims(trims);
- for (int i=0; igetCapability(Outputs)); i++) {
- channelSliders[i]->setValue(chVal(outputs.chans[i]));
- channelValues[i]->setText(QString("%1").arg((qreal)outputs.chans[i]*100/1024, 0, 'f', 1));
+ for (int i=0; igetCapability(Outputs); i++) {
+ if (i < channelSliders.size()) {
+ channelSliders[i]->setValue(chVal(outputs.chans[i]));
+ channelValues[i]->setText(QString("%1").arg((qreal)outputs.chans[i]*100/1024, 0, 'f', 1));
+ }
}
leftXPerc->setText(QString("X %1%").arg((qreal)nodeLeft->getX()*100+trims.values[0]/5, 2, 'f', 0));
@@ -830,6 +857,8 @@ void SimulatorDialog::setValues()
for (int i=0; igetCapability(LogicalSwitches); i++) {
logicalSwitchLabels[i]->setStyleSheet(outputs.vsw[i] ? CSWITCH_ON : CSWITCH_OFF);
+ if (!logicalSwitchLabels2.isEmpty())
+ logicalSwitchLabels2[i]->setStyleSheet(outputs.vsw[i] ? CSWITCH_ON : CSWITCH_OFF);
}
for (unsigned int gv=0; gv logicalSwitchLabels;
+ QVector logicalSwitchLabels2;
QVector channelSliders;
QVector channelValues;
QVector gvarValues;
@@ -91,6 +92,7 @@ class SimulatorDialog : public QDialog
int getValue(qint8 i);
bool getSwitch(int swtch, bool nc, qint8 level=0);
void setTrims();
+ QFrame * createLogicalSwitch(QWidget * parent, int switchNo, QVector & labels);
int beepVal;