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

Merge pull request #8837 from DonLakeFlyer/CherryPickSpecifiesAltitude

Use specifiesAltitude instead of specifiesCoordinate in correct places
parents bfb9135c 84d98a49
......@@ -16,6 +16,7 @@ Note: This file only contains high level features or important fixes.
## 4.0.8 - Not yet released
* Plan: Fix bugs associated with mission commands which specify and altitude but no lat/lon
* Fix bug which could prevent view switching from working after altitude mode warning dialog would pop up
## 4.0.8 - Stable
......
......@@ -117,7 +117,7 @@ SimpleMissionItem::SimpleMissionItem(PlanMasterController* masterController, boo
}
_isCurrentItem = missionItem.isCurrentItem();
_altitudeFact.setRawValue(specifiesCoordinate() || specifiesAltitudeOnly() ? _missionItem._param7Fact.rawValue() : qQNaN());
_altitudeFact.setRawValue(specifiesAltitude() ? _missionItem._param7Fact.rawValue() : qQNaN());
_amslAltAboveTerrainFact.setRawValue(qQNaN());
// In flyView we skip some of the intialization to save memory
......@@ -267,7 +267,7 @@ void SimpleMissionItem::save(QJsonArray& missionItems)
item->save(saveObject);
if (i == 0) {
// This is the main simple item, save the alt/terrain data
if (specifiesCoordinate()) {
if (specifiesAltitude()) {
saveObject[_jsonAltitudeModeKey] = _altitudeMode;
saveObject[_jsonAltitudeKey] = _altitudeFact.rawValue().toDouble();
saveObject[_jsonAMSLAltAboveTerrainKey] = _amslAltAboveTerrainFact.rawValue().toDouble();
......@@ -282,7 +282,7 @@ bool SimpleMissionItem::load(QTextStream &loadStream)
{
bool success;
if ((success = _missionItem.load(loadStream))) {
if (specifiesCoordinate()) {
if (specifiesAltitude()) {
_altitudeMode = _missionItem.relativeAltitude() ? QGroundControlQmlGlobal::AltitudeModeRelative : QGroundControlQmlGlobal::AltitudeModeAbsolute;
_altitudeFact.setRawValue(_missionItem._param7Fact.rawValue());
_amslAltAboveTerrainFact.setRawValue(qQNaN());
......@@ -302,7 +302,7 @@ bool SimpleMissionItem::load(const QJsonObject& json, int sequenceNumber, QStrin
return false;
}
if (specifiesCoordinate()) {
if (specifiesAltitude()) {
if (json.contains(_jsonAltitudeModeKey) || json.contains(_jsonAltitudeKey) || json.contains(_jsonAMSLAltAboveTerrainKey)) {
QList<JsonHelper::KeyValidateInfo> keyInfoList = {
{ _jsonAltitudeModeKey, QJsonValue::Double, true },
......@@ -573,7 +573,7 @@ bool SimpleMissionItem::friendlyEditAllowed(void) const
return false;
}
if (specifiesCoordinate() || specifiesAltitudeOnly()) {
if (specifiesAltitude()) {
MAV_FRAME frame = _missionItem.frame();
switch (frame) {
case MAV_FRAME_GLOBAL:
......@@ -726,7 +726,7 @@ void SimpleMissionItem::_setDefaultsForCommand(void)
_altitudeMode = QGroundControlQmlGlobal::AltitudeModeRelative;
emit altitudeModeChanged();
_amslAltAboveTerrainFact.setRawValue(qQNaN());
if (specifiesCoordinate() || isStandaloneCoordinate() || specifiesAltitudeOnly()) {
if (specifiesAltitude() || isStandaloneCoordinate()) {
double defaultAlt = qgcApp()->toolbox()->settingsManager()->appSettings()->defaultMissionItemAltitude()->rawValue().toDouble();
_altitudeFact.setRawValue(defaultAlt);
_missionItem._param7Fact.setRawValue(defaultAlt);
......@@ -758,7 +758,7 @@ void SimpleMissionItem::_setDefaultsForCommand(void)
}
_missionItem.setAutoContinue(true);
_missionItem.setFrame((specifiesCoordinate() || specifiesAltitudeOnly()) ? MAV_FRAME_GLOBAL_RELATIVE_ALT : MAV_FRAME_MISSION);
_missionItem.setFrame(specifiesAltitude() ? MAV_FRAME_GLOBAL_RELATIVE_ALT : MAV_FRAME_MISSION);
setRawEdit(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