Commit fc2781c3 authored by DonLakeFlyer's avatar DonLakeFlyer

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