1
0
Fork 0

Allow auto-throttle adjustment while active.

This commit is contained in:
curt 1999-02-12 23:22:35 +00:00
parent 4793414f88
commit 4b2dfde7bf
3 changed files with 60 additions and 14 deletions

View 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.

View 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.

View 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.
//