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 ),
77 landing_lights( false ),
78 turn_off_lights( false ),
85 instruments_norm( 0.0 ),
90 vertical_adjust( 0.0 ),
91 fore_aft_adjust( 0.0 ),
92 cmd_selector_valve( 0 ),
94 APU_fire_switch( false ),
95 autothrottle_arm( false ),
96 autothrottle_engage( false ),
97 heading_select( 0.0 ),
98 altitude_select( 50000.0 ),
99 bank_angle_select( 30.0 ),
100 vertical_speed_select( 0.0 ),
106 globals->set_controls( this );
110 void FGControls::reset_all()
113 set_aileron_trim( 0.0 );
115 set_elevator_trim( 0.0 );
117 set_rudder_trim( 0.0 );
120 set_speedbrake( 0.0 );
121 set_wing_sweep( 0.0 );
124 set_throttle( ALL_ENGINES, 0.0 );
125 set_starter( ALL_ENGINES, false );
126 set_magnetos( ALL_ENGINES, 0 );
127 set_fuel_pump( ALL_ENGINES, false );
128 set_fire_switch( ALL_ENGINES, false );
129 set_fire_bottle_discharge( ALL_ENGINES, false );
130 set_cutoff( ALL_ENGINES, true );
131 set_nitrous_injection( ALL_ENGINES, false );
132 set_cowl_flaps_norm( ALL_ENGINES, 1.0 );
133 set_feather( ALL_ENGINES, false );
134 set_ignition( ALL_ENGINES, false );
135 set_augmentation( ALL_ENGINES, false );
136 set_reverser( ALL_ENGINES, false );
137 set_water_injection( ALL_ENGINES, false );
138 set_condition( ALL_ENGINES, 1.0 );
139 throttle_idle = true;
140 set_fuel_selector( ALL_TANKS, true );
143 nose_wheel_steering = true;
147 catapult_launch_cmd = false;
148 tailwheel_lock = true;
149 set_carb_heat( ALL_ENGINES, false );
150 set_inlet_heat( ALL_ENGINES, false );
155 set_engine_pump( ALL_HYD_SYSTEMS, true );
156 set_electric_pump( ALL_HYD_SYSTEMS, true );
157 landing_lights = false;
158 turn_off_lights = false;
160 set_ejection_seat( ALL_EJECTION_SEATS, false );
161 set_eseat_status( ALL_EJECTION_SEATS, SEAT_SAFED );
162 set_cmd_selector_valve( CMD_SEL_NORM );
163 APU_fire_switch = false;
164 autothrottle_arm = false;
165 autothrottle_engage = false;
166 set_autopilot_engage( ALL_AUTOPILOTS, false );
171 FGControls::~FGControls() {
173 globals->set_controls( NULL );
180 throttle_idle = true;
181 for ( int engine = 0; engine < MAX_ENGINES; engine++ ) {
182 throttle[engine] = 0.0;
183 mixture[engine] = 1.0;
184 fuel_pump[engine] = false;
185 prop_advance[engine] = 1.0;
186 magnetos[engine] = 0;
187 feed_tank[engine] = -1; // set to -1 to turn off all tanks 0 feeds all engines from center body tank
188 starter[engine] = false;
189 feather[engine] = false;
190 ignition[engine] = false;
191 fire_switch[engine] = false;
192 fire_bottle_discharge[engine] = false;
193 cutoff[engine] = true;
194 augmentation[engine] = false;
195 reverser[engine] = false;
196 water_injection[engine] = false;
197 nitrous_injection[engine] = false;
198 cowl_flaps_norm[engine] = 0.0;
199 condition[engine] = 1.0;
200 carb_heat[engine] = false;
201 inlet_heat[engine] = false;
202 generator_breaker[engine] = false;
203 bus_tie[engine] = false;
204 engine_bleed[engine] = false;
207 for ( int tank = 0; tank < MAX_TANKS; tank++ ) {
208 fuel_selector[tank] = false;
213 for( int pump = 0; pump < MAX_TANKS * MAX_BOOSTPUMPS; pump++ ) {
214 boost_pump[pump] = false;
217 brake_left = brake_right
218 = copilot_brake_left = copilot_brake_right
219 = brake_parking = 0.0;
220 for ( int wheel = 0; wheel < MAX_WHEELS; wheel++ ) {
221 alternate_extension[wheel] = false;
224 auto_coordination = fgGetNode("/controls/flight/auto-coordination", true);
225 auto_coordination_factor = fgGetNode("/controls/flight/auto-coordination-factor", false );
226 if( NULL == auto_coordination_factor ) {
227 auto_coordination_factor = fgGetNode("/controls/flight/auto-coordination-factor", true );
228 auto_coordination_factor->setDoubleValue( 0.5 );
232 static inline void _SetRoot( simgear::TiedPropertyList & tiedProperties, const char * root, int index = 0 )
234 tiedProperties.setRoot( fgGetNode( root, index, true ) );
240 init(); // unfortunately, tie-ing requires init() to have occurred
244 _SetRoot( _tiedProperties, "/controls/flight" );
246 _tiedProperties.Tie( "aileron", this, &FGControls::get_aileron, &FGControls::set_aileron )
247 ->setAttribute( SGPropertyNode::ARCHIVE, true );
249 _tiedProperties.Tie( "aileron-trim", this, &FGControls::get_aileron_trim, &FGControls::set_aileron_trim )
250 ->setAttribute( SGPropertyNode::ARCHIVE, true );
252 _tiedProperties.Tie( "elevator", this, &FGControls::get_elevator, &FGControls::set_elevator )
253 ->setAttribute( SGPropertyNode::ARCHIVE, true );
255 _tiedProperties.Tie( "elevator-trim", this, &FGControls::get_elevator_trim, &FGControls::set_elevator_trim )
256 ->setAttribute( SGPropertyNode::ARCHIVE, true );
258 _tiedProperties.Tie( "rudder", this, &FGControls::get_rudder, &FGControls::set_rudder )
259 ->setAttribute( SGPropertyNode::ARCHIVE, true );
261 _tiedProperties.Tie( "rudder-trim", this, &FGControls::get_rudder_trim, &FGControls::set_rudder_trim )
262 ->setAttribute( SGPropertyNode::ARCHIVE, true );
264 _tiedProperties.Tie( "flaps", this, &FGControls::get_flaps, &FGControls::set_flaps )
265 ->setAttribute( SGPropertyNode::ARCHIVE, true );
267 _tiedProperties.Tie( "slats", this, &FGControls::get_slats, &FGControls::set_slats )
268 ->setAttribute( SGPropertyNode::ARCHIVE, true );
270 _tiedProperties.Tie( "BLC", this, &FGControls::get_BLC, &FGControls::set_BLC )
271 ->setAttribute( SGPropertyNode::ARCHIVE, true );
273 _tiedProperties.Tie( "spoilers", this, &FGControls::get_spoilers, &FGControls::set_spoilers )
274 ->setAttribute( SGPropertyNode::ARCHIVE, true );
276 _tiedProperties.Tie( "speedbrake", this, &FGControls::get_speedbrake, &FGControls::set_speedbrake )
277 ->setAttribute( SGPropertyNode::ARCHIVE, true );
279 _tiedProperties.Tie( "wing-sweep", this, &FGControls::get_wing_sweep, &FGControls::set_wing_sweep )
280 ->setAttribute( SGPropertyNode::ARCHIVE, true );
282 _tiedProperties.Tie( "wing-fold", this, &FGControls::get_wing_fold, &FGControls::set_wing_fold )
283 ->setAttribute( SGPropertyNode::ARCHIVE, true );
285 _tiedProperties.Tie( "drag-chute", this, &FGControls::get_drag_chute, &FGControls::set_drag_chute )
286 ->setAttribute( SGPropertyNode::ARCHIVE, true );
289 _tiedProperties.setRoot( fgGetNode("/controls/engines", true ) );
291 _tiedProperties.Tie( "throttle_idle", this, &FGControls::get_throttle_idle, &FGControls::set_throttle_idle )
292 ->setAttribute( SGPropertyNode::ARCHIVE, true );
294 for (index = 0; index < MAX_ENGINES; index++) {
295 _SetRoot(_tiedProperties, "/controls/engines/engine", index );
297 _tiedProperties.Tie( "throttle", this, index, &FGControls::get_throttle, &FGControls::set_throttle )
298 ->setAttribute( SGPropertyNode::ARCHIVE, true );
300 _tiedProperties.Tie( "starter", this, index, &FGControls::get_starter, &FGControls::set_starter )
301 ->setAttribute( SGPropertyNode::ARCHIVE, true );
303 _tiedProperties.Tie( "fuel-pump", this, index, &FGControls::get_fuel_pump, &FGControls::set_fuel_pump )
304 ->setAttribute( SGPropertyNode::ARCHIVE, true );
306 _tiedProperties.Tie( "fire-switch", this, index, &FGControls::get_fire_switch, &FGControls::set_fire_switch )
307 ->setAttribute( SGPropertyNode::ARCHIVE, true );
309 _tiedProperties.Tie( "fire-bottle-discharge", this, index, &FGControls::get_fire_bottle_discharge, &FGControls::set_fire_bottle_discharge )
310 ->setAttribute( SGPropertyNode::ARCHIVE, true );
312 _tiedProperties.Tie( "cutoff", this, index, &FGControls::get_cutoff, &FGControls::set_cutoff )
313 ->setAttribute( SGPropertyNode::ARCHIVE, true );
315 _tiedProperties.Tie( "mixture", this, index, &FGControls::get_mixture, &FGControls::set_mixture )
316 ->setAttribute( SGPropertyNode::ARCHIVE, true );
318 _tiedProperties.Tie( "propeller-pitch", this, index, &FGControls::get_prop_advance, &FGControls::set_prop_advance )
319 ->setAttribute( SGPropertyNode::ARCHIVE, true );
321 _tiedProperties.Tie( "magnetos", this, index, &FGControls::get_magnetos, &FGControls::set_magnetos )
322 ->setAttribute( SGPropertyNode::ARCHIVE, true );
324 _tiedProperties.Tie( "feed_tank", this, index, &FGControls::get_feed_tank, &FGControls::set_feed_tank )
325 ->setAttribute( SGPropertyNode::ARCHIVE, true );
327 _tiedProperties.Tie( "WEP", this, index, &FGControls::get_nitrous_injection, &FGControls::set_nitrous_injection )
328 ->setAttribute( SGPropertyNode::ARCHIVE, true );
330 _tiedProperties.Tie( "cowl-flaps-norm", this, index, &FGControls::get_cowl_flaps_norm, &FGControls::set_cowl_flaps_norm )
331 ->setAttribute( SGPropertyNode::ARCHIVE, true );
333 _tiedProperties.Tie( "propeller-feather", this, index, &FGControls::get_feather, &FGControls::set_feather )
334 ->setAttribute( SGPropertyNode::ARCHIVE, true );
336 _tiedProperties.Tie( "ignition", this, index, &FGControls::get_ignition, &FGControls::set_ignition )
337 ->setAttribute( SGPropertyNode::ARCHIVE, true );
339 _tiedProperties.Tie( "augmentation", this, index, &FGControls::get_augmentation, &FGControls::set_augmentation )
340 ->setAttribute( SGPropertyNode::ARCHIVE, true );
342 _tiedProperties.Tie( "reverser", this, index, &FGControls::get_reverser, &FGControls::set_reverser )
343 ->setAttribute( SGPropertyNode::ARCHIVE, true );
345 _tiedProperties.Tie( "water-injection", this, index, &FGControls::get_water_injection, &FGControls::set_water_injection )
346 ->setAttribute( SGPropertyNode::ARCHIVE, true );
348 _tiedProperties.Tie( "condition", this, index, &FGControls::get_condition, &FGControls::set_condition )
349 ->setAttribute( SGPropertyNode::ARCHIVE, true );
353 _SetRoot( _tiedProperties, "/controls/fuel" );
355 _tiedProperties.Tie( "dump-valve", this, &FGControls::get_dump_valve, &FGControls::set_dump_valve)
356 ->setAttribute( SGPropertyNode::ARCHIVE, true );
358 for (index = 0; index < MAX_TANKS; index++) {
359 _SetRoot( _tiedProperties, "/controls/fuel/tank", index );
361 _tiedProperties.Tie( "fuel_selector", this, index, &FGControls::get_fuel_selector, &FGControls::set_fuel_selector)
362 ->setAttribute( SGPropertyNode::ARCHIVE, true );
364 _tiedProperties.Tie( "to_engine", this, index, &FGControls::get_to_engine, &FGControls::set_to_engine)
365 ->setAttribute( SGPropertyNode::ARCHIVE, true );
367 _tiedProperties.Tie( "to_tank", this, index, &FGControls::get_to_tank, &FGControls::set_to_tank)
368 ->setAttribute( SGPropertyNode::ARCHIVE, true );
370 for (i = 0; i < MAX_BOOSTPUMPS; i++) {
371 _tiedProperties.Tie( "boost-pump", i,
372 this, index * 2 + i, &FGControls::get_boost_pump, &FGControls::set_boost_pump)
373 ->setAttribute( SGPropertyNode::ARCHIVE, true );
378 _SetRoot( _tiedProperties, "/controls/gear" );
380 _tiedProperties.Tie( "brake-left", this, &FGControls::get_brake_left, &FGControls::set_brake_left)
381 ->setAttribute( SGPropertyNode::ARCHIVE, true );
383 _tiedProperties.Tie( "brake-right", this, &FGControls::get_brake_right, &FGControls::set_brake_right)
384 ->setAttribute( SGPropertyNode::ARCHIVE, true );
386 _tiedProperties.Tie( "copilot-brake-left", this, &FGControls::get_copilot_brake_left, &FGControls::set_copilot_brake_left)
387 ->setAttribute( SGPropertyNode::ARCHIVE, true );
389 _tiedProperties.Tie( "copilot-brake-right", this, &FGControls::get_copilot_brake_right, &FGControls::set_copilot_brake_right)
390 ->setAttribute( SGPropertyNode::ARCHIVE, true );
392 _tiedProperties.Tie( "brake-parking", this, &FGControls::get_brake_parking, &FGControls::set_brake_parking)
393 ->setAttribute( SGPropertyNode::ARCHIVE, true );
395 _tiedProperties.Tie( "steering", this, &FGControls::get_steering, &FGControls::set_steering)
396 ->setAttribute( SGPropertyNode::ARCHIVE, true );
398 _tiedProperties.Tie( "nose-wheel-steering", this, &FGControls::get_nose_wheel_steering, &FGControls::set_nose_wheel_steering)
399 ->setAttribute( SGPropertyNode::ARCHIVE, true );
401 _tiedProperties.Tie( "gear-down", this, &FGControls::get_gear_down, &FGControls::set_gear_down)
402 ->setAttribute( SGPropertyNode::ARCHIVE, true );
404 _tiedProperties.Tie( "antiskid", this, &FGControls::get_antiskid, &FGControls::set_antiskid)
405 ->setAttribute( SGPropertyNode::ARCHIVE, true );
407 _tiedProperties.Tie( "tailhook", this, &FGControls::get_tailhook, &FGControls::set_tailhook)
408 ->setAttribute( SGPropertyNode::ARCHIVE, true );
410 _tiedProperties.Tie( "launchbar", this, &FGControls::get_launchbar, &FGControls::set_launchbar)
411 ->setAttribute( SGPropertyNode::ARCHIVE, true );
413 _tiedProperties.Tie( "catapult-launch-cmd", this, &FGControls::get_catapult_launch_cmd, &FGControls::set_catapult_launch_cmd)
414 ->setAttribute( SGPropertyNode::ARCHIVE, true );
416 _tiedProperties.Tie( "tailwheel-lock", this, &FGControls::get_tailwheel_lock, &FGControls::set_tailwheel_lock)
417 ->setAttribute( SGPropertyNode::ARCHIVE, true );
419 for (index = 0; index < MAX_WHEELS; index++) {
420 _SetRoot( _tiedProperties, "/controls/gear/wheel", index );
421 _tiedProperties.Tie( "alternate-extension", this, index, &FGControls::get_alternate_extension, &FGControls::set_alternate_extension)
422 ->setAttribute( SGPropertyNode::ARCHIVE, true );
426 _SetRoot( _tiedProperties, "/controls/anti-ice" );
428 _tiedProperties.Tie( "wing-heat", this, &FGControls::get_wing_heat, &FGControls::set_wing_heat)
429 ->setAttribute( SGPropertyNode::ARCHIVE, true );
431 _tiedProperties.Tie( "pitot-heat", this, &FGControls::get_pitot_heat, &FGControls::set_pitot_heat)
432 ->setAttribute( SGPropertyNode::ARCHIVE, true );
434 _tiedProperties.Tie( "wiper", this, &FGControls::get_wiper, &FGControls::set_wiper)
435 ->setAttribute( SGPropertyNode::ARCHIVE, true );
437 _tiedProperties.Tie( "window-heat", this, &FGControls::get_window_heat, &FGControls::set_window_heat)
438 ->setAttribute( SGPropertyNode::ARCHIVE, true );
440 for (index = 0; index < MAX_ENGINES; index++) {
441 _SetRoot( _tiedProperties, "/controls/anti-ice/engine", index );
443 _tiedProperties.Tie( "carb-heat", this, index, &FGControls::get_carb_heat, &FGControls::set_carb_heat)
444 ->setAttribute( SGPropertyNode::ARCHIVE, true );
446 _tiedProperties.Tie( "inlet-heat", this, index, &FGControls::get_inlet_heat, &FGControls::set_inlet_heat)
447 ->setAttribute( SGPropertyNode::ARCHIVE, true );
451 for (index = 0; index < MAX_HYD_SYSTEMS; index++) {
452 _SetRoot( _tiedProperties, "/controls/hydraulic/system", index );
454 _tiedProperties.Tie( "engine-pump", this, index, &FGControls::get_engine_pump, &FGControls::set_engine_pump)
455 ->setAttribute( SGPropertyNode::ARCHIVE, true );
457 _tiedProperties.Tie( "electric-pump", this, index, &FGControls::get_electric_pump, &FGControls::set_electric_pump)
458 ->setAttribute( SGPropertyNode::ARCHIVE, true );
462 _SetRoot( _tiedProperties, "/controls/electric" );
464 _tiedProperties.Tie( "battery-switch", this, &FGControls::get_battery_switch, &FGControls::set_battery_switch)
465 ->setAttribute( SGPropertyNode::ARCHIVE, true );
467 _tiedProperties.Tie( "external-power", this, &FGControls::get_external_power, &FGControls::set_external_power)
468 ->setAttribute( SGPropertyNode::ARCHIVE, true );
470 _tiedProperties.Tie( "APU-generator", this, &FGControls::get_APU_generator, &FGControls::set_APU_generator)
471 ->setAttribute( SGPropertyNode::ARCHIVE, true );
473 for (index = 0; index < MAX_ENGINES; index++) {
474 _SetRoot( _tiedProperties, "/controls/electric/engine", index );
476 _tiedProperties.Tie( "generator", this, index, &FGControls::get_generator_breaker, &FGControls::set_generator_breaker)
477 ->setAttribute( SGPropertyNode::ARCHIVE, true );
479 _tiedProperties.Tie( "bus-tie", this, index, &FGControls::get_bus_tie, &FGControls::set_bus_tie)
480 ->setAttribute( SGPropertyNode::ARCHIVE, true );
484 _SetRoot( _tiedProperties, "/controls/pneumatic" );
486 _tiedProperties.Tie( "APU-bleed", this, &FGControls::get_APU_bleed, &FGControls::set_APU_bleed)
487 ->setAttribute( SGPropertyNode::ARCHIVE, true );
489 for (index = 0; index < MAX_ENGINES; index++) {
490 _SetRoot( _tiedProperties, "/controls/pneumatic/engine", index );
492 _tiedProperties.Tie( "bleed", this, index, &FGControls::get_engine_bleed, &FGControls::set_engine_bleed)
493 ->setAttribute( SGPropertyNode::ARCHIVE, true );
497 _SetRoot( _tiedProperties, "/controls/pressurization" );
499 _tiedProperties.Tie( "mode", this, &FGControls::get_mode, &FGControls::set_mode)
500 ->setAttribute( SGPropertyNode::ARCHIVE, true );
502 _tiedProperties.Tie( "dump", this, &FGControls::get_dump, &FGControls::set_dump)
503 ->setAttribute( SGPropertyNode::ARCHIVE, true );
505 _tiedProperties.Tie( "outflow-valve", this, &FGControls::get_outflow_valve, &FGControls::set_outflow_valve)
506 ->setAttribute( SGPropertyNode::ARCHIVE, true );
508 for (index = 0; index < MAX_PACKS; index++) {
509 _SetRoot( _tiedProperties, "/controls/pressurization/pack", index );
511 _tiedProperties.Tie( "pack-on", this, index, &FGControls::get_pack_on, &FGControls::set_pack_on)
512 ->setAttribute( SGPropertyNode::ARCHIVE, true );
516 _SetRoot( _tiedProperties, "/controls/lighting" );
518 _tiedProperties.Tie( "landing-lights", this, &FGControls::get_landing_lights, &FGControls::set_landing_lights)
519 ->setAttribute( SGPropertyNode::ARCHIVE, true );
521 _tiedProperties.Tie( "turn-off-lights", this, &FGControls::get_turn_off_lights, &FGControls::set_turn_off_lights)
522 ->setAttribute( SGPropertyNode::ARCHIVE, true );
524 _tiedProperties.Tie( "taxi-light", this, &FGControls::get_taxi_light, &FGControls::set_taxi_light)
525 ->setAttribute( SGPropertyNode::ARCHIVE, true );
527 _tiedProperties.Tie( "logo-lights", this, &FGControls::get_logo_lights, &FGControls::set_logo_lights)
528 ->setAttribute( SGPropertyNode::ARCHIVE, true );
530 _tiedProperties.Tie( "nav-lights", this, &FGControls::get_nav_lights, &FGControls::set_nav_lights)
531 ->setAttribute( SGPropertyNode::ARCHIVE, true );
533 _tiedProperties.Tie( "beacon", this, &FGControls::get_beacon, &FGControls::set_beacon)
534 ->setAttribute( SGPropertyNode::ARCHIVE, true );
536 _tiedProperties.Tie( "strobe", this, &FGControls::get_strobe, &FGControls::set_strobe)
537 ->setAttribute( SGPropertyNode::ARCHIVE, true );
539 _tiedProperties.Tie( "panel-norm", this, &FGControls::get_panel_norm, &FGControls::set_panel_norm)
540 ->setAttribute( SGPropertyNode::ARCHIVE, true );
542 _tiedProperties.Tie( "instruments-norm", this, &FGControls::get_instruments_norm, &FGControls::set_instruments_norm)
543 ->setAttribute( SGPropertyNode::ARCHIVE, true );
545 _tiedProperties.Tie( "dome-norm", this, &FGControls::get_dome_norm, &FGControls::set_dome_norm)
546 ->setAttribute( SGPropertyNode::ARCHIVE, true );
549 _SetRoot( _tiedProperties, "/controls/armament" );
551 _tiedProperties.Tie( "master-arm", this, &FGControls::get_master_arm, &FGControls::set_master_arm)
552 ->setAttribute( SGPropertyNode::ARCHIVE, true );
554 _tiedProperties.Tie( "station-select", this, &FGControls::get_station_select, &FGControls::set_station_select)
555 ->setAttribute( SGPropertyNode::ARCHIVE, true );
557 _tiedProperties.Tie( "release-all", this, &FGControls::get_release_ALL, &FGControls::set_release_ALL)
558 ->setAttribute( SGPropertyNode::ARCHIVE, true );
560 for (index = 0; index < MAX_STATIONS; index++) {
561 _SetRoot( _tiedProperties, "/controls/armament/station", index );
563 _tiedProperties.Tie( "stick-size", this, index, &FGControls::get_stick_size, &FGControls::set_stick_size)
564 ->setAttribute( SGPropertyNode::ARCHIVE, true );
566 _tiedProperties.Tie( "release-stick", this, index, &FGControls::get_release_stick, &FGControls::set_release_stick)
567 ->setAttribute( SGPropertyNode::ARCHIVE, true );
569 _tiedProperties.Tie( "release-all", this, index, &FGControls::get_release_all, &FGControls::set_release_all)
570 ->setAttribute( SGPropertyNode::ARCHIVE, true );
572 _tiedProperties.Tie( "jettison-all", this, index, &FGControls::get_jettison_all, &FGControls::set_jettison_all)
573 ->setAttribute( SGPropertyNode::ARCHIVE, true );
577 _SetRoot( _tiedProperties, "/controls/seat" );
579 _tiedProperties.Tie( "vertical-adjust", this, &FGControls::get_vertical_adjust, &FGControls::set_vertical_adjust)
580 ->setAttribute( SGPropertyNode::ARCHIVE, true );
582 _tiedProperties.Tie( "fore-aft-adjust", this, &FGControls::get_fore_aft_adjust, &FGControls::set_fore_aft_adjust)
583 ->setAttribute( SGPropertyNode::ARCHIVE, true );
585 _tiedProperties.Tie( "cmd_selector_valve", this, &FGControls::get_cmd_selector_valve, &FGControls::set_cmd_selector_valve)
586 ->setAttribute( SGPropertyNode::ARCHIVE, true );
588 for (index = 0; index < MAX_EJECTION_SEATS; index++) {
589 _SetRoot( _tiedProperties, "/controls/seat/eject", index );
591 _tiedProperties.Tie( "initiate", this, index, &FGControls::get_ejection_seat, &FGControls::set_ejection_seat)
592 ->setAttribute( SGPropertyNode::ARCHIVE, true );
594 _tiedProperties.Tie( "status", this, index, &FGControls::get_eseat_status, &FGControls::set_eseat_status)
595 ->setAttribute( SGPropertyNode::ARCHIVE, true );
599 _SetRoot( _tiedProperties, "/controls/APU" );
601 _tiedProperties.Tie( "off-start-run", this, &FGControls::get_off_start_run, &FGControls::set_off_start_run)
602 ->setAttribute( SGPropertyNode::ARCHIVE, true );
604 _tiedProperties.Tie( "fire-switch", this, &FGControls::get_APU_fire_switch, &FGControls::set_APU_fire_switch)
605 ->setAttribute( SGPropertyNode::ARCHIVE, true );
608 for (index = 0; index < MAX_AUTOPILOTS; index++) {
610 _SetRoot( _tiedProperties, "/controls/autoflight/autopilot", index );
612 _tiedProperties.Tie( "engage", this, index, &FGControls::get_autopilot_engage, &FGControls::set_autopilot_engage)
613 ->setAttribute( SGPropertyNode::ARCHIVE, true );
616 _SetRoot( _tiedProperties, "/controls/autoflight/" );
618 _tiedProperties.Tie( "autothrottle-arm", this, &FGControls::get_autothrottle_arm, &FGControls::set_autothrottle_arm)
619 ->setAttribute( SGPropertyNode::ARCHIVE, true );
621 _tiedProperties.Tie( "autothrottle-engage", this, &FGControls::get_autothrottle_engage, &FGControls::set_autothrottle_engage)
622 ->setAttribute( SGPropertyNode::ARCHIVE, true );
624 _tiedProperties.Tie( "heading-select", this, &FGControls::get_heading_select, &FGControls::set_heading_select)
625 ->setAttribute( SGPropertyNode::ARCHIVE, true );
627 _tiedProperties.Tie( "altitude-select", this, &FGControls::get_altitude_select, &FGControls::set_altitude_select)
628 ->setAttribute( SGPropertyNode::ARCHIVE, true );
630 _tiedProperties.Tie( "bank-angle-select", this, &FGControls::get_bank_angle_select, &FGControls::set_bank_angle_select)
631 ->setAttribute( SGPropertyNode::ARCHIVE, true );
633 _tiedProperties.Tie( "vertical-speed-select", this, &FGControls::get_vertical_speed_select, &FGControls::set_vertical_speed_select)
634 ->setAttribute( SGPropertyNode::ARCHIVE, true );
636 _tiedProperties.Tie( "speed-select", this, &FGControls::get_speed_select, &FGControls::set_speed_select)
637 ->setAttribute( SGPropertyNode::ARCHIVE, true );
639 _tiedProperties.Tie( "mach-select", this, &FGControls::get_mach_select, &FGControls::set_mach_select)
640 ->setAttribute( SGPropertyNode::ARCHIVE, true );
642 _tiedProperties.Tie( "vertical-mode", this, &FGControls::get_vertical_mode, &FGControls::set_vertical_mode)
643 ->setAttribute( SGPropertyNode::ARCHIVE, true );
645 _tiedProperties.Tie( "lateral-mode", this, &FGControls::get_lateral_mode, &FGControls::set_lateral_mode)
646 ->setAttribute( SGPropertyNode::ARCHIVE, true );
649 void FGControls::unbind ()
651 _tiedProperties.Untie();
656 FGControls::update (double dt)
660 // nothing here, don't call again
664 ////////////////////////////////////////////////////////////////////////
665 // Setters and adjusters.
666 ////////////////////////////////////////////////////////////////////////
669 FGControls::set_aileron (double pos)
672 SG_CLAMP_RANGE<double>( aileron, -1.0, 1.0 );
673 do_autocoordination();
677 FGControls::move_aileron (double amt)
680 SG_CLAMP_RANGE<double>( aileron, -1.0, 1.0 );
681 do_autocoordination();
685 FGControls::set_aileron_trim( double pos )
688 SG_CLAMP_RANGE<double>( aileron_trim, -1.0, 1.0 );
692 FGControls::move_aileron_trim( double amt )
695 SG_CLAMP_RANGE<double>( aileron_trim, -1.0, 1.0 );
699 FGControls::set_elevator( double pos )
702 SG_CLAMP_RANGE<double>( elevator, -1.0, 1.0 );
706 FGControls::move_elevator( double amt )
709 SG_CLAMP_RANGE<double>( elevator, -1.0, 1.0 );
713 FGControls::set_elevator_trim( double pos )
716 SG_CLAMP_RANGE<double>( elevator_trim, -1.0, 1.0 );
720 FGControls::move_elevator_trim( double amt )
722 elevator_trim += amt;
723 SG_CLAMP_RANGE<double>( elevator_trim, -1.0, 1.0 );
727 FGControls::set_rudder( double pos )
730 SG_CLAMP_RANGE<double>( rudder, -1.0, 1.0 );
734 FGControls::move_rudder( double amt )
737 SG_CLAMP_RANGE<double>( rudder, -1.0, 1.0 );
741 FGControls::set_rudder_trim( double pos )
744 SG_CLAMP_RANGE<double>( rudder_trim, -1.0, 1.0 );
748 FGControls::move_rudder_trim( double amt )
751 SG_CLAMP_RANGE<double>( rudder_trim, -1.0, 1.0 );
755 FGControls::set_flaps( double pos )
758 SG_CLAMP_RANGE<double>( flaps, 0.0, 1.0 );
762 FGControls::move_flaps( double amt )
765 SG_CLAMP_RANGE<double>( flaps, 0.0, 1.0 );
769 FGControls::set_slats( double pos )
772 SG_CLAMP_RANGE<double>( slats, 0.0, 1.0 );
776 FGControls::move_slats( double amt )
779 SG_CLAMP_RANGE<double>( slats, 0.0, 1.0 );
783 FGControls::set_BLC( bool val )
789 FGControls::set_spoilers( double pos )
792 SG_CLAMP_RANGE<double>( spoilers, 0.0, 1.0 );
796 FGControls::move_spoilers( double amt )
799 SG_CLAMP_RANGE<double>( spoilers, 0.0, 1.0 );
803 FGControls::set_speedbrake( double pos )
806 SG_CLAMP_RANGE<double>( speedbrake, 0.0, 1.0 );
810 FGControls::move_speedbrake( double amt )
813 SG_CLAMP_RANGE<double>( speedbrake, 0.0, 1.0 );
817 FGControls::set_wing_sweep( double pos )
820 SG_CLAMP_RANGE<double>( wing_sweep, 0.0, 1.0 );
824 FGControls::move_wing_sweep( double amt )
827 SG_CLAMP_RANGE<double>( wing_sweep, 0.0, 1.0 );
831 FGControls::set_wing_fold( bool val )
837 FGControls::set_drag_chute( bool val )
843 FGControls::set_throttle_idle( bool val )
849 FGControls::set_throttle( int engine, double pos )
851 if ( engine == ALL_ENGINES ) {
852 for ( int i = 0; i < MAX_ENGINES; i++ ) {
854 SG_CLAMP_RANGE<double>( throttle[i], 0.0, 1.0 );
857 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
858 throttle[engine] = pos;
859 SG_CLAMP_RANGE<double>( throttle[engine], 0.0, 1.0 );
865 FGControls::move_throttle( int engine, double amt )
867 if ( engine == ALL_ENGINES ) {
868 for ( int i = 0; i < MAX_ENGINES; i++ ) {
870 SG_CLAMP_RANGE<double>( throttle[i], 0.0, 1.0 );
873 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
874 throttle[engine] += amt;
875 SG_CLAMP_RANGE<double>( throttle[engine], 0.0, 1.0 );
881 FGControls::set_starter( int engine, bool flag )
883 if ( engine == ALL_ENGINES ) {
884 for ( int i = 0; i < MAX_ENGINES; i++ ) {
888 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
889 starter[engine] = flag;
895 FGControls::set_fuel_pump( int engine, bool val )
897 if ( engine == ALL_ENGINES ) {
898 for ( int i = 0; i < MAX_ENGINES; i++ ) {
902 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
903 fuel_pump[engine] = val;
909 FGControls::set_fire_switch( int engine, bool val )
911 if ( engine == ALL_ENGINES ) {
912 for ( int i = 0; i < MAX_ENGINES; i++ ) {
913 fire_switch[i] = val;
916 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
917 fire_switch[engine] = val;
923 FGControls::set_fire_bottle_discharge( int engine, bool val )
925 if ( engine == ALL_ENGINES ) {
926 for ( int i = 0; i < MAX_ENGINES; i++ ) {
927 fire_bottle_discharge[i] = val;
930 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
931 fire_bottle_discharge[engine] = val;
937 FGControls::set_cutoff( int engine, bool val )
939 if ( engine == ALL_ENGINES ) {
940 for ( int i = 0; i < MAX_ENGINES; i++ ) {
944 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
945 cutoff[engine] = val;
951 FGControls::set_feed_tank( int engine, int tank )
953 if ( engine == ALL_ENGINES ) {
954 for ( int i = 0; i < MAX_ENGINES; i++ ) {
956 SG_CLAMP_RANGE<int>( feed_tank[i], -1, 4 );
959 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
960 feed_tank[engine] = tank;
961 SG_CLAMP_RANGE<int>( feed_tank[engine], -1, 4 );
964 // feed_tank[engine] = engine;
969 FGControls::set_mixture( int engine, double pos )
971 if ( engine == ALL_ENGINES ) {
972 for ( int i = 0; i < MAX_ENGINES; i++ ) {
974 SG_CLAMP_RANGE<double>( mixture[i], 0.0, 1.0 );
977 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
978 mixture[engine] = pos;
979 SG_CLAMP_RANGE<double>( mixture[engine], 0.0, 1.0 );
985 FGControls::move_mixture( int engine, double amt )
987 if ( engine == ALL_ENGINES ) {
988 for ( int i = 0; i < MAX_ENGINES; i++ ) {
990 SG_CLAMP_RANGE<double>( mixture[i], 0.0, 1.0 );
993 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
994 mixture[engine] += amt;
995 SG_CLAMP_RANGE<double>( mixture[engine], 0.0, 1.0 );
1001 FGControls::set_prop_advance( int engine, double pos )
1003 if ( engine == ALL_ENGINES ) {
1004 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1005 prop_advance[i] = pos;
1006 SG_CLAMP_RANGE<double>( prop_advance[i], 0.0, 1.0 );
1009 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1010 prop_advance[engine] = pos;
1011 SG_CLAMP_RANGE<double>( prop_advance[engine], 0.0, 1.0 );
1017 FGControls::move_prop_advance( int engine, double amt )
1019 if ( engine == ALL_ENGINES ) {
1020 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1021 prop_advance[i] += amt;
1022 SG_CLAMP_RANGE<double>( prop_advance[i], 0.0, 1.0 );
1025 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1026 prop_advance[engine] += amt;
1027 SG_CLAMP_RANGE<double>( prop_advance[engine], 0.0, 1.0 );
1033 FGControls::set_magnetos( int engine, int pos )
1035 if ( engine == ALL_ENGINES ) {
1036 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1038 SG_CLAMP_RANGE<int>( magnetos[i], 0, 3 );
1041 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1042 magnetos[engine] = pos;
1043 SG_CLAMP_RANGE<int>( magnetos[engine], 0, 3 );
1049 FGControls::move_magnetos( int engine, int amt )
1051 if ( engine == ALL_ENGINES ) {
1052 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1054 SG_CLAMP_RANGE<int>( magnetos[i], 0, 3 );
1057 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1058 magnetos[engine] += amt;
1059 SG_CLAMP_RANGE<int>( magnetos[engine], 0, 3 );
1065 FGControls::set_nitrous_injection( int engine, bool val )
1067 if ( engine == ALL_ENGINES ) {
1068 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1069 nitrous_injection[i] = val;
1072 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1073 nitrous_injection[engine] = val;
1080 FGControls::set_cowl_flaps_norm( int engine, double pos )
1082 if ( engine == ALL_ENGINES ) {
1083 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1084 cowl_flaps_norm[i] = pos;
1085 SG_CLAMP_RANGE<double>( cowl_flaps_norm[i], 0.0, 1.0 );
1088 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1089 cowl_flaps_norm[engine] = pos;
1090 SG_CLAMP_RANGE<double>( cowl_flaps_norm[engine], 0.0, 1.0 );
1096 FGControls::move_cowl_flaps_norm( int engine, double amt )
1098 if ( engine == ALL_ENGINES ) {
1099 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1100 cowl_flaps_norm[i] += amt;
1101 SG_CLAMP_RANGE<double>( cowl_flaps_norm[i], 0.0, 1.0 );
1104 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1105 cowl_flaps_norm[engine] += amt;
1106 SG_CLAMP_RANGE<double>( cowl_flaps_norm[engine], 0.0, 1.0 );
1112 FGControls::set_feather( int engine, bool val )
1114 if ( engine == ALL_ENGINES ) {
1115 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1119 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1120 feather[engine] = val;
1126 FGControls::set_ignition( int engine, int pos )
1128 if ( engine == ALL_ENGINES ) {
1129 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1131 SG_CLAMP_RANGE<int>( ignition[i], 0, 3 );
1134 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1135 ignition[engine] = pos;
1136 SG_CLAMP_RANGE<int>( ignition[engine], 0, 3 );
1142 FGControls::set_augmentation( int engine, bool val )
1144 if ( engine == ALL_ENGINES ) {
1145 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1146 augmentation[i] = val;
1149 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1150 augmentation[engine] = val;
1156 FGControls::set_reverser( int engine, bool val )
1158 if ( engine == ALL_ENGINES ) {
1159 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1163 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1164 reverser[engine] = val;
1170 FGControls::set_water_injection( int engine, bool val )
1172 if ( engine == ALL_ENGINES ) {
1173 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1174 water_injection[i] = val;
1177 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1178 water_injection[engine] = val;
1184 FGControls::set_condition( int engine, double val )
1186 if ( engine == ALL_ENGINES ) {
1187 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1189 SG_CLAMP_RANGE<double>( condition[i], 0.0, 1.0 );
1192 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1193 condition[engine] = val;
1194 SG_CLAMP_RANGE<double>( condition[engine], 0.0, 1.0 );
1200 FGControls::set_dump_valve( bool val )
1207 FGControls::set_fuel_selector( int tank, bool pos )
1209 if ( tank == ALL_TANKS ) {
1210 for ( int i = 0; i < MAX_TANKS; i++ ) {
1211 fuel_selector[i] = pos;
1214 if ( (tank >= 0) && (tank < MAX_TANKS) ) {
1215 fuel_selector[tank] = pos;
1221 FGControls::set_to_engine( int tank, int engine )
1223 if ( tank == ALL_TANKS ) {
1224 for ( int i = 0; i < MAX_TANKS; i++ ) {
1225 to_engine[i] = engine;
1228 if ( (tank >= 0) && (tank < MAX_TANKS) ) {
1229 to_engine[tank] = engine;
1235 FGControls::set_to_tank( int tank, int dest_tank )
1237 if ( tank == ALL_TANKS ) {
1238 for ( int i = 0; i < MAX_TANKS; i++ ) {
1239 to_tank[i] = dest_tank;
1242 if ( (tank >= 0) && (tank < MAX_TANKS) ) {
1243 to_tank[tank] = dest_tank;
1249 FGControls::set_boost_pump( int index, bool val )
1251 if ( index == -1 ) {
1252 for ( int i = 0; i < (MAX_TANKS * MAX_BOOSTPUMPS); i++ ) {
1253 boost_pump[i] = val;
1256 if ( (index >= 0) && (index < (MAX_TANKS * MAX_BOOSTPUMPS)) ) {
1257 boost_pump[index] = val;
1264 FGControls::set_brake_left( double pos )
1267 SG_CLAMP_RANGE<double>(brake_left, 0.0, 1.0);
1271 FGControls::move_brake_left( double amt )
1274 SG_CLAMP_RANGE<double>( brake_left, 0.0, 1.0 );
1278 FGControls::set_brake_right( double pos )
1281 SG_CLAMP_RANGE<double>(brake_right, 0.0, 1.0);
1285 FGControls::move_brake_right( double amt )
1288 SG_CLAMP_RANGE<double>( brake_right, 0.0, 1.0 );
1292 FGControls::set_copilot_brake_left( double pos )
1294 copilot_brake_left = pos;
1295 SG_CLAMP_RANGE<double>(brake_left, 0.0, 1.0);
1299 FGControls::set_copilot_brake_right( double pos )
1301 copilot_brake_right = pos;
1302 SG_CLAMP_RANGE<double>(brake_right, 0.0, 1.0);
1306 FGControls::set_brake_parking( double pos )
1308 brake_parking = pos;
1309 SG_CLAMP_RANGE<double>(brake_parking, 0.0, 1.0);
1313 FGControls::set_steering( double angle )
1316 SG_CLAMP_RANGE<double>(steering, -80.0, 80.0);
1320 FGControls::set_nose_wheel_steering( bool nws )
1322 nose_wheel_steering = nws;
1326 FGControls::move_steering( double angle )
1329 SG_CLAMP_RANGE<double>(steering, -80.0, 80.0);
1333 FGControls::set_gear_down( bool gear )
1339 FGControls::set_antiskid( bool state )
1345 FGControls::set_tailhook( bool state )
1351 FGControls::set_launchbar( bool state )
1357 FGControls::set_catapult_launch_cmd( bool state )
1359 catapult_launch_cmd = state;
1363 FGControls::set_tailwheel_lock( bool state )
1365 tailwheel_lock = state;
1370 FGControls::set_alternate_extension( int wheel, bool val )
1372 if ( wheel == ALL_WHEELS ) {
1373 for ( int i = 0; i < MAX_WHEELS; i++ ) {
1374 alternate_extension[i] = val;
1377 if ( (wheel >= 0) && (wheel < MAX_WHEELS) ) {
1378 alternate_extension[wheel] = val;
1384 FGControls::set_wing_heat( bool state )
1390 FGControls::set_pitot_heat( bool state )
1396 FGControls::set_wiper( int state )
1402 FGControls::set_window_heat( bool state )
1404 window_heat = state;
1408 FGControls::set_carb_heat( int engine, bool val )
1410 if ( engine == ALL_ENGINES ) {
1411 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1415 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1416 carb_heat[engine] = val;
1422 FGControls::set_inlet_heat( int engine, bool val )
1424 if ( engine == ALL_ENGINES ) {
1425 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1426 inlet_heat[i] = val;
1429 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1430 inlet_heat[engine] = val;
1436 FGControls::set_engine_pump( int system, bool val )
1438 if ( system == ALL_HYD_SYSTEMS ) {
1439 for ( int i = 0; i < MAX_HYD_SYSTEMS; i++ ) {
1440 engine_pump[i] = val;
1443 if ( (system >= 0) && (system < MAX_HYD_SYSTEMS) ) {
1444 engine_pump[system] = val;
1450 FGControls::set_electric_pump( int system, bool val )
1452 if ( system == ALL_HYD_SYSTEMS ) {
1453 for ( int i = 0; i < MAX_HYD_SYSTEMS; i++ ) {
1454 electric_pump[i] = val;
1457 if ( (system >= 0) && (system < MAX_HYD_SYSTEMS) ) {
1458 electric_pump[system] = val;
1464 FGControls::set_battery_switch( bool state )
1466 battery_switch = state;
1470 FGControls::set_external_power( bool state )
1472 external_power = state;
1476 FGControls::set_APU_generator( bool state )
1478 APU_generator = state;
1482 FGControls::set_generator_breaker( int engine, bool val )
1484 if ( engine == ALL_ENGINES ) {
1485 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1486 generator_breaker[i] = val;
1489 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1490 generator_breaker[engine] = val;
1496 FGControls::set_bus_tie( int engine, bool val )
1498 if ( engine == ALL_ENGINES ) {
1499 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1503 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1504 bus_tie[engine] = val;
1510 FGControls::set_APU_bleed( bool state )
1516 FGControls::set_engine_bleed( int engine, bool val )
1518 if ( engine == ALL_ENGINES ) {
1519 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1520 engine_bleed[i] = val;
1523 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1524 engine_bleed[engine] = val;
1530 FGControls::set_mode( int new_mode )
1536 FGControls::set_outflow_valve( double pos )
1538 outflow_valve = pos;
1539 SG_CLAMP_RANGE<double>( outflow_valve, 0.0, 1.0 );
1543 FGControls::move_outflow_valve( double amt )
1545 outflow_valve += amt;
1546 SG_CLAMP_RANGE<double>( outflow_valve, 0.0, 1.0 );
1550 FGControls::set_dump( bool state )
1556 FGControls::set_pack_on( int pack, bool val )
1558 if ( pack == ALL_PACKS ) {
1559 for ( int i = 0; i < MAX_PACKS; i++ ) {
1563 if ( (pack >= 0) && (pack < MAX_PACKS) ) {
1564 pack_on[pack] = val;
1570 FGControls::set_landing_lights( bool state )
1572 landing_lights = state;
1576 FGControls::set_turn_off_lights( bool state )
1578 turn_off_lights = state;
1582 FGControls::set_taxi_light( bool state )
1588 FGControls::set_logo_lights( bool state )
1590 logo_lights = state;
1594 FGControls::set_nav_lights( bool state )
1600 FGControls::set_beacon( bool state )
1606 FGControls::set_strobe( bool state )
1612 FGControls::set_panel_norm( double intensity )
1614 panel_norm = intensity;
1615 SG_CLAMP_RANGE<double>( panel_norm, 0.0, 1.0 );
1619 FGControls::move_panel_norm( double amt )
1622 SG_CLAMP_RANGE<double>( panel_norm, 0.0, 1.0 );
1626 FGControls::set_instruments_norm( double intensity )
1628 instruments_norm = intensity;
1629 SG_CLAMP_RANGE<double>( instruments_norm, 0.0, 1.0 );
1633 FGControls::move_instruments_norm( double amt )
1635 instruments_norm += amt;
1636 SG_CLAMP_RANGE<double>( instruments_norm, 0.0, 1.0 );
1640 FGControls::set_dome_norm( double intensity )
1642 dome_norm = intensity;
1643 SG_CLAMP_RANGE<double>( dome_norm, 0.0, 1.0 );
1647 FGControls::move_dome_norm( double amt )
1650 SG_CLAMP_RANGE<double>( dome_norm, 0.0, 1.0 );
1654 FGControls::set_master_arm( bool val )
1660 FGControls::set_station_select( int station )
1662 station_select = station;
1663 SG_CLAMP_RANGE<int>( station_select, 0, MAX_STATIONS );
1667 FGControls::set_release_ALL( bool val )
1673 FGControls::set_stick_size( int station, int size )
1675 if ( station == ALL_STATIONS ) {
1676 for ( int i = 0; i < MAX_STATIONS; i++ ) {
1677 stick_size[i] = size;
1678 SG_CLAMP_RANGE<int>( stick_size[i], 1, 20 );
1681 if ( (station >= 0) && (station < MAX_STATIONS) ) {
1682 stick_size[station] = size;
1683 SG_CLAMP_RANGE<int>( stick_size[station], 1, 20 );
1689 FGControls::set_release_stick( int station, bool val )
1691 if ( station == ALL_STATIONS ) {
1692 for ( int i = 0; i < MAX_STATIONS; i++ ) {
1693 release_stick[i] = val;
1696 if ( (station >= 0) && (station < MAX_STATIONS) ) {
1697 release_stick[station] = val;
1703 FGControls::set_release_all( int station, bool val )
1705 if ( station == ALL_STATIONS ) {
1706 for ( int i = 0; i < MAX_STATIONS; i++ ) {
1707 release_all[i] = val;
1710 if ( (station >= 0) && (station < MAX_STATIONS) ) {
1711 release_all[station] = val;
1717 FGControls::set_jettison_all( int station, bool val )
1719 if ( station == ALL_STATIONS ) {
1720 for ( int i = 0; i < MAX_STATIONS; i++ ) {
1721 jettison_all[i] = val;
1724 if ( (station >= 0) && (station < MAX_STATIONS) ) {
1725 jettison_all[station] = val;
1731 FGControls::set_vertical_adjust( double pos )
1733 vertical_adjust = pos;
1734 SG_CLAMP_RANGE<double>( vertical_adjust, -1.0, 1.0 );
1738 FGControls::move_vertical_adjust( double amt )
1740 vertical_adjust += amt;
1741 SG_CLAMP_RANGE<double>( vertical_adjust, -1.0, 1.0 );
1745 FGControls::set_fore_aft_adjust( double pos )
1747 fore_aft_adjust = pos;
1748 SG_CLAMP_RANGE<double>( fore_aft_adjust, -1.0, 1.0 );
1752 FGControls::move_fore_aft_adjust( double amt )
1754 fore_aft_adjust += amt;
1755 SG_CLAMP_RANGE<double>( fore_aft_adjust, -1.0, 1.0 );
1759 FGControls::set_ejection_seat( int which_seat, bool val )
1761 if ( which_seat == ALL_EJECTION_SEATS ) {
1762 for ( int i = 0; i < MAX_EJECTION_SEATS; i++ ) {
1766 if ( (which_seat >= 0) && (which_seat <= MAX_EJECTION_SEATS) ) {
1767 if ( eseat_status[which_seat] == SEAT_SAFED ||
1768 eseat_status[which_seat] == SEAT_FAIL )
1770 // we can never eject if SEAT_SAFED or SEAT_FAIL
1774 eject[which_seat] = val;
1780 FGControls::set_eseat_status( int which_seat, int val )
1782 if ( which_seat == ALL_EJECTION_SEATS ) {
1783 for ( int i = 0; i < MAX_EJECTION_SEATS; i++ ) {
1784 eseat_status[i] = val;
1787 if ( (which_seat >=0) && (which_seat <= MAX_EJECTION_SEATS) ) {
1788 eseat_status[which_seat] = val;
1794 FGControls::set_cmd_selector_valve( int val )
1796 cmd_selector_valve = val;
1801 FGControls::set_off_start_run( int pos )
1803 off_start_run = pos;
1804 SG_CLAMP_RANGE<int>( off_start_run, 0, 3 );
1808 FGControls::set_APU_fire_switch( bool val )
1810 APU_fire_switch = val;
1814 FGControls::set_autothrottle_arm( bool val )
1816 autothrottle_arm = val;
1820 FGControls::set_autothrottle_engage( bool val )
1822 autothrottle_engage = val;
1826 FGControls::set_heading_select( double heading )
1828 heading_select = heading;
1829 SG_CLAMP_RANGE<double>( heading_select, 0.0, 360.0 );
1833 FGControls::move_heading_select( double amt )
1835 heading_select += amt;
1836 SG_CLAMP_RANGE<double>( heading_select, 0.0, 360.0 );
1840 FGControls::set_altitude_select( double altitude )
1842 altitude_select = altitude;
1843 SG_CLAMP_RANGE<double>( altitude_select, -1000.0, 100000.0 );
1847 FGControls::move_altitude_select( double amt )
1849 altitude_select += amt;
1850 SG_CLAMP_RANGE<double>( altitude_select, -1000.0, 100000.0 );
1854 FGControls::set_bank_angle_select( double angle )
1856 bank_angle_select = angle;
1857 SG_CLAMP_RANGE<double>( bank_angle_select, 10.0, 30.0 );
1861 FGControls::move_bank_angle_select( double amt )
1863 bank_angle_select += amt;
1864 SG_CLAMP_RANGE<double>( bank_angle_select, 10.0, 30.0 );
1868 FGControls::set_vertical_speed_select( double speed )
1870 vertical_speed_select = speed;
1871 SG_CLAMP_RANGE<double>( vertical_speed_select, -3000.0, 4000.0 );
1875 FGControls::move_vertical_speed_select( double amt )
1877 vertical_speed_select += amt;
1878 SG_CLAMP_RANGE<double>( vertical_speed_select, -3000.0, 4000.0 );
1882 FGControls::set_speed_select( double speed )
1884 speed_select = speed;
1885 SG_CLAMP_RANGE<double>( speed_select, 60.0, 400.0 );
1889 FGControls::move_speed_select( double amt )
1891 speed_select += amt;
1892 SG_CLAMP_RANGE<double>( speed_select, 60.0, 400.0 );
1896 FGControls::set_mach_select( double mach )
1899 SG_CLAMP_RANGE<double>( mach_select, 0.4, 4.0 );
1903 FGControls::move_mach_select( double amt )
1906 SG_CLAMP_RANGE<double>( mach_select, 0.4, 4.0 );
1910 FGControls::set_vertical_mode( int mode )
1912 vertical_mode = mode;
1913 SG_CLAMP_RANGE<int>( vertical_mode, 0, 4 );
1917 FGControls::set_lateral_mode( int mode )
1919 lateral_mode = mode;
1920 SG_CLAMP_RANGE<int>( lateral_mode, 0, 4 );
1924 FGControls::set_autopilot_engage( int ap, bool val )
1926 if ( ap == ALL_AUTOPILOTS ) {
1927 for ( int i = 0; i < MAX_AUTOPILOTS; i++ ) {
1928 autopilot_engage[i] = val;
1931 if ( (ap >= 0) && (ap < MAX_AUTOPILOTS) ) {
1932 autopilot_engage[ap] = val;