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.01 ) {
+ if ( power_btn ) {
// buttons
if ( adf_btn == 0 ) {
ant_mode = 1;
et_ann = false;
}
-
+ // formatted timer
+ double time;
+ int hours, min, sec;
+ if ( timer_mode == 0 ) {
+ time = flight_timer;
+ } else {
+ time = elapsed_timer;
+ }
+ // cout << time << endl;
+ hours = (int)(time / 3600.0);
+ time -= hours * 3600.00;
+ min = (int)(time / 60.0);
+ time -= min * 60.0;
+ sec = (int)time;
+ int big, little;
+ if ( hours > 0 ) {
+ big = hours;
+ if ( big > 99 ) {
+ big = 99;
+ }
+ little = min;
+ } else {
+ big = min;
+ little = sec;
+ }
+ if ( big > 99 ) {
+ big = 99;
+ }
+ char formatted_timer[128];
+ // cout << big << ":" << little << endl;
+ snprintf(formatted_timer, 6, "%02d:%02d", big, little);
+ fgSetString( "/radios/kr-87/outputs/timer-string", formatted_timer );
+
while ( goal_needle_deg < 0.0 ) { goal_needle_deg += 360.0; }
while ( goal_needle_deg >= 360.0 ) { goal_needle_deg -= 360.0; }
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" );
}