diff --git a/src/Cockpit/dme.cxx b/src/Cockpit/dme.cxx index f8e40efd3..fb416fcaa 100644 --- a/src/Cockpit/dme.cxx +++ b/src/Cockpit/dme.cxx @@ -161,6 +161,9 @@ FGDME::update(double dt) station = Point3D( x, y, z ); dist = aircraft.distance3D( station ) * SG_METER_TO_NM; dist -= bias; + if ( dist < 0.0 ) { + dist = 0.0; + } current_time.stamp(); long dMs = (current_time - last_time) / 1000; diff --git a/src/Instrumentation/dme.cxx b/src/Instrumentation/dme.cxx index f9d186ca1..5aea2a8ba 100644 --- a/src/Instrumentation/dme.cxx +++ b/src/Instrumentation/dme.cxx @@ -128,7 +128,11 @@ DME::update (double delta_time_sec) _last_distance_nm = distance_nm; _in_range_node->setBoolValue(true); - _distance_node->setDoubleValue(distance_nm - _transmitter_bias); + double tmp_dist = distance_nm - _transmitter_bias; + if ( tmp_dist < 0.0 ) { + tmp_dist = 0.0; + } + _distance_node->setDoubleValue( tmp_dist ); _speed_node->setDoubleValue(speed_kt); _time_node->setDoubleValue(distance_nm/speed_kt*60.0);