Commit fc2781c3 authored by DonLakeFlyer's avatar DonLakeFlyer

parent 87363227
......@@ -395,9 +395,8 @@ 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, _controllerVehicle, _flyView, _settingsItem, this);
TakeoffMissionItem * newItem = new TakeoffMissionItem(_controllerVehicle->vtol() ? MAV_CMD_NAV_VTOL_TAKEOFF : MAV_CMD_NAV_TAKEOFF, _managerVehicle, _flyView, _settingsItem, this);
newItem->setSequenceNumber(sequenceNumber);
newItem->setWizardMode(true);
_initVisualItem(newItem);
if (newItem->specifiesAltitude()) {
......@@ -1705,8 +1704,6 @@ void MissionController::_initAllVisualItems(void)
}
}
_settingsItem->setHomePositionFromVehicle(_managerVehicle);
connect(_settingsItem, &MissionSettingsItem::coordinateChanged, this, &MissionController::_recalcAll);
connect(_settingsItem, &MissionSettingsItem::coordinateChanged, this, &MissionController::plannedHomePositionChanged);
......@@ -1831,7 +1828,7 @@ bool MissionController::_findPreviousAltitude(int newIndex, double* prevAltitude
{
bool found = false;
double foundAltitude = 0;
int foundAltitudeMode;
int foundAltitudeMode = QGroundControlQmlGlobal::AltitudeModeNone;
if (newIndex > _visualItems->count()) {
return false;
......@@ -1879,9 +1876,8 @@ MissionSettingsItem* MissionController::_addMissionSettings(QmlObjectListModel*
{
qCDebug(MissionControllerLog) << "_addMissionSettings";
MissionSettingsItem* settingsItem = new MissionSettingsItem(_controllerVehicle, _flyView, visualItems);
MissionSettingsItem* settingsItem = new MissionSettingsItem(_managerVehicle, _flyView, visualItems);
visualItems->insert(0, settingsItem);
settingsItem->setHomePositionFromVehicle(_managerVehicle);
if (visualItems == _visualItems) {
_settingsItem = settingsItem;
......
......@@ -47,17 +47,16 @@ MissionSettingsItem::MissionSettingsItem(Vehicle* vehicle, bool flyView, QObject
connect(this, &MissionSettingsItem::specifyMissionFlightSpeedChanged, this, &MissionSettingsItem::_setDirtyAndUpdateLastSequenceNumber);
connect(&_cameraSection, &CameraSection::itemCountChanged, this, &MissionSettingsItem::_setDirtyAndUpdateLastSequenceNumber);
connect(&_speedSection, &CameraSection::itemCountChanged, this, &MissionSettingsItem::_setDirtyAndUpdateLastSequenceNumber);
connect(this, &MissionSettingsItem::terrainAltitudeChanged, this, &MissionSettingsItem::_setHomeAltFromTerrain);
connect(&_plannedHomePositionAltitudeFact, &Fact::rawValueChanged, this, &MissionSettingsItem::_updateAltitudeInCoordinate);
connect(&_cameraSection, &CameraSection::dirtyChanged, this, &MissionSettingsItem::_sectionDirtyChanged);
connect(&_speedSection, &SpeedSection::dirtyChanged, this, &MissionSettingsItem::_sectionDirtyChanged);
connect(&_cameraSection, &CameraSection::specifiedGimbalYawChanged, this, &MissionSettingsItem::specifiedGimbalYawChanged);
connect(&_cameraSection, &CameraSection::specifiedGimbalPitchChanged, this, &MissionSettingsItem::specifiedGimbalPitchChanged);
connect(&_speedSection, &SpeedSection::specifiedFlightSpeedChanged, this, &MissionSettingsItem::specifiedFlightSpeedChanged);
connect(_vehicle, &Vehicle::homePositionChanged, this, &MissionSettingsItem::_updateHomePosition);
connect(&_plannedHomePositionAltitudeFact, &Fact::rawValueChanged, this, &MissionSettingsItem::_updateAltitudeInCoordinate);
_updateHomePosition(_vehicle->homePosition());
}
int MissionSettingsItem::lastSequenceNumber(void) const
......@@ -285,3 +284,10 @@ QString MissionSettingsItem::abbreviation(void) const
{
return _flyView ? tr("H") : tr("Launch");
}
void MissionSettingsItem::_updateHomePosition(const QGeoCoordinate& homePosition)
{
if (_flyView) {
setCoordinate(homePosition);
}
}
......@@ -100,6 +100,7 @@ private slots:
void _updateAltitudeInCoordinate (QVariant value);
void _setHomeAltFromTerrain (double terrainAltitude);
void _setCoordinateWorker (const QGeoCoordinate& coordinate);
void _updateHomePosition (const QGeoCoordinate& homePosition);
private:
QGeoCoordinate _plannedHomePositionCoordinate; // Does not include altitude
......
......@@ -58,6 +58,13 @@ void TakeoffMissionItem::_init(void)
_initLaunchTakeoffAtSameLocation();
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