From e87936ccb0e2a00ad7f444683dab037973cb03c5 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 8 Sep 2013 18:21:50 +0200 Subject: [PATCH] Added DSM-X support --- src/ui/QGCPX4VehicleConfig.cc | 16 +++++++++++++++- src/ui/QGCPX4VehicleConfig.ui | 29 +++++++++++++++++++++++------ 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/ui/QGCPX4VehicleConfig.cc b/src/ui/QGCPX4VehicleConfig.cc index 04bd330d0..0176aa659 100644 --- a/src/ui/QGCPX4VehicleConfig.cc +++ b/src/ui/QGCPX4VehicleConfig.cc @@ -335,9 +335,23 @@ void QGCPX4VehicleConfig::toggleCalibrationRC(bool enabled) void QGCPX4VehicleConfig::toggleSpektrumPairing(bool enabled) { + if (!ui->dsm2RadioButton->isChecked() && !ui->dsmxRadioButton) { + // Reject + QMessageBox warnMsgBox; + warnMsgBox.setText(tr("Please select a Spektrum Protocol Version")); + warnMsgBox.setInformativeText(tr("Please select either DSM2 or DSM-X\ndirectly below the pair button,\nbased on the receiver type.")); + warnMsgBox.setStandardButtons(QMessageBox::Ok); + warnMsgBox.setDefaultButton(QMessageBox::Ok); + (void)warnMsgBox.exec(); + } + if (enabled) { - mav->getParamManager()->setPendingParam(0, "RC_DSM_BIND", (int)1); + int mode = 1; // DSM2 + if (ui->dsmxRadioButton->isChecked()) + mode = 2; // DSMX + + mav->getParamManager()->setPendingParam(0, "RC_DSM_BIND", mode); // Do not save this parameter, just set in RAM mav->getParamManager()->sendPendingParameters(); } diff --git a/src/ui/QGCPX4VehicleConfig.ui b/src/ui/QGCPX4VehicleConfig.ui index db6fbd9f2..26210d1c8 100644 --- a/src/ui/QGCPX4VehicleConfig.ui +++ b/src/ui/QGCPX4VehicleConfig.ui @@ -205,6 +205,23 @@ + + + + DSM2 Mode + + + true + + + + + + + DSMX Mode + + + @@ -853,8 +870,8 @@ 0 0 - 16 - 16 + 98 + 28 @@ -890,8 +907,8 @@ 0 0 - 16 - 16 + 98 + 28 @@ -941,8 +958,8 @@ 0 0 - 16 - 16 + 98 + 28 -- 2.22.0