From: ehofman Date: Mon, 24 Mar 2003 10:04:19 +0000 (+0000) Subject: Add speed-brake and spoilers controlls X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=60283d19bb9758e48ec110abba1f445006d795e7;p=flightgear.git Add speed-brake and spoilers controlls --- diff --git a/src/Controls/controls.cxx b/src/Controls/controls.cxx index a60ae0ca3..dc3892e20 100644 --- a/src/Controls/controls.cxx +++ b/src/Controls/controls.cxx @@ -61,6 +61,8 @@ FGControls::FGControls() : rudder_trim( 0.0 ), flaps( 0.0 ), parking_brake( 0.0 ), + speed_brake( 0.0 ), + spoilers( 0.0 ), throttle_idle( true ), gear_down( false ) { @@ -164,7 +166,13 @@ FGControls::bind () } fgTie("/controls/parking-brake", this, &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++) { char name[32]; sprintf(name, "/controls/brakes[%d]", index); @@ -519,6 +527,20 @@ FGControls::set_parking_brake( double pos ) 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 FGControls::set_brake( int wheel, double pos ) { diff --git a/src/Controls/controls.hxx b/src/Controls/controls.hxx index a58561cb9..1d7ae58e4 100644 --- a/src/Controls/controls.hxx +++ b/src/Controls/controls.hxx @@ -70,6 +70,8 @@ private: bool fuel_pump[MAX_ENGINES]; double prop_advance[MAX_ENGINES]; double parking_brake; + double speed_brake; + double spoilers; double brake[MAX_WHEELS]; int magnetos[MAX_ENGINES]; bool throttle_idle; @@ -108,6 +110,8 @@ public: return prop_advance[engine]; } 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 int get_magnetos(int engine) const { return magnetos[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_fuel_selector( int tank, bool 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 move_brake( int wheel, double amt ); void set_gear_down( bool gear ); diff --git a/src/FDM/JSBSim/JSBSim.cxx b/src/FDM/JSBSim/JSBSim.cxx index aaa08ef87..7e7be7416 100644 --- a/src/FDM/JSBSim/JSBSim.cxx +++ b/src/FDM/JSBSim/JSBSim.cxx @@ -371,8 +371,8 @@ bool FGJSBsim::copy_to_JSBsim() { FCS->SetDrCmd( -globals->get_controls()->get_rudder() ); FCS->SetYawTrimCmd( -globals->get_controls()->get_rudder_trim() ); FCS->SetDfCmd( globals->get_controls()->get_flaps() ); - FCS->SetDsbCmd( 0.0 ); //speedbrakes - FCS->SetDspCmd( 0.0 ); //spoilers + FCS->SetDsbCmd( globals->get_controls()->get_speed_brake() ); + FCS->SetDspCmd( globals->get_controls()->get_spoilers() ); // Parking brake sets minimum braking // level for mains.