Add some formated frequency outputs to aid panel builders.
This commit is contained in:
parent
dd2ea8f77d
commit
1ad71dbbe0
2 changed files with 27 additions and 1 deletions
|
@ -57,6 +57,8 @@ FGNavRadio::FGNavRadio(SGPropertyNode *node) :
|
||||||
audio_btn(true),
|
audio_btn(true),
|
||||||
nav_freq(0.0),
|
nav_freq(0.0),
|
||||||
nav_alt_freq(0.0),
|
nav_alt_freq(0.0),
|
||||||
|
fmt_freq(""),
|
||||||
|
fmt_alt_freq(""),
|
||||||
nav_heading(0.0),
|
nav_heading(0.0),
|
||||||
nav_radial(0.0),
|
nav_radial(0.0),
|
||||||
nav_target_radial(0.0),
|
nav_target_radial(0.0),
|
||||||
|
@ -161,6 +163,14 @@ FGNavRadio::bind ()
|
||||||
&FGNavRadio::get_nav_alt_freq, &FGNavRadio::set_nav_alt_freq);
|
&FGNavRadio::get_nav_alt_freq, &FGNavRadio::set_nav_alt_freq);
|
||||||
fgSetArchivable( (branch + "/frequencies/standby-mhz").c_str() );
|
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,
|
fgTie( (branch + "/radials/selected-deg").c_str() , this,
|
||||||
&FGNavRadio::get_nav_sel_radial, &FGNavRadio::set_nav_sel_radial );
|
&FGNavRadio::get_nav_sel_radial, &FGNavRadio::set_nav_sel_radial );
|
||||||
fgSetArchivable((branch + "/radials/selected-deg").c_str() );
|
fgSetArchivable((branch + "/radials/selected-deg").c_str() );
|
||||||
|
@ -344,6 +354,14 @@ FGNavRadio::update(double dt)
|
||||||
Point3D station;
|
Point3D station;
|
||||||
double az1, az2, s;
|
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
|
// On timeout, scan again
|
||||||
_time_before_search_sec -= dt;
|
_time_before_search_sec -= dt;
|
||||||
if ( _time_before_search_sec < 0 ) {
|
if ( _time_before_search_sec < 0 ) {
|
||||||
|
|
|
@ -73,6 +73,8 @@ class FGNavRadio : public SGSubsystem
|
||||||
bool nav_loc;
|
bool nav_loc;
|
||||||
double nav_freq;
|
double nav_freq;
|
||||||
double nav_alt_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_heading; // true heading to nav station
|
||||||
double nav_radial; // current radial we are on (taking
|
double nav_radial; // current radial we are on (taking
|
||||||
// into consideration the vor station
|
// into consideration the vor station
|
||||||
|
@ -152,7 +154,9 @@ public:
|
||||||
inline void set_nav_freq( double freq ) {
|
inline void set_nav_freq( double freq ) {
|
||||||
nav_freq = freq; need_update = true;
|
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_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 ) {
|
inline void set_nav_sel_radial( double radial ) {
|
||||||
nav_sel_radial = radial; need_update = true;
|
nav_sel_radial = radial; need_update = true;
|
||||||
}
|
}
|
||||||
|
@ -170,9 +174,13 @@ public:
|
||||||
inline bool get_power_btn() const { return power_btn; }
|
inline bool get_power_btn() const { return power_btn; }
|
||||||
inline bool get_audio_btn() const { return audio_btn; }
|
inline bool get_audio_btn() const { return audio_btn; }
|
||||||
|
|
||||||
// NAV Accessors
|
// NAV Accessors
|
||||||
inline double get_nav_freq () const { return nav_freq; }
|
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 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_sel_radial() const { return nav_sel_radial; }
|
||||||
inline double get_nav_target_radial() const { return nav_target_radial; }
|
inline double get_nav_target_radial() const { return nav_target_radial; }
|
||||||
inline double get_nav_target_radial_true() const {
|
inline double get_nav_target_radial_true() const {
|
||||||
|
|
Loading…
Reference in a new issue