diff --git a/src/AutoPilotPlugins/PX4/SensorsComponent.qml b/src/AutoPilotPlugins/PX4/SensorsComponent.qml index 35d893d47d4421a715057fe876bcc609e85a5c22..cea99e5a0553fba8ec8353409107346dc702b790 100644 --- a/src/AutoPilotPlugins/PX4/SensorsComponent.qml +++ b/src/AutoPilotPlugins/PX4/SensorsComponent.qml @@ -37,9 +37,9 @@ SetupPage { readonly property string boardRotationText: qsTr("If the orientation is in the direction of flight, select ROTATION_NONE.") readonly property string compassRotationText: qsTr("If the orientation is in the direction of flight, select ROTATION_NONE.") - readonly property string compassHelp: qsTr("For Compass calibration you will need to rotate your vehicle through a number of positions.") - readonly property string gyroHelp: qsTr("For Gyroscope calibration you will need to place your vehicle on a surface and leave it still.") - readonly property string accelHelp: qsTr("For Accelerometer calibration you will need to place your vehicle on all six sides on a perfectly level surface and hold it still in each orientation for a few seconds.") + readonly property string compassHelp: qsTr("For Compass calibration you will need to rotate your vehicle through a number of positions. Click Ok to start calibration.") + readonly property string gyroHelp: qsTr("For Gyroscope calibration you will need to place your vehicle on a surface and leave it still. Click Ok to start calibration.") + readonly property string accelHelp: qsTr("For Accelerometer calibration you will need to place your vehicle on all six sides on a perfectly level surface and hold it still in each orientation for a few seconds. Click Ok to start calibration.") readonly property string levelHelp: qsTr("To level the horizon you need to place the vehicle in its level flight position and press OK.") readonly property string airspeedHelp: qsTr("For Airspeed calibration you will need to keep your airspeed sensor out of any wind and then blow across the sensor.") @@ -106,6 +106,9 @@ SetupPage { property bool showCompass1Rot: cal_mag1_id.value > 0 && cal_mag1_rot.value >= 0 property bool showCompass2Rot: cal_mag2_id.value > 0 && cal_mag2_rot.value >= 0 + property bool _sensorsHaveFixedOrientation: QGroundControl.corePlugin.options.sensorsHaveFixedOrientation + property bool _wifiReliableForCalibration: QGroundControl.corePlugin.options.wifiReliableForCalibration + SensorsComponentController { id: controller factPanel: sensorsPage.viewPanel @@ -123,7 +126,7 @@ SetupPage { onResetStatusTextArea: statusLog.text = statusTextAreaDefaultText onSetCompassRotations: { - if (showCompass0Rot || showCompass1Rot || showCompass2Rot) { + if (!_sensorsHaveFixedOrientation && (showCompass0Rot || showCompass1Rot || showCompass2Rot)) { setOrientationsDialogShowBoardOrientation = false showDialog(setOrientationsDialogComponent, qsTr("Set Compass Rotation(s)"), sensorsPage.showDialogDefaultWidth, StandardButton.Ok) } @@ -141,8 +144,7 @@ SetupPage { Component.onCompleted: { var usingUDP = controller.usingUDPLink() - if (usingUDP) { - console.log("onUsingUDPLink") + if (usingUDP && !_wifiReliableForCalibration) { showMessage("Sensor Calibration", "Performing sensor calibration over a WiFi connection is known to be unreliable. You should disconnect and perform calibration using a direct USB connection instead.", StandardButton.Ok) } } @@ -178,25 +180,31 @@ SetupPage { text: preCalibrationDialogHelp } - QGCLabel { - id: boardRotationHelp - width: parent.width - wrapMode: Text.WordWrap - visible: (preCalibrationDialogType != "airspeed") && (preCalibrationDialogType != "gyro") - text: boardRotationText - } - Column { - visible: boardRotationHelp.visible + anchors.fill: parent + spacing: 5 + visible: !_sensorsHaveFixedOrientation + QGCLabel { - text: qsTr("Autopilot Orientation:") + id: boardRotationHelp + width: parent.width + wrapMode: Text.WordWrap + visible: (preCalibrationDialogType != "airspeed") && (preCalibrationDialogType != "gyro") + text: boardRotationText } - FactComboBox { - id: boardRotationCombo - width: rotationColumnWidth; - model: rotations - fact: sens_board_rot + Column { + visible: boardRotationHelp.visible + QGCLabel { + text: qsTr("Autopilot Orientation:") + } + + FactComboBox { + id: boardRotationCombo + width: rotationColumnWidth; + model: rotations + fact: sens_board_rot + } } } } @@ -414,7 +422,7 @@ SetupPage { id: setOrientationsButton width: parent.buttonWidth text: qsTr("Set Orientations") - visible: QGroundControl.corePlugin.options.showSensorCalibrationOrient + visible: !_sensorsHaveFixedOrientation onClicked: { setOrientationsDialogShowBoardOrientation = true diff --git a/src/api/QGCOptions.h b/src/api/QGCOptions.h index 403da42f3a1efe226713cea58903e64eed109173..0a16ecfe466f04ce98d64e332377751041fbea0f 100644 --- a/src/api/QGCOptions.h +++ b/src/api/QGCOptions.h @@ -33,7 +33,8 @@ public: Q_PROPERTY(bool showSensorCalibrationAccel READ showSensorCalibrationAccel NOTIFY showSensorCalibrationAccelChanged) Q_PROPERTY(bool showSensorCalibrationLevel READ showSensorCalibrationLevel NOTIFY showSensorCalibrationLevelChanged) Q_PROPERTY(bool showSensorCalibrationAirspeed READ showSensorCalibrationAirspeed NOTIFY showSensorCalibrationAirspeedChanged) - Q_PROPERTY(bool showSensorCalibrationOrient READ showSensorCalibrationOrient NOTIFY showSensorCalibrationOrientChanged) + Q_PROPERTY(bool sensorsHaveFixedOrientation READ sensorsHaveFixedOrientation CONSTANT) + Q_PROPERTY(bool wifiReliableForCalibration READ wifiReliableForCalibration CONSTANT) Q_PROPERTY(bool showFirmwareUpgrade READ showFirmwareUpgrade NOTIFY showFirmwareUpgradeChanged) Q_PROPERTY(QString firmwareUpgradeSingleURL READ firmwareUpgradeSingleURL CONSTANT) Q_PROPERTY(bool guidedBarShowEmergencyStop READ guidedBarShowEmergencyStop NOTIFY guidedBarShowEmergencyStopChanged) @@ -61,7 +62,8 @@ public: virtual bool showSensorCalibrationAccel () const { return true; } virtual bool showSensorCalibrationLevel () const { return true; } virtual bool showSensorCalibrationAirspeed () const { return true; } - virtual bool showSensorCalibrationOrient () const { return true; } + virtual bool wifiReliableForCalibration () const { return false; } + virtual bool sensorsHaveFixedOrientation () const { return false; } virtual bool showFirmwareUpgrade () const { return true; } @@ -79,7 +81,6 @@ signals: void showSensorCalibrationAccelChanged (bool show); void showSensorCalibrationLevelChanged (bool show); void showSensorCalibrationAirspeedChanged (bool show); - void showSensorCalibrationOrientChanged (bool show); void showFirmwareUpgradeChanged (bool show); void guidedBarShowEmergencyStopChanged (bool show); void guidedBarShowOrbitChanged (bool show);