diff --git a/deploy/qgroundcontrol_installer.nsi b/deploy/qgroundcontrol_installer.nsi index e3064b681af7269891ed8f49f819aa58d568ac84..e1ede489b32e6a4541f19abd2e742741bc6b1d57 100644 --- a/deploy/qgroundcontrol_installer.nsi +++ b/deploy/qgroundcontrol_installer.nsi @@ -2,6 +2,7 @@ !include LogicLib.nsh !include Win\COM.nsh !include Win\Propkey.nsh +!include "FileFunc.nsh" !macro DemoteShortCut target !insertmacro ComHlpr_CreateInProcInstance ${CLSID_ShellLink} ${IID_IShellLink} r0 "" @@ -61,7 +62,7 @@ Section ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" StrCmp $R0 "" doinstall - ExecWait "$R0 /S _?=$INSTDIR" + ExecWait "$R0 /S _?=$INSTDIR -LEAVE_DATA=1" IntCmp $0 0 doinstall MessageBox MB_OK|MB_ICONEXCLAMATION \ @@ -104,12 +105,16 @@ done: SectionEnd Section "Uninstall" + ${GetParameters} $R0 + ${GetOptions} $R0 "-LEAVE_DATA=" $R1 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder SetShellVarContext all RMDir /r /REBOOTOK $INSTDIR RMDir /r /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\" SetShellVarContext current - RMDir /r /REBOOTOK "$APPDATA\${ORGNAME}\" + ${If} $R1 != 1 + RMDir /r /REBOOTOK "$APPDATA\${ORGNAME}\" + ${Endif} DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\${EXENAME}.exe" SectionEnd diff --git a/src/AutoPilotPlugins/PX4/SensorsSetup.qml b/src/AutoPilotPlugins/PX4/SensorsSetup.qml index 6bbb20ddc5758d471d3644e3fc59c88fb5910b9c..d6c4902728e0abae9291d774ef6e4c1bdd079732 100644 --- a/src/AutoPilotPlugins/PX4/SensorsSetup.qml +++ b/src/AutoPilotPlugins/PX4/SensorsSetup.qml @@ -132,10 +132,8 @@ Item { onResetStatusTextArea: statusLog.text = statusTextAreaDefaultText onMagCalComplete: { - //if (!_sensorsHaveFixedOrientation && (showCompass0Rot || showCompass1Rot || showCompass2Rot)) { - setOrientationsDialogShowBoardOrientation = false - showDialog(setOrientationsDialogComponent, qsTr("Compass Calibration Complete"), qgcView.showDialogDefaultWidth, StandardButton.Ok) - //} + setOrientationsDialogShowBoardOrientation = false + showDialog(setOrientationsDialogComponent, qsTr("Compass Calibration Complete"), qgcView.showDialogDefaultWidth, StandardButton.Ok) } onWaitingForCancelChanged: { @@ -255,7 +253,9 @@ Item { QGCLabel { width: parent.width wrapMode: Text.WordWrap - text: qsTr("Set your compass orientations below and the make sure to reboot the vehicle prior to flight.") + text: _sensorsHaveFixedOrientation ? + qsTr("Make sure to reboot the vehicle prior to flight.") : + qsTr("Set your compass orientations below and the make sure to reboot the vehicle prior to flight.") } QGCButton { @@ -270,6 +270,7 @@ Item { width: parent.width wrapMode: Text.WordWrap text: boardRotationText + visible: !_sensorsHaveFixedOrientation } Column { @@ -287,8 +288,10 @@ Item { } } + // Compass 0 rotation Column { - // Compass 0 rotation + visible: !_sensorsHaveFixedOrientation + Component { id: compass0ComponentLabel2 @@ -312,8 +315,10 @@ Item { Loader { sourceComponent: showCompass0Rot ? compass0ComponentCombo2 : null } } + // Compass 1 rotation Column { - // Compass 1 rotation + visible: !_sensorsHaveFixedOrientation + Component { id: compass1ComponentLabel2 @@ -337,10 +342,11 @@ Item { Loader { sourceComponent: showCompass1Rot ? compass1ComponentCombo2 : null } } + // Compass 2 rotation Column { + visible: !_sensorsHaveFixedOrientation spacing: ScreenTools.defaultFontPixelWidth - // Compass 2 rotation Component { id: compass2ComponentLabel2 diff --git a/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc b/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc index 188da227fb950f3f941e53d6446d2d89dea4c747..ea1f2d7a6945577542d8152aa48c12fe7195e85e 100644 --- a/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc +++ b/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc @@ -285,7 +285,7 @@ QList PX4FirmwarePlugin::supportedMissionCommands(void) list << MAV_CMD_NAV_WAYPOINT << MAV_CMD_NAV_LOITER_UNLIM << MAV_CMD_NAV_LOITER_TIME << MAV_CMD_NAV_LOITER_TO_ALT - << MAV_CMD_NAV_LAND << MAV_CMD_NAV_TAKEOFF + << MAV_CMD_NAV_LAND << MAV_CMD_NAV_TAKEOFF << MAV_CMD_NAV_RETURN_TO_LAUNCH << MAV_CMD_DO_JUMP << MAV_CMD_DO_VTOL_TRANSITION << MAV_CMD_NAV_VTOL_TAKEOFF << MAV_CMD_NAV_VTOL_LAND << MAV_CMD_DO_DIGICAM_CONTROL diff --git a/src/MissionManager/MissionController.cc b/src/MissionManager/MissionController.cc index 9eedc40ec987a68e6d14c6ee1159da596a843c63..590098b861294ed5731de3fe829332f58bd595d9 100644 --- a/src/MissionManager/MissionController.cc +++ b/src/MissionManager/MissionController.cc @@ -349,13 +349,12 @@ int MissionController::insertSimpleMissionItem(QGeoCoordinate coordinate, int i) newItem->setCoordinate(coordinate); newItem->setCommand(MAV_CMD_NAV_WAYPOINT); _initVisualItem(newItem); - if (_visualItems->count() == 1) { + if (_visualItems->count() == 1 && (_controllerVehicle->fixedWing() || _controllerVehicle->vtol() || _controllerVehicle->multiRotor())) { MAV_CMD takeoffCmd = _controllerVehicle->vtol() ? MAV_CMD_NAV_VTOL_TAKEOFF : MAV_CMD_NAV_TAKEOFF; if (_controllerVehicle->firmwarePlugin()->supportedMissionCommands().contains((MAV_CMD)takeoffCmd)) { newItem->setCommand(takeoffCmd); } } - newItem->setDefaultsForCommand(); if (newItem->specifiesAltitude()) { double prevAltitude; int prevAltitudeMode; @@ -382,7 +381,6 @@ int MissionController::insertROIMissionItem(QGeoCoordinate coordinate, int i) MAV_CMD_DO_SET_ROI_LOCATION : MAV_CMD_DO_SET_ROI)); _initVisualItem(newItem); - newItem->setDefaultsForCommand(); newItem->setCoordinate(coordinate); double prevAltitude; diff --git a/src/MissionManager/SimpleMissionItem.cc b/src/MissionManager/SimpleMissionItem.cc index 6c1583b6c5b3ee105e5b3d7786c89ac2749b2683..e96c9256b95b088775155a2234957bb536388af1 100644 --- a/src/MissionManager/SimpleMissionItem.cc +++ b/src/MissionManager/SimpleMissionItem.cc @@ -78,7 +78,7 @@ SimpleMissionItem::SimpleMissionItem(Vehicle* vehicle, bool flyView, QObject* pa _connectSignals(); _updateOptionalSections(); - setDefaultsForCommand(); + _setDefaultsForCommand(); _rebuildFacts(); setDirty(false); @@ -213,7 +213,7 @@ void SimpleMissionItem::_connectSignals(void) connect(&_missionItem._frameFact, &Fact::valueChanged, this, &SimpleMissionItem::_sendFriendlyEditAllowedChanged); // A command change triggers a number of other changes as well. - connect(&_missionItem._commandFact, &Fact::valueChanged, this, &SimpleMissionItem::setDefaultsForCommand); + connect(&_missionItem._commandFact, &Fact::valueChanged, this, &SimpleMissionItem::_setDefaultsForCommand); connect(&_missionItem._commandFact, &Fact::valueChanged, this, &SimpleMissionItem::commandNameChanged); connect(&_missionItem._commandFact, &Fact::valueChanged, this, &SimpleMissionItem::commandDescriptionChanged); connect(&_missionItem._commandFact, &Fact::valueChanged, this, &SimpleMissionItem::abbreviationChanged); @@ -729,15 +729,32 @@ bool SimpleMissionItem::readyForSave(void) const return !specifiesAltitude() || !qIsNaN(_missionItem._param7Fact.rawValue().toDouble()); } -void SimpleMissionItem::setDefaultsForCommand(void) +void SimpleMissionItem::_setDefaultsForCommand(void) { - // We set these global defaults first, then if there are param defaults they will get reset + // First reset params 1-4 to 0, we leave 5-7 alone to preserve any previous location information on command change + _missionItem._param1Fact.setRawValue(0); + _missionItem._param2Fact.setRawValue(0); + _missionItem._param3Fact.setRawValue(0); + _missionItem._param4Fact.setRawValue(0); + + if (!specifiesCoordinate() && !isStandaloneCoordinate()) { + // No need to carry across previous lat/lon + _missionItem._param5Fact.setRawValue(0); + _missionItem._param6Fact.setRawValue(0); + } + + // Set global defaults first, then if there are param defaults they will get reset _altitudeMode = AltitudeRelative; emit altitudeModeChanged(); - double defaultAlt = qgcApp()->toolbox()->settingsManager()->appSettings()->defaultMissionItemAltitude()->rawValue().toDouble(); - _altitudeFact.setRawValue(defaultAlt); - _missionItem._param7Fact.setRawValue(defaultAlt); _amslAltAboveTerrainFact.setRawValue(qQNaN()); + if (specifiesCoordinate() || isStandaloneCoordinate() || specifiesAltitudeOnly()) { + double defaultAlt = qgcApp()->toolbox()->settingsManager()->appSettings()->defaultMissionItemAltitude()->rawValue().toDouble(); + _altitudeFact.setRawValue(defaultAlt); + _missionItem._param7Fact.setRawValue(defaultAlt); + } else { + _altitudeFact.setRawValue(0); + _missionItem._param7Fact.setRawValue(0); + } MAV_CMD command = (MAV_CMD)this->command(); const MissionCommandUIInfo* uiInfo = _commandTree->getUIInfo(_vehicle, command); diff --git a/src/MissionManager/SimpleMissionItem.h b/src/MissionManager/SimpleMissionItem.h index 886d6f4cdc812ca9e67eed78d375be5216d7bd32..c8a85ca4a2d729f8bd205ee8cffd4521ed26dcc0 100644 --- a/src/MissionManager/SimpleMissionItem.h +++ b/src/MissionManager/SimpleMissionItem.h @@ -134,9 +134,6 @@ public: int lastSequenceNumber (void) const final; void save (QJsonArray& missionItems) final; -public slots: - void setDefaultsForCommand(void); - signals: void commandChanged (int command); void friendlyEditAllowedChanged (bool friendlyEditAllowed); @@ -160,6 +157,7 @@ private slots: void _rebuildFacts (void); void _rebuildTextFieldFacts (void); void _possibleAdditionalTimeDelayChanged(void); + void _setDefaultsForCommand (void); private: void _connectSignals (void); diff --git a/src/MissionManager/TransectStyleComplexItem.cc b/src/MissionManager/TransectStyleComplexItem.cc index a15dbf71dd1b2a67d3daba0adf8a1cef4a579d7c..8e7e4e2ae40339b8de23094495bfdc2cd6adea8a 100644 --- a/src/MissionManager/TransectStyleComplexItem.cc +++ b/src/MissionManager/TransectStyleComplexItem.cc @@ -385,11 +385,6 @@ void TransectStyleComplexItem::_rebuildTransects(void) void TransectStyleComplexItem::_queryTransectsPathHeightInfo(void) { _transectsPathHeightInfo.clear(); - if (_terrainPolyPathQuery) { - // Toss previous query - _terrainPolyPathQuery->deleteLater(); - _terrainPolyPathQuery = NULL; - } if (_transects.count()) { // We don't actually send the query until this timer times out. This way we only send @@ -400,6 +395,20 @@ void TransectStyleComplexItem::_queryTransectsPathHeightInfo(void) void TransectStyleComplexItem::_reallyQueryTransectsPathHeightInfo(void) { + // Clear any previous query + if (_terrainPolyPathQuery) { + // FIXME: We should really be blowing away any previous query here. But internally that is difficult to implement so instead we let + // it complete and drop the results. +#if 0 + // Toss previous query + _terrainPolyPathQuery->deleteLater(); +#else + // Let the signal fall on the floor + disconnect(_terrainPolyPathQuery, &TerrainPolyPathQuery::terrainDataReceived, this, &TransectStyleComplexItem::_polyPathTerrainData); +#endif + _terrainPolyPathQuery = NULL; + } + // Append all transects into a single PolyPath query QList transectPoints; @@ -436,6 +445,12 @@ void TransectStyleComplexItem::_polyPathTerrainData(bool success, const QList error = true; qCWarning(TerrainQueryLog) << "TerrainTileManager::_getAltitudesForCoordinates Internal Error: negative elevation in tile cache"; } else { - qCWarning(TerrainQueryLog) << "TerrainTileManager::_getAltitudesForCoordinates returning elevation from tile cache" << elevation; + qCDebug(TerrainQueryLog) << "TerrainTileManager::_getAltitudesForCoordinates returning elevation from tile cache" << elevation; } altitudes.push_back(elevation); } else {