Browse Source

Merge pull request #1653 from DonLakeFlyer/RadioCal

Add Copy Trims support
QGC4.4
Don Gagne 10 years ago
parent
commit
b871d1eb9c
  1. 80
      src/AutoPilotPlugins/PX4/RadioComponent.qml
  2. 5
      src/AutoPilotPlugins/PX4/RadioComponentController.cc
  3. 1
      src/AutoPilotPlugins/PX4/RadioComponentController.h
  4. 3
      src/uas/UAS.cc
  5. 3
      src/uas/UASInterface.h

80
src/AutoPilotPlugins/PX4/RadioComponent.qml

@ -42,6 +42,7 @@ QGCView {
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled } QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
readonly property string dialogTitle: "Radio Config"
readonly property real labelToMonitorMargin: defaultTextWidth * 3 readonly property real labelToMonitorMargin: defaultTextWidth * 3
property bool controllerCompleted: false property bool controllerCompleted: false
property bool controllerAndViewReady: false property bool controllerAndViewReady: false
@ -49,11 +50,15 @@ QGCView {
function updateChannelCount() function updateChannelCount()
{ {
if (controllerAndViewReady) { 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) { if (controller.channelCount < controller.minChannelCount) {
showDialog(channelCountDialogComponent, "Radio Config", 50, 0) showDialog(channelCountDialogComponent, dialogTitle, 50, 0)
} else { } else {
hideDialog() hideDialog()
} }
*/
} }
} }
@ -90,6 +95,32 @@ QGCView {
anchors.fill: parent anchors.fill: parent
Component { 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 id: channelCountDialogComponent
QGCViewMessage { QGCViewMessage {
@ -245,22 +276,6 @@ QGCView {
anchors.right: columnSpacer.left anchors.right: columnSpacer.left
spacing: 10 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 // Attitude Controls
Column { Column {
width: parent.width width: parent.width
@ -412,7 +427,7 @@ QGCView {
primary: true primary: true
text: "Calibrate" text: "Calibrate"
onClicked: controller.nextButtonClicked() onClicked: showDialog(zeroTrimsDialogComponent, dialogTitle, 50, StandardButton.Ok | StandardButton.Cancel)
} }
} // Row - Buttons } // Row - Buttons
@ -422,6 +437,35 @@ QGCView {
width: parent.width width: parent.width
wrapMode: Text.WordWrap 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 } // Column - Left Column
Item { Item {

5
src/AutoPilotPlugins/PX4/RadioComponentController.cc

@ -1050,3 +1050,8 @@ void RadioComponentController::_signalAllAttiudeValueChanges(void)
emit yawChannelReversedChanged(yawChannelReversed()); emit yawChannelReversedChanged(yawChannelReversed());
emit throttleChannelReversedChanged(throttleChannelReversed()); emit throttleChannelReversedChanged(throttleChannelReversed());
} }
void RadioComponentController::copyTrims(void)
{
_uas->startCalibration(UASInterface::StartCalibrationRadio);
}

1
src/AutoPilotPlugins/PX4/RadioComponentController.h

@ -93,6 +93,7 @@ public:
Q_INVOKABLE void skipButtonClicked(void); Q_INVOKABLE void skipButtonClicked(void);
Q_INVOKABLE void nextButtonClicked(void); Q_INVOKABLE void nextButtonClicked(void);
Q_INVOKABLE void start(void); Q_INVOKABLE void start(void);
Q_INVOKABLE void copyTrims(void);
int rollChannelRCValue(void); int rollChannelRCValue(void);
int pitchChannelRCValue(void); int pitchChannelRCValue(void);

3
src/uas/UAS.cc

@ -1473,6 +1473,9 @@ void UAS::startCalibration(UASInterface::StartCalibrationType calType)
case StartCalibrationRadio: case StartCalibrationRadio:
radioCal = 1; radioCal = 1;
break; break;
case StartCalibrationCopyTrims:
radioCal = 2;
break;
case StartCalibrationAccel: case StartCalibrationAccel:
accelCal = 1; accelCal = 1;
break; break;

3
src/uas/UASInterface.h

@ -245,7 +245,8 @@ public:
StartCalibrationAirspeed, StartCalibrationAirspeed,
StartCalibrationAccel, StartCalibrationAccel,
StartCalibrationLevel, StartCalibrationLevel,
StartCalibrationEsc StartCalibrationEsc,
StartCalibrationCopyTrims
}; };
/// Starts the specified calibration /// Starts the specified calibration

Loading…
Cancel
Save