From: curt Date: Thu, 29 Mar 2001 06:05:01 +0000 (+0000) Subject: Put blinking marker beacon (bool) into the property registry for use by the X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4fc7f6d09704285d82854baecd18309743c5278b;p=flightgear.git Put blinking marker beacon (bool) into the property registry for use by the panel. --- diff --git a/src/Cockpit/radiostack.cxx b/src/Cockpit/radiostack.cxx index 99263ae51..a033cc6c6 100644 --- a/src/Cockpit/radiostack.cxx +++ b/src/Cockpit/radiostack.cxx @@ -103,6 +103,7 @@ FGRadioStack::init () { morse.init(); beacon.init(); + blink.stamp(); search(); update(); @@ -196,6 +197,13 @@ FGRadioStack::bind () fgTie("/radios/adf/ident", this, &FGRadioStack::get_adf_ident_btn, &FGRadioStack::set_adf_ident_btn); + + fgTie("/radios/marker-beacons/inner", this, + &FGRadioStack::get_inner_blink); + fgTie("/radios/marker-beacons/middle", this, + &FGRadioStack::get_middle_blink); + fgTie("/radios/marker-beacons/outer", this, + &FGRadioStack::get_outer_blink); } void @@ -234,6 +242,10 @@ FGRadioStack::unbind () fgUntie("/radios/adf/rotation"); fgUntie("/radios/adf/on"); fgUntie("/radios/adf/ident"); + + fgUntie("/radios/marker-beacons/inner"); + fgUntie("/radios/marker-beacons/middle"); + fgUntie("/radios/marker-beacons/outer"); } @@ -545,6 +557,39 @@ FGRadioStack::update() globals->get_soundmgr()->stop( "adf-ident" ); } } + + // marker beacon blinking + bool light_on = ( outer_blink || middle_blink || inner_blink ); + SGTimeStamp current; + current.stamp(); + + if ( light_on && (current - blink > 400000) ) { + light_on = false; + blink.stamp(); + } else if ( !light_on && (current - blink > 100000) ) { + light_on = true; + blink.stamp(); + } + + if ( outer_marker ) { + outer_blink = light_on; + } else { + outer_blink = false; + } + + if ( middle_marker ) { + middle_blink = light_on; + } else { + middle_blink = false; + } + + if ( inner_marker ) { + inner_blink = light_on; + } else { + inner_blink = false; + } + + cout << outer_blink << " " << middle_blink << " " << inner_blink << endl; } @@ -817,7 +862,7 @@ void FGRadioStack::search() if ( beacon_type == FGMkrBeacon::OUTER ) { outer_marker = true; - cout << "OUTER MARKER" << endl; + // cout << "OUTER MARKER" << endl; if ( last_beacon != FGMkrBeacon::OUTER ) { if ( ! globals->get_soundmgr()->exists( "outer-marker" ) ) { FGSimpleSound *sound = beacon.get_outer(); @@ -830,7 +875,7 @@ void FGRadioStack::search() } } else if ( beacon_type == FGMkrBeacon::MIDDLE ) { middle_marker = true; - cout << "MIDDLE MARKER" << endl; + // cout << "MIDDLE MARKER" << endl; if ( last_beacon != FGMkrBeacon::MIDDLE ) { if ( ! globals->get_soundmgr()->exists( "middle-marker" ) ) { FGSimpleSound *sound = beacon.get_middle(); @@ -843,7 +888,7 @@ void FGRadioStack::search() } } else if ( beacon_type == FGMkrBeacon::INNER ) { inner_marker = true; - cout << "INNER MARKER" << endl; + // cout << "INNER MARKER" << endl; if ( last_beacon != FGMkrBeacon::INNER ) { if ( ! globals->get_soundmgr()->exists( "inner-marker" ) ) { FGSimpleSound *sound = beacon.get_inner(); @@ -855,7 +900,7 @@ void FGRadioStack::search() } } } else { - cout << "no marker" << endl; + // cout << "no marker" << endl; globals->get_soundmgr()->stop( "outer-marker" ); globals->get_soundmgr()->stop( "middle-marker" ); globals->get_soundmgr()->stop( "inner-marker" ); diff --git a/src/Cockpit/radiostack.hxx b/src/Cockpit/radiostack.hxx index 2d6d0ca48..9a8f0f3db 100644 --- a/src/Cockpit/radiostack.hxx +++ b/src/Cockpit/radiostack.hxx @@ -31,6 +31,7 @@ #include #include +#include #include #include @@ -133,6 +134,11 @@ class FGRadioStack : public FGSubsystem bool middle_marker; bool inner_marker; + SGTimeStamp blink; + bool outer_blink; + bool middle_blink; + bool inner_blink; + string adf_ident; string adf_trans_ident; bool adf_valid; @@ -233,6 +239,11 @@ public: inline double get_adf_alt_freq () const { return adf_alt_freq; } inline double get_adf_rotation () const { return adf_rotation; } + // Marker Beacon Accessors + inline bool get_inner_blink () const { return inner_blink; } + inline bool get_middle_blink () const { return middle_blink; } + inline bool get_outer_blink () const { return outer_blink; } + // Calculated values. inline bool get_nav1_inrange() const { return nav1_inrange; } bool get_nav1_to_flag () const; diff --git a/src/Navaids/mkrbeacons.cxx b/src/Navaids/mkrbeacons.cxx index 75cc2e8c6..57f2fcd6e 100644 --- a/src/Navaids/mkrbeacons.cxx +++ b/src/Navaids/mkrbeacons.cxx @@ -204,14 +204,14 @@ FGMkrBeacon::fgMkrBeacType FGMarkerBeacons::query( double lon, double lat, // match up to twice the published range so we can model // reduced signal strength if ( d < maxrange2 ) { - cout << "lon = " << lon << " lat = " << lat - << " closest beacon = " << sqrt( min_dist ) << endl; + // cout << "lon = " << lon << " lat = " << lat + // << " closest beacon = " << sqrt( min_dist ) << endl; return current->get_type(); } } - cout << "lon = " << lon << " lat = " << lat - << " closest beacon = " << sqrt( min_dist ) << endl; + // cout << "lon = " << lon << " lat = " << lat + // << " closest beacon = " << sqrt( min_dist ) << endl; return FGMkrBeacon::NOBEACON; } diff --git a/src/Sound/soundmgr.cxx b/src/Sound/soundmgr.cxx index b0154535d..93ff51bed 100644 --- a/src/Sound/soundmgr.cxx +++ b/src/Sound/soundmgr.cxx @@ -126,7 +126,7 @@ bool FGSoundMgr::update() { if ( safety > 0.5 ) { safety = 0.5; } - cout << "safety = " << safety << endl; + // cout << "safety = " << safety << endl; audio_sched -> setSafetyMargin ( 2 * safety ) ; if ( !audio_sched->not_working() ) {