]> git.mxchange.org Git - flightgear.git/commitdiff
Add support for KR 87 annunciators.
authorcurt <curt>
Wed, 3 Jul 2002 04:48:44 +0000 (04:48 +0000)
committercurt <curt>
Wed, 3 Jul 2002 04:48:44 +0000 (04:48 +0000)
src/Cockpit/kr_87.cxx
src/Network/atc610x.cxx
src/Network/atc610x.hxx

index d216768b55cc4a3aaa7d3be63082f9f377adf1a1..19744ffe60b8493b3c2dd8ce304f18b4350b1dda 100644 (file)
@@ -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 {
index 70e79cecdfc539b043406a71b8335942c02d9887..75f04e69879a0d6ae78a859f845b305b83807166 100644 (file)
@@ -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();
index 00da4bbce1f253667907bf5a38d9d9e0dba03c30..a10c94a5f331ea9413bb9665b6532c4bf0b13e20 100644 (file)
@@ -30,6 +30,8 @@
 
 #include <plib/netChat.h>
 
+#include <simgear/timing/timestamp.hxx>
+
 #include <Main/fg_props.hxx>
 
 #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() { }