True Wind: calculate HDT only if true wind calc is requested

This commit is contained in:
Ulrich Meine
2026-04-25 01:23:42 +02:00
parent f84ef25a30
commit 1098afa8b2
+6 -2
View File
@@ -467,6 +467,10 @@ bool WindUtils::handleWinds(bool calcWinds)
double twd, tws, twa, awd; double twd, tws, twa, awd;
bool twCalculated = false; bool twCalculated = false;
if (!calcWinds) { // don't calculate anything if true wind calculation has not been set in configuration
return twCalculated;
}
double awaVal = awaBVal->valid ? awaBVal->value : DBL_MAX; double awaVal = awaBVal->valid ? awaBVal->value : DBL_MAX;
double awsVal = awsBVal->valid ? awsBVal->value : DBL_MAX; double awsVal = awsBVal->valid ? awsBVal->value : DBL_MAX;
double cogVal = cogBVal->valid ? cogBVal->value : DBL_MAX; double cogVal = cogBVal->valid ? cogBVal->value : DBL_MAX;
@@ -511,8 +515,8 @@ bool WindUtils::handleWinds(bool calcWinds)
} }
} }
if (calcWinds && (!twaBVal->valid || !twsBVal->valid || !twdBVal->valid)) { if (!twaBVal->valid || !twsBVal->valid || !twdBVal->valid) {
// calculate true winds if user setting and at least one of three true wind values does not exist // calculate true winds at least one of three true wind values does not exist
twCalculated = calcTrueWinds(&awaVal, &awsVal, &awd, &cogVal, &stwVal, &sogVal, &hdtVal, &twa, &tws, &twd); twCalculated = calcTrueWinds(&awaVal, &awsVal, &awd, &cogVal, &stwVal, &sogVal, &hdtVal, &twa, &tws, &twd);
if (twCalculated) { // Replace values only, if successfully calculated and not already available if (twCalculated) { // Replace values only, if successfully calculated and not already available
if (!twaBVal->valid) { if (!twaBVal->valid) {