Unverified Commit 023d517a authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #6395 from DonLakeFlyer/TerrainDrag

Update terrain alts when user drags mission item
parents 39d73e52 79dbbce8
...@@ -705,19 +705,17 @@ void SimpleMissionItem::_terrainAltChanged(void) ...@@ -705,19 +705,17 @@ void SimpleMissionItem::_terrainAltChanged(void)
return; return;
} }
if (!qIsNaN(_amslAltAboveTerrainFact.rawValue().toDouble())) {
// We already have terrain values set. Don't do it again to prevent dirty bit changing.
return;
}
if (qIsNaN(terrainAltitude())) { if (qIsNaN(terrainAltitude())) {
// Set NaNs to signal we are waiting on terrain data // Set NaNs to signal we are waiting on terrain data
_missionItem._param7Fact.setRawValue(qQNaN()); _missionItem._param7Fact.setRawValue(qQNaN());
_amslAltAboveTerrainFact.setRawValue(qQNaN()); _amslAltAboveTerrainFact.setRawValue(qQNaN());
} else { } else {
double aboveTerrain = terrainAltitude() + _altitudeFact.rawValue().toDouble(); double newAboveTerrain = terrainAltitude() + _altitudeFact.rawValue().toDouble();
_missionItem._param7Fact.setRawValue(aboveTerrain); double oldAboveTerrain = _amslAltAboveTerrainFact.rawValue().toDouble();
_amslAltAboveTerrainFact.setRawValue(aboveTerrain); if (qIsNaN(oldAboveTerrain) || !qFuzzyCompare(newAboveTerrain, oldAboveTerrain)) {
_missionItem._param7Fact.setRawValue(newAboveTerrain);
_amslAltAboveTerrainFact.setRawValue(newAboveTerrain);
}
} }
} }
......
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