]> git.mxchange.org Git - flightgear.git/commitdiff
Allow auto-throttle adjustment while active.
authorcurt <curt>
Fri, 12 Feb 1999 23:22:35 +0000 (23:22 +0000)
committercurt <curt>
Fri, 12 Feb 1999 23:22:35 +0000 (23:22 +0000)
Autopilot/autopilot.cxx
Autopilot/autopilot.hxx
Main/GLUTkey.cxx

index d556aa7cb8923de529ef0363b8a8d6a1d43e45da..76c8d37374c3e63d1f824c8cd9f3a9102d399cad 100644 (file)
@@ -116,21 +116,31 @@ bool fgAPHeadingEnabled( void )
     fgAPDataPtr APData;
        
     APData = APDataGlobal;
-    // end section
                
     // heading hold enabled?
-    return( APData->heading_hold );
+    return APData->heading_hold;
 }
+
 bool fgAPAltitudeEnabled( void )
 {
     fgAPDataPtr APData;
        
     APData = APDataGlobal;
-    // end section
                
     // altitude hold or terrain follow enabled?
-    return( APData->altitude_hold || APData->terrain_follow );
+    return APData->altitude_hold || APData->terrain_follow ;
+}
+
+bool fgAPAutoThrottleEnabled( void )
+{
+    fgAPDataPtr APData;
+       
+    APData = APDataGlobal;
+
+    // autothrottle enabled?
+    return APData->auto_throttle;
 }
+
 void fgAPAltitudeAdjust( double inc )
 {
     // Remove at a later date
@@ -156,19 +166,28 @@ void fgAPAltitudeAdjust( double inc )
        target_agl *= FEET_TO_METER;
     }
 
-    // heading hold enabled?
     APData->TargetAltitude = target_alt;
     APData->TargetAGL = target_agl;
 }
+
 void fgAPHeadingAdjust( double inc )
 {
     fgAPDataPtr APData;
-       
     APData = APDataGlobal;
-    // end section
-               
-    // heading hold enabled?
-    APData->TargetHeading = NormalizeDegrees(APData->TargetHeading + inc);
+
+    double target = (int)(APData->TargetHeading / inc) * inc + inc;
+
+    APData->TargetHeading = NormalizeDegrees(target);
+}
+
+void fgAPAutoThrottleAdjust( double inc )
+{
+    fgAPDataPtr APData;
+    APData = APDataGlobal;
+
+    double target = (int)(APData->TargetSpeed / inc) * inc + inc;
+
+    APData->TargetSpeed = target;
 }
 
 void fgAPInit( fgAIRCRAFT *current_aircraft )
@@ -562,6 +581,9 @@ double NormalizeDegrees(double Input)
 
 
 // $Log$
+// Revision 1.15  1999/02/12 23:22:35  curt
+// Allow auto-throttle adjustment while active.
+//
 // Revision 1.14  1999/02/12 22:17:14  curt
 // Changes contributed by Norman Vine to allow adjustment of the autopilot
 // while it is activated.
index 45e11757cecb3c9dca01af46ba4da3b05f1f774f..18235c73520cfe585fbb589dfb97d6b55d2a5a6d 100644 (file)
@@ -73,14 +73,19 @@ void fgAPToggleAutoThrottle( void );
 
 bool fgAPAltitudeEnabled( void );
 bool fgAPHeadingEnabled( void );
+bool fgAPAutoThrottleEnabled( void );
 void fgAPAltitudeAdjust( double inc );
 void fgAPHeadingAdjust( double inc );
+void fgAPAutoThrottleAdjust( double inc );
 
 
 #endif // _AUTOPILOT_HXX
 
 
 // $Log$
+// Revision 1.9  1999/02/12 23:22:36  curt
+// Allow auto-throttle adjustment while active.
+//
 // Revision 1.8  1999/02/12 22:17:15  curt
 // Changes contributed by Norman Vine to allow adjustment of the autopilot
 // while it is activated.
index 3799d9e25086a815fdfc6d83d27557ba5d99c210..e04a1db54aa40963ff569e88103964bfe457789f 100644 (file)
@@ -221,10 +221,18 @@ void GLUTkey(unsigned char k, int x, int y) {
            controls.set_rudder(0.0);
            return;
        case 57: // numeric keypad 9 (Pg Up)
-           controls.move_throttle( FGControls::ALL_ENGINES, 0.01 );
+           if( fgAPAutoThrottleEnabled() ) {
+               fgAPAutoThrottleAdjust( 5 );
+           } else {
+               controls.move_throttle( FGControls::ALL_ENGINES, 0.01 );
+           }
            return;
        case 51: // numeric keypad 3 (Pg Dn)
-           controls.move_throttle( FGControls::ALL_ENGINES, -0.01 );
+           if( fgAPAutoThrottleEnabled() ) {
+               fgAPAutoThrottleAdjust( -5 );
+           } else {
+               controls.move_throttle( FGControls::ALL_ENGINES, -0.01 );
+           }
            return;
        case 98: // b key
            int b_ret;
@@ -407,10 +415,18 @@ void GLUTspecialkey(int k, int x, int y) {
            controls.set_rudder(0.0);
            return;
        case GLUT_KEY_PAGE_UP: // numeric keypad 9 (Pg Up)
-           controls.move_throttle( FGControls::ALL_ENGINES, 0.01 );
+           if( fgAPAutoThrottleEnabled() ) {
+               fgAPAutoThrottleAdjust( 5 );
+           } else {
+               controls.move_throttle( FGControls::ALL_ENGINES, 0.01 );
+           }
            return;
        case GLUT_KEY_PAGE_DOWN: // numeric keypad 3 (Pg Dn)
-           controls.move_throttle( FGControls::ALL_ENGINES, -0.01 );
+           if( fgAPAutoThrottleEnabled() ) {
+               fgAPAutoThrottleAdjust( -5 );
+           } else {
+               controls.move_throttle( FGControls::ALL_ENGINES, -0.01 );
+           }
            return;
        }
     }
@@ -418,6 +434,9 @@ void GLUTspecialkey(int k, int x, int y) {
 
 
 // $Log$
+// Revision 1.41  1999/02/12 23:22:43  curt
+// Allow auto-throttle adjustment while active.
+//
 // Revision 1.40  1999/02/12 22:17:59  curt
 // Changes to allow adjustment of the autopilot settings while it is activated.
 //