diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index 275350f8ac546aea26d54c4e22403cd1fab3fb19..0d3e7c6fdb4157bdcac5034606437ddb1eee982b 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -2866,6 +2866,17 @@ void UAS::land() sendMessage(msg); } +/** +* Order the robot to land on the runway +*/ +void UAS::pairRX(int rxType, int rxSubType) +{ + mavlink_message_t msg; + + mavlink_msg_command_long_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, uasId, MAV_COMP_ID_ALL, MAV_CMD_START_RX_PAIR, 0, rxType, rxSubType, 0, 0, 0, 0, 0); + sendMessage(msg); +} + /** * The MAV starts the emergency landing procedure. The behaviour depends on the onboard implementation * and might differ between systems. diff --git a/src/uas/UAS.h b/src/uas/UAS.h index 6b5d34f8d69c4e3d59190ac213982055f6509bb4..8a60d343ea7d0de0a6e46552f2ab69265216057b 100644 --- a/src/uas/UAS.h +++ b/src/uas/UAS.h @@ -723,6 +723,9 @@ public slots: void home(); /** @brief Order the robot to land **/ void land(); + /** @brief Order the robot to pair its receiver **/ + void pairRX(int rxType, int rxSubType); + void halt(); void go(); diff --git a/src/uas/UASInterface.h b/src/uas/UASInterface.h index 7a0640eddd9aba61bbadfc07dd87e3d45bb7a519..e97ca675edae6f297cdd68b79d72985580d6b7d8 100644 --- a/src/uas/UASInterface.h +++ b/src/uas/UASInterface.h @@ -290,6 +290,8 @@ public slots: virtual void home() = 0; /** @brief Order the robot to land **/ virtual void land() = 0; + /** @brief Order the robot to pair its receiver **/ + virtual void pairRX(int rxType, int rxSubType) = 0; /** @brief Halt the system */ virtual void halt() = 0; /** @brief Start/continue the current robot action */ diff --git a/src/ui/QGCPX4VehicleConfig.cc b/src/ui/QGCPX4VehicleConfig.cc index c06fdd54ee4b4a05510cf0bee9772f6e3758c834..1a30cdaf7d0f527daac4f1cd6e0d7b3fe055de49 100644 --- a/src/ui/QGCPX4VehicleConfig.cc +++ b/src/ui/QGCPX4VehicleConfig.cc @@ -343,15 +343,12 @@ void QGCPX4VehicleConfig::toggleSpektrumPairing(bool enabled) warnMsgBox.setStandardButtons(QMessageBox::Ok); warnMsgBox.setDefaultButton(QMessageBox::Ok); (void)warnMsgBox.exec(); + return; } - int mode = 1; // DSM2 - if (ui->dsmxRadioButton->isChecked()) - mode = 2; // DSMX - - mav->getParamManager()->setPendingParam(0, "RC_DSM_BIND", mode, true); - // Do not save this parameter, just set in RAM - mav->getParamManager()->sendPendingParameters(false, true); + UASInterface* mav = UASManager::instance()->getActiveUAS(); + if (mav) + mav->pairRX(0, ui->dsmxRadioButton->isChecked() ? 1 : 0); } void QGCPX4VehicleConfig::setTrimPositions()