1 // controls.cxx -- defines a standard interface to all flight sim controls
3 // Written by Curtis Olson, started May 1997.
5 // Copyright (C) 1997 Curtis L. Olson - http://www.flightgear.org/~curt
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 #include <Main/fg_props.hxx>
28 #include <simgear/sg_inlines.h>
29 #include "controls.hxx"
31 ////////////////////////////////////////////////////////////////////////
32 // Implementation of FGControls.
33 ////////////////////////////////////////////////////////////////////////
36 FGControls::FGControls() :
51 throttle_idle( true ),
55 copilot_brake_left( 0.0 ),
56 copilot_brake_right( 0.0 ),
59 nose_wheel_steering( true ),
64 catapult_launch_cmd( false ),
65 tailwheel_lock( true ),
70 battery_switch( true ),
71 external_power( false ),
72 APU_generator( false ),
83 instruments_norm( 0.0 ),
88 vertical_adjust( 0.0 ),
89 fore_aft_adjust( 0.0 ),
91 APU_fire_switch( false ),
92 autothrottle_arm( false ),
93 autothrottle_engage( false ),
94 heading_select( 0.0 ),
95 altitude_select( 50000.0 ),
96 bank_angle_select( 30.0 ),
97 vertical_speed_select( 0.0 ),
106 void FGControls::reset_all()
109 set_aileron_trim( 0.0 );
111 set_elevator_trim( 0.0 );
113 set_rudder_trim( 0.0 );
116 set_speedbrake( 0.0 );
117 set_wing_sweep( 0.0 );
120 set_throttle( ALL_ENGINES, 0.0 );
121 set_starter( ALL_ENGINES, false );
122 set_magnetos( ALL_ENGINES, 0 );
123 set_fuel_pump( ALL_ENGINES, false );
124 set_fire_switch( ALL_ENGINES, false );
125 set_fire_bottle_discharge( ALL_ENGINES, false );
126 set_cutoff( ALL_ENGINES, true );
127 set_nitrous_injection( ALL_ENGINES, false );
128 set_cowl_flaps_norm( ALL_ENGINES, 1.0 );
129 set_feather( ALL_ENGINES, false );
130 set_ignition( ALL_ENGINES, false );
131 set_augmentation( ALL_ENGINES, false );
132 set_reverser( ALL_ENGINES, false );
133 set_water_injection( ALL_ENGINES, false );
134 set_condition( ALL_ENGINES, 1.0 );
135 throttle_idle = true;
136 set_fuel_selector( ALL_TANKS, true );
139 nose_wheel_steering = true;
143 catapult_launch_cmd = false;
144 tailwheel_lock = true;
145 set_carb_heat( ALL_ENGINES, false );
146 set_inlet_heat( ALL_ENGINES, false );
151 set_engine_pump( ALL_HYD_SYSTEMS, true );
152 set_electric_pump( ALL_HYD_SYSTEMS, true );
153 landing_lights = false;
154 turn_off_lights = false;
156 set_ejection_seat( ALL_EJECTION_SEATS, false );
157 set_eseat_status( ALL_EJECTION_SEATS, SEAT_SAFED );
158 set_cmd_selector_valve( CMD_SEL_NORM );
159 APU_fire_switch = false;
160 autothrottle_arm = false;
161 autothrottle_engage = false;
162 set_autopilot_engage( ALL_AUTOPILOTS, false );
167 FGControls::~FGControls() {
174 throttle_idle = true;
175 for ( int engine = 0; engine < MAX_ENGINES; engine++ ) {
176 throttle[engine] = 0.0;
177 mixture[engine] = 1.0;
178 fuel_pump[engine] = false;
179 prop_advance[engine] = 1.0;
180 magnetos[engine] = 0;
181 feed_tank[engine] = -1; // set to -1 to turn off all tanks 0 feeds all engines from center body tank
182 starter[engine] = false;
183 feather[engine] = false;
184 ignition[engine] = false;
185 fire_switch[engine] = false;
186 fire_bottle_discharge[engine] = false;
187 cutoff[engine] = true;
188 augmentation[engine] = false;
189 reverser[engine] = false;
190 water_injection[engine] = false;
191 nitrous_injection[engine] = false;
192 cowl_flaps_norm[engine] = 0.0;
193 condition[engine] = 1.0;
194 carb_heat[engine] = false;
195 inlet_heat[engine] = false;
196 generator_breaker[engine] = false;
197 bus_tie[engine] = false;
198 engine_bleed[engine] = false;
201 for ( int tank = 0; tank < MAX_TANKS; tank++ ) {
202 fuel_selector[tank] = false;
207 for( int pump = 0; pump < MAX_TANKS * MAX_BOOSTPUMPS; pump++ ) {
208 boost_pump[pump] = false;
211 brake_left = brake_right
212 = copilot_brake_left = copilot_brake_right
213 = brake_parking = 0.0;
214 for ( int wheel = 0; wheel < MAX_WHEELS; wheel++ ) {
215 alternate_extension[wheel] = false;
218 auto_coordination = fgGetNode("/controls/flight/auto-coordination", true);
219 auto_coordination_factor = fgGetNode("/controls/flight/auto-coordination-factor", false );
220 if( NULL == auto_coordination_factor ) {
221 auto_coordination_factor = fgGetNode("/controls/flight/auto-coordination-factor", true );
222 auto_coordination_factor->setDoubleValue( 0.5 );
226 static inline void _SetRoot( simgear::TiedPropertyList & tiedProperties, const char * root, int index = 0 )
228 tiedProperties.setRoot( fgGetNode( root, index, true ) );
237 _SetRoot( _tiedProperties, "/controls/flight" );
239 _tiedProperties.Tie( "aileron", this, &FGControls::get_aileron, &FGControls::set_aileron )
240 ->setAttribute( SGPropertyNode::ARCHIVE, true );
242 _tiedProperties.Tie( "aileron-trim", this, &FGControls::get_aileron_trim, &FGControls::set_aileron_trim )
243 ->setAttribute( SGPropertyNode::ARCHIVE, true );
245 _tiedProperties.Tie( "elevator", this, &FGControls::get_elevator, &FGControls::set_elevator )
246 ->setAttribute( SGPropertyNode::ARCHIVE, true );
248 _tiedProperties.Tie( "elevator-trim", this, &FGControls::get_elevator_trim, &FGControls::set_elevator_trim )
249 ->setAttribute( SGPropertyNode::ARCHIVE, true );
251 _tiedProperties.Tie( "rudder", this, &FGControls::get_rudder, &FGControls::set_rudder )
252 ->setAttribute( SGPropertyNode::ARCHIVE, true );
254 _tiedProperties.Tie( "rudder-trim", this, &FGControls::get_rudder_trim, &FGControls::set_rudder_trim )
255 ->setAttribute( SGPropertyNode::ARCHIVE, true );
257 _tiedProperties.Tie( "flaps", this, &FGControls::get_flaps, &FGControls::set_flaps )
258 ->setAttribute( SGPropertyNode::ARCHIVE, true );
260 _tiedProperties.Tie( "slats", this, &FGControls::get_slats, &FGControls::set_slats )
261 ->setAttribute( SGPropertyNode::ARCHIVE, true );
263 _tiedProperties.Tie( "BLC", this, &FGControls::get_BLC, &FGControls::set_BLC )
264 ->setAttribute( SGPropertyNode::ARCHIVE, true );
266 _tiedProperties.Tie( "spoilers", this, &FGControls::get_spoilers, &FGControls::set_spoilers )
267 ->setAttribute( SGPropertyNode::ARCHIVE, true );
269 _tiedProperties.Tie( "speedbrake", this, &FGControls::get_speedbrake, &FGControls::set_speedbrake )
270 ->setAttribute( SGPropertyNode::ARCHIVE, true );
272 _tiedProperties.Tie( "wing-sweep", this, &FGControls::get_wing_sweep, &FGControls::set_wing_sweep )
273 ->setAttribute( SGPropertyNode::ARCHIVE, true );
275 _tiedProperties.Tie( "wing-fold", this, &FGControls::get_wing_fold, &FGControls::set_wing_fold )
276 ->setAttribute( SGPropertyNode::ARCHIVE, true );
278 _tiedProperties.Tie( "drag-chute", this, &FGControls::get_drag_chute, &FGControls::set_drag_chute )
279 ->setAttribute( SGPropertyNode::ARCHIVE, true );
282 _tiedProperties.setRoot( fgGetNode("/controls/engines", true ) );
284 _tiedProperties.Tie( "throttle_idle", this, &FGControls::get_throttle_idle, &FGControls::set_throttle_idle )
285 ->setAttribute( SGPropertyNode::ARCHIVE, true );
287 for (index = 0; index < MAX_ENGINES; index++) {
288 _SetRoot(_tiedProperties, "/controls/engines/engine", index );
290 _tiedProperties.Tie( "throttle", this, index, &FGControls::get_throttle, &FGControls::set_throttle )
291 ->setAttribute( SGPropertyNode::ARCHIVE, true );
293 _tiedProperties.Tie( "starter", this, index, &FGControls::get_starter, &FGControls::set_starter )
294 ->setAttribute( SGPropertyNode::ARCHIVE, true );
296 _tiedProperties.Tie( "fuel-pump", this, index, &FGControls::get_fuel_pump, &FGControls::set_fuel_pump )
297 ->setAttribute( SGPropertyNode::ARCHIVE, true );
299 _tiedProperties.Tie( "fire-switch", this, index, &FGControls::get_fire_switch, &FGControls::set_fire_switch )
300 ->setAttribute( SGPropertyNode::ARCHIVE, true );
302 _tiedProperties.Tie( "fire-bottle-discharge", this, index, &FGControls::get_fire_bottle_discharge, &FGControls::set_fire_bottle_discharge )
303 ->setAttribute( SGPropertyNode::ARCHIVE, true );
305 _tiedProperties.Tie( "cutoff", this, index, &FGControls::get_cutoff, &FGControls::set_cutoff )
306 ->setAttribute( SGPropertyNode::ARCHIVE, true );
308 _tiedProperties.Tie( "mixture", this, index, &FGControls::get_mixture, &FGControls::set_mixture )
309 ->setAttribute( SGPropertyNode::ARCHIVE, true );
311 _tiedProperties.Tie( "propeller-pitch", this, index, &FGControls::get_prop_advance, &FGControls::set_prop_advance )
312 ->setAttribute( SGPropertyNode::ARCHIVE, true );
314 _tiedProperties.Tie( "magnetos", this, index, &FGControls::get_magnetos, &FGControls::set_magnetos )
315 ->setAttribute( SGPropertyNode::ARCHIVE, true );
317 _tiedProperties.Tie( "feed_tank", this, index, &FGControls::get_feed_tank, &FGControls::set_feed_tank )
318 ->setAttribute( SGPropertyNode::ARCHIVE, true );
320 _tiedProperties.Tie( "WEP", this, index, &FGControls::get_nitrous_injection, &FGControls::set_nitrous_injection )
321 ->setAttribute( SGPropertyNode::ARCHIVE, true );
323 _tiedProperties.Tie( "cowl-flaps-norm", this, index, &FGControls::get_cowl_flaps_norm, &FGControls::set_cowl_flaps_norm )
324 ->setAttribute( SGPropertyNode::ARCHIVE, true );
326 _tiedProperties.Tie( "propeller-feather", this, index, &FGControls::get_feather, &FGControls::set_feather )
327 ->setAttribute( SGPropertyNode::ARCHIVE, true );
329 _tiedProperties.Tie( "ignition", this, index, &FGControls::get_ignition, &FGControls::set_ignition )
330 ->setAttribute( SGPropertyNode::ARCHIVE, true );
332 _tiedProperties.Tie( "augmentation", this, index, &FGControls::get_augmentation, &FGControls::set_augmentation )
333 ->setAttribute( SGPropertyNode::ARCHIVE, true );
335 _tiedProperties.Tie( "reverser", this, index, &FGControls::get_reverser, &FGControls::set_reverser )
336 ->setAttribute( SGPropertyNode::ARCHIVE, true );
338 _tiedProperties.Tie( "water-injection", this, index, &FGControls::get_water_injection, &FGControls::set_water_injection )
339 ->setAttribute( SGPropertyNode::ARCHIVE, true );
341 _tiedProperties.Tie( "condition", this, index, &FGControls::get_condition, &FGControls::set_condition )
342 ->setAttribute( SGPropertyNode::ARCHIVE, true );
346 _SetRoot( _tiedProperties, "/controls/fuel" );
348 _tiedProperties.Tie( "dump-valve", this, &FGControls::get_dump_valve, &FGControls::set_dump_valve)
349 ->setAttribute( SGPropertyNode::ARCHIVE, true );
351 for (index = 0; index < MAX_TANKS; index++) {
352 _SetRoot( _tiedProperties, "/controls/fuel/tank", index );
354 _tiedProperties.Tie( "fuel_selector", this, index, &FGControls::get_fuel_selector, &FGControls::set_fuel_selector)
355 ->setAttribute( SGPropertyNode::ARCHIVE, true );
357 _tiedProperties.Tie( "to_engine", this, index, &FGControls::get_to_engine, &FGControls::set_to_engine)
358 ->setAttribute( SGPropertyNode::ARCHIVE, true );
360 _tiedProperties.Tie( "to_tank", this, index, &FGControls::get_to_tank, &FGControls::set_to_tank)
361 ->setAttribute( SGPropertyNode::ARCHIVE, true );
363 for (i = 0; i < MAX_BOOSTPUMPS; i++) {
364 _tiedProperties.Tie( "boost-pump", i,
365 this, index * 2 + i, &FGControls::get_boost_pump, &FGControls::set_boost_pump)
366 ->setAttribute( SGPropertyNode::ARCHIVE, true );
371 _SetRoot( _tiedProperties, "/controls/gear" );
373 _tiedProperties.Tie( "brake-left", this, &FGControls::get_brake_left, &FGControls::set_brake_left)
374 ->setAttribute( SGPropertyNode::ARCHIVE, true );
376 _tiedProperties.Tie( "brake-right", this, &FGControls::get_brake_right, &FGControls::set_brake_right)
377 ->setAttribute( SGPropertyNode::ARCHIVE, true );
379 _tiedProperties.Tie( "copilot-brake-left", this, &FGControls::get_copilot_brake_left, &FGControls::set_copilot_brake_left)
380 ->setAttribute( SGPropertyNode::ARCHIVE, true );
382 _tiedProperties.Tie( "copilot-brake-right", this, &FGControls::get_copilot_brake_right, &FGControls::set_copilot_brake_right)
383 ->setAttribute( SGPropertyNode::ARCHIVE, true );
385 _tiedProperties.Tie( "brake-parking", this, &FGControls::get_brake_parking, &FGControls::set_brake_parking)
386 ->setAttribute( SGPropertyNode::ARCHIVE, true );
388 _tiedProperties.Tie( "steering", this, &FGControls::get_steering, &FGControls::set_steering)
389 ->setAttribute( SGPropertyNode::ARCHIVE, true );
391 _tiedProperties.Tie( "nose-wheel-steering", this, &FGControls::get_nose_wheel_steering, &FGControls::set_nose_wheel_steering)
392 ->setAttribute( SGPropertyNode::ARCHIVE, true );
394 _tiedProperties.Tie( "gear-down", this, &FGControls::get_gear_down, &FGControls::set_gear_down)
395 ->setAttribute( SGPropertyNode::ARCHIVE, true );
397 _tiedProperties.Tie( "antiskid", this, &FGControls::get_antiskid, &FGControls::set_antiskid)
398 ->setAttribute( SGPropertyNode::ARCHIVE, true );
400 _tiedProperties.Tie( "tailhook", this, &FGControls::get_tailhook, &FGControls::set_tailhook)
401 ->setAttribute( SGPropertyNode::ARCHIVE, true );
403 _tiedProperties.Tie( "launchbar", this, &FGControls::get_launchbar, &FGControls::set_launchbar)
404 ->setAttribute( SGPropertyNode::ARCHIVE, true );
406 _tiedProperties.Tie( "catapult-launch-cmd", this, &FGControls::get_catapult_launch_cmd, &FGControls::set_catapult_launch_cmd)
407 ->setAttribute( SGPropertyNode::ARCHIVE, true );
409 _tiedProperties.Tie( "tailwheel-lock", this, &FGControls::get_tailwheel_lock, &FGControls::set_tailwheel_lock)
410 ->setAttribute( SGPropertyNode::ARCHIVE, true );
412 for (index = 0; index < MAX_WHEELS; index++) {
413 _SetRoot( _tiedProperties, "/controls/gear/wheel", index );
414 _tiedProperties.Tie( "alternate-extension", this, index, &FGControls::get_alternate_extension, &FGControls::set_alternate_extension)
415 ->setAttribute( SGPropertyNode::ARCHIVE, true );
419 _SetRoot( _tiedProperties, "/controls/anti-ice" );
421 _tiedProperties.Tie( "wing-heat", this, &FGControls::get_wing_heat, &FGControls::set_wing_heat)
422 ->setAttribute( SGPropertyNode::ARCHIVE, true );
424 _tiedProperties.Tie( "pitot-heat", this, &FGControls::get_pitot_heat, &FGControls::set_pitot_heat)
425 ->setAttribute( SGPropertyNode::ARCHIVE, true );
427 _tiedProperties.Tie( "wiper", this, &FGControls::get_wiper, &FGControls::set_wiper)
428 ->setAttribute( SGPropertyNode::ARCHIVE, true );
430 _tiedProperties.Tie( "window-heat", this, &FGControls::get_window_heat, &FGControls::set_window_heat)
431 ->setAttribute( SGPropertyNode::ARCHIVE, true );
433 for (index = 0; index < MAX_ENGINES; index++) {
434 _SetRoot( _tiedProperties, "/controls/anti-ice/engine", index );
436 _tiedProperties.Tie( "carb-heat", this, index, &FGControls::get_carb_heat, &FGControls::set_carb_heat)
437 ->setAttribute( SGPropertyNode::ARCHIVE, true );
439 _tiedProperties.Tie( "inlet-heat", this, index, &FGControls::get_inlet_heat, &FGControls::set_inlet_heat)
440 ->setAttribute( SGPropertyNode::ARCHIVE, true );
444 for (index = 0; index < MAX_HYD_SYSTEMS; index++) {
445 _SetRoot( _tiedProperties, "/controls/hydraulic/system", index );
447 _tiedProperties.Tie( "engine-pump", this, index, &FGControls::get_engine_pump, &FGControls::set_engine_pump)
448 ->setAttribute( SGPropertyNode::ARCHIVE, true );
450 _tiedProperties.Tie( "electric-pump", this, index, &FGControls::get_electric_pump, &FGControls::set_electric_pump)
451 ->setAttribute( SGPropertyNode::ARCHIVE, true );
455 _SetRoot( _tiedProperties, "/controls/electric" );
457 _tiedProperties.Tie( "battery-switch", this, &FGControls::get_battery_switch, &FGControls::set_battery_switch)
458 ->setAttribute( SGPropertyNode::ARCHIVE, true );
460 _tiedProperties.Tie( "external-power", this, &FGControls::get_external_power, &FGControls::set_external_power)
461 ->setAttribute( SGPropertyNode::ARCHIVE, true );
463 _tiedProperties.Tie( "APU-generator", this, &FGControls::get_APU_generator, &FGControls::set_APU_generator)
464 ->setAttribute( SGPropertyNode::ARCHIVE, true );
466 for (index = 0; index < MAX_ENGINES; index++) {
467 _SetRoot( _tiedProperties, "/controls/electric/engine", index );
469 _tiedProperties.Tie( "generator", this, index, &FGControls::get_generator_breaker, &FGControls::set_generator_breaker)
470 ->setAttribute( SGPropertyNode::ARCHIVE, true );
472 _tiedProperties.Tie( "bus-tie", this, index, &FGControls::get_bus_tie, &FGControls::set_bus_tie)
473 ->setAttribute( SGPropertyNode::ARCHIVE, true );
477 _SetRoot( _tiedProperties, "/controls/pneumatic" );
479 _tiedProperties.Tie( "APU-bleed", this, &FGControls::get_APU_bleed, &FGControls::set_APU_bleed)
480 ->setAttribute( SGPropertyNode::ARCHIVE, true );
482 for (index = 0; index < MAX_ENGINES; index++) {
483 _SetRoot( _tiedProperties, "/controls/pneumatic/engine", index );
485 _tiedProperties.Tie( "bleed", this, index, &FGControls::get_engine_bleed, &FGControls::set_engine_bleed)
486 ->setAttribute( SGPropertyNode::ARCHIVE, true );
490 _SetRoot( _tiedProperties, "/controls/pressurization" );
492 _tiedProperties.Tie( "mode", this, &FGControls::get_mode, &FGControls::set_mode)
493 ->setAttribute( SGPropertyNode::ARCHIVE, true );
495 _tiedProperties.Tie( "dump", this, &FGControls::get_dump, &FGControls::set_dump)
496 ->setAttribute( SGPropertyNode::ARCHIVE, true );
498 _tiedProperties.Tie( "outflow-valve", this, &FGControls::get_outflow_valve, &FGControls::set_outflow_valve)
499 ->setAttribute( SGPropertyNode::ARCHIVE, true );
501 for (index = 0; index < MAX_PACKS; index++) {
502 _SetRoot( _tiedProperties, "/controls/pressurization/pack", index );
504 _tiedProperties.Tie( "pack-on", this, index, &FGControls::get_pack_on, &FGControls::set_pack_on)
505 ->setAttribute( SGPropertyNode::ARCHIVE, true );
509 _SetRoot( _tiedProperties, "/controls/lighting" );
511 _tiedProperties.Tie( "landing-lights", this, &FGControls::get_landing_lights, &FGControls::set_landing_lights)
512 ->setAttribute( SGPropertyNode::ARCHIVE, true );
514 _tiedProperties.Tie( "turn-off-lights", this, &FGControls::get_turn_off_lights, &FGControls::set_turn_off_lights)
515 ->setAttribute( SGPropertyNode::ARCHIVE, true );
517 _tiedProperties.Tie( "taxi-light", this, &FGControls::get_taxi_light, &FGControls::set_taxi_light)
518 ->setAttribute( SGPropertyNode::ARCHIVE, true );
520 _tiedProperties.Tie( "logo-lights", this, &FGControls::get_logo_lights, &FGControls::set_logo_lights)
521 ->setAttribute( SGPropertyNode::ARCHIVE, true );
523 _tiedProperties.Tie( "nav-lights", this, &FGControls::get_nav_lights, &FGControls::set_nav_lights)
524 ->setAttribute( SGPropertyNode::ARCHIVE, true );
526 _tiedProperties.Tie( "beacon", this, &FGControls::get_beacon, &FGControls::set_beacon)
527 ->setAttribute( SGPropertyNode::ARCHIVE, true );
529 _tiedProperties.Tie( "strobe", this, &FGControls::get_strobe, &FGControls::set_strobe)
530 ->setAttribute( SGPropertyNode::ARCHIVE, true );
532 _tiedProperties.Tie( "panel-norm", this, &FGControls::get_panel_norm, &FGControls::set_panel_norm)
533 ->setAttribute( SGPropertyNode::ARCHIVE, true );
535 _tiedProperties.Tie( "instruments-norm", this, &FGControls::get_instruments_norm, &FGControls::set_instruments_norm)
536 ->setAttribute( SGPropertyNode::ARCHIVE, true );
538 _tiedProperties.Tie( "dome-norm", this, &FGControls::get_dome_norm, &FGControls::set_dome_norm)
539 ->setAttribute( SGPropertyNode::ARCHIVE, true );
542 _SetRoot( _tiedProperties, "/controls/armament" );
544 _tiedProperties.Tie( "master-arm", this, &FGControls::get_master_arm, &FGControls::set_master_arm)
545 ->setAttribute( SGPropertyNode::ARCHIVE, true );
547 _tiedProperties.Tie( "station-select", this, &FGControls::get_station_select, &FGControls::set_station_select)
548 ->setAttribute( SGPropertyNode::ARCHIVE, true );
550 _tiedProperties.Tie( "release-all", this, &FGControls::get_release_ALL, &FGControls::set_release_ALL)
551 ->setAttribute( SGPropertyNode::ARCHIVE, true );
553 for (index = 0; index < MAX_STATIONS; index++) {
554 _SetRoot( _tiedProperties, "/controls/armament/station", index );
556 _tiedProperties.Tie( "stick-size", this, index, &FGControls::get_stick_size, &FGControls::set_stick_size)
557 ->setAttribute( SGPropertyNode::ARCHIVE, true );
559 _tiedProperties.Tie( "release-stick", this, index, &FGControls::get_release_stick, &FGControls::set_release_stick)
560 ->setAttribute( SGPropertyNode::ARCHIVE, true );
562 _tiedProperties.Tie( "release-all", this, index, &FGControls::get_release_all, &FGControls::set_release_all)
563 ->setAttribute( SGPropertyNode::ARCHIVE, true );
565 _tiedProperties.Tie( "jettison-all", this, index, &FGControls::get_jettison_all, &FGControls::set_jettison_all)
566 ->setAttribute( SGPropertyNode::ARCHIVE, true );
570 _SetRoot( _tiedProperties, "/controls/seat" );
572 _tiedProperties.Tie( "vertical-adjust", this, &FGControls::get_vertical_adjust, &FGControls::set_vertical_adjust)
573 ->setAttribute( SGPropertyNode::ARCHIVE, true );
575 _tiedProperties.Tie( "fore-aft-adjust", this, &FGControls::get_fore_aft_adjust, &FGControls::set_fore_aft_adjust)
576 ->setAttribute( SGPropertyNode::ARCHIVE, true );
578 _tiedProperties.Tie( "cmd_selector_valve", this, &FGControls::get_cmd_selector_valve, &FGControls::set_cmd_selector_valve)
579 ->setAttribute( SGPropertyNode::ARCHIVE, true );
581 for (index = 0; index < MAX_EJECTION_SEATS; index++) {
582 _SetRoot( _tiedProperties, "/controls/seat/eject", index );
584 _tiedProperties.Tie( "initiate", this, index, &FGControls::get_ejection_seat, &FGControls::set_ejection_seat)
585 ->setAttribute( SGPropertyNode::ARCHIVE, true );
587 _tiedProperties.Tie( "status", this, index, &FGControls::get_eseat_status, &FGControls::set_eseat_status)
588 ->setAttribute( SGPropertyNode::ARCHIVE, true );
592 _SetRoot( _tiedProperties, "/controls/APU" );
594 _tiedProperties.Tie( "off-start-run", this, &FGControls::get_off_start_run, &FGControls::set_off_start_run)
595 ->setAttribute( SGPropertyNode::ARCHIVE, true );
597 _tiedProperties.Tie( "fire-switch", this, &FGControls::get_APU_fire_switch, &FGControls::set_APU_fire_switch)
598 ->setAttribute( SGPropertyNode::ARCHIVE, true );
601 for (index = 0; index < MAX_AUTOPILOTS; index++) {
603 _SetRoot( _tiedProperties, "/controls/autoflight/autopilot", index );
605 _tiedProperties.Tie( "engage", this, index, &FGControls::get_autopilot_engage, &FGControls::set_autopilot_engage)
606 ->setAttribute( SGPropertyNode::ARCHIVE, true );
609 _SetRoot( _tiedProperties, "/controls/autoflight/" );
611 _tiedProperties.Tie( "autothrottle-arm", this, &FGControls::get_autothrottle_arm, &FGControls::set_autothrottle_arm)
612 ->setAttribute( SGPropertyNode::ARCHIVE, true );
614 _tiedProperties.Tie( "autothrottle-engage", this, &FGControls::get_autothrottle_engage, &FGControls::set_autothrottle_engage)
615 ->setAttribute( SGPropertyNode::ARCHIVE, true );
617 _tiedProperties.Tie( "heading-select", this, &FGControls::get_heading_select, &FGControls::set_heading_select)
618 ->setAttribute( SGPropertyNode::ARCHIVE, true );
620 _tiedProperties.Tie( "altitude-select", this, &FGControls::get_altitude_select, &FGControls::set_altitude_select)
621 ->setAttribute( SGPropertyNode::ARCHIVE, true );
623 _tiedProperties.Tie( "bank-angle-select", this, &FGControls::get_bank_angle_select, &FGControls::set_bank_angle_select)
624 ->setAttribute( SGPropertyNode::ARCHIVE, true );
626 _tiedProperties.Tie( "vertical-speed-select", this, &FGControls::get_vertical_speed_select, &FGControls::set_vertical_speed_select)
627 ->setAttribute( SGPropertyNode::ARCHIVE, true );
629 _tiedProperties.Tie( "speed-select", this, &FGControls::get_speed_select, &FGControls::set_speed_select)
630 ->setAttribute( SGPropertyNode::ARCHIVE, true );
632 _tiedProperties.Tie( "mach-select", this, &FGControls::get_mach_select, &FGControls::set_mach_select)
633 ->setAttribute( SGPropertyNode::ARCHIVE, true );
635 _tiedProperties.Tie( "vertical-mode", this, &FGControls::get_vertical_mode, &FGControls::set_vertical_mode)
636 ->setAttribute( SGPropertyNode::ARCHIVE, true );
638 _tiedProperties.Tie( "lateral-mode", this, &FGControls::get_lateral_mode, &FGControls::set_lateral_mode)
639 ->setAttribute( SGPropertyNode::ARCHIVE, true );
642 void FGControls::unbind ()
644 _tiedProperties.Untie();
649 FGControls::update (double dt)
655 ////////////////////////////////////////////////////////////////////////
656 // Setters and adjusters.
657 ////////////////////////////////////////////////////////////////////////
660 FGControls::set_aileron (double pos)
663 SG_CLAMP_RANGE<double>( aileron, -1.0, 1.0 );
664 do_autocoordination();
668 FGControls::move_aileron (double amt)
671 SG_CLAMP_RANGE<double>( aileron, -1.0, 1.0 );
672 do_autocoordination();
676 FGControls::set_aileron_trim( double pos )
679 SG_CLAMP_RANGE<double>( aileron_trim, -1.0, 1.0 );
683 FGControls::move_aileron_trim( double amt )
686 SG_CLAMP_RANGE<double>( aileron_trim, -1.0, 1.0 );
690 FGControls::set_elevator( double pos )
693 SG_CLAMP_RANGE<double>( elevator, -1.0, 1.0 );
697 FGControls::move_elevator( double amt )
700 SG_CLAMP_RANGE<double>( elevator, -1.0, 1.0 );
704 FGControls::set_elevator_trim( double pos )
707 SG_CLAMP_RANGE<double>( elevator_trim, -1.0, 1.0 );
711 FGControls::move_elevator_trim( double amt )
713 elevator_trim += amt;
714 SG_CLAMP_RANGE<double>( elevator_trim, -1.0, 1.0 );
718 FGControls::set_rudder( double pos )
721 SG_CLAMP_RANGE<double>( rudder, -1.0, 1.0 );
725 FGControls::move_rudder( double amt )
728 SG_CLAMP_RANGE<double>( rudder, -1.0, 1.0 );
732 FGControls::set_rudder_trim( double pos )
735 SG_CLAMP_RANGE<double>( rudder_trim, -1.0, 1.0 );
739 FGControls::move_rudder_trim( double amt )
742 SG_CLAMP_RANGE<double>( rudder_trim, -1.0, 1.0 );
746 FGControls::set_flaps( double pos )
749 SG_CLAMP_RANGE<double>( flaps, 0.0, 1.0 );
753 FGControls::move_flaps( double amt )
756 SG_CLAMP_RANGE<double>( flaps, 0.0, 1.0 );
760 FGControls::set_slats( double pos )
763 SG_CLAMP_RANGE<double>( slats, 0.0, 1.0 );
767 FGControls::move_slats( double amt )
770 SG_CLAMP_RANGE<double>( slats, 0.0, 1.0 );
774 FGControls::set_BLC( bool val )
780 FGControls::set_spoilers( double pos )
783 SG_CLAMP_RANGE<double>( spoilers, 0.0, 1.0 );
787 FGControls::move_spoilers( double amt )
790 SG_CLAMP_RANGE<double>( spoilers, 0.0, 1.0 );
794 FGControls::set_speedbrake( double pos )
797 SG_CLAMP_RANGE<double>( speedbrake, 0.0, 1.0 );
801 FGControls::move_speedbrake( double amt )
804 SG_CLAMP_RANGE<double>( speedbrake, 0.0, 1.0 );
808 FGControls::set_wing_sweep( double pos )
811 SG_CLAMP_RANGE<double>( wing_sweep, 0.0, 1.0 );
815 FGControls::move_wing_sweep( double amt )
818 SG_CLAMP_RANGE<double>( wing_sweep, 0.0, 1.0 );
822 FGControls::set_wing_fold( bool val )
828 FGControls::set_drag_chute( bool val )
834 FGControls::set_throttle_idle( bool val )
840 FGControls::set_throttle( int engine, double pos )
842 if ( engine == ALL_ENGINES ) {
843 for ( int i = 0; i < MAX_ENGINES; i++ ) {
845 SG_CLAMP_RANGE<double>( throttle[i], 0.0, 1.0 );
848 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
849 throttle[engine] = pos;
850 SG_CLAMP_RANGE<double>( throttle[engine], 0.0, 1.0 );
856 FGControls::move_throttle( int engine, double amt )
858 if ( engine == ALL_ENGINES ) {
859 for ( int i = 0; i < MAX_ENGINES; i++ ) {
861 SG_CLAMP_RANGE<double>( throttle[i], 0.0, 1.0 );
864 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
865 throttle[engine] += amt;
866 SG_CLAMP_RANGE<double>( throttle[engine], 0.0, 1.0 );
872 FGControls::set_starter( int engine, bool flag )
874 if ( engine == ALL_ENGINES ) {
875 for ( int i = 0; i < MAX_ENGINES; i++ ) {
879 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
880 starter[engine] = flag;
886 FGControls::set_fuel_pump( int engine, bool val )
888 if ( engine == ALL_ENGINES ) {
889 for ( int i = 0; i < MAX_ENGINES; i++ ) {
893 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
894 fuel_pump[engine] = val;
900 FGControls::set_fire_switch( int engine, bool val )
902 if ( engine == ALL_ENGINES ) {
903 for ( int i = 0; i < MAX_ENGINES; i++ ) {
904 fire_switch[i] = val;
907 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
908 fire_switch[engine] = val;
914 FGControls::set_fire_bottle_discharge( int engine, bool val )
916 if ( engine == ALL_ENGINES ) {
917 for ( int i = 0; i < MAX_ENGINES; i++ ) {
918 fire_bottle_discharge[i] = val;
921 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
922 fire_bottle_discharge[engine] = val;
928 FGControls::set_cutoff( int engine, bool val )
930 if ( engine == ALL_ENGINES ) {
931 for ( int i = 0; i < MAX_ENGINES; i++ ) {
935 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
936 cutoff[engine] = val;
942 FGControls::set_feed_tank( int engine, int tank )
944 if ( engine == ALL_ENGINES ) {
945 for ( int i = 0; i < MAX_ENGINES; i++ ) {
947 SG_CLAMP_RANGE<int>( feed_tank[i], -1, 4 );
950 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
951 feed_tank[engine] = tank;
952 SG_CLAMP_RANGE<int>( feed_tank[engine], -1, 4 );
955 // feed_tank[engine] = engine;
960 FGControls::set_mixture( int engine, double pos )
962 if ( engine == ALL_ENGINES ) {
963 for ( int i = 0; i < MAX_ENGINES; i++ ) {
965 SG_CLAMP_RANGE<double>( mixture[i], 0.0, 1.0 );
968 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
969 mixture[engine] = pos;
970 SG_CLAMP_RANGE<double>( mixture[engine], 0.0, 1.0 );
976 FGControls::move_mixture( int engine, double amt )
978 if ( engine == ALL_ENGINES ) {
979 for ( int i = 0; i < MAX_ENGINES; i++ ) {
981 SG_CLAMP_RANGE<double>( mixture[i], 0.0, 1.0 );
984 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
985 mixture[engine] += amt;
986 SG_CLAMP_RANGE<double>( mixture[engine], 0.0, 1.0 );
992 FGControls::set_prop_advance( int engine, double pos )
994 if ( engine == ALL_ENGINES ) {
995 for ( int i = 0; i < MAX_ENGINES; i++ ) {
996 prop_advance[i] = pos;
997 SG_CLAMP_RANGE<double>( prop_advance[i], 0.0, 1.0 );
1000 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1001 prop_advance[engine] = pos;
1002 SG_CLAMP_RANGE<double>( prop_advance[engine], 0.0, 1.0 );
1008 FGControls::move_prop_advance( int engine, double amt )
1010 if ( engine == ALL_ENGINES ) {
1011 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1012 prop_advance[i] += amt;
1013 SG_CLAMP_RANGE<double>( prop_advance[i], 0.0, 1.0 );
1016 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1017 prop_advance[engine] += amt;
1018 SG_CLAMP_RANGE<double>( prop_advance[engine], 0.0, 1.0 );
1024 FGControls::set_magnetos( int engine, int pos )
1026 if ( engine == ALL_ENGINES ) {
1027 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1029 SG_CLAMP_RANGE<int>( magnetos[i], 0, 3 );
1032 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1033 magnetos[engine] = pos;
1034 SG_CLAMP_RANGE<int>( magnetos[engine], 0, 3 );
1040 FGControls::move_magnetos( int engine, int amt )
1042 if ( engine == ALL_ENGINES ) {
1043 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1045 SG_CLAMP_RANGE<int>( magnetos[i], 0, 3 );
1048 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1049 magnetos[engine] += amt;
1050 SG_CLAMP_RANGE<int>( magnetos[engine], 0, 3 );
1056 FGControls::set_nitrous_injection( int engine, bool val )
1058 if ( engine == ALL_ENGINES ) {
1059 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1060 nitrous_injection[i] = val;
1063 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1064 nitrous_injection[engine] = val;
1071 FGControls::set_cowl_flaps_norm( int engine, double pos )
1073 if ( engine == ALL_ENGINES ) {
1074 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1075 cowl_flaps_norm[i] = pos;
1076 SG_CLAMP_RANGE<double>( cowl_flaps_norm[i], 0.0, 1.0 );
1079 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1080 cowl_flaps_norm[engine] = pos;
1081 SG_CLAMP_RANGE<double>( cowl_flaps_norm[engine], 0.0, 1.0 );
1087 FGControls::move_cowl_flaps_norm( int engine, double amt )
1089 if ( engine == ALL_ENGINES ) {
1090 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1091 cowl_flaps_norm[i] += amt;
1092 SG_CLAMP_RANGE<double>( cowl_flaps_norm[i], 0.0, 1.0 );
1095 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1096 cowl_flaps_norm[engine] += amt;
1097 SG_CLAMP_RANGE<double>( cowl_flaps_norm[engine], 0.0, 1.0 );
1103 FGControls::set_feather( int engine, bool val )
1105 if ( engine == ALL_ENGINES ) {
1106 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1110 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1111 feather[engine] = val;
1117 FGControls::set_ignition( int engine, int pos )
1119 if ( engine == ALL_ENGINES ) {
1120 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1122 SG_CLAMP_RANGE<int>( ignition[i], 0, 3 );
1125 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1126 ignition[engine] = pos;
1127 SG_CLAMP_RANGE<int>( ignition[engine], 0, 3 );
1133 FGControls::set_augmentation( int engine, bool val )
1135 if ( engine == ALL_ENGINES ) {
1136 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1137 augmentation[i] = val;
1140 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1141 augmentation[engine] = val;
1147 FGControls::set_reverser( int engine, bool val )
1149 if ( engine == ALL_ENGINES ) {
1150 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1154 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1155 reverser[engine] = val;
1161 FGControls::set_water_injection( int engine, bool val )
1163 if ( engine == ALL_ENGINES ) {
1164 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1165 water_injection[i] = val;
1168 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1169 water_injection[engine] = val;
1175 FGControls::set_condition( int engine, double val )
1177 if ( engine == ALL_ENGINES ) {
1178 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1180 SG_CLAMP_RANGE<double>( condition[i], 0.0, 1.0 );
1183 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1184 condition[engine] = val;
1185 SG_CLAMP_RANGE<double>( condition[engine], 0.0, 1.0 );
1191 FGControls::set_dump_valve( bool val )
1198 FGControls::set_fuel_selector( int tank, bool pos )
1200 if ( tank == ALL_TANKS ) {
1201 for ( int i = 0; i < MAX_TANKS; i++ ) {
1202 fuel_selector[i] = pos;
1205 if ( (tank >= 0) && (tank < MAX_TANKS) ) {
1206 fuel_selector[tank] = pos;
1212 FGControls::set_to_engine( int tank, int engine )
1214 if ( tank == ALL_TANKS ) {
1215 for ( int i = 0; i < MAX_TANKS; i++ ) {
1216 to_engine[i] = engine;
1219 if ( (tank >= 0) && (tank < MAX_TANKS) ) {
1220 to_engine[tank] = engine;
1226 FGControls::set_to_tank( int tank, int dest_tank )
1228 if ( tank == ALL_TANKS ) {
1229 for ( int i = 0; i < MAX_TANKS; i++ ) {
1230 to_tank[i] = dest_tank;
1233 if ( (tank >= 0) && (tank < MAX_TANKS) ) {
1234 to_tank[tank] = dest_tank;
1240 FGControls::set_boost_pump( int index, bool val )
1242 if ( index == -1 ) {
1243 for ( int i = 0; i < (MAX_TANKS * MAX_BOOSTPUMPS); i++ ) {
1244 boost_pump[i] = val;
1247 if ( (index >= 0) && (index < (MAX_TANKS * MAX_BOOSTPUMPS)) ) {
1248 boost_pump[index] = val;
1255 FGControls::set_brake_left( double pos )
1258 SG_CLAMP_RANGE<double>(brake_left, 0.0, 1.0);
1262 FGControls::move_brake_left( double amt )
1265 SG_CLAMP_RANGE<double>( brake_left, 0.0, 1.0 );
1269 FGControls::set_brake_right( double pos )
1272 SG_CLAMP_RANGE<double>(brake_right, 0.0, 1.0);
1276 FGControls::move_brake_right( double amt )
1279 SG_CLAMP_RANGE<double>( brake_right, 0.0, 1.0 );
1283 FGControls::set_copilot_brake_left( double pos )
1285 copilot_brake_left = pos;
1286 SG_CLAMP_RANGE<double>(brake_left, 0.0, 1.0);
1290 FGControls::set_copilot_brake_right( double pos )
1292 copilot_brake_right = pos;
1293 SG_CLAMP_RANGE<double>(brake_right, 0.0, 1.0);
1297 FGControls::set_brake_parking( double pos )
1299 brake_parking = pos;
1300 SG_CLAMP_RANGE<double>(brake_parking, 0.0, 1.0);
1304 FGControls::set_steering( double angle )
1307 SG_CLAMP_RANGE<double>(steering, -80.0, 80.0);
1311 FGControls::set_nose_wheel_steering( bool nws )
1313 nose_wheel_steering = nws;
1317 FGControls::move_steering( double angle )
1320 SG_CLAMP_RANGE<double>(steering, -80.0, 80.0);
1324 FGControls::set_gear_down( bool gear )
1330 FGControls::set_antiskid( bool state )
1336 FGControls::set_tailhook( bool state )
1342 FGControls::set_launchbar( bool state )
1348 FGControls::set_catapult_launch_cmd( bool state )
1350 catapult_launch_cmd = state;
1354 FGControls::set_tailwheel_lock( bool state )
1356 tailwheel_lock = state;
1361 FGControls::set_alternate_extension( int wheel, bool val )
1363 if ( wheel == ALL_WHEELS ) {
1364 for ( int i = 0; i < MAX_WHEELS; i++ ) {
1365 alternate_extension[i] = val;
1368 if ( (wheel >= 0) && (wheel < MAX_WHEELS) ) {
1369 alternate_extension[wheel] = val;
1375 FGControls::set_wing_heat( bool state )
1381 FGControls::set_pitot_heat( bool state )
1387 FGControls::set_wiper( int state )
1393 FGControls::set_window_heat( bool state )
1395 window_heat = state;
1399 FGControls::set_carb_heat( int engine, bool val )
1401 if ( engine == ALL_ENGINES ) {
1402 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1406 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1407 carb_heat[engine] = val;
1413 FGControls::set_inlet_heat( int engine, bool val )
1415 if ( engine == ALL_ENGINES ) {
1416 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1417 inlet_heat[i] = val;
1420 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1421 inlet_heat[engine] = val;
1427 FGControls::set_engine_pump( int system, bool val )
1429 if ( system == ALL_HYD_SYSTEMS ) {
1430 for ( int i = 0; i < MAX_HYD_SYSTEMS; i++ ) {
1431 engine_pump[i] = val;
1434 if ( (system >= 0) && (system < MAX_HYD_SYSTEMS) ) {
1435 engine_pump[system] = val;
1441 FGControls::set_electric_pump( int system, bool val )
1443 if ( system == ALL_HYD_SYSTEMS ) {
1444 for ( int i = 0; i < MAX_HYD_SYSTEMS; i++ ) {
1445 electric_pump[i] = val;
1448 if ( (system >= 0) && (system < MAX_HYD_SYSTEMS) ) {
1449 electric_pump[system] = val;
1455 FGControls::set_battery_switch( bool state )
1457 battery_switch = state;
1461 FGControls::set_external_power( bool state )
1463 external_power = state;
1467 FGControls::set_APU_generator( bool state )
1469 APU_generator = state;
1473 FGControls::set_generator_breaker( int engine, bool val )
1475 if ( engine == ALL_ENGINES ) {
1476 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1477 generator_breaker[i] = val;
1480 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1481 generator_breaker[engine] = val;
1487 FGControls::set_bus_tie( int engine, bool val )
1489 if ( engine == ALL_ENGINES ) {
1490 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1494 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1495 bus_tie[engine] = val;
1501 FGControls::set_APU_bleed( bool state )
1507 FGControls::set_engine_bleed( int engine, bool val )
1509 if ( engine == ALL_ENGINES ) {
1510 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1511 engine_bleed[i] = val;
1514 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1515 engine_bleed[engine] = val;
1521 FGControls::set_mode( int new_mode )
1527 FGControls::set_outflow_valve( double pos )
1529 outflow_valve = pos;
1530 SG_CLAMP_RANGE<double>( outflow_valve, 0.0, 1.0 );
1534 FGControls::move_outflow_valve( double amt )
1536 outflow_valve += amt;
1537 SG_CLAMP_RANGE<double>( outflow_valve, 0.0, 1.0 );
1541 FGControls::set_dump( bool state )
1547 FGControls::set_pack_on( int pack, bool val )
1549 if ( pack == ALL_PACKS ) {
1550 for ( int i = 0; i < MAX_PACKS; i++ ) {
1554 if ( (pack >= 0) && (pack < MAX_PACKS) ) {
1555 pack_on[pack] = val;
1561 FGControls::set_landing_lights( bool state )
1563 landing_lights = state;
1567 FGControls::set_turn_off_lights( bool state )
1569 turn_off_lights = state;
1573 FGControls::set_taxi_light( bool state )
1579 FGControls::set_logo_lights( bool state )
1581 logo_lights = state;
1585 FGControls::set_nav_lights( bool state )
1591 FGControls::set_beacon( bool state )
1597 FGControls::set_strobe( bool state )
1603 FGControls::set_panel_norm( double intensity )
1605 panel_norm = intensity;
1606 SG_CLAMP_RANGE<double>( panel_norm, 0.0, 1.0 );
1610 FGControls::move_panel_norm( double amt )
1613 SG_CLAMP_RANGE<double>( panel_norm, 0.0, 1.0 );
1617 FGControls::set_instruments_norm( double intensity )
1619 instruments_norm = intensity;
1620 SG_CLAMP_RANGE<double>( instruments_norm, 0.0, 1.0 );
1624 FGControls::move_instruments_norm( double amt )
1626 instruments_norm += amt;
1627 SG_CLAMP_RANGE<double>( instruments_norm, 0.0, 1.0 );
1631 FGControls::set_dome_norm( double intensity )
1633 dome_norm = intensity;
1634 SG_CLAMP_RANGE<double>( dome_norm, 0.0, 1.0 );
1638 FGControls::move_dome_norm( double amt )
1641 SG_CLAMP_RANGE<double>( dome_norm, 0.0, 1.0 );
1645 FGControls::set_master_arm( bool val )
1651 FGControls::set_station_select( int station )
1653 station_select = station;
1654 SG_CLAMP_RANGE<int>( station_select, 0, MAX_STATIONS );
1658 FGControls::set_release_ALL( bool val )
1664 FGControls::set_stick_size( int station, int size )
1666 if ( station == ALL_STATIONS ) {
1667 for ( int i = 0; i < MAX_STATIONS; i++ ) {
1668 stick_size[i] = size;
1669 SG_CLAMP_RANGE<int>( stick_size[i], 1, 20 );
1672 if ( (station >= 0) && (station < MAX_STATIONS) ) {
1673 stick_size[station] = size;
1674 SG_CLAMP_RANGE<int>( stick_size[station], 1, 20 );
1680 FGControls::set_release_stick( int station, bool val )
1682 if ( station == ALL_STATIONS ) {
1683 for ( int i = 0; i < MAX_STATIONS; i++ ) {
1684 release_stick[i] = val;
1687 if ( (station >= 0) && (station < MAX_STATIONS) ) {
1688 release_stick[station] = val;
1694 FGControls::set_release_all( int station, bool val )
1696 if ( station == ALL_STATIONS ) {
1697 for ( int i = 0; i < MAX_STATIONS; i++ ) {
1698 release_all[i] = val;
1701 if ( (station >= 0) && (station < MAX_STATIONS) ) {
1702 release_all[station] = val;
1708 FGControls::set_jettison_all( int station, bool val )
1710 if ( station == ALL_STATIONS ) {
1711 for ( int i = 0; i < MAX_STATIONS; i++ ) {
1712 jettison_all[i] = val;
1715 if ( (station >= 0) && (station < MAX_STATIONS) ) {
1716 jettison_all[station] = val;
1722 FGControls::set_vertical_adjust( double pos )
1724 vertical_adjust = pos;
1725 SG_CLAMP_RANGE<double>( vertical_adjust, -1.0, 1.0 );
1729 FGControls::move_vertical_adjust( double amt )
1731 vertical_adjust += amt;
1732 SG_CLAMP_RANGE<double>( vertical_adjust, -1.0, 1.0 );
1736 FGControls::set_fore_aft_adjust( double pos )
1738 fore_aft_adjust = pos;
1739 SG_CLAMP_RANGE<double>( fore_aft_adjust, -1.0, 1.0 );
1743 FGControls::move_fore_aft_adjust( double amt )
1745 fore_aft_adjust += amt;
1746 SG_CLAMP_RANGE<double>( fore_aft_adjust, -1.0, 1.0 );
1750 FGControls::set_ejection_seat( int which_seat, bool val )
1752 if ( which_seat == ALL_EJECTION_SEATS ) {
1753 for ( int i = 0; i < MAX_EJECTION_SEATS; i++ ) {
1757 if ( (which_seat >= 0) && (which_seat <= MAX_EJECTION_SEATS) ) {
1758 if ( eseat_status[which_seat] == SEAT_SAFED ||
1759 eseat_status[which_seat] == SEAT_FAIL )
1761 // we can never eject if SEAT_SAFED or SEAT_FAIL
1765 eject[which_seat] = val;
1771 FGControls::set_eseat_status( int which_seat, int val )
1773 if ( which_seat == ALL_EJECTION_SEATS ) {
1774 for ( int i = 0; i < MAX_EJECTION_SEATS; i++ ) {
1775 eseat_status[i] = val;
1778 if ( (which_seat >=0) && (which_seat <= MAX_EJECTION_SEATS) ) {
1779 eseat_status[which_seat] = val;
1785 FGControls::set_cmd_selector_valve( int val )
1787 cmd_selector_valve = val;
1792 FGControls::set_off_start_run( int pos )
1794 off_start_run = pos;
1795 SG_CLAMP_RANGE<int>( off_start_run, 0, 3 );
1799 FGControls::set_APU_fire_switch( bool val )
1801 APU_fire_switch = val;
1805 FGControls::set_autothrottle_arm( bool val )
1807 autothrottle_arm = val;
1811 FGControls::set_autothrottle_engage( bool val )
1813 autothrottle_engage = val;
1817 FGControls::set_heading_select( double heading )
1819 heading_select = heading;
1820 SG_CLAMP_RANGE<double>( heading_select, 0.0, 360.0 );
1824 FGControls::move_heading_select( double amt )
1826 heading_select += amt;
1827 SG_CLAMP_RANGE<double>( heading_select, 0.0, 360.0 );
1831 FGControls::set_altitude_select( double altitude )
1833 altitude_select = altitude;
1834 SG_CLAMP_RANGE<double>( altitude_select, -1000.0, 100000.0 );
1838 FGControls::move_altitude_select( double amt )
1840 altitude_select += amt;
1841 SG_CLAMP_RANGE<double>( altitude_select, -1000.0, 100000.0 );
1845 FGControls::set_bank_angle_select( double angle )
1847 bank_angle_select = angle;
1848 SG_CLAMP_RANGE<double>( bank_angle_select, 10.0, 30.0 );
1852 FGControls::move_bank_angle_select( double amt )
1854 bank_angle_select += amt;
1855 SG_CLAMP_RANGE<double>( bank_angle_select, 10.0, 30.0 );
1859 FGControls::set_vertical_speed_select( double speed )
1861 vertical_speed_select = speed;
1862 SG_CLAMP_RANGE<double>( vertical_speed_select, -3000.0, 4000.0 );
1866 FGControls::move_vertical_speed_select( double amt )
1868 vertical_speed_select += amt;
1869 SG_CLAMP_RANGE<double>( vertical_speed_select, -3000.0, 4000.0 );
1873 FGControls::set_speed_select( double speed )
1875 speed_select = speed;
1876 SG_CLAMP_RANGE<double>( speed_select, 60.0, 400.0 );
1880 FGControls::move_speed_select( double amt )
1882 speed_select += amt;
1883 SG_CLAMP_RANGE<double>( speed_select, 60.0, 400.0 );
1887 FGControls::set_mach_select( double mach )
1890 SG_CLAMP_RANGE<double>( mach_select, 0.4, 4.0 );
1894 FGControls::move_mach_select( double amt )
1897 SG_CLAMP_RANGE<double>( mach_select, 0.4, 4.0 );
1901 FGControls::set_vertical_mode( int mode )
1903 vertical_mode = mode;
1904 SG_CLAMP_RANGE<int>( vertical_mode, 0, 4 );
1908 FGControls::set_lateral_mode( int mode )
1910 lateral_mode = mode;
1911 SG_CLAMP_RANGE<int>( lateral_mode, 0, 4 );
1915 FGControls::set_autopilot_engage( int ap, bool val )
1917 if ( ap == ALL_AUTOPILOTS ) {
1918 for ( int i = 0; i < MAX_AUTOPILOTS; i++ ) {
1919 autopilot_engage[i] = val;
1922 if ( (ap >= 0) && (ap < MAX_AUTOPILOTS) ) {
1923 autopilot_engage[ap] = val;