]> git.mxchange.org Git - flightgear.git/commitdiff
Put blinking marker beacon (bool) into the property registry for use by the
authorcurt <curt>
Thu, 29 Mar 2001 06:05:01 +0000 (06:05 +0000)
committercurt <curt>
Thu, 29 Mar 2001 06:05:01 +0000 (06:05 +0000)
panel.

src/Cockpit/radiostack.cxx
src/Cockpit/radiostack.hxx
src/Navaids/mkrbeacons.cxx
src/Sound/soundmgr.cxx

index 99263ae515724dd68f22bef6e8ed6a414dc5e516..a033cc6c65d034da130033d7edadddf34e2f19b1 100644 (file)
@@ -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" );
index 2d6d0ca48a1072416e85865b61d344996acdef2b..9a8f0f3db5c215d9822503ecc0e6552420d9e63e 100644 (file)
@@ -31,6 +31,7 @@
 #include <simgear/compiler.h>
 
 #include <simgear/math/interpolater.hxx>
+#include <simgear/timing/timestamp.hxx>
 
 #include <Navaids/ilslist.hxx>
 #include <Navaids/navlist.hxx>
@@ -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;
index 75cc2e8c6a3f1fd9b252469617e19ebd84be51eb..57f2fcd6eb8340164bb21a407223f367026b3142 100644 (file)
@@ -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;
 }
index b0154535de30867d1a72ef12f0c89604b932649c..93ff51bed649e3404cbc06a88db711dffd5c2e91 100644 (file)
@@ -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() ) {