1
0
Fork 0

Add some formated frequency outputs to aid panel builders.

This commit is contained in:
curt 2005-01-19 02:11:28 +00:00
parent dd2ea8f77d
commit 1ad71dbbe0
2 changed files with 27 additions and 1 deletions

View file

@ -57,6 +57,8 @@ FGNavRadio::FGNavRadio(SGPropertyNode *node) :
audio_btn(true),
nav_freq(0.0),
nav_alt_freq(0.0),
fmt_freq(""),
fmt_alt_freq(""),
nav_heading(0.0),
nav_radial(0.0),
nav_target_radial(0.0),
@ -161,6 +163,14 @@ FGNavRadio::bind ()
&FGNavRadio::get_nav_alt_freq, &FGNavRadio::set_nav_alt_freq);
fgSetArchivable( (branch + "/frequencies/standby-mhz").c_str() );
fgTie( (branch + "/frequencies/selected-mhz-fmt").c_str() , this,
&FGNavRadio::get_fmt_freq, &FGNavRadio::set_fmt_freq );
fgSetArchivable( (branch + "/frequencies/selected-mhz-fmt").c_str() );
fgTie( (branch + "/frequencies/standby-mhz-fmt").c_str() , this,
&FGNavRadio::get_fmt_alt_freq, &FGNavRadio::set_fmt_alt_freq);
fgSetArchivable( (branch + "/frequencies/standby-mhz-fmt").c_str() );
fgTie( (branch + "/radials/selected-deg").c_str() , this,
&FGNavRadio::get_nav_sel_radial, &FGNavRadio::set_nav_sel_radial );
fgSetArchivable((branch + "/radials/selected-deg").c_str() );
@ -344,6 +354,14 @@ FGNavRadio::update(double dt)
Point3D station;
double az1, az2, s;
// Create "formatted" versions of the nav frequencies for
// consistant display output.
char tmp[16];
sprintf( tmp, "%.2f", nav_freq );
fmt_freq = tmp;
sprintf( tmp, "%.2f", nav_alt_freq );
fmt_alt_freq = tmp;
// On timeout, scan again
_time_before_search_sec -= dt;
if ( _time_before_search_sec < 0 ) {

View file

@ -73,6 +73,8 @@ class FGNavRadio : public SGSubsystem
bool nav_loc;
double nav_freq;
double nav_alt_freq;
string fmt_freq; // formated frequency
string fmt_alt_freq; // formated alternate frequency
double nav_heading; // true heading to nav station
double nav_radial; // current radial we are on (taking
// into consideration the vor station
@ -152,7 +154,9 @@ public:
inline void set_nav_freq( double freq ) {
nav_freq = freq; need_update = true;
}
inline void set_fmt_freq( const char *freq ) { fmt_freq = freq; }
inline void set_nav_alt_freq( double freq ) { nav_alt_freq = freq; }
inline void set_fmt_alt_freq( const char *freq ) { fmt_alt_freq = freq; }
inline void set_nav_sel_radial( double radial ) {
nav_sel_radial = radial; need_update = true;
}
@ -170,9 +174,13 @@ public:
inline bool get_power_btn() const { return power_btn; }
inline bool get_audio_btn() const { return audio_btn; }
// NAV Accessors
// NAV Accessors
inline double get_nav_freq () const { return nav_freq; }
inline const char *get_fmt_freq () const { return fmt_freq.c_str(); }
inline double get_nav_alt_freq () const { return nav_alt_freq; }
inline const char *get_fmt_alt_freq () const {
return fmt_alt_freq.c_str();
}
inline double get_nav_sel_radial() const { return nav_sel_radial; }
inline double get_nav_target_radial() const { return nav_target_radial; }
inline double get_nav_target_radial_true() const {