diff --git a/src/AutoPilotPlugins/PX4/RadioComponent.qml b/src/AutoPilotPlugins/PX4/RadioComponent.qml index 273d3fd8dadaf5176d7a6551dc71bba601c49179..17a5acd2b88904019df13edb2782050f9de77a7e 100644 --- a/src/AutoPilotPlugins/PX4/RadioComponent.qml +++ b/src/AutoPilotPlugins/PX4/RadioComponent.qml @@ -42,6 +42,7 @@ QGCView { QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled } + readonly property string dialogTitle: "Radio Config" readonly property real labelToMonitorMargin: defaultTextWidth * 3 property bool controllerCompleted: false property bool controllerAndViewReady: false @@ -49,11 +50,15 @@ QGCView { function updateChannelCount() { if (controllerAndViewReady) { +/* + FIXME: Turned off for now, since it prevents binding. Need to restructure to + allow binding and still check channel count if (controller.channelCount < controller.minChannelCount) { - showDialog(channelCountDialogComponent, "Radio Config", 50, 0) + showDialog(channelCountDialogComponent, dialogTitle, 50, 0) } else { hideDialog() } +*/ } } @@ -89,6 +94,32 @@ QGCView { id: panel anchors.fill: parent + Component { + id: copyTrimsDialogComponent + + QGCViewMessage { + message: "Center your sticks and move throttle all the way down, then press Ok to copy trims. After pressing Ok, reset the trims on your radio back to zero." + + function accept() { + hideDialog() + controller.copyTrims() + } + } + } + + Component { + id: zeroTrimsDialogComponent + + QGCViewMessage { + message: "Before calibrating you should zero all your trims and subtrims. Click Ok to start Calibration." + + function accept() { + hideDialog() + controller.nextButtonClicked() + } + } + } + Component { id: channelCountDialogComponent @@ -245,22 +276,6 @@ QGCView { anchors.right: columnSpacer.left spacing: 10 - Row { - spacing: 10 - - QGCLabel { - anchors.baseline: bindButton.baseline - text: "Place Spektrum satellite receiver in bind mode:" - } - - QGCButton { - id: bindButton - text: "Spektrum Bind" - - onClicked: showDialog(spektrumBindDialogComponent, "Radio Config", 50, StandardButton.Ok | StandardButton.Cancel) - } - } - // Attitude Controls Column { width: parent.width @@ -412,7 +427,7 @@ QGCView { primary: true text: "Calibrate" - onClicked: controller.nextButtonClicked() + onClicked: showDialog(zeroTrimsDialogComponent, dialogTitle, 50, StandardButton.Ok | StandardButton.Cancel) } } // Row - Buttons @@ -422,6 +437,35 @@ QGCView { width: parent.width wrapMode: Text.WordWrap } + + Item { + width: 10 + height: defaultTextHeight * 2 + } + + QGCLabel { text: "Additional Radio setup:" } + + Row { + spacing: 10 + + QGCLabel { + anchors.baseline: bindButton.baseline + text: "Place Spektrum satellite receiver in bind mode:" + } + + QGCButton { + id: bindButton + text: "Spektrum Bind" + + onClicked: showDialog(spektrumBindDialogComponent, dialogTitle, 50, StandardButton.Ok | StandardButton.Cancel) + } + } + + QGCButton { + text: "Copy Trims" + onClicked: showDialog(copyTrimsDialogComponent, dialogTitle, 50, StandardButton.Ok | StandardButton.Cancel) + } + } // Column - Left Column Item { diff --git a/src/AutoPilotPlugins/PX4/RadioComponentController.cc b/src/AutoPilotPlugins/PX4/RadioComponentController.cc index e642f84cc25796478fe3f49faeeb5a4d152def9d..2b8d2342b1ee7352ace382e9ee98f6d2beee14fc 100644 --- a/src/AutoPilotPlugins/PX4/RadioComponentController.cc +++ b/src/AutoPilotPlugins/PX4/RadioComponentController.cc @@ -1050,3 +1050,8 @@ void RadioComponentController::_signalAllAttiudeValueChanges(void) emit yawChannelReversedChanged(yawChannelReversed()); emit throttleChannelReversedChanged(throttleChannelReversed()); } + +void RadioComponentController::copyTrims(void) +{ + _uas->startCalibration(UASInterface::StartCalibrationRadio); +} diff --git a/src/AutoPilotPlugins/PX4/RadioComponentController.h b/src/AutoPilotPlugins/PX4/RadioComponentController.h index 6325da86b85b730684e309080dc9a8fe288239ae..6c48a96fe9ee4feac407e595c566a045b715c3ca 100644 --- a/src/AutoPilotPlugins/PX4/RadioComponentController.h +++ b/src/AutoPilotPlugins/PX4/RadioComponentController.h @@ -93,6 +93,7 @@ public: Q_INVOKABLE void skipButtonClicked(void); Q_INVOKABLE void nextButtonClicked(void); Q_INVOKABLE void start(void); + Q_INVOKABLE void copyTrims(void); int rollChannelRCValue(void); int pitchChannelRCValue(void); diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index 6cb37da585e215e3a8b7fa6c611f0fcd951da50a..957bc5004b36f562c6c45fbc46f544f5350bedbe 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -1473,6 +1473,9 @@ void UAS::startCalibration(UASInterface::StartCalibrationType calType) case StartCalibrationRadio: radioCal = 1; break; + case StartCalibrationCopyTrims: + radioCal = 2; + break; case StartCalibrationAccel: accelCal = 1; break; diff --git a/src/uas/UASInterface.h b/src/uas/UASInterface.h index ce6e9291f60f3b31f0ced00c8b2fc74d82a2a140..f535abba8225054b7c45a55fb954833bb751ae13 100644 --- a/src/uas/UASInterface.h +++ b/src/uas/UASInterface.h @@ -245,7 +245,8 @@ public: StartCalibrationAirspeed, StartCalibrationAccel, StartCalibrationLevel, - StartCalibrationEsc + StartCalibrationEsc, + StartCalibrationCopyTrims }; /// Starts the specified calibration