From: curt Date: Tue, 27 Feb 2001 23:52:52 +0000 (+0000) Subject: Backcourse ILS needle should move correct direction now. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4a61945285b39759ce98b29bc278f66b59e87352;p=flightgear.git Backcourse ILS needle should move correct direction now. --- diff --git a/src/Autopilot/newauto.cxx b/src/Autopilot/newauto.cxx index 7b904bb1e..99bf553c1 100644 --- a/src/Autopilot/newauto.cxx +++ b/src/Autopilot/newauto.cxx @@ -400,8 +400,13 @@ int FGAutopilot::run() { // determine our current radial position relative to the // navaid in "true" heading. - double cur_radial = current_radiostack->get_nav1_heading() + - current_radiostack->get_nav1_magvar(); + double cur_radial = current_radiostack->get_nav1_heading(); + if ( current_radiostack->get_nav1_loc() ) { + // ILS localizers radials are already "true" in our + // database + } else { + cur_radial += current_radiostack->get_nav1_magvar(); + } if ( current_radiostack->get_nav1_from_flag() ) { cur_radial += 180.0; while ( cur_radial >= 360.0 ) { cur_radial -= 360.0; } diff --git a/src/Cockpit/radiostack.cxx b/src/Cockpit/radiostack.cxx index 62096af5d..9b93cc8bc 100644 --- a/src/Cockpit/radiostack.cxx +++ b/src/Cockpit/radiostack.cxx @@ -455,14 +455,19 @@ double FGRadioStack::get_nav1_heading_needle_deflection() const { // cout << "Radial = " << nav1_radial // << " Bearing = " << nav1_heading << endl; - while (r> 180.0) r-=360.0; - while (r<-180.0) r+=360.0; - if ( fabs(r) > 90.0 ) + while ( r > 180.0 ) { r -= 360.0;} + while ( r < -180.0 ) { r += 360.0;} + if ( fabs(r) > 90.0 ) { r = ( r<0.0 ? -r-180.0 : -r+180.0 ); + if ( nav1_loc ) { + r = -r; + } + } + // According to Robin Peel, the ILS is 4x more sensitive than a vor - if ( nav1_loc ) r *= 4.0; - if ( r < -10.0 ) r = -10.0; - if ( r > 10.0 ) r = 10.0; + if ( nav1_loc ) { r *= 4.0; } + if ( r < -10.0 ) { r = -10.0; } + if ( r > 10.0 ) { r = 10.0; } } else { r = 0.0; }