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 - curt@infoplane.com
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., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include "controls.hxx"
26 #include <simgear/debug/logstream.hxx>
27 #include <Main/fg_props.hxx>
30 static const int MAX_NAME_LEN = 128;
33 ////////////////////////////////////////////////////////////////////////
34 // Inline utility methods.
35 ////////////////////////////////////////////////////////////////////////
38 CLAMP(double *x, double min, double max )
40 if ( *x < min ) { *x = min; }
41 if ( *x > max ) { *x = max; }
45 CLAMP(int *i, int min, int max )
47 if ( *i < min ) { *i = min; }
48 if ( *i > max ) { *i = max; }
52 ////////////////////////////////////////////////////////////////////////
53 // Implementation of FGControls.
54 ////////////////////////////////////////////////////////////////////////
57 FGControls::FGControls() :
72 throttle_idle( true ),
79 tailwheel_lock( false ),
84 battery_switch( true ),
85 external_power( false ),
86 APU_generator( false ),
96 instruments_norm( 0.0 ),
100 release_ALL( false ),
101 vertical_adjust( 0.0 ),
102 fore_aft_adjust( 0.0 ),
105 APU_fire_switch( false ),
106 autothrottle_arm( false ),
107 autothrottle_engage( false ),
108 heading_select( 0.0 ),
109 altitude_select( 50000.0 ),
110 bank_angle_select( 30.0 ),
111 vertical_speed_select( 0.0 ),
120 void FGControls::reset_all()
123 set_aileron_trim( 0.0 );
125 set_elevator_trim( 0.0 );
127 set_rudder_trim( 0.0 );
130 set_speedbrake( 0.0 );
131 set_wing_sweep( 0.0 );
134 set_throttle( ALL_ENGINES, 0.0 );
135 set_starter( ALL_ENGINES, false );
136 set_magnetos( ALL_ENGINES, 0 );
137 set_fuel_pump( ALL_ENGINES, false );
138 set_fire_switch( ALL_ENGINES, false );
139 set_fire_bottle_discharge( ALL_ENGINES, false );
140 set_cutoff( ALL_ENGINES, true );
141 set_nitrous_injection( ALL_ENGINES, false );
142 set_cowl_flaps_norm( ALL_ENGINES, 1.0 );
143 set_feather( ALL_ENGINES, false );
144 set_ignition( ALL_ENGINES, false );
145 set_augmentation( ALL_ENGINES, false );
146 set_reverser( ALL_ENGINES, false );
147 set_water_injection( ALL_ENGINES, false );
148 set_condition( ALL_ENGINES, 0 );
149 throttle_idle = true;
150 set_fuel_selector( ALL_TANKS, true );
155 tailwheel_lock = false;
156 set_carb_heat( ALL_ENGINES, false );
157 set_inlet_heat( ALL_ENGINES, false );
162 set_engine_pump( ALL_HYD_SYSTEMS, true );
163 set_electric_pump( ALL_HYD_SYSTEMS, true );
164 landing_lights = false;
165 turn_off_lights = false;
168 APU_fire_switch = false;
169 autothrottle_arm = false;
170 autothrottle_engage = false;
171 set_autopilot_engage( ALL_AUTOPILOTS, false );
176 FGControls::~FGControls() {
183 throttle_idle = true;
184 for ( int engine = 0; engine < MAX_ENGINES; engine++ ) {
185 throttle[engine] = 0.0;
186 mixture[engine] = 1.0;
187 fuel_pump[engine] = false;
188 prop_advance[engine] = 1.0;
189 magnetos[engine] = 0;
190 starter[engine] = false;
191 ignition[engine] = false;
192 fire_switch[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 condition[engine] = 0;
201 for ( int wheel = 0; wheel < MAX_WHEELS; wheel++ ) {
203 alternate_extension[wheel] = false;
206 auto_coordination = fgGetNode("/sim/auto-coordination", true);
216 fgTie("/controls/flight/aileron", this,
217 &FGControls::get_aileron, &FGControls::set_aileron);
218 fgSetArchivable("/controls/flight/aileron");
220 fgTie("/controls/flight/aileron-trim", this,
221 &FGControls::get_aileron_trim, &FGControls::set_aileron_trim);
222 fgSetArchivable("/controls/flight/aileron-trim");
224 fgTie("/controls/flight/elevator", this,
225 &FGControls::get_elevator, &FGControls::set_elevator);
226 fgSetArchivable("/controls/flight/elevator");
228 fgTie("/controls/flight/elevator-trim", this,
229 &FGControls::get_elevator_trim, &FGControls::set_elevator_trim);
230 fgSetArchivable("/controls/flight/elevator-trim");
232 fgTie("/controls/flight/rudder", this,
233 &FGControls::get_rudder, &FGControls::set_rudder);
234 fgSetArchivable("/controls/flight/rudder");
236 fgTie("/controls/flight/rudder-trim", this,
237 &FGControls::get_rudder_trim, &FGControls::set_rudder_trim);
238 fgSetArchivable("/controls/flight/rudder-trim");
240 fgTie("/controls/flight/flaps", this,
241 &FGControls::get_flaps, &FGControls::set_flaps);
242 fgSetArchivable("/controls/flight/flaps");
244 fgTie("/controls/flight/slats", this,
245 &FGControls::get_slats, &FGControls::set_slats);
246 fgSetArchivable("/controls/flight/slats");
248 fgTie("/controls/flight/BLC", this,
249 &FGControls::get_BLC, &FGControls::set_BLC);
250 fgSetArchivable("/controls/flight/BLC");
252 fgTie("/controls/flight/spoilers", this,
253 &FGControls::get_spoilers, &FGControls::set_spoilers);
254 fgSetArchivable("/controls/flight/spoilers");
256 fgTie("/controls/flight/speedbrake", this,
257 &FGControls::get_speedbrake, &FGControls::set_speedbrake);
258 fgSetArchivable("/controls/flight/speedbrake");
260 fgTie("/controls/flight/wing-sweep", this,
261 &FGControls::get_wing_sweep, &FGControls::set_wing_sweep);
262 fgSetArchivable("/controls/flight/wing-sweep");
264 fgTie("/controls/flight/wing-fold", this,
265 &FGControls::get_wing_fold, &FGControls::set_wing_fold);
266 fgSetArchivable("/controls/flight/wing-fold");
268 fgTie("/controls/flight/drag-chute", this,
269 &FGControls::get_drag_chute, &FGControls::set_drag_chute);
270 fgSetArchivable("/controls/flight/drag-chute");
273 fgTie("/controls/engines/throttle_idle", this,
274 &FGControls::get_throttle_idle, &FGControls::set_throttle_idle);
275 fgSetArchivable("/controls/engines/throttle_idle");
277 for (index = 0; index < MAX_ENGINES; index++) {
278 char name[MAX_NAME_LEN];
279 sprintf(name, "/controls/engines/engine[%d]/throttle", index);
280 fgTie(name, this, index,
281 &FGControls::get_throttle, &FGControls::set_throttle);
282 fgSetArchivable(name);
284 sprintf(name, "/controls/engines/engine[%d]/starter", index);
285 fgTie(name, this, index,
286 &FGControls::get_starter, &FGControls::set_starter);
287 fgSetArchivable(name);
289 sprintf(name, "/controls/engines/engine[%d]/fuel-pump", index);
290 fgTie(name, this, index,
291 &FGControls::get_fuel_pump, &FGControls::set_fuel_pump);
292 fgSetArchivable(name);
294 sprintf(name, "/controls/engines/engine[%d]/fire-switch", index);
295 fgTie(name, this, index,
296 &FGControls::get_fire_switch, &FGControls::set_fire_switch);
297 fgSetArchivable(name);
300 "/controls/engines/engine[%d]/fire-bottle-discharge", index);
301 fgTie(name, this, index,
302 &FGControls::get_fire_bottle_discharge,
303 &FGControls::set_fire_bottle_discharge);
304 fgSetArchivable(name);
306 sprintf(name, "/controls/engines/engine[%d]/cutoff", index);
307 fgTie(name, this, index,
308 &FGControls::get_cutoff, &FGControls::set_cutoff);
309 fgSetArchivable(name);
311 sprintf(name, "/controls/engines/engine[%d]/mixture", index);
312 fgTie(name, this, index,
313 &FGControls::get_mixture, &FGControls::set_mixture);
314 fgSetArchivable(name);
317 "/controls/engines/engine[%d]/propeller-pitch", index);
318 fgTie(name, this, index,
319 &FGControls::get_prop_advance,
320 &FGControls::set_prop_advance);
321 fgSetArchivable(name);
323 sprintf(name, "/controls/engines/engine[%d]/magnetos", index);
324 fgTie(name, this, index,
325 &FGControls::get_magnetos, &FGControls::set_magnetos);
326 fgSetArchivable(name);
328 sprintf(name, "/controls/engines/engine[%d]/WEP", index);
329 fgTie(name, this, index,
330 &FGControls::get_nitrous_injection,
331 &FGControls::set_nitrous_injection);
332 fgSetArchivable(name);
335 "/controls/engines/engine[%d]/cowl-flaps-norm", index);
336 fgTie(name, this, index,
337 &FGControls::get_cowl_flaps_norm,
338 &FGControls::set_cowl_flaps_norm);
339 fgSetArchivable(name);
341 sprintf(name, "/controls/engines/engine[%d]/feather", index);
342 fgTie(name, this, index,
343 &FGControls::get_feather, &FGControls::set_feather);
344 fgSetArchivable(name);
346 sprintf(name, "/controls/engines/engine[%d]/ignition", index);
347 fgTie(name, this, index,
348 &FGControls::get_ignition, &FGControls::set_ignition);
349 fgSetArchivable(name);
351 sprintf(name, "/controls/engines/engine[%d]/augmentation", index);
352 fgTie(name, this, index,
353 &FGControls::get_augmentation,
354 &FGControls::set_augmentation);
355 fgSetArchivable(name);
357 sprintf(name, "/controls/engines/engine[%d]/reverser", index);
358 fgTie(name, this, index,
359 &FGControls::get_reverser, &FGControls::set_reverser);
360 fgSetArchivable(name);
363 "/controls/engines/engine[%d]/water-injection", index);
364 fgTie(name, this, index,
365 &FGControls::get_water_injection,
366 &FGControls::set_water_injection);
367 fgSetArchivable(name);
369 sprintf(name, "/controls/engines/engine[%d]/condition", index);
370 fgTie(name, this, index,
371 &FGControls::get_condition, &FGControls::set_condition);
372 fgSetArchivable(name);
376 fgTie("/controls/fuel/dump-valve", this,
377 &FGControls::get_dump_valve, &FGControls::set_dump_valve);
378 fgSetArchivable("/controls/fuel/dump-valve");
380 for (index = 0; index < MAX_TANKS; index++) {
381 char name[MAX_NAME_LEN];
382 sprintf(name, "/controls/fuel/tank[%d]/fuel_selector", index);
383 fgTie(name, this, index,
384 &FGControls::get_fuel_selector,
385 &FGControls::set_fuel_selector);
386 fgSetArchivable(name);
388 sprintf(name, "/controls/fuel/tank[%d]/to_engine", index);
389 fgTie(name, this, index,
390 &FGControls::get_to_engine, &FGControls::set_to_engine);
391 fgSetArchivable(name);
393 sprintf(name, "/controls/fuel/tank[%d]/to_tank", index);
394 fgTie(name, this, index,
395 &FGControls::get_to_tank, &FGControls::set_to_tank);
396 fgSetArchivable(name);
398 for (i = 0; i < MAX_BOOSTPUMPS; i++) {
399 char name[MAX_NAME_LEN];
401 "/controls/fuel/tank[%d]/boost-pump[%d]", index, i);
402 fgTie(name, this, index * 2 + i,
403 &FGControls::get_boost_pump,
404 &FGControls::set_boost_pump);
405 fgSetArchivable(name);
410 fgTie("/controls/gear/parking-brake", this,
411 &FGControls::get_parking_brake,
412 &FGControls::set_parking_brake);
413 fgSetArchivable("/controls/gear/parking-brake");
415 fgTie("/controls/gear/steering", this,
416 &FGControls::get_steering, &FGControls::set_steering);
417 fgSetArchivable("/controls/gear/steering");
419 fgTie("/controls/gear/gear-down", this,
420 &FGControls::get_gear_down, &FGControls::set_gear_down);
421 fgSetArchivable("/controls/gear/gear-down");
423 fgTie("/controls/gear/antiskid", this,
424 &FGControls::get_antiskid, &FGControls::set_antiskid);
425 fgSetArchivable("/controls/gear/antiskid");
427 fgTie("/controls/gear/tailhook", this,
428 &FGControls::get_tailhook, &FGControls::set_tailhook);
429 fgSetArchivable("/controls/gear/tailhook");
431 fgTie("/controls/gear/tailwheel-lock", this,
432 &FGControls::get_tailwheel_lock,
433 &FGControls::set_tailwheel_lock);
434 fgSetArchivable("/controls/gear/tailwheel-lock");
436 for (index = 0; index < MAX_WHEELS; index++) {
437 char name[MAX_NAME_LEN];
438 sprintf(name, "/controls/gear/wheel[%d]/brake", index);
439 fgTie(name, this, index,
440 &FGControls::get_brake, &FGControls::set_brake);
441 fgSetArchivable(name);
443 sprintf(name, "/controls/gear/wheel[%d]/alternate-extension", index);
444 fgTie(name, this, index,
445 &FGControls::get_alternate_extension,
446 &FGControls::set_alternate_extension);
447 fgSetArchivable(name);
451 fgTie("/controls/anti-ice/wing-heat", this,
452 &FGControls::get_wing_heat, &FGControls::set_wing_heat);
453 fgSetArchivable("/controls/anti-ice/wing-heat");
455 fgTie("/controls/anti-ice/pitot-heat", this,
456 &FGControls::get_pitot_heat, &FGControls::set_pitot_heat);
457 fgSetArchivable("/controls/anti-ice/pitot-heat");
459 fgTie("/controls/anti-ice/wiper", this,
460 &FGControls::get_wiper, &FGControls::set_wiper);
461 fgSetArchivable("/controls/anti-ice/wiper");
463 fgTie("/controls/anti-ice/window-heat", this,
464 &FGControls::get_window_heat, &FGControls::set_window_heat);
465 fgSetArchivable("/controls/anti-ice/window-heat");
467 for (index = 0; index < MAX_ENGINES; index++) {
468 char name[MAX_NAME_LEN];
469 sprintf(name, "/controls/anti-ice/engine[%d]/carb-heat", index);
470 fgTie(name, this, index,
471 &FGControls::get_carb_heat, &FGControls::set_carb_heat);
472 fgSetArchivable(name);
474 sprintf(name, "/controls/anti-ice/engine[%d]/inlet-heat", index);
475 fgTie(name, this, index,
476 &FGControls::get_inlet_heat, &FGControls::set_inlet_heat);
477 fgSetArchivable(name);
481 for (index = 0; index < MAX_HYD_SYSTEMS; index++) {
482 char name[MAX_NAME_LEN];
484 "/controls/hydraulic/system[%d]/engine-pump", index);
485 fgTie(name, this, index,
486 &FGControls::get_engine_pump, &FGControls::set_engine_pump);
487 fgSetArchivable(name);
490 "/controls/hydraulic/system[%d]/electric-pump", index);
491 fgTie(name, this, index,
492 &FGControls::get_electric_pump,
493 &FGControls::set_electric_pump);
494 fgSetArchivable(name);
498 fgTie("/controls/electric/battery-switch", this,
499 &FGControls::get_battery_switch,
500 &FGControls::set_battery_switch);
501 fgSetArchivable("/controls/electric/battery-switch");
503 fgTie("/controls/electric/external-power", this,
504 &FGControls::get_external_power,
505 &FGControls::set_external_power);
506 fgSetArchivable("/controls/electric/external-power");
508 fgTie("/controls/electric/APU-generator", this,
509 &FGControls::get_APU_generator,
510 &FGControls::set_APU_generator);
511 fgSetArchivable("/controls/electric/APU-generator");
513 for (index = 0; index < MAX_ENGINES; index++) {
514 char name[MAX_NAME_LEN];
516 "/controls/electric/engine[%d]/generator", index);
517 fgTie(name, this, index,
518 &FGControls::get_generator_breaker,
519 &FGControls::set_generator_breaker);
520 fgSetArchivable(name);
522 sprintf(name, "/controls/electric/engine[%d]/bus-tie", index);
523 fgTie(name, this, index,
524 &FGControls::get_bus_tie,
525 &FGControls::set_bus_tie);
526 fgSetArchivable(name);
530 fgTie("/controls/pneumatic/APU-bleed", this,
531 &FGControls::get_APU_bleed,
532 &FGControls::set_APU_bleed);
533 fgSetArchivable("/controls/pneumatic/APU-bleed");
535 for (index = 0; index < MAX_ENGINES; index++) {
536 char name[MAX_NAME_LEN];
538 "/controls/pneumatic/engine[%d]/bleed", index);
539 fgTie(name, this, index,
540 &FGControls::get_engine_bleed,
541 &FGControls::set_engine_bleed);
542 fgSetArchivable(name);
546 fgTie("/controls/pressurization/mode", this,
547 &FGControls::get_mode, &FGControls::set_mode);
548 fgSetArchivable("/controls/pressurization/mode");
550 fgTie("/controls/pressurization/dump", this,
551 &FGControls::get_dump, &FGControls::set_dump);
552 fgSetArchivable("/controls/pressurization/dump");
554 fgTie("/controls/pressurization/outflow-valve", this,
555 &FGControls::get_outflow_valve,
556 &FGControls::set_outflow_valve);
557 fgSetArchivable("/controls/pressurization/outflow-valve");
559 for (index = 0; index < MAX_PACKS; index++) {
560 char name[MAX_NAME_LEN];
561 sprintf(name, "/controls/pressurization/pack[%d]/pack-on", index);
562 fgTie(name, this, index,
563 &FGControls::get_pack_on, &FGControls::set_pack_on);
564 fgSetArchivable(name);
568 fgTie("/controls/lighting/landing-lights", this,
569 &FGControls::get_landing_lights,
570 &FGControls::set_landing_lights);
571 fgSetArchivable("/controls/lighting/landing-lights");
573 fgTie("/controls/lighting/turn-off-lights", this,
574 &FGControls::get_turn_off_lights,
575 &FGControls::set_turn_off_lights);
576 fgSetArchivable("/controls/lighting/turn-off-lights");
578 fgTie("/controls/lighting/taxi-light", this,
579 &FGControls::get_taxi_light, &FGControls::set_taxi_light);
580 fgSetArchivable("/controls/lighting/taxi-light");
582 fgTie("/controls/lighting/logo-lights", this,
583 &FGControls::get_logo_lights, &FGControls::set_logo_lights);
584 fgSetArchivable("/controls/lighting/logo-lights");
586 fgTie("/controls/lighting/nav-lights", this,
587 &FGControls::get_nav_lights, &FGControls::set_nav_lights);
588 fgSetArchivable("/controls/lighting/nav-lights");
590 fgTie("/controls/lighting/beacon", this,
591 &FGControls::get_beacon, &FGControls::set_beacon);
592 fgSetArchivable("/controls/lighting/beacon");
594 fgTie("/controls/lighting/strobe", this,
595 &FGControls::get_strobe, &FGControls::set_strobe);
596 fgSetArchivable("/controls/lighting/strobe");
598 fgTie("/controls/lighting/panel-norm", this,
599 &FGControls::get_panel_norm, &FGControls::set_panel_norm);
600 fgSetArchivable("/controls/lighting/panel-norm");
602 fgTie("/controls/lighting/instruments-norm", this,
603 &FGControls::get_instruments_norm,
604 &FGControls::set_instruments_norm);
605 fgSetArchivable("/controls/lighting/instruments-norm");
607 fgTie("/controls/lighting/dome-norm", this,
608 &FGControls::get_dome_norm, &FGControls::set_dome_norm);
609 fgSetArchivable("/controls/lighting/dome-norm");
611 #ifdef FG_HAVE_ARMAMENT
613 fgTie("/controls/armament/master-arm", this,
614 &FGControls::get_master_arm, &FGControls::set_master_arm);
615 fgSetArchivable("/controls/armament/master-arm");
617 fgTie("/controls/armament/station-select", this,
618 &FGControls::get_station_select,
619 &FGControls::set_station_select);
620 fgSetArchivable("/controls/armament/station-select");
622 fgTie("/controls/armament/release-all", this,
623 &FGControls::get_release_ALL,
624 &FGControls::set_release_ALL);
625 fgSetArchivable("/controls/armament/release-all");
627 for (index = 0; index < MAX_STATIONS; index++) {
628 char name[MAX_NAME_LEN];
629 sprintf(name, "/controls/armament/station[%d]/stick-size", index);
630 fgTie(name, this, index,
631 &FGControls::get_stick_size, &FGControls::set_stick_size);
632 fgSetArchivable(name);
635 "/controls/armament/station[%d]/release-stick", index);
636 fgTie(name, this, index,
637 &FGControls::get_release_stick, &FGControls::set_release_stick);
638 fgSetArchivable(name);
640 sprintf(name, "/controls/armament/station[%d]/release-all", index);
641 fgTie(name, this, index,
642 &FGControls::get_release_all, &FGControls::set_release_all);
643 fgSetArchivable(name);
645 sprintf(name, "/controls/armament/station[%d]/jettison-all", index);
646 fgTie(name, this, index,
647 &FGControls::get_jettison_all, &FGControls::set_jettison_all);
648 fgSetArchivable(name);
654 fgTie("/controls/seat/vertical-adjust", this,
655 &FGControls::get_vertical_adjust,
656 &FGControls::set_vertical_adjust);
657 fgSetArchivable("/controls/seat/vertical-adjust");
659 fgTie("/controls/seat/fore-aft-adjust", this,
660 &FGControls::get_fore_aft_adjust,
661 &FGControls::set_fore_aft_adjust);
662 fgSetArchivable("/controls/seat/fore-aft-adjust");
664 fgTie("/controls/seat/eject", this,
665 &FGControls::get_eject, &FGControls::set_eject);
666 fgSetArchivable("/controls/seat/eject");
669 fgTie("/controls/APU/off-start-run", this,
670 &FGControls::get_off_start_run,
671 &FGControls::set_off_start_run);
672 fgSetArchivable("/controls/APU/off-start-run");
674 fgTie("/controls/APU/fire-switch", this,
675 &FGControls::get_APU_fire_switch,
676 &FGControls::set_APU_fire_switch);
677 fgSetArchivable("/controls/APU/fire-switch");
680 for (index = 0; index < MAX_AUTOPILOTS; index++) {
681 char name[MAX_NAME_LEN];
683 "/controls/autoflight/autopilot[%d]/engage", index);
684 fgTie(name, this, index,
685 &FGControls::get_autopilot_engage,
686 &FGControls::set_autopilot_engage);
687 fgSetArchivable(name);
690 fgTie("/controls/autoflight/autothrottle-arm", this,
691 &FGControls::get_autothrottle_arm,
692 &FGControls::set_autothrottle_arm);
693 fgSetArchivable("/controls/autoflight/autothrottle-arm");
695 fgTie("/controls/autoflight/autothrottle-engage", this,
696 &FGControls::get_autothrottle_engage,
697 &FGControls::set_autothrottle_engage);
698 fgSetArchivable("/controls/autoflight/autothrottle-engage");
700 fgTie("/controls/autoflight/heading-select", this,
701 &FGControls::get_heading_select,
702 &FGControls::set_heading_select);
703 fgSetArchivable("/controls/autoflight/heading-select");
705 fgTie("/controls/autoflight/altitude-select", this,
706 &FGControls::get_altitude_select,
707 &FGControls::set_altitude_select);
708 fgSetArchivable("/controls/autoflight/altitude-select");
710 fgTie("/controls/autoflight/bank-angle-select", this,
711 &FGControls::get_bank_angle_select,
712 &FGControls::set_bank_angle_select);
713 fgSetArchivable("/controls/autoflight/bank-angle-select");
715 fgTie("/controls/autoflight/vertical-speed-select", this,
716 &FGControls::get_vertical_speed_select,
717 &FGControls::set_vertical_speed_select);
718 fgSetArchivable("/controls/autoflight/vertical-speed-select");
720 fgTie("/controls/autoflight/speed-select", this,
721 &FGControls::get_speed_select,
722 &FGControls::set_speed_select);
723 fgSetArchivable("/controls/autoflight/speed-select");
725 fgTie("/controls/autoflight/mach-select", this,
726 &FGControls::get_mach_select,
727 &FGControls::set_mach_select);
728 fgSetArchivable("/controls/autoflight/mach-select");
730 fgTie("/controls/autoflight/vertical-mode", this,
731 &FGControls::get_vertical_mode,
732 &FGControls::set_vertical_mode);
733 fgSetArchivable("/controls/autoflight/vertical-mode");
735 fgTie("/controls/autoflight/lateral-mode", this,
736 &FGControls::get_lateral_mode,
737 &FGControls::set_lateral_mode);
738 fgSetArchivable("/controls/autoflight/lateral-mode");
742 void FGControls::unbind ()
745 //Tie control properties.
746 fgUntie("/controls/flight/aileron");
747 fgUntie("/controls/flight/aileron-trim");
748 fgUntie("/controls/flight/elevator");
749 fgUntie("/controls/flight/elevator-trim");
750 fgUntie("/controls/flight/rudder");
751 fgUntie("/controls/flight/rudder-trim");
752 fgUntie("/controls/flight/flaps");
753 fgUntie("/controls/flight/slats");
754 fgUntie("/controls/flight/BLC");
755 fgUntie("/controls/flight/spoilers");
756 fgUntie("/controls/flight/speedbrake");
757 fgUntie("/controls/flight/wing-sweep");
758 fgUntie("/controls/flight/wing-fold");
759 fgUntie("/controls/flight/drag-chute");
760 for (index = 0; index < MAX_ENGINES; index++) {
761 char name[MAX_NAME_LEN];
762 sprintf(name, "/controls/engines/engine[%d]/throttle", index);
764 sprintf(name, "/controls/engines/engine[%d]/starter", index);
766 sprintf(name, "/controls/engines/engine[%d]/fuel_pump", index);
768 sprintf(name, "/controls/engines/engine[%d]/fire-switch", index);
771 "/controls/engines/engine[%d]/fire-bottle-discharge", index);
773 sprintf(name, "/controls/engines/engine[%d]/throttle_idle", index);
775 sprintf(name, "/controls/engines/engine[%d]/cutoff", index);
777 sprintf(name, "/controls/engines/engine[%d]/mixture", index);
780 "/controls/engines/engine[%d]/propeller-pitch", index);
782 sprintf(name, "/controls/engines/engine[%d]/magnetos", index);
784 sprintf(name, "/controls/engines/engine[%d]/WEP", index);
786 sprintf(name, "/controls/engines/engine[%d]/cowl-flaps-norm", index);
788 sprintf(name, "/controls/engines/engine[%d]/feather", index);
790 sprintf(name, "/controls/engines/engine[%d]/ignition", index);
792 sprintf(name, "/controls/engines/engine[%d]/augmentation", index);
794 sprintf(name, "/controls/engines/engine[%d]/reverser", index);
796 sprintf(name, "/controls/engines/engine[%d]/water-injection", index);
798 sprintf(name, "/controls/engines/engine[%d]/condition", index);
801 fgUntie("/controls/fuel/dump-valve");
802 for (index = 0; index < MAX_TANKS; index++) {
803 char name[MAX_NAME_LEN];
804 sprintf(name, "/controls/fuel/tank[%d]/fuel_selector", index);
806 sprintf(name, "/controls/fuel/tank[%d]/to_engine", index);
808 sprintf(name, "/controls/fuel/tank[%d]/to_tank", index);
810 for (i = 0; index < MAX_BOOSTPUMPS; i++) {
811 sprintf(name, "/controls/fuel/tank[%d]/boost-pump[%d]", index, i);
815 fgUntie("/controls/gear/parking_brake");
816 fgUntie("/controls/gear/steering");
817 fgUntie("/controls/gear/gear_down");
818 fgUntie("/controls/gear/antiskid");
819 fgUntie("/controls/gear/tailhook");
820 fgUntie("/controls/gear/tailwheel-lock");
821 for (index = 0; index < MAX_WHEELS; index++) {
822 char name[MAX_NAME_LEN];
823 sprintf(name, "/controls/gear/wheel[%d]/brakes", index);
826 "/controls/gear/wheel[%d]/alternate-extension", index);
829 fgUntie("/controls/anti-ice/wing-heat");
830 fgUntie("/controls/anti-ice/pitot-heat");
831 fgUntie("/controls/anti-ice/wiper");
832 fgUntie("/controls/anti-ice/window-heat");
833 for (index = 0; index < MAX_ENGINES; index++) {
834 char name[MAX_NAME_LEN];
835 sprintf(name, "/controls/anti-ice/engine[%d]/carb-heat", index);
837 sprintf(name, "/controls/anti-ice/engine[%d]/inlet-heat", index);
840 for (index = 0; index < MAX_HYD_SYSTEMS; index++) {
841 char name[MAX_NAME_LEN];
843 "/controls/hydraulic/system[%d]/engine-pump", index);
846 "/controls/hydraulic/system[%d]/electric-pump", index);
849 fgUntie("/controls/electric/battery-switch");
850 fgUntie("/controls/electric/external-power");
851 fgUntie("/controls/electric/APU-generator");
852 for (index = 0; index < MAX_ENGINES; index++) {
853 char name[MAX_NAME_LEN];
855 "/controls/electric/engine[%d]/generator", index);
858 "/controls/electric/engine[%d]/bus-tie", index);
861 fgUntie("/controls/pneumatic/APU-bleed");
862 for (index = 0; index < MAX_ENGINES; index++) {
863 char name[MAX_NAME_LEN];
865 "/controls/pneumatic/engine[%d]/bleed", index);
868 fgUntie("/controls/pressurization/mode");
869 fgUntie("/controls/pressurization/dump");
870 for (index = 0; index < MAX_PACKS; index++) {
871 char name[MAX_NAME_LEN];
873 "/controls/pressurization/pack[%d]/pack-on", index);
876 fgUntie("/controls/lighting/landing-lights");
877 fgUntie("/controls/lighting/turn-off-lights");
878 fgUntie("/controls/lighting/taxi-light");
879 fgUntie("/controls/lighting/logo-lights");
880 fgUntie("/controls/lighting/nav-lights");
881 fgUntie("/controls/lighting/beacon");
882 fgUntie("/controls/lighting/strobe");
883 fgUntie("/controls/lighting/panel-norm");
884 fgUntie("/controls/lighting/instruments-norm");
885 fgUntie("/controls/lighting/dome-norm");
887 #ifdef FG_HAVE_ARMAMENT
888 fgUntie("/controls/armament/master-arm");
889 fgUntie("/controls/armament/station-select");
890 fgUntie("/controls/armament/release-all");
891 for (index = 0; index < MAX_STATIONS; index++) {
892 char name[MAX_NAME_LEN];
894 "/controls/armament/station[%d]/stick-size", index);
897 "/controls/armament/station[%d]/release-stick", index);
900 "/controls/armament/station[%d]/release-all", index);
903 "/controls/armament/station[%d]/jettison-all", index);
907 fgUntie("/controls/seat/vertical-adjust");
908 fgUntie("/controls/seat/fore-aft-adjust");
909 fgUntie("/controls/seat/eject");
910 fgUntie("/controls/APU/off-start-run");
911 fgUntie("/controls/APU/fire-switch");
912 for (index = 0; index < MAX_AUTOPILOTS; index++) {
913 char name[MAX_NAME_LEN];
915 "/controls/autoflight/autopilot[%d]/engage", index);
918 fgUntie("/controls/autoflight/autothrottle-arm");
919 fgUntie("/controls/autoflight/autothrottle-engage");
920 fgUntie("/controls/autoflight/heading-select");
921 fgUntie("/controls/autoflight/altitude-select");
922 fgUntie("/controls/autoflight/bank-angle-select");
923 fgUntie("/controls/autoflight/vertical-speed-select");
924 fgUntie("/controls/autoflight/speed-select");
925 fgUntie("/controls/autoflight/mach-select");
926 fgUntie("/controls/autoflight/vertical-mode");
927 fgUntie("/controls/autoflight/lateral-mode");
932 FGControls::update (double dt)
938 ////////////////////////////////////////////////////////////////////////
939 // Setters and adjusters.
940 ////////////////////////////////////////////////////////////////////////
943 FGControls::set_aileron (double pos)
946 CLAMP( &aileron, -1.0, 1.0 );
948 // check for autocoordination
949 if ( auto_coordination->getBoolValue() ) {
950 set_rudder( aileron / 2.0 );
955 FGControls::move_aileron (double amt)
958 CLAMP( &aileron, -1.0, 1.0 );
960 // check for autocoordination
961 if ( auto_coordination->getBoolValue() ) {
962 set_rudder( aileron / 2.0 );
967 FGControls::set_aileron_trim( double pos )
970 CLAMP( &aileron_trim, -1.0, 1.0 );
974 FGControls::move_aileron_trim( double amt )
977 CLAMP( &aileron_trim, -1.0, 1.0 );
981 FGControls::set_elevator( double pos )
984 CLAMP( &elevator, -1.0, 1.0 );
988 FGControls::move_elevator( double amt )
991 CLAMP( &elevator, -1.0, 1.0 );
995 FGControls::set_elevator_trim( double pos )
998 CLAMP( &elevator_trim, -1.0, 1.0 );
1002 FGControls::move_elevator_trim( double amt )
1004 elevator_trim += amt;
1005 CLAMP( &elevator_trim, -1.0, 1.0 );
1009 FGControls::set_rudder( double pos )
1012 CLAMP( &rudder, -1.0, 1.0 );
1016 FGControls::move_rudder( double amt )
1019 CLAMP( &rudder, -1.0, 1.0 );
1023 FGControls::set_rudder_trim( double pos )
1026 CLAMP( &rudder_trim, -1.0, 1.0 );
1030 FGControls::move_rudder_trim( double amt )
1033 CLAMP( &rudder_trim, -1.0, 1.0 );
1037 FGControls::set_flaps( double pos )
1040 CLAMP( &flaps, 0.0, 1.0 );
1044 FGControls::move_flaps( double amt )
1047 CLAMP( &flaps, 0.0, 1.0 );
1051 FGControls::set_slats( double pos )
1054 CLAMP( &slats, 0.0, 1.0 );
1058 FGControls::move_slats( double amt )
1061 CLAMP( &slats, 0.0, 1.0 );
1065 FGControls::set_BLC( bool val )
1071 FGControls::set_spoilers( double pos )
1074 CLAMP( &spoilers, 0.0, 1.0 );
1078 FGControls::move_spoilers( double amt )
1081 CLAMP( &spoilers, 0.0, 1.0 );
1085 FGControls::set_speedbrake( double pos )
1088 CLAMP( &speedbrake, 0.0, 1.0 );
1092 FGControls::move_speedbrake( double amt )
1095 CLAMP( &speedbrake, 0.0, 1.0 );
1099 FGControls::set_wing_sweep( double pos )
1102 CLAMP( &wing_sweep, 0.0, 1.0 );
1106 FGControls::move_wing_sweep( double amt )
1109 CLAMP( &wing_sweep, 0.0, 1.0 );
1113 FGControls::set_wing_fold( bool val )
1119 FGControls::set_drag_chute( bool val )
1125 FGControls::set_throttle_idle( bool val )
1127 throttle_idle = val;
1131 FGControls::set_throttle( int engine, double pos )
1133 if ( engine == ALL_ENGINES ) {
1134 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1136 CLAMP( &throttle[i], 0.0, 1.0 );
1139 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1140 throttle[engine] = pos;
1141 CLAMP( &throttle[engine], 0.0, 1.0 );
1147 FGControls::move_throttle( int engine, double amt )
1149 if ( engine == ALL_ENGINES ) {
1150 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1152 CLAMP( &throttle[i], 0.0, 1.0 );
1155 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1156 throttle[engine] += amt;
1157 CLAMP( &throttle[engine], 0.0, 1.0 );
1163 FGControls::set_starter( int engine, bool flag )
1165 if ( engine == ALL_ENGINES ) {
1166 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1170 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1171 starter[engine] = flag;
1177 FGControls::set_fuel_pump( int engine, bool val )
1179 if ( engine == ALL_ENGINES ) {
1180 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1184 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1185 fuel_pump[engine] = val;
1191 FGControls::set_fire_switch( int engine, bool val )
1193 if ( engine == ALL_ENGINES ) {
1194 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1195 fire_switch[i] = val;
1198 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1199 fire_switch[engine] = val;
1205 FGControls::set_fire_bottle_discharge( int engine, bool val )
1207 if ( engine == ALL_ENGINES ) {
1208 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1209 fire_bottle_discharge[i] = val;
1212 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1213 fire_bottle_discharge[engine] = val;
1219 FGControls::set_cutoff( int engine, bool val )
1221 if ( engine == ALL_ENGINES ) {
1222 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1226 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1227 cutoff[engine] = val;
1234 FGControls::set_mixture( int engine, double pos )
1236 if ( engine == ALL_ENGINES ) {
1237 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1239 CLAMP( &mixture[i], 0.0, 1.0 );
1242 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1243 mixture[engine] = pos;
1244 CLAMP( &mixture[engine], 0.0, 1.0 );
1250 FGControls::move_mixture( int engine, double amt )
1252 if ( engine == ALL_ENGINES ) {
1253 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1255 CLAMP( &mixture[i], 0.0, 1.0 );
1258 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1259 mixture[engine] += amt;
1260 CLAMP( &mixture[engine], 0.0, 1.0 );
1266 FGControls::set_prop_advance( int engine, double pos )
1268 if ( engine == ALL_ENGINES ) {
1269 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1270 prop_advance[i] = pos;
1271 CLAMP( &prop_advance[i], 0.0, 1.0 );
1274 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1275 prop_advance[engine] = pos;
1276 CLAMP( &prop_advance[engine], 0.0, 1.0 );
1282 FGControls::move_prop_advance( int engine, double amt )
1284 if ( engine == ALL_ENGINES ) {
1285 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1286 prop_advance[i] += amt;
1287 CLAMP( &prop_advance[i], 0.0, 1.0 );
1290 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1291 prop_advance[engine] += amt;
1292 CLAMP( &prop_advance[engine], 0.0, 1.0 );
1298 FGControls::set_magnetos( int engine, int pos )
1300 if ( engine == ALL_ENGINES ) {
1301 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1303 CLAMP( &magnetos[i], 0, 3 );
1306 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1307 magnetos[engine] = pos;
1308 CLAMP( &magnetos[engine], 0, 3 );
1314 FGControls::move_magnetos( int engine, int amt )
1316 if ( engine == ALL_ENGINES ) {
1317 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1319 CLAMP( &magnetos[i], 0, 3 );
1322 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1323 magnetos[engine] += amt;
1324 CLAMP( &magnetos[engine], 0, 3 );
1330 FGControls::set_nitrous_injection( int engine, bool val )
1332 if ( engine == ALL_ENGINES ) {
1333 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1334 nitrous_injection[i] = val;
1337 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1338 nitrous_injection[engine] = val;
1345 FGControls::set_cowl_flaps_norm( int engine, double pos )
1347 if ( engine == ALL_ENGINES ) {
1348 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1349 cowl_flaps_norm[i] = pos;
1350 CLAMP( &cowl_flaps_norm[i], 0.0, 1.0 );
1353 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1354 cowl_flaps_norm[engine] = pos;
1355 CLAMP( &cowl_flaps_norm[engine], 0.0, 1.0 );
1361 FGControls::move_cowl_flaps_norm( int engine, double amt )
1363 if ( engine == ALL_ENGINES ) {
1364 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1365 cowl_flaps_norm[i] += amt;
1366 CLAMP( &cowl_flaps_norm[i], 0.0, 1.0 );
1369 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1370 cowl_flaps_norm[engine] += amt;
1371 CLAMP( &cowl_flaps_norm[engine], 0.0, 1.0 );
1377 FGControls::set_feather( int engine, bool val )
1379 if ( engine == ALL_ENGINES ) {
1380 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1384 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1385 feather[engine] = val;
1391 FGControls::set_ignition( int engine, int pos )
1393 if ( engine == ALL_ENGINES ) {
1394 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1396 CLAMP( &ignition[i], 0, 3 );
1399 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1400 ignition[engine] = pos;
1401 CLAMP( &ignition[engine], 0, 3 );
1407 FGControls::set_augmentation( int engine, bool val )
1409 if ( engine == ALL_ENGINES ) {
1410 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1411 augmentation[i] = val;
1414 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1415 augmentation[engine] = val;
1421 FGControls::set_reverser( int engine, bool val )
1423 if ( engine == ALL_ENGINES ) {
1424 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1428 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1429 reverser[engine] = val;
1435 FGControls::set_water_injection( int engine, bool val )
1437 if ( engine == ALL_ENGINES ) {
1438 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1439 water_injection[i] = val;
1442 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1443 water_injection[engine] = val;
1449 FGControls::set_condition( int engine, int val )
1451 if ( engine == ALL_ENGINES ) {
1452 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1454 CLAMP( &condition[i], 0, 3 );
1457 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1458 condition[engine] = val;
1459 CLAMP( &condition[engine], 0, 3 );
1465 FGControls::set_dump_valve( bool val )
1472 FGControls::set_fuel_selector( int tank, bool pos )
1474 if ( tank == ALL_TANKS ) {
1475 for ( int i = 0; i < MAX_TANKS; i++ ) {
1476 fuel_selector[i] = pos;
1479 if ( (tank >= 0) && (tank < MAX_TANKS) ) {
1480 fuel_selector[tank] = pos;
1486 FGControls::set_to_engine( int tank, int engine )
1488 if ( tank == ALL_TANKS ) {
1489 for ( int i = 0; i < MAX_TANKS; i++ ) {
1490 to_engine[i] = engine;
1493 if ( (tank >= 0) && (tank < MAX_TANKS) ) {
1494 to_engine[tank] = engine;
1500 FGControls::set_to_tank( int tank, int dest_tank )
1502 if ( tank == ALL_TANKS ) {
1503 for ( int i = 0; i < MAX_TANKS; i++ ) {
1504 to_tank[i] = dest_tank;
1507 if ( (tank >= 0) && (tank < MAX_TANKS) ) {
1508 to_tank[tank] = dest_tank;
1514 FGControls::set_boost_pump( int index, bool val )
1516 if ( index == -1 ) {
1517 for ( int i = 0; i < (MAX_TANKS * MAX_BOOSTPUMPS); i++ ) {
1518 boost_pump[i] = val;
1521 if ( (index >= 0) && (index < (MAX_TANKS * MAX_BOOSTPUMPS)) ) {
1522 boost_pump[index] = val;
1529 FGControls::set_parking_brake( double pos )
1531 parking_brake = pos;
1532 CLAMP(&parking_brake, 0.0, 1.0);
1536 FGControls::set_steering( double angle )
1539 CLAMP(&steering, -80.0, 80.0);
1543 FGControls::move_steering( double angle )
1546 CLAMP(&steering, -80.0, 80.0);
1550 FGControls::set_gear_down( bool gear )
1556 FGControls::set_antiskid( bool state )
1562 FGControls::set_tailhook( bool state )
1568 FGControls::set_tailwheel_lock( bool state )
1570 tailwheel_lock = state;
1575 FGControls::set_brake( int wheel, double pos )
1577 if ( wheel == ALL_WHEELS ) {
1578 for ( int i = 0; i < MAX_WHEELS; i++ ) {
1580 CLAMP( &brake[i], 0.0, 1.0 );
1583 if ( (wheel >= 0) && (wheel < MAX_WHEELS) ) {
1585 CLAMP( &brake[wheel], 0.0, 1.0 );
1591 FGControls::move_brake( int wheel, double amt )
1593 if ( wheel == ALL_WHEELS ) {
1594 for ( int i = 0; i < MAX_WHEELS; i++ ) {
1596 CLAMP( &brake[i], 0.0, 1.0 );
1599 if ( (wheel >= 0) && (wheel < MAX_WHEELS) ) {
1600 brake[wheel] += amt;
1601 CLAMP( &brake[wheel], 0.0, 1.0 );
1607 FGControls::set_alternate_extension( int wheel, bool val )
1609 if ( wheel == ALL_WHEELS ) {
1610 for ( int i = 0; i < MAX_WHEELS; i++ ) {
1611 alternate_extension[i] = val;
1614 if ( (wheel >= 0) && (wheel < MAX_WHEELS) ) {
1615 alternate_extension[wheel] = val;
1621 FGControls::set_wing_heat( bool state )
1627 FGControls::set_pitot_heat( bool state )
1633 FGControls::set_wiper( int state )
1639 FGControls::set_window_heat( bool state )
1641 window_heat = state;
1645 FGControls::set_carb_heat( int engine, bool val )
1647 if ( engine == ALL_ENGINES ) {
1648 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1652 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1653 carb_heat[engine] = val;
1659 FGControls::set_inlet_heat( int engine, bool val )
1661 if ( engine == ALL_ENGINES ) {
1662 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1663 inlet_heat[i] = val;
1666 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1667 inlet_heat[engine] = val;
1673 FGControls::set_engine_pump( int system, bool val )
1675 if ( system == ALL_HYD_SYSTEMS ) {
1676 for ( int i = 0; i < MAX_HYD_SYSTEMS; i++ ) {
1677 engine_pump[i] = val;
1680 if ( (system >= 0) && (system < MAX_HYD_SYSTEMS) ) {
1681 engine_pump[system] = val;
1687 FGControls::set_electric_pump( int system, bool val )
1689 if ( system == ALL_HYD_SYSTEMS ) {
1690 for ( int i = 0; i < MAX_HYD_SYSTEMS; i++ ) {
1691 electric_pump[i] = val;
1694 if ( (system >= 0) && (system < MAX_HYD_SYSTEMS) ) {
1695 electric_pump[system] = val;
1701 FGControls::set_battery_switch( bool state )
1703 battery_switch = state;
1707 FGControls::set_external_power( bool state )
1709 external_power = state;
1713 FGControls::set_APU_generator( bool state )
1715 APU_generator = state;
1719 FGControls::set_generator_breaker( int engine, bool val )
1721 if ( engine == ALL_ENGINES ) {
1722 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1723 generator_breaker[i] = val;
1726 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1727 generator_breaker[engine] = val;
1733 FGControls::set_bus_tie( int engine, bool val )
1735 if ( engine == ALL_ENGINES ) {
1736 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1740 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1741 bus_tie[engine] = val;
1747 FGControls::set_APU_bleed( bool state )
1753 FGControls::set_engine_bleed( int engine, bool val )
1755 if ( engine == ALL_ENGINES ) {
1756 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1757 engine_bleed[i] = val;
1760 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1761 engine_bleed[engine] = val;
1767 FGControls::set_mode( int new_mode )
1773 FGControls::set_outflow_valve( double pos )
1775 outflow_valve = pos;
1776 CLAMP( &outflow_valve, 0.0, 1.0 );
1780 FGControls::move_outflow_valve( double amt )
1782 outflow_valve += amt;
1783 CLAMP( &outflow_valve, 0.0, 1.0 );
1787 FGControls::set_dump( bool state )
1793 FGControls::set_pack_on( int pack, bool val )
1795 if ( pack == ALL_PACKS ) {
1796 for ( int i = 0; i < MAX_PACKS; i++ ) {
1800 if ( (pack >= 0) && (pack < MAX_PACKS) ) {
1801 pack_on[pack] = val;
1807 FGControls::set_landing_lights( bool state )
1809 landing_lights = state;
1813 FGControls::set_turn_off_lights( bool state )
1815 turn_off_lights = state;
1819 FGControls::set_taxi_light( bool state )
1825 FGControls::set_logo_lights( bool state )
1827 logo_lights = state;
1831 FGControls::set_nav_lights( bool state )
1837 FGControls::set_beacon( bool state )
1843 FGControls::set_strobe( bool state )
1849 FGControls::set_panel_norm( double intensity )
1851 panel_norm = intensity;
1852 CLAMP( &panel_norm, 0.0, 1.0 );
1856 FGControls::move_panel_norm( double amt )
1859 CLAMP( &panel_norm, 0.0, 1.0 );
1863 FGControls::set_instruments_norm( double intensity )
1865 instruments_norm = intensity;
1866 CLAMP( &instruments_norm, 0.0, 1.0 );
1870 FGControls::move_instruments_norm( double amt )
1872 instruments_norm += amt;
1873 CLAMP( &instruments_norm, 0.0, 1.0 );
1877 FGControls::set_dome_norm( double intensity )
1879 dome_norm = intensity;
1880 CLAMP( &dome_norm, 0.0, 1.0 );
1884 FGControls::move_dome_norm( double amt )
1887 CLAMP( &dome_norm, 0.0, 1.0 );
1890 #ifdef FG_HAVE_ARMAMENT
1893 FGControls::set_master_arm( bool val )
1899 FGControls::set_station_select( int station )
1901 station_select = station;
1902 CLAMP( &station_select, 0, MAX_STATIONS );
1906 FGControls::set_release_ALL( bool val )
1912 FGControls::set_stick_size( int station, int size )
1914 if ( station == ALL_STATIONS ) {
1915 for ( int i = 0; i < MAX_STATIONS; i++ ) {
1916 stick_size[i] = size;
1917 CLAMP( &stick_size[i], 1, 20 );
1920 if ( (station >= 0) && (station < MAX_STATIONS) ) {
1921 stick_size[station] = size;
1922 CLAMP( &stick_size[station], 1, 20 );
1928 FGControls::set_release_stick( int station, bool val )
1930 if ( station == ALL_STATIONS ) {
1931 for ( int i = 0; i < MAX_STATIONS; i++ ) {
1932 release_stick[i] = val;
1935 if ( (station >= 0) && (station < MAX_STATIONS) ) {
1936 release_stick[station] = val;
1942 FGControls::set_release_all( int station, bool val )
1944 if ( station == ALL_STATIONS ) {
1945 for ( int i = 0; i < MAX_STATIONS; i++ ) {
1946 release_all[i] = val;
1949 if ( (station >= 0) && (station < MAX_STATIONS) ) {
1950 release_all[station] = val;
1956 FGControls::set_jettison_all( int station, bool val )
1958 if ( station == ALL_STATIONS ) {
1959 for ( int i = 0; i < MAX_STATIONS; i++ ) {
1960 jettison_all[i] = val;
1963 if ( (station >= 0) && (station < MAX_STATIONS) ) {
1964 jettison_all[station] = val;
1972 FGControls::set_vertical_adjust( double pos )
1974 vertical_adjust = pos;
1975 CLAMP( &vertical_adjust, -1.0, 1.0 );
1979 FGControls::move_vertical_adjust( double amt )
1981 vertical_adjust += amt;
1982 CLAMP( &vertical_adjust, -1.0, 1.0 );
1986 FGControls::set_fore_aft_adjust( double pos )
1988 fore_aft_adjust = pos;
1989 CLAMP( &fore_aft_adjust, -1.0, 1.0 );
1993 FGControls::move_fore_aft_adjust( double amt )
1995 fore_aft_adjust += amt;
1996 CLAMP( &fore_aft_adjust, -1.0, 1.0 );
2000 FGControls::set_eject( bool val )
2006 FGControls::set_off_start_run( int pos )
2008 off_start_run = pos;
2009 CLAMP( &off_start_run, 0, 3 );
2013 FGControls::set_APU_fire_switch( bool val )
2015 APU_fire_switch = val;
2019 FGControls::set_autothrottle_arm( bool val )
2021 autothrottle_arm = val;
2025 FGControls::set_autothrottle_engage( bool val )
2027 autothrottle_engage = val;
2031 FGControls::set_heading_select( double heading )
2033 heading_select = heading;
2034 CLAMP( &heading_select, 0.0, 360.0 );
2038 FGControls::move_heading_select( double amt )
2040 heading_select += amt;
2041 CLAMP( &heading_select, 0.0, 360.0 );
2045 FGControls::set_altitude_select( double altitude )
2047 altitude_select = altitude;
2048 CLAMP( &altitude_select, -1000.0, 100000.0 );
2052 FGControls::move_altitude_select( double amt )
2054 altitude_select += amt;
2055 CLAMP( &altitude_select, -1000.0, 100000.0 );
2059 FGControls::set_bank_angle_select( double angle )
2061 bank_angle_select = angle;
2062 CLAMP( &bank_angle_select, 10.0, 30.0 );
2066 FGControls::move_bank_angle_select( double amt )
2068 bank_angle_select += amt;
2069 CLAMP( &bank_angle_select, 10.0, 30.0 );
2073 FGControls::set_vertical_speed_select( double speed )
2075 vertical_speed_select = speed;
2076 CLAMP( &vertical_speed_select, -3000.0, 4000.0 );
2080 FGControls::move_vertical_speed_select( double amt )
2082 vertical_speed_select += amt;
2083 CLAMP( &vertical_speed_select, -3000.0, 4000.0 );
2087 FGControls::set_speed_select( double speed )
2089 speed_select = speed;
2090 CLAMP( &speed_select, 60.0, 400.0 );
2094 FGControls::move_speed_select( double amt )
2096 speed_select += amt;
2097 CLAMP( &speed_select, 60.0, 400.0 );
2101 FGControls::set_mach_select( double mach )
2104 CLAMP( &mach_select, 0.4, 4.0 );
2108 FGControls::move_mach_select( double amt )
2111 CLAMP( &mach_select, 0.4, 4.0 );
2115 FGControls::set_vertical_mode( int mode )
2117 vertical_mode = mode;
2118 CLAMP( &vertical_mode, 0, 4 );
2122 FGControls::set_lateral_mode( int mode )
2124 lateral_mode = mode;
2125 CLAMP( &lateral_mode, 0, 4 );
2129 FGControls::set_autopilot_engage( int ap, bool val )
2131 if ( ap == ALL_AUTOPILOTS ) {
2132 for ( int i = 0; i < MAX_AUTOPILOTS; i++ ) {
2133 autopilot_engage[i] = val;
2136 if ( (ap >= 0) && (ap < MAX_AUTOPILOTS) ) {
2137 autopilot_engage[ap] = val;