diff --git a/src/Cockpit/kr_87.cxx b/src/Cockpit/kr_87.cxx index d216768b5..19744ffe6 100644 --- a/src/Cockpit/kr_87.cxx +++ b/src/Cockpit/kr_87.cxx @@ -258,15 +258,19 @@ FGKR_87::update(double dt) // button depressed and was last iteration too tmp_timer += dt; cout << "tmp_timer = " << tmp_timer << endl; - } - if ( set_rst_btn == 0 && set_rst_btn != last_set_rst_btn ) { - // button released if ( tmp_timer > 2.0 ) { // button held depressed for 2 seconds cout << "entering elapsed count down mode" << endl; timer_mode = 1; count_mode = 2; elapsed_timer = 0.0; + } + } + if ( set_rst_btn == 0 && set_rst_btn != last_set_rst_btn ) { + // button released + if ( tmp_timer > 2.0 ) { + // button held depressed for 2 seconds, don't adjust + // mode, just exit } else if ( count_mode == 2 ) { count_mode = 1; } else { diff --git a/src/Network/atc610x.cxx b/src/Network/atc610x.cxx index 70e79cecd..75f04e698 100644 --- a/src/Network/atc610x.cxx +++ b/src/Network/atc610x.cxx @@ -397,6 +397,8 @@ bool FGATC610x::open() { = fgGetNode( "/radios/nav[1]/frequencies/standby-mhz", true ); adf_on_off_vol = fgGetNode( "/radios/adf/on-off-volume", true ); + adf_adf_btn = fgGetNode( "/radios/adf/adf-btn", true ); + adf_bfo_btn = fgGetNode( "/radios/adf/bfo-btn", true ); adf_freq = fgGetNode( "/radios/adf/frequencies/selected-khz", true ); adf_stby_freq = fgGetNode( "/radios/adf/frequencies/standby-khz", true ); adf_stby_mode = fgGetNode( "/radios/adf/stby-mode", true ); @@ -489,12 +491,46 @@ bool FGATC610x::do_analog_in() { // Write the lights ///////////////////////////////////////////////////////////////////// -bool FGATC610x::do_lights() { +bool FGATC610x::do_lights( double dt ) { + // Marker beacons ATC610xSetLamp( lamps_fd, 4, inner->getBoolValue() ); ATC610xSetLamp( lamps_fd, 5, middle->getBoolValue() ); ATC610xSetLamp( lamps_fd, 3, outer->getBoolValue() ); + // ADF annunciators + if ( adf_on_off_vol->getDoubleValue() >= 0.01 ) { + ATC610xSetLamp( lamps_fd, 11, !adf_adf_btn->getBoolValue() ); // ANT + ATC610xSetLamp( lamps_fd, 12, adf_adf_btn->getBoolValue() ); // ADF + ATC610xSetLamp( lamps_fd, 13, adf_bfo_btn->getBoolValue() ); // BFO + ATC610xSetLamp( lamps_fd, 14, !adf_stby_mode->getBoolValue() ); // FRQ + ATC610xSetLamp( lamps_fd, 15, adf_stby_mode->getBoolValue() && + !adf_timer_mode->getBoolValue() ); // FLT + + // ET needs to blink when we are in ET set countdown time + if ( adf_count_mode->getIntValue() < 2 ) { + ATC610xSetLamp( lamps_fd, 16, adf_stby_mode->getBoolValue() && + adf_timer_mode->getBoolValue() ); // ET + } else { + et_flash_time += dt; + if ( et_flash && et_flash_time > 0.5 ) { + et_flash = false; + et_flash_time -= 0.5; + } else if ( !et_flash && et_flash_time > 0.2 ) { + et_flash = true; + et_flash_time -= 0.2; + } + ATC610xSetLamp( lamps_fd, 16, et_flash ); // ET + } + } else { + ATC610xSetLamp( lamps_fd, 11, false ); // ANT + ATC610xSetLamp( lamps_fd, 12, false ); // ADF + ATC610xSetLamp( lamps_fd, 13, false ); // BFO + ATC610xSetLamp( lamps_fd, 14, false ); // FRQ + ATC610xSetLamp( lamps_fd, 15, false ); // FLT + ATC610xSetLamp( lamps_fd, 16, false ); // ET + } + return true; } @@ -1232,12 +1268,17 @@ bool FGATC610x::do_switches() { bool FGATC610x::process() { + SGTimeStamp current; + current.stamp(); + + double dt = (double)(current - last_time_stamp) / 1000000; + last_time_stamp.stamp(); // Lock the hardware, skip if it's not ready yet if ( ATC610xLock( lock_fd ) > 0 ) { do_analog_in(); - do_lights(); + do_lights( dt ); do_radio_switches(); do_radio_display(); do_steppers(); diff --git a/src/Network/atc610x.hxx b/src/Network/atc610x.hxx index 00da4bbce..a10c94a5f 100644 --- a/src/Network/atc610x.hxx +++ b/src/Network/atc610x.hxx @@ -30,6 +30,8 @@ #include +#include + #include
#include "protocol.hxx" @@ -76,15 +78,21 @@ class FGATC610x : public FGProtocol { SGPropertyNode *com2_freq, *com2_stby_freq; 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_freq, *adf_stby_freq, *adf_stby_mode, *adf_timer_mode; + SGPropertyNode *adf_freq, *adf_stby_freq; + SGPropertyNode *adf_stby_mode, *adf_timer_mode; SGPropertyNode *adf_count_mode, *adf_flight_timer, *adf_elapsed_timer; SGPropertyNode *inner, *middle, *outer; int dme_switch; + SGTimeStamp last_time_stamp; + double et_flash_time; + bool et_flash; + bool do_analog_in(); - bool do_lights(); + bool do_lights( double dt ); bool do_radio_switches(); bool do_radio_display(); bool do_steppers(); @@ -92,7 +100,10 @@ class FGATC610x : public FGProtocol { public: - FGATC610x() { } + FGATC610x(): + et_flash_time(0.0) + { + } ~FGATC610x() { }