From 477b69ae37be56a439eeb4a589cefeece70636c7 Mon Sep 17 00:00:00 2001 From: benjinne Date: Tue, 5 Nov 2024 07:45:15 -0500 Subject: [PATCH] add crsf-bind button --- src/AutoPilotPlugins/Common/RadioComponent.qml | 8 ++++++++ src/AutoPilotPlugins/Common/RadioComponentController.cc | 5 +++++ src/AutoPilotPlugins/Common/RadioComponentController.h | 1 + 3 files changed, 14 insertions(+) diff --git a/src/AutoPilotPlugins/Common/RadioComponent.qml b/src/AutoPilotPlugins/Common/RadioComponent.qml index 8f89d2fec9d..fca76f6b127 100644 --- a/src/AutoPilotPlugins/Common/RadioComponent.qml +++ b/src/AutoPilotPlugins/Common/RadioComponent.qml @@ -388,6 +388,14 @@ SetupPage { onClicked: spektrumBindDialogComponent.createObject(mainWindow).open() } + QGCButton { + text: qsTr("CRSF Bind") + onClicked: mainWindow.showMessageDialog(qsTr("CRSF Bind"), + qsTr("Click Ok to place your CRSF receiver in the bind mode."), + Dialog.Ok | Dialog.Cancel, + function() { controller.crsfBindMode() }) + } + QGCButton { text: qsTr("Copy Trims") onClicked: mainWindow.showMessageDialog(qsTr("Copy Trims"), diff --git a/src/AutoPilotPlugins/Common/RadioComponentController.cc b/src/AutoPilotPlugins/Common/RadioComponentController.cc index d03e8f3dc05..8a138165051 100644 --- a/src/AutoPilotPlugins/Common/RadioComponentController.cc +++ b/src/AutoPilotPlugins/Common/RadioComponentController.cc @@ -608,6 +608,11 @@ void RadioComponentController::spektrumBindMode(int mode) _vehicle->pairRX(0, mode); } +void RadioComponentController::crsfBindMode() +{ + _vehicle->pairRX(1, 0); +} + /// @brief Validates the current settings against the calibration rules resetting values as necessary. void RadioComponentController::_validateCalibration(void) { diff --git a/src/AutoPilotPlugins/Common/RadioComponentController.h b/src/AutoPilotPlugins/Common/RadioComponentController.h index 465959a8293..426d483f46c 100644 --- a/src/AutoPilotPlugins/Common/RadioComponentController.h +++ b/src/AutoPilotPlugins/Common/RadioComponentController.h @@ -76,6 +76,7 @@ class RadioComponentController : public FactPanelController Q_ENUM(BindModes) Q_INVOKABLE void spektrumBindMode(int mode); + Q_INVOKABLE void crsfBindMode(void); Q_INVOKABLE void cancelButtonClicked(void); Q_INVOKABLE void skipButtonClicked(void); Q_INVOKABLE void nextButtonClicked(void);