Add speed-brake and spoilers controlls
This commit is contained in:
parent
1a50c56d5e
commit
60283d19bb
3 changed files with 31 additions and 3 deletions
|
@ -61,6 +61,8 @@ FGControls::FGControls() :
|
||||||
rudder_trim( 0.0 ),
|
rudder_trim( 0.0 ),
|
||||||
flaps( 0.0 ),
|
flaps( 0.0 ),
|
||||||
parking_brake( 0.0 ),
|
parking_brake( 0.0 ),
|
||||||
|
speed_brake( 0.0 ),
|
||||||
|
spoilers( 0.0 ),
|
||||||
throttle_idle( true ),
|
throttle_idle( true ),
|
||||||
gear_down( false )
|
gear_down( false )
|
||||||
{
|
{
|
||||||
|
@ -164,7 +166,13 @@ FGControls::bind ()
|
||||||
}
|
}
|
||||||
fgTie("/controls/parking-brake", this,
|
fgTie("/controls/parking-brake", this,
|
||||||
&FGControls::get_parking_brake, &FGControls::set_parking_brake);
|
&FGControls::get_parking_brake, &FGControls::set_parking_brake);
|
||||||
fgSetArchivable("/controls/parking-brake");
|
fgSetArchivable("/controls/speed-brake");
|
||||||
|
fgTie("/controls/speed-brake", this,
|
||||||
|
&FGControls::get_speed_brake, &FGControls::set_speed_brake);
|
||||||
|
fgSetArchivable("/controls/speed-brake");
|
||||||
|
fgTie("/controls/spoilers", this,
|
||||||
|
&FGControls::get_spoilers, &FGControls::set_spoilers);
|
||||||
|
fgSetArchivable("/controls/spoilers");
|
||||||
for (index = 0; index < MAX_WHEELS; index++) {
|
for (index = 0; index < MAX_WHEELS; index++) {
|
||||||
char name[32];
|
char name[32];
|
||||||
sprintf(name, "/controls/brakes[%d]", index);
|
sprintf(name, "/controls/brakes[%d]", index);
|
||||||
|
@ -519,6 +527,20 @@ FGControls::set_parking_brake( double pos )
|
||||||
CLAMP(&parking_brake, 0.0, 1.0);
|
CLAMP(&parking_brake, 0.0, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGControls::set_speed_brake( double pos )
|
||||||
|
{
|
||||||
|
speed_brake = pos;
|
||||||
|
CLAMP(&speed_brake, 0.0, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGControls::set_spoilers( double pos )
|
||||||
|
{
|
||||||
|
spoilers = pos;
|
||||||
|
CLAMP(&spoilers, 0.0, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FGControls::set_brake( int wheel, double pos )
|
FGControls::set_brake( int wheel, double pos )
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,6 +70,8 @@ private:
|
||||||
bool fuel_pump[MAX_ENGINES];
|
bool fuel_pump[MAX_ENGINES];
|
||||||
double prop_advance[MAX_ENGINES];
|
double prop_advance[MAX_ENGINES];
|
||||||
double parking_brake;
|
double parking_brake;
|
||||||
|
double speed_brake;
|
||||||
|
double spoilers;
|
||||||
double brake[MAX_WHEELS];
|
double brake[MAX_WHEELS];
|
||||||
int magnetos[MAX_ENGINES];
|
int magnetos[MAX_ENGINES];
|
||||||
bool throttle_idle;
|
bool throttle_idle;
|
||||||
|
@ -108,6 +110,8 @@ public:
|
||||||
return prop_advance[engine];
|
return prop_advance[engine];
|
||||||
}
|
}
|
||||||
inline double get_parking_brake() const { return parking_brake; }
|
inline double get_parking_brake() const { return parking_brake; }
|
||||||
|
inline double get_speed_brake() const { return speed_brake; }
|
||||||
|
inline double get_spoilers() const { return spoilers; }
|
||||||
inline double get_brake(int wheel) const { return brake[wheel]; }
|
inline double get_brake(int wheel) const { return brake[wheel]; }
|
||||||
inline int get_magnetos(int engine) const { return magnetos[engine]; }
|
inline int get_magnetos(int engine) const { return magnetos[engine]; }
|
||||||
inline bool get_starter(int engine) const { return starter[engine]; }
|
inline bool get_starter(int engine) const { return starter[engine]; }
|
||||||
|
@ -143,6 +147,8 @@ public:
|
||||||
void set_starter( int engine, bool flag );
|
void set_starter( int engine, bool flag );
|
||||||
void set_fuel_selector( int tank, bool pos );
|
void set_fuel_selector( int tank, bool pos );
|
||||||
void set_parking_brake( double pos );
|
void set_parking_brake( double pos );
|
||||||
|
void set_speed_brake( double pos );
|
||||||
|
void set_spoilers( double pos );
|
||||||
void set_brake( int wheel, double pos );
|
void set_brake( int wheel, double pos );
|
||||||
void move_brake( int wheel, double amt );
|
void move_brake( int wheel, double amt );
|
||||||
void set_gear_down( bool gear );
|
void set_gear_down( bool gear );
|
||||||
|
|
|
@ -371,8 +371,8 @@ bool FGJSBsim::copy_to_JSBsim() {
|
||||||
FCS->SetDrCmd( -globals->get_controls()->get_rudder() );
|
FCS->SetDrCmd( -globals->get_controls()->get_rudder() );
|
||||||
FCS->SetYawTrimCmd( -globals->get_controls()->get_rudder_trim() );
|
FCS->SetYawTrimCmd( -globals->get_controls()->get_rudder_trim() );
|
||||||
FCS->SetDfCmd( globals->get_controls()->get_flaps() );
|
FCS->SetDfCmd( globals->get_controls()->get_flaps() );
|
||||||
FCS->SetDsbCmd( 0.0 ); //speedbrakes
|
FCS->SetDsbCmd( globals->get_controls()->get_speed_brake() );
|
||||||
FCS->SetDspCmd( 0.0 ); //spoilers
|
FCS->SetDspCmd( globals->get_controls()->get_spoilers() );
|
||||||
|
|
||||||
// Parking brake sets minimum braking
|
// Parking brake sets minimum braking
|
||||||
// level for mains.
|
// level for mains.
|
||||||
|
|
Loading…
Reference in a new issue