Put blinking marker beacon (bool) into the property registry for use by the
panel.
This commit is contained in:
parent
f8e234bb27
commit
4fc7f6d097
4 changed files with 65 additions and 9 deletions
|
@ -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" );
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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() ) {
|
||||
|
|
Loading…
Reference in a new issue