timer_mode(0),
count_mode(0),
rotation(0),
- on_off_vol_btn(0.5),
+ power_btn(true),
+ vol_btn(0.5),
adf_btn(true),
bfo_btn(false),
frq_btn(false),
fgTie("/radios/kr-87/inputs/rotation-deg", this,
&FGKR_87::get_rotation, &FGKR_87::set_rotation);
fgSetArchivable("/radios/kr-87/inputs/rotation-deg");
- fgTie("/radios/kr-87/inputs/on-off-volume", this,
- &FGKR_87::get_on_off_vol_btn,
- &FGKR_87::set_on_off_vol_btn);
- fgSetArchivable("/radios/kr-87/inputs/on-off-volume");
+ fgTie("/radios/kr-87/inputs/power-btn", this,
+ &FGKR_87::get_power_btn,
+ &FGKR_87::set_power_btn);
+ fgSetArchivable("/radios/kr-87/inputs/power-btn");
+ fgTie("/radios/kr-87/inputs/volume", this,
+ &FGKR_87::get_vol_btn,
+ &FGKR_87::set_vol_btn);
+ fgSetArchivable("/radios/kr-87/inputs/volume");
fgTie("/radios/kr-87/inputs/adf-btn", this,
&FGKR_87::get_adf_btn,
&FGKR_87::set_adf_btn);
// input and buttons
fgUntie("/radios/kr-87/inputs/rotation-deg");
- fgUntie("/radios/kr-87/inputs/on-off-volume");
+ fgUntie("/radios/kr-87/inputs/power-btn");
+ fgUntie("/radios/kr-87/inputs/volume");
fgUntie("/radios/kr-87/inputs/adf-btn");
fgUntie("/radios/kr-87/inputs/bfo-btn");
fgUntie("/radios/kr-87/inputs/frq-btn");
// Radio
////////////////////////////////////////////////////////////////////////
- if ( on_off_vol_btn >= 0.05 ) {
+ if ( power_btn ) {
// buttons
if ( adf_btn == 0 ) {
ant_mode = 1;
if ( valid && inrange ) {
// play station ident via audio system if on + ident_btn,
// otherwise turn it off
- if ( on_off_vol_btn >= 0.01 && ident_btn ) {
+ if ( vol_btn >= 0.01 && ident_btn ) {
FGSimpleSound *sound;
sound = globals->get_soundmgr()->find( "adf-ident" );
if ( sound != NULL ) {
- sound->set_volume( on_off_vol_btn );
+ sound->set_volume( vol_btn );
} else {
SG_LOG( SG_COCKPIT, SG_ALERT, "Can't find adf-ident sound" );
}
// input and buttons
double rotation; // compass faceplace rotation
- double on_off_vol_btn;
+ bool power_btn; // 0 = off, 1 = powered
+ double vol_btn;
bool adf_btn; // 0 = normal, 1 = depressed
bool bfo_btn; // 0 = normal, 1 = depressed
bool frq_btn; // 0 = normal, 1 = depressed
// input and buttons
inline double get_rotation () const { return rotation; }
inline void set_rotation( double rot ) { rotation = rot; }
- inline double get_on_off_vol_btn() const { return on_off_vol_btn; }
- inline void set_on_off_vol_btn( double val ) {
+ inline bool get_power_btn() const { return power_btn; }
+ inline void set_power_btn( bool val ) {
+ power_btn = val;
+ }
+ inline double get_vol_btn() const { return vol_btn; }
+ inline void set_vol_btn( double val ) {
if ( val < 0.0 ) val = 0.0;
if ( val > 1.0 ) val = 1.0;
- on_off_vol_btn = val;
+ vol_btn = val;
}
inline bool get_adf_btn() const { return adf_btn; }
inline void set_adf_btn( bool val ) { adf_btn = val; }
nav2_stby_freq
= fgGetNode( "/radios/nav[1]/frequencies/standby-mhz", true );
- adf_on_off_vol = fgGetNode( "/radios/kr-87/inputs/on-off-volume", true );
+ adf_power = fgGetNode( "/radios/kr-87/inputs/power-btn", true );
+ adf_vol = fgGetNode( "/radios/kr-87/inputs/volume", true );
adf_adf_btn = fgGetNode( "/radios/kr-87/inputs/adf-btn", true );
adf_bfo_btn = fgGetNode( "/radios/kr-87/inputs/bfo-btn", true );
adf_freq = fgGetNode( "/radios/kr-87/outputs/selected-khz", true );
// adf volume
tmp = (float)analog_in_data[26] / 1024.0f;
- fgSetFloat( "/radios/kr-87/inputs/on-off-volume", tmp );
+ fgSetFloat( "/radios/kr-87/inputs/volume", tmp );
// nav2 obs tuner
tmp = (float)analog_in_data[29] * 360.0f / 1024.0f;
!(radio_switch_data[23] >> 3 & 0x01) );
fgSetInt( "/radios/kr-87/inputs/set-rst-btn",
!(radio_switch_data[23] >> 4 & 0x01) );
+ fgSetInt( "/radios/kr-87/inputs/power-btn",
+ radio_switch_data[23] >> 4 & 0x01 );
/* cout << "adf = " << !(radio_switch_data[23] & 0x01)
<< " bfo = " << !(radio_switch_data[23] >> 1 & 0x01)
<< " stby = " << !(radio_switch_data[23] >> 2 & 0x01)
// turns on the decimal point
// ADF standby frequency / timer
- if ( adf_on_off_vol->getDoubleValue() >= 0.01 ) {
+ if ( adf_vol->getDoubleValue() >= 0.01 ) {
if ( adf_stby_mode->getIntValue() == 0 ) {
// frequency
float adf_stby = adf_stby_freq->getFloatValue();
SGPropertyNode *nav1_freq, *nav1_stby_freq;
SGPropertyNode *nav2_freq, *nav2_stby_freq;
SGPropertyNode *adf_adf_btn, *adf_bfo_btn;
- SGPropertyNode *adf_on_off_vol;
+ SGPropertyNode *adf_power, *adf_vol;
SGPropertyNode *adf_freq, *adf_stby_freq;
SGPropertyNode *adf_stby_mode, *adf_timer_mode;
SGPropertyNode *adf_count_mode, *adf_flight_timer, *adf_elapsed_timer;