Unverified Commit a4be3aef authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #8060 from DonLakeFlyer/MoreTakeoffItem

Plan: More takeoff item fixes
parents 8f1b0d04 299fb347
......@@ -395,7 +395,7 @@ VisualMissionItem* MissionController::insertSimpleMissionItem(QGeoCoordinate coo
VisualMissionItem* MissionController::insertTakeoffItem(QGeoCoordinate /*coordinate*/, int visualItemIndex, bool makeCurrentItem)
{
int sequenceNumber = _nextSequenceNumber();
TakeoffMissionItem * newItem = new TakeoffMissionItem(_controllerVehicle->vtol() ? MAV_CMD_NAV_VTOL_TAKEOFF : MAV_CMD_NAV_TAKEOFF, _managerVehicle, _flyView, _settingsItem, this);
TakeoffMissionItem * newItem = new TakeoffMissionItem(_controllerVehicle->vtol() ? MAV_CMD_NAV_VTOL_TAKEOFF : MAV_CMD_NAV_TAKEOFF, _controllerVehicle, _flyView, _settingsItem, this);
newItem->setSequenceNumber(sequenceNumber);
_initVisualItem(newItem);
......
......@@ -50,19 +50,36 @@ void TakeoffMissionItem::_init(void)
{
_editorQml = QStringLiteral("qrc:/qml/SimpleItemEditor.qml");
QGeoCoordinate homePosition = _vehicle->homePosition();
if (homePosition.isValid()) {
_settingsItem->setCoordinate(homePosition);
}
connect(_settingsItem, &MissionSettingsItem::coordinateChanged, this, &TakeoffMissionItem::launchCoordinateChanged);
if (_flyView) {
_initLaunchTakeoffAtSameLocation();
return;
}
QGeoCoordinate homePosition = _settingsItem->coordinate();
if (!homePosition.isValid()) {
Vehicle* activeVehicle = qgcApp()->toolbox()->multiVehicleManager()->activeVehicle();
if (activeVehicle) {
homePosition = activeVehicle->homePosition();
if (homePosition.isValid()) {
_settingsItem->setCoordinate(homePosition);
}
}
}
_initLaunchTakeoffAtSameLocation();
if (_launchTakeoffAtSameLocation && homePosition.isValid()) {
if (homePosition.isValid() && coordinate().isValid()) {
// Item already full specified, most likely from mission load from storage
_wizardMode = false;
SimpleMissionItem::setCoordinate(homePosition);
} else {
_wizardMode = true;
if (_launchTakeoffAtSameLocation && homePosition.isValid()) {
_wizardMode = false;
SimpleMissionItem::setCoordinate(homePosition);
} else {
_wizardMode = true;
}
}
setDirty(false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment