From b527bec9b136fbea054c6cfb8d16c42b42899926 Mon Sep 17 00:00:00 2001 From: DonLakeFlyer Date: Mon, 25 Jun 2018 17:23:12 -0700 Subject: [PATCH 1/3] Add reboot button to calibration complete dialogs --- src/AutoPilotPlugins/APM/APMSensorsComponent.qml | 40 +++++++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/src/AutoPilotPlugins/APM/APMSensorsComponent.qml b/src/AutoPilotPlugins/APM/APMSensorsComponent.qml index 907188f..645fa09 100644 --- a/src/AutoPilotPlugins/APM/APMSensorsComponent.qml +++ b/src/AutoPilotPlugins/APM/APMSensorsComponent.qml @@ -37,8 +37,8 @@ SetupPage { // Help text which is shown both in the status text area prior to pressing a cal button and in the // pre-calibration dialog. - readonly property string orientationHelpSet: qsTr("If the orientation is in the direction of flight, select None.") - readonly property string orientationHelpCal: qsTr("Before calibrating make sure orientation settings are correct. ") + orientationHelpSet + readonly property string orientationHelpSet: qsTr("If mounted in the direction of flight, select None.") + readonly property string orientationHelpCal: qsTr("Before calibrating make sure rotation settings are correct. ") + orientationHelpSet readonly property string compassRotationText: qsTr("If the compass or GPS module is mounted in flight direction, leave the default value (None)") readonly property string compassHelp: qsTr("For Compass calibration you will need to rotate your vehicle through a number of positions.") @@ -137,10 +137,10 @@ SetupPage { onCalibrationComplete: { switch (calType) { case APMSensorsComponentController.CalTypeAccel: - showMessage(qsTr("Calibration complete"), qsTr("Accelerometer calibration complete."), StandardButton.Ok) + showDialog(postCalibrationComponent, qsTr("Accelerometer calibration complete"), qgcView.showDialogDefaultWidth, StandardButton.Ok) break case APMSensorsComponentController.CalTypeOffboardCompass: - showMessage(qsTr("Calibration complete"), qsTr("Compass calibration complete."), StandardButton.Ok) + showDialog(postCalibrationComponent, qsTr("Compass calibration complete"), qgcView.showDialogDefaultWidth, StandardButton.Ok) break case APMSensorsComponentController.CalTypeOnboardCompass: showDialog(postOnboardCompassCalibrationComponent, qsTr("Calibration complete"), qgcView.showDialogDefaultWidth, StandardButton.Ok) @@ -262,6 +262,36 @@ SetupPage { qsTr("- Red indicates a compass which should not be used.\n\n") + qsTr("YOU MUST REBOOT YOUR VEHICLE AFTER EACH CALIBRATION.") } + + QGCButton { + text: qsTr("Reboot Vehicle") + onClicked: controller.vehicle.reboot() + } + } + } + } + + Component { + id: postCalibrationComponent + + QGCViewDialog { + Column { + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.left: parent.left + anchors.right: parent.right + spacing: ScreenTools.defaultFontPixelHeight + + QGCLabel { + anchors.left: parent.left + anchors.right: parent.right + wrapMode: Text.WordWrap + text: qsTr("YOU MUST REBOOT YOUR VEHICLE AFTER EACH CALIBRATION.") + } + + QGCButton { + text: qsTr("Reboot Vehicle") + onClicked: controller.vehicle.rebootVehicle() + } } } } @@ -343,7 +373,7 @@ SetupPage { } Column { - QGCLabel { text: qsTr("Autopilot Orientation:") } + QGCLabel { text: qsTr("Autopilot Rotation:") } FactComboBox { width: rotationColumnWidth From 09b911c4494f021e386b8427610d9de01a35bda1 Mon Sep 17 00:00:00 2001 From: DonLakeFlyer Date: Mon, 25 Jun 2018 17:23:31 -0700 Subject: [PATCH 2/3] Autodisconnect link when user requests reboot --- src/Vehicle/Vehicle.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index cdd1d13..97ee1b2 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -3121,6 +3121,7 @@ QString Vehicle::firmwareVersionTypeString(void) const void Vehicle::rebootVehicle() { + _autoDisconnect = true; sendMavCommand(_defaultComponentId, MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN, true, 1.0f); } From bc829486ea4e638174547939f1264a9416969392 Mon Sep 17 00:00:00 2001 From: DonLakeFlyer Date: Mon, 25 Jun 2018 17:23:42 -0700 Subject: [PATCH 3/3] Fix vehicle shutdown crash --- src/comm/LinkInterface.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/comm/LinkInterface.cc b/src/comm/LinkInterface.cc index d2c1923..d23201c 100644 --- a/src/comm/LinkInterface.cc +++ b/src/comm/LinkInterface.cc @@ -204,7 +204,7 @@ void LinkInterface::stopHeartbeatTimer() { while (iter.hasNext()) { iter.next(); QObject::disconnect(iter.value(), &HeartbeatTimer::activeChanged, this, &LinkInterface::_activeChanged); - delete _heartbeatTimers[iter.key()]; + _heartbeatTimers[iter.key()]->deleteLater(); _heartbeatTimers[iter.key()] = nullptr; }