speed_kt = fgGetLowPass(_last_speed_kts, speed_kt, dt/20.0);
_last_speed_kts = speed_kt;
-
+
double odometer = _odometer_node->getDoubleValue();
_odometer_node->setDoubleValue(odometer + distance_m * SG_METER_TO_NM);
odometer = _trip_odometer_node->getDoubleValue();
}
_routeDistanceNm->setDoubleValue(totalDistance * SG_METER_TO_NM);
- double TTW = ((totalDistance * SG_METER_TO_NM) / _last_speed_kts) * 3600.0;
- _routeETE->setStringValue(makeTTWString(TTW));
+ if (_last_speed_kts > 1.0) {
+ double TTW = ((totalDistance * SG_METER_TO_NM) / _last_speed_kts) * 3600.0;
+ _routeETE->setStringValue(makeTTWString(TTW));
+ }
}
/////////////////////////////////////////////////////////////////////////////
double GPS::getLegDistance() const
{
- if (_mode == "obs") {
+ if (!_last_valid || (_mode == "obs")) {
return -1;
}
double GPS::getLegCourse() const
{
- if (_mode == "obs") {
+ if (!_last_valid || (_mode == "obs")) {
return -9999.0;
}
const char* GPS::getWP0Ident() const
{
- if (_mode != "leg") {
+ if (!_last_valid || (_mode != "leg")) {
return "";
}
const char* GPS::getWP0Name() const
{
- if (_mode != "leg") {
+ if (!_last_valid || (_mode != "leg")) {
return "";
}
const char* GPS::getWP1Ident() const
{
+ if (!_last_valid) {
+ return "";
+ }
+
return _wp1Ident.c_str();
}
const char* GPS::getWP1Name() const
{
+ if (!_last_valid) {
+ return "";
+ }
+
return _wp1Name.c_str();
}
return -1.0;
}
- if (_last_speed_kts <= 0.0) {
+ if (_last_speed_kts < 1.0) {
return -1.0;
}
const char* GPS::getWP1TTWString() const
{
+ if (!_last_valid) {
+ return "";
+ }
+
return makeTTWString(getWP1TTW());
}