]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/kr_87.cxx
Tidy up the autoconf/automake configuration a bit.
[flightgear.git] / src / Cockpit / kr_87.cxx
index 611f367c121c56f0b0495b14f69472b165ff0efb..a675f1adc57cc4605c004929ae66089eb99c332c 100644 (file)
@@ -76,6 +76,8 @@ FGKR_87::FGKR_87() :
     need_update(true),
     valid(false),
     inrange(false),
+    dist(0.0),
+    heading(0.0),
     goal_needle_deg(0.0),
     et_flash_time(0.0),
     ant_mode(0),
@@ -252,7 +254,7 @@ void FGKR_87::update( double dt ) {
     // Radio
     ////////////////////////////////////////////////////////////////////////
 
-    if ( on_off_vol_btn >= 0.01 ) {
+    if ( on_off_vol_btn >= 0.05 ) {
         // buttons
         if ( adf_btn == 0 ) {
             ant_mode = 1;
@@ -395,7 +397,39 @@ void FGKR_87::update( double dt ) {
         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; }