X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FInstrumentation%2Fdme.cxx;h=485412a122ebcf32290cbb5d07904a707986584f;hb=5c101b8021a14ac1e5d60b77b76140b1365460dc;hp=0164888a170f5fc67c37a174ab8c1865c444918c;hpb=28b751f121fd20849646c1921b8143689414a990;p=flightgear.git diff --git a/src/Instrumentation/dme.cxx b/src/Instrumentation/dme.cxx index 0164888a1..485412a12 100644 --- a/src/Instrumentation/dme.cxx +++ b/src/Instrumentation/dme.cxx @@ -3,6 +3,10 @@ // // This file is in the Public Domain and comes with no warranty. +#ifdef HAVE_CONFIG_H +# include +#endif + #include #include #include @@ -57,9 +61,9 @@ DME::DME ( SGPropertyNode *node ) } else if ( cname == "number" ) { num = child->getIntValue(); } else { - SG_LOG( SG_AUTOPILOT, SG_WARN, "Error in dme config logic" ); + SG_LOG( SG_INSTR, SG_WARN, "Error in dme config logic" ); if ( name.length() ) { - SG_LOG( SG_AUTOPILOT, SG_WARN, "Section = " << name ); + SG_LOG( SG_INSTR, SG_WARN, "Section = " << name ); } } } @@ -98,10 +102,8 @@ DME::init () _frequency_node = fnode->getChild("selected-mhz", 0, true); _in_range_node = node->getChild("in-range", 0, true); _distance_node = node->getChild("indicated-distance-nm", 0, true); - _speed_node = node->getChild("indicated-ground-speed", 0, true); + _speed_node = node->getChild("indicated-ground-speed-kt", 0, true); _time_node = node->getChild("indicated-time-min", 0, true); - - _serviceable_node->setBoolValue(true); } void @@ -150,9 +152,10 @@ DME::update (double delta_time_sec) } // Calculate the distance to the transmitter - Point3D location = - sgGeodToCart(Point3D(longitude_rad, latitude_rad, altitude_m)); - double distance_nm = _transmitter.distance3D(location) * SG_METER_TO_NM; + SGGeod geod = SGGeod::fromRadM(longitude_rad, latitude_rad, altitude_m); + SGVec3d location = SGVec3d::fromGeod(geod); + + double distance_nm = dist(_transmitter, location) * SG_METER_TO_NM; double range_nm = adjust_range(_transmitter_elevation_ft, altitude_m * SG_METER_TO_FEET, @@ -196,7 +199,7 @@ DME::search (double frequency_mhz, double longitude_rad, _transmitter_valid = (dme != NULL); if ( _transmitter_valid ) { - _transmitter = Point3D(dme->get_x(), dme->get_y(), dme->get_z()); + _transmitter = dme->get_cart(); _transmitter_elevation_ft = dme->get_elev_ft(); _transmitter_range_nm = dme->get_range(); _transmitter_bias = dme->get_multiuse();