diff --git a/src/AutoPilotPlugins/APM/APMCompassCal.cc b/src/AutoPilotPlugins/APM/APMCompassCal.cc index a430cd427b7f09aace1001a5024412fc72160df3..f2a61daebb57336d281ae127ee888cba5f587769 100644 --- a/src/AutoPilotPlugins/APM/APMCompassCal.cc +++ b/src/AutoPilotPlugins/APM/APMCompassCal.cc @@ -579,7 +579,11 @@ APMCompassCal::APMCompassCal(void) APMCompassCal::~APMCompassCal() { - + if (_calWorkerThread) { + _calWorkerThread->terminate(); + // deleteLater so it happens on correct thread + _calWorkerThread->deleteLater(); + } } void APMCompassCal::setVehicle(Vehicle* vehicle) @@ -601,7 +605,7 @@ void APMCompassCal::startCalibration(void) // Simulate a start message _emitVehicleTextMessage("[cal] calibration started: mag"); - _calWorkerThread = new CalWorkerThread(_vehicle, this); + _calWorkerThread = new CalWorkerThread(_vehicle); connect(_calWorkerThread, &CalWorkerThread::vehicleTextMessage, this, &APMCompassCal::vehicleTextMessage); // Clear the offset parameters so we get raw data diff --git a/src/AutoPilotPlugins/APM/APMSensorsComponent.qml b/src/AutoPilotPlugins/APM/APMSensorsComponent.qml index 54ad7b33a5d70a774b78574b874d24fff96378c3..a4d83794a2f2ec70639347d9a27aadc3bec79348 100644 --- a/src/AutoPilotPlugins/APM/APMSensorsComponent.qml +++ b/src/AutoPilotPlugins/APM/APMSensorsComponent.qml @@ -169,6 +169,14 @@ QGCView { } } + Component.onCompleted: { + var usingUDP = controller.usingUDPLink() + if (usingUDP) { + console.log("onUsingUDPLink") + 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) + } + } + QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled } Component { @@ -450,12 +458,17 @@ QGCView { Flow { anchors.topMargin: ScreenTools.defaultFontPixelWidth anchors.top: orientationCalAreaHelpText.bottom - anchors.left: orientationCalAreaHelpText.left - width: parent.width - height: parent.height - orientationCalAreaHelpText.implicitHeight + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right spacing: ScreenTools.defaultFontPixelWidth + property real indicatorWidth: (width / 3) - (spacing * 2) + property real indicatorHeight: (height / 2) - spacing + VehicleRotationCal { + width: parent.indicatorWidth + height: parent.indicatorHeight visible: controller.orientationCalDownSideVisible calValid: controller.orientationCalDownSideDone calInProgress: controller.orientationCalDownSideInProgress @@ -463,6 +476,8 @@ QGCView { imageSource: controller.orientationCalDownSideRotate ? "qrc:///qmlimages/VehicleDownRotate.png" : "qrc:///qmlimages/VehicleDown.png" } VehicleRotationCal { + width: parent.indicatorWidth + height: parent.indicatorHeight visible: controller.orientationCalUpsideDownSideVisible calValid: controller.orientationCalUpsideDownSideDone calInProgress: controller.orientationCalUpsideDownSideInProgress @@ -470,6 +485,8 @@ QGCView { imageSource: controller.orientationCalUpsideDownSideRotate ? "qrc:///qmlimages/VehicleUpsideDownRotate.png" : "qrc:///qmlimages/VehicleUpsideDown.png" } VehicleRotationCal { + width: parent.indicatorWidth + height: parent.indicatorHeight visible: controller.orientationCalNoseDownSideVisible calValid: controller.orientationCalNoseDownSideDone calInProgress: controller.orientationCalNoseDownSideInProgress @@ -477,6 +494,8 @@ QGCView { imageSource: controller.orientationCalNoseDownSideRotate ? "qrc:///qmlimages/VehicleNoseDownRotate.png" : "qrc:///qmlimages/VehicleNoseDown.png" } VehicleRotationCal { + width: parent.indicatorWidth + height: parent.indicatorHeight visible: controller.orientationCalTailDownSideVisible calValid: controller.orientationCalTailDownSideDone calInProgress: controller.orientationCalTailDownSideInProgress @@ -484,6 +503,8 @@ QGCView { imageSource: controller.orientationCalTailDownSideRotate ? "qrc:///qmlimages/VehicleTailDownRotate.png" : "qrc:///qmlimages/VehicleTailDown.png" } VehicleRotationCal { + width: parent.indicatorWidth + height: parent.indicatorHeight visible: controller.orientationCalLeftSideVisible calValid: controller.orientationCalLeftSideDone calInProgress: controller.orientationCalLeftSideInProgress @@ -491,6 +512,8 @@ QGCView { imageSource: controller.orientationCalLeftSideRotate ? "qrc:///qmlimages/VehicleLeftRotate.png" : "qrc:///qmlimages/VehicleLeft.png" } VehicleRotationCal { + width: parent.indicatorWidth + height: parent.indicatorHeight visible: controller.orientationCalRightSideVisible calValid: controller.orientationCalRightSideDone calInProgress: controller.orientationCalRightSideInProgress diff --git a/src/AutoPilotPlugins/APM/APMSensorsComponentController.cc b/src/AutoPilotPlugins/APM/APMSensorsComponentController.cc index ada5d0571bc51faf382b9ab3737111b8dad78bec..1dbcd76251b2c5898571a65d2e26ee58ef3d5e39 100644 --- a/src/AutoPilotPlugins/APM/APMSensorsComponentController.cc +++ b/src/AutoPilotPlugins/APM/APMSensorsComponentController.cc @@ -464,3 +464,8 @@ bool APMSensorsComponentController::accelSetupNeeded(void) const { return _sensorsComponent->accelSetupNeeded(); } + +bool APMSensorsComponentController::usingUDPLink(void) +{ + return _vehicle->priorityLink()->getLinkConfiguration()->type() == LinkConfiguration::TypeUdp; +} diff --git a/src/AutoPilotPlugins/APM/APMSensorsComponentController.h b/src/AutoPilotPlugins/APM/APMSensorsComponentController.h index ade7a95d2b93a6652f3b354ce553bb782b46e4fa..6ba4dd2c2ca8a57499bdca777b2bc09e109d8d14 100644 --- a/src/AutoPilotPlugins/APM/APMSensorsComponentController.h +++ b/src/AutoPilotPlugins/APM/APMSensorsComponentController.h @@ -77,6 +77,7 @@ public: Q_INVOKABLE void calibrateAccel(void); Q_INVOKABLE void cancelCalibration(void); Q_INVOKABLE void nextClicked(void); + Q_INVOKABLE bool usingUDPLink(void); bool compassSetupNeeded(void) const; bool accelSetupNeeded(void) const; diff --git a/src/AutoPilotPlugins/PX4/PX4SimpleFlightModesController.cc b/src/AutoPilotPlugins/PX4/PX4SimpleFlightModesController.cc index 5ed00d31b73bd15346d7f27e289325b3b31c0193..8f0bebfd525663d0142678f6ed007b87593c8ba9 100644 --- a/src/AutoPilotPlugins/PX4/PX4SimpleFlightModesController.cc +++ b/src/AutoPilotPlugins/PX4/PX4SimpleFlightModesController.cc @@ -51,6 +51,12 @@ void PX4SimpleFlightModesController::_rcChannelsChanged(int channelCount, int pw } int flightModeChannel = pFact->rawValue().toInt() - 1; + if (flightModeChannel == -1) { + // Flight mode channel not set, can't track active flight mode + _activeFlightMode = 0; + emit activeFlightModeChanged(_activeFlightMode); + return; + } pFact = getParameterFact(-1, QString("RC%1_REV").arg(flightModeChannel + 1)); if(!pFact) { diff --git a/src/AutoPilotPlugins/PX4/SensorsComponent.qml b/src/AutoPilotPlugins/PX4/SensorsComponent.qml index 6290c6bcaf8461fa5873f3cc1c7f0e58dd51f1dc..5395afb86f0dc6911545848f21c92248120933d2 100644 --- a/src/AutoPilotPlugins/PX4/SensorsComponent.qml +++ b/src/AutoPilotPlugins/PX4/SensorsComponent.qml @@ -30,7 +30,7 @@ QGCView { 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. Most users prefer to do this wirelessly with the telemetry link.") + 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 levelHelp: qsTr("To level the horizon you need to place the vehicle in its level flight position and press OK.") @@ -160,8 +160,8 @@ QGCView { } Column { - anchors.fill: parent - spacing: 5 + anchors.fill: parent + spacing: 5 QGCLabel { width: parent.width @@ -170,17 +170,25 @@ QGCView { } QGCLabel { + id: boardRotationHelp width: parent.width wrapMode: Text.WordWrap visible: (preCalibrationDialogType != "airspeed") && (preCalibrationDialogType != "gyro") text: boardRotationText } - FactComboBox { - width: rotationColumnWidth - model: rotations - visible: preCalibrationDialogType != "airspeed" && (preCalibrationDialogType != "gyro") - fact: sens_board_rot + Column { + visible: boardRotationHelp.visible + QGCLabel { + text: qsTr("Autopilot Orientation:") + } + + FactComboBox { + id: boardRotationCombo + width: rotationColumnWidth; + model: rotations + fact: sens_board_rot + } } } } @@ -454,8 +462,6 @@ QGCView { anchors.bottom: parent.bottom anchors.left: parent.left anchors.right: parent.right - width: parent.width - height: parent.height - orientationCalAreaHelpText.implicitHeight spacing: ScreenTools.defaultFontPixelWidth / 2 property real indicatorWidth: (width / 3) - (spacing * 2) diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index e7dcfc7e6387ffbbf69c6e2618446e1e02333e1e..f03e74cd492b36c888d4db41cc789d2ba8e7762a 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -223,7 +223,7 @@ QGCView { //-- Virtual Joystick Loader { - id: multiTouchItem + id: virtualJoystickMultiTouch z: _panel.z + 5 width: parent.width - (_flightVideoPipControl.width / 2) height: Math.min(ScreenTools.availableHeight * 0.25, ScreenTools.defaultFontPixelWidth * 16) diff --git a/src/FlightDisplay/FlightDisplayViewWidgets.qml b/src/FlightDisplay/FlightDisplayViewWidgets.qml index 4644dcc438fae5049a58dfbb463e75433445dd13..53edcd23c7c72f99cb00d0893f5c6ada0e2e252c 100644 --- a/src/FlightDisplay/FlightDisplayViewWidgets.qml +++ b/src/FlightDisplay/FlightDisplayViewWidgets.qml @@ -27,9 +27,11 @@ Item { property alias guidedModeBar: _guidedModeBar - property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle - property bool _isSatellite: _mainIsMap ? (_flightMap ? _flightMap.isSatelliteMap : true) : true - property bool _lightWidgetBorders: _mainIsMap ? (_flightMap ? _flightMap.isSatelliteMap : true) : true + property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle + property bool _isSatellite: _mainIsMap ? (_flightMap ? _flightMap.isSatelliteMap : true) : true + property bool _lightWidgetBorders: _mainIsMap ? (_flightMap ? _flightMap.isSatelliteMap : true) : true + property bool _useAlternateInstruments: QGroundControl.virtualTabletJoystick || ScreenTools.isTinyScreen + readonly property real _margins: ScreenTools.defaultFontPixelHeight / 2 @@ -69,7 +71,7 @@ Item { QGCLabel { anchors.horizontalCenter: parent.horizontalCenter - visible: _activeVehicle && !_activeVehicle.coordinateValid + visible: _activeVehicle && _activeVehicle.prearmError z: QGroundControl.zOrderTopMost color: mapPal.text font.pointSize: ScreenTools.largeFontPointSize @@ -94,7 +96,7 @@ Item { anchors.margins: ScreenTools.defaultFontPixelHeight / 2 anchors.right: altitudeSlider.visible ? altitudeSlider.left : parent.right anchors.verticalCenter: parent.verticalCenter - visible: !QGroundControl.virtualTabletJoystick + visible: !_useAlternateInstruments size: getGadgetWidth() active: _activeVehicle != null heading: _heading @@ -113,8 +115,8 @@ Item { anchors.margins: ScreenTools.defaultFontPixelHeight / 2 anchors.top: parent.top anchors.right: altitudeSlider.visible ? altitudeSlider.left : parent.right - visible: QGroundControl.virtualTabletJoystick - width: ScreenTools.isTinyScreen ? getGadgetWidth() * 2 : getGadgetWidth() + visible: _useAlternateInstruments + width: ScreenTools.isTinyScreen ? getGadgetWidth() * 1.5 : getGadgetWidth() active: _activeVehicle != null heading: _heading rollAngle: _roll @@ -126,14 +128,14 @@ Item { } ValuesWidget { - anchors.topMargin: ScreenTools.defaultFontPixelHeight - anchors.top: instrumentGadgetAlternate.bottom - anchors.left: instrumentGadgetAlternate.left - width: getGadgetWidth() - qgcView: parent.parent.qgcView - textColor: _isSatellite ? "white" : "black" - visible: QGroundControl.virtualTabletJoystick - maxHeight: multiTouchItem.y - y + anchors.topMargin: ScreenTools.defaultFontPixelHeight + anchors.top: instrumentGadgetAlternate.bottom + anchors.horizontalCenter: instrumentGadgetAlternate.horizontalCenter + width: getGadgetWidth() + qgcView: parent.parent.qgcView + textColor: _isSatellite ? "white" : "black" + visible: _useAlternateInstruments + maxHeight: virtualJoystickMultiTouch.visible ? virtualJoystickMultiTouch.y - y : parent.height - anchors.margins - y } //-- Vertical Tool Buttons @@ -443,27 +445,31 @@ Item { } Row { - spacing: _margins + spacing: _margins * 2 QGCButton { + pointSize: ScreenTools.largeFontPointSize text: (_activeVehicle && _activeVehicle.armed) ? (_activeVehicle.flying ? qsTr("Emergency Stop") : qsTr("Disarm")) : qsTr("Arm") visible: _activeVehicle onClicked: _guidedModeBar.confirmAction(_activeVehicle.armed ? (_activeVehicle.flying ? _guidedModeBar.confirmEmergencyStop : _guidedModeBar.confirmDisarm) : _guidedModeBar.confirmArm) } QGCButton { + pointSize: ScreenTools.largeFontPointSize text: qsTr("RTL") visible: (_activeVehicle && _activeVehicle.armed) && _activeVehicle.guidedModeSupported && _activeVehicle.flying onClicked: _guidedModeBar.confirmAction(_guidedModeBar.confirmHome) } QGCButton { + pointSize: ScreenTools.largeFontPointSize text: (_activeVehicle && _activeVehicle.flying) ? qsTr("Land"): qsTr("Takeoff") visible: _activeVehicle && _activeVehicle.guidedModeSupported && _activeVehicle.armed onClicked: _guidedModeBar.confirmAction(_activeVehicle.flying ? _guidedModeBar.confirmLand : _guidedModeBar.confirmTakeoff) } QGCButton { + pointSize: ScreenTools.largeFontPointSize text: qsTr("Pause") visible: (_activeVehicle && _activeVehicle.armed) && _activeVehicle.pauseVehicleSupported && _activeVehicle.flying onClicked: { @@ -473,6 +479,7 @@ Item { } QGCButton { + pointSize: ScreenTools.largeFontPointSize text: qsTr("Change Altitude") visible: (_activeVehicle && _activeVehicle.flying) && _activeVehicle.guidedModeSupported && _activeVehicle.armed onClicked: _guidedModeBar.confirmAction(_guidedModeBar.confirmChangeAlt) @@ -493,7 +500,7 @@ Item { anchors.bottomMargin: _margins anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter - height: ScreenTools.defaultFontPixelHeight * 3 + height: _guidedModeBar.height visible: false z: QGroundControl.zOrderWidgets diff --git a/src/Joystick/JoystickManager.h b/src/Joystick/JoystickManager.h index 96f22f80b923514544fdd3f2224e36f25130f363..26cf0093f986256206b80296044a3846f40e8072 100644 --- a/src/Joystick/JoystickManager.h +++ b/src/Joystick/JoystickManager.h @@ -20,8 +20,6 @@ Q_DECLARE_LOGGING_CATEGORY(JoystickManagerLog) -class QGCApplicaiton; - class JoystickManager : public QGCTool { Q_OBJECT diff --git a/src/QmlControls/QGCButton.qml b/src/QmlControls/QGCButton.qml index 43c44f05d7886ad208f3640a06412d2366a4645a..1417af567db569d9f34772ca36977a71a614ac3e 100644 --- a/src/QmlControls/QGCButton.qml +++ b/src/QmlControls/QGCButton.qml @@ -7,8 +7,8 @@ import QGroundControl.Palette 1.0 import QGroundControl.ScreenTools 1.0 Button { - - property bool primary: false ///< primary button for a group of buttons + property bool primary: false ///< primary button for a group of buttons + property real pointSize: ScreenTools.defaultFontPointSize ///< Point size for button text property var _qgcPal: QGCPalette { colorGroupEnabled: enabled } property bool _showHighlight: (pressed | hovered | checked) && !__forceHoverOff @@ -102,7 +102,7 @@ Button { id: text antialiasing: true text: control.text - font.pointSize: ScreenTools.defaultFontPointSize + font.pointSize: pointSize font.family: ScreenTools.normalFontFamily anchors.verticalCenter: parent.verticalCenter color: _showHighlight ? diff --git a/src/QmlControls/SliderSwitch.qml b/src/QmlControls/SliderSwitch.qml index 7ca493e7c1d1aebfc2e8b54841f948511d9b3572..3567e34351575842ad21d6a8447e88e17eae5ab7 100644 --- a/src/QmlControls/SliderSwitch.qml +++ b/src/QmlControls/SliderSwitch.qml @@ -23,10 +23,11 @@ Rectangle { QGCPalette { id: qgcPal; colorGroupEnabled: true } QGCLabel { - id: label + id: label anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter - text: qsTr("Slide to %1").arg(confirmText) + font.pointSize: ScreenTools.largeFontPointSize + text: qsTr("Slide to %1").arg(confirmText) } Rectangle { diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index b9fdaec03263f299b0b78255e21900d40df85284..64fd84839f4056b7cb4cfe6f370cadfd17442d31 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -1057,7 +1057,10 @@ void Vehicle::_loadSettings(void) _joystickMode = JoystickModeRC; } - _joystickEnabled = settings.value(_joystickEnabledSettingsKey, false).toBool(); + // Joystick enabled is a global setting so first make sure there are any joysticks connected + if (qgcApp()->toolbox()->joystickManager()->joysticks().count()) { + _joystickEnabled = settings.value(_joystickEnabledSettingsKey, false).toBool(); + } } void Vehicle::_saveSettings(void) diff --git a/src/VehicleSetup/FirmwareUpgrade.qml b/src/VehicleSetup/FirmwareUpgrade.qml index 51b665076801038ee30e9c43a70d64f50345991b..335f4c640b41c71348a98dbeeaa438357010a198 100644 --- a/src/VehicleSetup/FirmwareUpgrade.qml +++ b/src/VehicleSetup/FirmwareUpgrade.qml @@ -244,10 +244,11 @@ QGCView { } QGCComboBox { - id: vehicleTypeSelectionCombo - width: 200 - visible: apmFlightStack.checked - model: controller.apmAvailableVersions + id: vehicleTypeSelectionCombo + anchors.left: parent.left + anchors.right: parent.right + visible: apmFlightStack.checked + model: controller.apmAvailableVersions } Row { @@ -291,7 +292,8 @@ QGCView { QGCComboBox { id: firmwareVersionCombo - width: 200 + anchors.left: parent.left + anchors.right: parent.right visible: showFirmwareTypeSelection model: px4Flow ? px4FlowTypeList : firmwareTypeList currentIndex: controller.selectedFirmwareType diff --git a/src/ui/toolbar/MainToolBarIndicators.qml b/src/ui/toolbar/MainToolBarIndicators.qml index 4f9892a2c55855090d42323f54039c2159831ccc..e342300d2e3f254169906092fcb77ef4a10f8eb6 100644 --- a/src/ui/toolbar/MainToolBarIndicators.qml +++ b/src/ui/toolbar/MainToolBarIndicators.qml @@ -173,7 +173,7 @@ Row { visible: activeVehicle && !isNaN(activeVehicle.gps.hdop.value) font.pointSize: ScreenTools.smallFontPointSize color: qgcPal.buttonText - text: activeVehicle ? activeVehicle.gps.hdop.value.toFixed(0) : "" + text: activeVehicle ? activeVehicle.gps.hdop.value.toFixed(1) : "" } MouseArea { anchors.fill: parent