diff --git a/src/MissionManager/MissionController.cc b/src/MissionManager/MissionController.cc index 5809910349cc7e15f499b1ef17e2bb6e675d1190..4e06ce00a568a9965a33ed4a8eb4de99704cf174 100644 --- a/src/MissionManager/MissionController.cc +++ b/src/MissionManager/MissionController.cc @@ -348,12 +348,15 @@ VisualMissionItem* MissionController::_insertSimpleMissionItemWorker(QGeoCoordin _initVisualItem(newItem); if (newItem->specifiesAltitude()) { - double prevAltitude; - int prevAltitudeMode; - - if (_findPreviousAltitude(visualItemIndex, &prevAltitude, &prevAltitudeMode)) { - newItem->altitude()->setRawValue(prevAltitude); - newItem->setAltitudeMode(static_cast(prevAltitudeMode)); + const MissionCommandUIInfo* uiInfo = qgcApp()->toolbox()->missionCommandTree()->getUIInfo(_controllerVehicle, command); + if (!uiInfo->isLandCommand()) { + double prevAltitude; + int prevAltitudeMode; + + if (_findPreviousAltitude(visualItemIndex, &prevAltitude, &prevAltitudeMode)) { + newItem->altitude()->setRawValue(prevAltitude); + newItem->setAltitudeMode(static_cast(prevAltitudeMode)); + } } } newItem->setMissionFlightStatus(_missionFlightStatus); @@ -418,7 +421,7 @@ VisualMissionItem* MissionController::insertLandItem(QGeoCoordinate coordinate, fwLanding->setLoiterDragAngleOnly(true); return fwLanding; } else { - return _insertSimpleMissionItemWorker(coordinate, MAV_CMD_NAV_RETURN_TO_LAUNCH, visualItemIndex, makeCurrentItem); + return _insertSimpleMissionItemWorker(coordinate, _managerVehicle->vtol() ? MAV_CMD_NAV_VTOL_LAND : MAV_CMD_NAV_RETURN_TO_LAUNCH, visualItemIndex, makeCurrentItem); } }