diff --git a/src/Cockpit/navcom.cxx b/src/Cockpit/navcom.cxx index a3525f5e4..a67f67336 100644 --- a/src/Cockpit/navcom.cxx +++ b/src/Cockpit/navcom.cxx @@ -58,6 +58,8 @@ FGNavCom::FGNavCom() : comm_vol_btn(0.0), nav_freq(0.0), nav_alt_freq(0.0), + nav_heading(0.0), + nav_radial(0.0), nav_target_radial(0.0), nav_vol_btn(0.0), nav_ident_btn(true) @@ -179,6 +181,9 @@ FGNavCom::bind () &FGNavCom::get_audio_btn, &FGNavCom::set_audio_btn ); fgSetArchivable( propname ); + snprintf(propname, 256, "/radios/nav[%d]/heading-deg", index); + fgTie( propname, this, &FGNavCom::get_nav_heading ); + snprintf(propname, 256, "/radios/nav[%d]/radials/actual-deg", index); fgTie( propname, this, &FGNavCom::get_nav_radial ); @@ -388,7 +393,7 @@ FGNavCom::update(double dt) lat * SGD_RADIANS_TO_DEGREES, lon * SGD_RADIANS_TO_DEGREES, nav_loclat, nav_loclon, - &az1, &az2, &s ); + &nav_heading, &az2, &s ); // cout << "az1 = " << az1 << " magvar = " << nav_magvar << endl; nav_radial = az2 - nav_twist; // cout << " heading = " << nav_heading @@ -727,6 +732,16 @@ FGNavCom::get_nav_from_flag () const } +/** + * Return the true heading to station + */ +double +FGNavCom::get_nav_heading () const +{ + return nav_heading; +} + + /** * Return the current radial. */ diff --git a/src/Cockpit/navcom.hxx b/src/Cockpit/navcom.hxx index b05a2f9c4..5d18a118e 100644 --- a/src/Cockpit/navcom.hxx +++ b/src/Cockpit/navcom.hxx @@ -88,7 +88,12 @@ class FGNavCom : public SGSubsystem bool nav_loc; double nav_freq; double nav_alt_freq; - double nav_radial; + double nav_heading; // true heading to nav station + double nav_radial; // current radial we are on (taking + // into consideration the vor station + // alignment which likely doesn't + // match the magnetic alignment + // exactly.) double nav_sel_radial; double nav_target_radial; double nav_loclon; @@ -212,6 +217,7 @@ public: inline double get_nav_gs_dist() const { return nav_gs_dist; } inline double get_nav_gs_dist_signed() const { return nav_gs_dist_signed; } inline double get_nav_elev() const { return nav_elev; } + double get_nav_heading() const; double get_nav_radial() const; double get_nav_reciprocal_radial() const; inline double get_nav_target_gs() const { return nav_target_gs; }