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() :
42 tailwheel_lock( true ),
43 battery_switch( true ),
44 external_power( false ),
45 APU_generator( false ),
56 instruments_norm( 0.0 ),
60 vertical_adjust( 0.0 ),
61 fore_aft_adjust( 0.0 ),
62 cmd_selector_valve( 0 ),
64 heading_select( 0.0 ),
65 altitude_select( 50000.0 ),
66 bank_angle_select( 30.0 ),
67 vertical_speed_select( 0.0 ),
73 auto_coordination = fgGetNode("/controls/flight/auto-coordination", true);
74 auto_coordination_factor = fgGetNode("/controls/flight/auto-coordination-factor", false );
75 if( NULL == auto_coordination_factor ) {
76 auto_coordination_factor = fgGetNode("/controls/flight/auto-coordination-factor", true );
77 auto_coordination_factor->setDoubleValue( 0.5 );
84 void FGControls::reset_all()
87 set_aileron_trim( 0.0 );
89 set_elevator_trim( 0.0 );
91 set_rudder_trim( 0.0 );
94 set_speedbrake( 0.0 );
95 set_wing_sweep( 0.0 );
98 set_throttle( ALL_ENGINES, 0.0 );
99 set_starter( ALL_ENGINES, false );
100 set_magnetos( ALL_ENGINES, 0 );
101 set_fuel_pump( ALL_ENGINES, false );
102 set_fire_switch( ALL_ENGINES, false );
103 set_fire_bottle_discharge( ALL_ENGINES, false );
104 set_cutoff( ALL_ENGINES, true );
105 set_nitrous_injection( ALL_ENGINES, false );
106 set_cowl_flaps_norm( ALL_ENGINES, 1.0 );
107 set_feather( ALL_ENGINES, false );
108 set_ignition( ALL_ENGINES, false );
109 set_augmentation( ALL_ENGINES, false );
110 set_reverser( ALL_ENGINES, false );
111 set_water_injection( ALL_ENGINES, false );
112 set_condition( ALL_ENGINES, 1.0 );
113 throttle_idle = true;
114 set_fuel_selector( ALL_TANKS, true );
117 nose_wheel_steering = true;
121 catapult_launch_cmd = false;
122 tailwheel_lock = true;
123 set_carb_heat( ALL_ENGINES, false );
124 set_inlet_heat( ALL_ENGINES, false );
129 set_engine_pump( ALL_HYD_SYSTEMS, true );
130 set_electric_pump( ALL_HYD_SYSTEMS, true );
131 landing_lights = false;
132 turn_off_lights = false;
134 set_ejection_seat( ALL_EJECTION_SEATS, false );
135 set_eseat_status( ALL_EJECTION_SEATS, SEAT_SAFED );
136 set_cmd_selector_valve( CMD_SEL_NORM );
137 APU_fire_switch = false;
138 autothrottle_arm = false;
139 autothrottle_engage = false;
140 set_autopilot_engage( ALL_AUTOPILOTS, false );
142 brake_left = brake_right
143 = copilot_brake_left = copilot_brake_right
144 = brake_parking = 0.0;
146 set_fuel_selector(ALL_TANKS, false);
147 set_to_engine(ALL_TANKS, 0);
148 set_to_tank(ALL_TANKS, 0);
149 set_boost_pump(ALL_TANKS, false);
151 set_alternate_extension(ALL_WHEELS, false);
153 set_mixture(ALL_ENGINES, 1.0);
154 set_prop_advance(ALL_ENGINES, 1.0);
155 set_generator_breaker(ALL_ENGINES, false);
156 set_bus_tie(ALL_ENGINES, false);
157 set_engine_bleed(ALL_ENGINES, false);
158 set_feed_tank(ALL_ENGINES, -1); // feed off
159 set_cowl_flaps_norm(ALL_ENGINES, 0.0);
164 FGControls::~FGControls()
180 static inline void _SetRoot( simgear::TiedPropertyList & tiedProperties, const char * root, int index = 0 )
182 tiedProperties.setRoot( fgGetNode( root, index, true ) );
192 _SetRoot( _tiedProperties, "/controls/flight" );
194 _tiedProperties.Tie( "aileron", this, &FGControls::get_aileron, &FGControls::set_aileron )
195 ->setAttribute( SGPropertyNode::ARCHIVE, true );
197 _tiedProperties.Tie( "aileron-trim", this, &FGControls::get_aileron_trim, &FGControls::set_aileron_trim )
198 ->setAttribute( SGPropertyNode::ARCHIVE, true );
200 _tiedProperties.Tie( "elevator", this, &FGControls::get_elevator, &FGControls::set_elevator )
201 ->setAttribute( SGPropertyNode::ARCHIVE, true );
203 _tiedProperties.Tie( "elevator-trim", this, &FGControls::get_elevator_trim, &FGControls::set_elevator_trim )
204 ->setAttribute( SGPropertyNode::ARCHIVE, true );
206 _tiedProperties.Tie( "rudder", this, &FGControls::get_rudder, &FGControls::set_rudder )
207 ->setAttribute( SGPropertyNode::ARCHIVE, true );
209 _tiedProperties.Tie( "rudder-trim", this, &FGControls::get_rudder_trim, &FGControls::set_rudder_trim )
210 ->setAttribute( SGPropertyNode::ARCHIVE, true );
212 _tiedProperties.Tie( "flaps", this, &FGControls::get_flaps, &FGControls::set_flaps )
213 ->setAttribute( SGPropertyNode::ARCHIVE, true );
215 _tiedProperties.Tie( "slats", this, &FGControls::get_slats, &FGControls::set_slats )
216 ->setAttribute( SGPropertyNode::ARCHIVE, true );
218 _tiedProperties.Tie( "BLC", this, &FGControls::get_BLC, &FGControls::set_BLC )
219 ->setAttribute( SGPropertyNode::ARCHIVE, true );
221 _tiedProperties.Tie( "spoilers", this, &FGControls::get_spoilers, &FGControls::set_spoilers )
222 ->setAttribute( SGPropertyNode::ARCHIVE, true );
224 _tiedProperties.Tie( "speedbrake", this, &FGControls::get_speedbrake, &FGControls::set_speedbrake )
225 ->setAttribute( SGPropertyNode::ARCHIVE, true );
227 _tiedProperties.Tie( "wing-sweep", this, &FGControls::get_wing_sweep, &FGControls::set_wing_sweep )
228 ->setAttribute( SGPropertyNode::ARCHIVE, true );
230 _tiedProperties.Tie( "wing-fold", this, &FGControls::get_wing_fold, &FGControls::set_wing_fold )
231 ->setAttribute( SGPropertyNode::ARCHIVE, true );
233 _tiedProperties.Tie( "drag-chute", this, &FGControls::get_drag_chute, &FGControls::set_drag_chute )
234 ->setAttribute( SGPropertyNode::ARCHIVE, true );
237 _tiedProperties.setRoot( fgGetNode("/controls/engines", true ) );
239 _tiedProperties.Tie( "throttle_idle", this, &FGControls::get_throttle_idle, &FGControls::set_throttle_idle )
240 ->setAttribute( SGPropertyNode::ARCHIVE, true );
242 for (index = 0; index < MAX_ENGINES; index++) {
243 _SetRoot(_tiedProperties, "/controls/engines/engine", index );
245 _tiedProperties.Tie( "throttle", this, index, &FGControls::get_throttle, &FGControls::set_throttle )
246 ->setAttribute( SGPropertyNode::ARCHIVE, true );
248 _tiedProperties.Tie( "starter", this, index, &FGControls::get_starter, &FGControls::set_starter )
249 ->setAttribute( SGPropertyNode::ARCHIVE, true );
251 _tiedProperties.Tie( "fuel-pump", this, index, &FGControls::get_fuel_pump, &FGControls::set_fuel_pump )
252 ->setAttribute( SGPropertyNode::ARCHIVE, true );
254 _tiedProperties.Tie( "fire-switch", this, index, &FGControls::get_fire_switch, &FGControls::set_fire_switch )
255 ->setAttribute( SGPropertyNode::ARCHIVE, true );
257 _tiedProperties.Tie( "fire-bottle-discharge", this, index, &FGControls::get_fire_bottle_discharge, &FGControls::set_fire_bottle_discharge )
258 ->setAttribute( SGPropertyNode::ARCHIVE, true );
260 _tiedProperties.Tie( "cutoff", this, index, &FGControls::get_cutoff, &FGControls::set_cutoff )
261 ->setAttribute( SGPropertyNode::ARCHIVE, true );
263 _tiedProperties.Tie( "mixture", this, index, &FGControls::get_mixture, &FGControls::set_mixture )
264 ->setAttribute( SGPropertyNode::ARCHIVE, true );
266 _tiedProperties.Tie( "propeller-pitch", this, index, &FGControls::get_prop_advance, &FGControls::set_prop_advance )
267 ->setAttribute( SGPropertyNode::ARCHIVE, true );
269 _tiedProperties.Tie( "magnetos", this, index, &FGControls::get_magnetos, &FGControls::set_magnetos )
270 ->setAttribute( SGPropertyNode::ARCHIVE, true );
272 _tiedProperties.Tie( "feed_tank", this, index, &FGControls::get_feed_tank, &FGControls::set_feed_tank )
273 ->setAttribute( SGPropertyNode::ARCHIVE, true );
275 _tiedProperties.Tie( "WEP", this, index, &FGControls::get_nitrous_injection, &FGControls::set_nitrous_injection )
276 ->setAttribute( SGPropertyNode::ARCHIVE, true );
278 _tiedProperties.Tie( "cowl-flaps-norm", this, index, &FGControls::get_cowl_flaps_norm, &FGControls::set_cowl_flaps_norm )
279 ->setAttribute( SGPropertyNode::ARCHIVE, true );
281 _tiedProperties.Tie( "propeller-feather", this, index, &FGControls::get_feather, &FGControls::set_feather )
282 ->setAttribute( SGPropertyNode::ARCHIVE, true );
284 _tiedProperties.Tie( "ignition", this, index, &FGControls::get_ignition, &FGControls::set_ignition )
285 ->setAttribute( SGPropertyNode::ARCHIVE, true );
287 _tiedProperties.Tie( "augmentation", this, index, &FGControls::get_augmentation, &FGControls::set_augmentation )
288 ->setAttribute( SGPropertyNode::ARCHIVE, true );
290 _tiedProperties.Tie( "reverser", this, index, &FGControls::get_reverser, &FGControls::set_reverser )
291 ->setAttribute( SGPropertyNode::ARCHIVE, true );
293 _tiedProperties.Tie( "water-injection", this, index, &FGControls::get_water_injection, &FGControls::set_water_injection )
294 ->setAttribute( SGPropertyNode::ARCHIVE, true );
296 _tiedProperties.Tie( "condition", this, index, &FGControls::get_condition, &FGControls::set_condition )
297 ->setAttribute( SGPropertyNode::ARCHIVE, true );
301 _SetRoot( _tiedProperties, "/controls/fuel" );
303 _tiedProperties.Tie( "dump-valve", this, &FGControls::get_dump_valve, &FGControls::set_dump_valve)
304 ->setAttribute( SGPropertyNode::ARCHIVE, true );
306 for (index = 0; index < MAX_TANKS; index++) {
307 _SetRoot( _tiedProperties, "/controls/fuel/tank", index );
309 _tiedProperties.Tie( "fuel_selector", this, index, &FGControls::get_fuel_selector, &FGControls::set_fuel_selector)
310 ->setAttribute( SGPropertyNode::ARCHIVE, true );
312 _tiedProperties.Tie( "to_engine", this, index, &FGControls::get_to_engine, &FGControls::set_to_engine)
313 ->setAttribute( SGPropertyNode::ARCHIVE, true );
315 _tiedProperties.Tie( "to_tank", this, index, &FGControls::get_to_tank, &FGControls::set_to_tank)
316 ->setAttribute( SGPropertyNode::ARCHIVE, true );
318 for (i = 0; i < MAX_BOOSTPUMPS; i++) {
319 _tiedProperties.Tie( "boost-pump", i,
320 this, index * 2 + i, &FGControls::get_boost_pump, &FGControls::set_boost_pump)
321 ->setAttribute( SGPropertyNode::ARCHIVE, true );
326 _SetRoot( _tiedProperties, "/controls/gear" );
328 _tiedProperties.Tie( "brake-left", this, &FGControls::get_brake_left, &FGControls::set_brake_left)
329 ->setAttribute( SGPropertyNode::ARCHIVE, true );
331 _tiedProperties.Tie( "brake-right", this, &FGControls::get_brake_right, &FGControls::set_brake_right)
332 ->setAttribute( SGPropertyNode::ARCHIVE, true );
334 _tiedProperties.Tie( "copilot-brake-left", this, &FGControls::get_copilot_brake_left, &FGControls::set_copilot_brake_left)
335 ->setAttribute( SGPropertyNode::ARCHIVE, true );
337 _tiedProperties.Tie( "copilot-brake-right", this, &FGControls::get_copilot_brake_right, &FGControls::set_copilot_brake_right)
338 ->setAttribute( SGPropertyNode::ARCHIVE, true );
340 _tiedProperties.Tie( "brake-parking", this, &FGControls::get_brake_parking, &FGControls::set_brake_parking)
341 ->setAttribute( SGPropertyNode::ARCHIVE, true );
343 _tiedProperties.Tie( "steering", this, &FGControls::get_steering, &FGControls::set_steering)
344 ->setAttribute( SGPropertyNode::ARCHIVE, true );
346 _tiedProperties.Tie( "nose-wheel-steering", this, &FGControls::get_nose_wheel_steering, &FGControls::set_nose_wheel_steering)
347 ->setAttribute( SGPropertyNode::ARCHIVE, true );
349 _tiedProperties.Tie( "gear-down", this, &FGControls::get_gear_down, &FGControls::set_gear_down)
350 ->setAttribute( SGPropertyNode::ARCHIVE, true );
352 _tiedProperties.Tie( "antiskid", this, &FGControls::get_antiskid, &FGControls::set_antiskid)
353 ->setAttribute( SGPropertyNode::ARCHIVE, true );
355 _tiedProperties.Tie( "tailhook", this, &FGControls::get_tailhook, &FGControls::set_tailhook)
356 ->setAttribute( SGPropertyNode::ARCHIVE, true );
358 _tiedProperties.Tie( "launchbar", this, &FGControls::get_launchbar, &FGControls::set_launchbar)
359 ->setAttribute( SGPropertyNode::ARCHIVE, true );
361 _tiedProperties.Tie( "catapult-launch-cmd", this, &FGControls::get_catapult_launch_cmd, &FGControls::set_catapult_launch_cmd)
362 ->setAttribute( SGPropertyNode::ARCHIVE, true );
364 _tiedProperties.Tie( "tailwheel-lock", this, &FGControls::get_tailwheel_lock, &FGControls::set_tailwheel_lock)
365 ->setAttribute( SGPropertyNode::ARCHIVE, true );
367 for (index = 0; index < MAX_WHEELS; index++) {
368 _SetRoot( _tiedProperties, "/controls/gear/wheel", index );
369 _tiedProperties.Tie( "alternate-extension", this, index, &FGControls::get_alternate_extension, &FGControls::set_alternate_extension)
370 ->setAttribute( SGPropertyNode::ARCHIVE, true );
374 _SetRoot( _tiedProperties, "/controls/anti-ice" );
376 _tiedProperties.Tie( "wing-heat", this, &FGControls::get_wing_heat, &FGControls::set_wing_heat)
377 ->setAttribute( SGPropertyNode::ARCHIVE, true );
379 _tiedProperties.Tie( "pitot-heat", this, &FGControls::get_pitot_heat, &FGControls::set_pitot_heat)
380 ->setAttribute( SGPropertyNode::ARCHIVE, true );
382 _tiedProperties.Tie( "wiper", this, &FGControls::get_wiper, &FGControls::set_wiper)
383 ->setAttribute( SGPropertyNode::ARCHIVE, true );
385 _tiedProperties.Tie( "window-heat", this, &FGControls::get_window_heat, &FGControls::set_window_heat)
386 ->setAttribute( SGPropertyNode::ARCHIVE, true );
388 for (index = 0; index < MAX_ENGINES; index++) {
389 _SetRoot( _tiedProperties, "/controls/anti-ice/engine", index );
391 _tiedProperties.Tie( "carb-heat", this, index, &FGControls::get_carb_heat, &FGControls::set_carb_heat)
392 ->setAttribute( SGPropertyNode::ARCHIVE, true );
394 _tiedProperties.Tie( "inlet-heat", this, index, &FGControls::get_inlet_heat, &FGControls::set_inlet_heat)
395 ->setAttribute( SGPropertyNode::ARCHIVE, true );
399 for (index = 0; index < MAX_HYD_SYSTEMS; index++) {
400 _SetRoot( _tiedProperties, "/controls/hydraulic/system", index );
402 _tiedProperties.Tie( "engine-pump", this, index, &FGControls::get_engine_pump, &FGControls::set_engine_pump)
403 ->setAttribute( SGPropertyNode::ARCHIVE, true );
405 _tiedProperties.Tie( "electric-pump", this, index, &FGControls::get_electric_pump, &FGControls::set_electric_pump)
406 ->setAttribute( SGPropertyNode::ARCHIVE, true );
410 _SetRoot( _tiedProperties, "/controls/electric" );
412 _tiedProperties.Tie( "battery-switch", this, &FGControls::get_battery_switch, &FGControls::set_battery_switch)
413 ->setAttribute( SGPropertyNode::ARCHIVE, true );
415 _tiedProperties.Tie( "external-power", this, &FGControls::get_external_power, &FGControls::set_external_power)
416 ->setAttribute( SGPropertyNode::ARCHIVE, true );
418 _tiedProperties.Tie( "APU-generator", this, &FGControls::get_APU_generator, &FGControls::set_APU_generator)
419 ->setAttribute( SGPropertyNode::ARCHIVE, true );
421 for (index = 0; index < MAX_ENGINES; index++) {
422 _SetRoot( _tiedProperties, "/controls/electric/engine", index );
424 _tiedProperties.Tie( "generator", this, index, &FGControls::get_generator_breaker, &FGControls::set_generator_breaker)
425 ->setAttribute( SGPropertyNode::ARCHIVE, true );
427 _tiedProperties.Tie( "bus-tie", this, index, &FGControls::get_bus_tie, &FGControls::set_bus_tie)
428 ->setAttribute( SGPropertyNode::ARCHIVE, true );
432 _SetRoot( _tiedProperties, "/controls/pneumatic" );
434 _tiedProperties.Tie( "APU-bleed", this, &FGControls::get_APU_bleed, &FGControls::set_APU_bleed)
435 ->setAttribute( SGPropertyNode::ARCHIVE, true );
437 for (index = 0; index < MAX_ENGINES; index++) {
438 _SetRoot( _tiedProperties, "/controls/pneumatic/engine", index );
440 _tiedProperties.Tie( "bleed", this, index, &FGControls::get_engine_bleed, &FGControls::set_engine_bleed)
441 ->setAttribute( SGPropertyNode::ARCHIVE, true );
445 _SetRoot( _tiedProperties, "/controls/pressurization" );
447 _tiedProperties.Tie( "mode", this, &FGControls::get_mode, &FGControls::set_mode)
448 ->setAttribute( SGPropertyNode::ARCHIVE, true );
450 _tiedProperties.Tie( "dump", this, &FGControls::get_dump, &FGControls::set_dump)
451 ->setAttribute( SGPropertyNode::ARCHIVE, true );
453 _tiedProperties.Tie( "outflow-valve", this, &FGControls::get_outflow_valve, &FGControls::set_outflow_valve)
454 ->setAttribute( SGPropertyNode::ARCHIVE, true );
456 for (index = 0; index < MAX_PACKS; index++) {
457 _SetRoot( _tiedProperties, "/controls/pressurization/pack", index );
459 _tiedProperties.Tie( "pack-on", this, index, &FGControls::get_pack_on, &FGControls::set_pack_on)
460 ->setAttribute( SGPropertyNode::ARCHIVE, true );
464 _SetRoot( _tiedProperties, "/controls/lighting" );
466 _tiedProperties.Tie( "landing-lights", this, &FGControls::get_landing_lights, &FGControls::set_landing_lights)
467 ->setAttribute( SGPropertyNode::ARCHIVE, true );
469 _tiedProperties.Tie( "turn-off-lights", this, &FGControls::get_turn_off_lights, &FGControls::set_turn_off_lights)
470 ->setAttribute( SGPropertyNode::ARCHIVE, true );
472 _tiedProperties.Tie( "taxi-light", this, &FGControls::get_taxi_light, &FGControls::set_taxi_light)
473 ->setAttribute( SGPropertyNode::ARCHIVE, true );
475 _tiedProperties.Tie( "logo-lights", this, &FGControls::get_logo_lights, &FGControls::set_logo_lights)
476 ->setAttribute( SGPropertyNode::ARCHIVE, true );
478 _tiedProperties.Tie( "nav-lights", this, &FGControls::get_nav_lights, &FGControls::set_nav_lights)
479 ->setAttribute( SGPropertyNode::ARCHIVE, true );
481 _tiedProperties.Tie( "beacon", this, &FGControls::get_beacon, &FGControls::set_beacon)
482 ->setAttribute( SGPropertyNode::ARCHIVE, true );
484 _tiedProperties.Tie( "strobe", this, &FGControls::get_strobe, &FGControls::set_strobe)
485 ->setAttribute( SGPropertyNode::ARCHIVE, true );
487 _tiedProperties.Tie( "panel-norm", this, &FGControls::get_panel_norm, &FGControls::set_panel_norm)
488 ->setAttribute( SGPropertyNode::ARCHIVE, true );
490 _tiedProperties.Tie( "instruments-norm", this, &FGControls::get_instruments_norm, &FGControls::set_instruments_norm)
491 ->setAttribute( SGPropertyNode::ARCHIVE, true );
493 _tiedProperties.Tie( "dome-norm", this, &FGControls::get_dome_norm, &FGControls::set_dome_norm)
494 ->setAttribute( SGPropertyNode::ARCHIVE, true );
497 _SetRoot( _tiedProperties, "/controls/armament" );
499 _tiedProperties.Tie( "master-arm", this, &FGControls::get_master_arm, &FGControls::set_master_arm)
500 ->setAttribute( SGPropertyNode::ARCHIVE, true );
502 _tiedProperties.Tie( "station-select", this, &FGControls::get_station_select, &FGControls::set_station_select)
503 ->setAttribute( SGPropertyNode::ARCHIVE, true );
505 _tiedProperties.Tie( "release-all", this, &FGControls::get_release_ALL, &FGControls::set_release_ALL)
506 ->setAttribute( SGPropertyNode::ARCHIVE, true );
508 for (index = 0; index < MAX_STATIONS; index++) {
509 _SetRoot( _tiedProperties, "/controls/armament/station", index );
511 _tiedProperties.Tie( "stick-size", this, index, &FGControls::get_stick_size, &FGControls::set_stick_size)
512 ->setAttribute( SGPropertyNode::ARCHIVE, true );
514 _tiedProperties.Tie( "release-stick", this, index, &FGControls::get_release_stick, &FGControls::set_release_stick)
515 ->setAttribute( SGPropertyNode::ARCHIVE, true );
517 _tiedProperties.Tie( "release-all", this, index, &FGControls::get_release_all, &FGControls::set_release_all)
518 ->setAttribute( SGPropertyNode::ARCHIVE, true );
520 _tiedProperties.Tie( "jettison-all", this, index, &FGControls::get_jettison_all, &FGControls::set_jettison_all)
521 ->setAttribute( SGPropertyNode::ARCHIVE, true );
525 _SetRoot( _tiedProperties, "/controls/seat" );
527 _tiedProperties.Tie( "vertical-adjust", this, &FGControls::get_vertical_adjust, &FGControls::set_vertical_adjust)
528 ->setAttribute( SGPropertyNode::ARCHIVE, true );
530 _tiedProperties.Tie( "fore-aft-adjust", this, &FGControls::get_fore_aft_adjust, &FGControls::set_fore_aft_adjust)
531 ->setAttribute( SGPropertyNode::ARCHIVE, true );
533 _tiedProperties.Tie( "cmd_selector_valve", this, &FGControls::get_cmd_selector_valve, &FGControls::set_cmd_selector_valve)
534 ->setAttribute( SGPropertyNode::ARCHIVE, true );
536 for (index = 0; index < MAX_EJECTION_SEATS; index++) {
537 _SetRoot( _tiedProperties, "/controls/seat/eject", index );
539 _tiedProperties.Tie( "initiate", this, index, &FGControls::get_ejection_seat, &FGControls::set_ejection_seat)
540 ->setAttribute( SGPropertyNode::ARCHIVE, true );
542 _tiedProperties.Tie( "status", this, index, &FGControls::get_eseat_status, &FGControls::set_eseat_status)
543 ->setAttribute( SGPropertyNode::ARCHIVE, true );
547 _SetRoot( _tiedProperties, "/controls/APU" );
549 _tiedProperties.Tie( "off-start-run", this, &FGControls::get_off_start_run, &FGControls::set_off_start_run)
550 ->setAttribute( SGPropertyNode::ARCHIVE, true );
552 _tiedProperties.Tie( "fire-switch", this, &FGControls::get_APU_fire_switch, &FGControls::set_APU_fire_switch)
553 ->setAttribute( SGPropertyNode::ARCHIVE, true );
556 for (index = 0; index < MAX_AUTOPILOTS; index++) {
558 _SetRoot( _tiedProperties, "/controls/autoflight/autopilot", index );
560 _tiedProperties.Tie( "engage", this, index, &FGControls::get_autopilot_engage, &FGControls::set_autopilot_engage)
561 ->setAttribute( SGPropertyNode::ARCHIVE, true );
564 _SetRoot( _tiedProperties, "/controls/autoflight/" );
566 _tiedProperties.Tie( "autothrottle-arm", this, &FGControls::get_autothrottle_arm, &FGControls::set_autothrottle_arm)
567 ->setAttribute( SGPropertyNode::ARCHIVE, true );
569 _tiedProperties.Tie( "autothrottle-engage", this, &FGControls::get_autothrottle_engage, &FGControls::set_autothrottle_engage)
570 ->setAttribute( SGPropertyNode::ARCHIVE, true );
572 _tiedProperties.Tie( "heading-select", this, &FGControls::get_heading_select, &FGControls::set_heading_select)
573 ->setAttribute( SGPropertyNode::ARCHIVE, true );
575 _tiedProperties.Tie( "altitude-select", this, &FGControls::get_altitude_select, &FGControls::set_altitude_select)
576 ->setAttribute( SGPropertyNode::ARCHIVE, true );
578 _tiedProperties.Tie( "bank-angle-select", this, &FGControls::get_bank_angle_select, &FGControls::set_bank_angle_select)
579 ->setAttribute( SGPropertyNode::ARCHIVE, true );
581 _tiedProperties.Tie( "vertical-speed-select", this, &FGControls::get_vertical_speed_select, &FGControls::set_vertical_speed_select)
582 ->setAttribute( SGPropertyNode::ARCHIVE, true );
584 _tiedProperties.Tie( "speed-select", this, &FGControls::get_speed_select, &FGControls::set_speed_select)
585 ->setAttribute( SGPropertyNode::ARCHIVE, true );
587 _tiedProperties.Tie( "mach-select", this, &FGControls::get_mach_select, &FGControls::set_mach_select)
588 ->setAttribute( SGPropertyNode::ARCHIVE, true );
590 _tiedProperties.Tie( "vertical-mode", this, &FGControls::get_vertical_mode, &FGControls::set_vertical_mode)
591 ->setAttribute( SGPropertyNode::ARCHIVE, true );
593 _tiedProperties.Tie( "lateral-mode", this, &FGControls::get_lateral_mode, &FGControls::set_lateral_mode)
594 ->setAttribute( SGPropertyNode::ARCHIVE, true );
597 void FGControls::unbind ()
599 _tiedProperties.Untie();
604 FGControls::update (double dt)
608 // nothing here, don't call again
612 ////////////////////////////////////////////////////////////////////////
613 // Setters and adjusters.
614 ////////////////////////////////////////////////////////////////////////
617 FGControls::set_aileron (double pos)
620 SG_CLAMP_RANGE<double>( aileron, -1.0, 1.0 );
621 do_autocoordination();
625 FGControls::move_aileron (double amt)
628 SG_CLAMP_RANGE<double>( aileron, -1.0, 1.0 );
629 do_autocoordination();
633 FGControls::set_aileron_trim( double pos )
636 SG_CLAMP_RANGE<double>( aileron_trim, -1.0, 1.0 );
640 FGControls::move_aileron_trim( double amt )
643 SG_CLAMP_RANGE<double>( aileron_trim, -1.0, 1.0 );
647 FGControls::set_elevator( double pos )
650 SG_CLAMP_RANGE<double>( elevator, -1.0, 1.0 );
654 FGControls::move_elevator( double amt )
657 SG_CLAMP_RANGE<double>( elevator, -1.0, 1.0 );
661 FGControls::set_elevator_trim( double pos )
664 SG_CLAMP_RANGE<double>( elevator_trim, -1.0, 1.0 );
668 FGControls::move_elevator_trim( double amt )
670 elevator_trim += amt;
671 SG_CLAMP_RANGE<double>( elevator_trim, -1.0, 1.0 );
675 FGControls::set_rudder( double pos )
678 SG_CLAMP_RANGE<double>( rudder, -1.0, 1.0 );
682 FGControls::move_rudder( double amt )
685 SG_CLAMP_RANGE<double>( rudder, -1.0, 1.0 );
689 FGControls::set_rudder_trim( double pos )
692 SG_CLAMP_RANGE<double>( rudder_trim, -1.0, 1.0 );
696 FGControls::move_rudder_trim( double amt )
699 SG_CLAMP_RANGE<double>( rudder_trim, -1.0, 1.0 );
703 FGControls::set_flaps( double pos )
706 SG_CLAMP_RANGE<double>( flaps, 0.0, 1.0 );
710 FGControls::move_flaps( double amt )
713 SG_CLAMP_RANGE<double>( flaps, 0.0, 1.0 );
717 FGControls::set_slats( double pos )
720 SG_CLAMP_RANGE<double>( slats, 0.0, 1.0 );
724 FGControls::move_slats( double amt )
727 SG_CLAMP_RANGE<double>( slats, 0.0, 1.0 );
731 FGControls::set_BLC( bool val )
737 FGControls::set_spoilers( double pos )
740 SG_CLAMP_RANGE<double>( spoilers, 0.0, 1.0 );
744 FGControls::move_spoilers( double amt )
747 SG_CLAMP_RANGE<double>( spoilers, 0.0, 1.0 );
751 FGControls::set_speedbrake( double pos )
754 SG_CLAMP_RANGE<double>( speedbrake, 0.0, 1.0 );
758 FGControls::move_speedbrake( double amt )
761 SG_CLAMP_RANGE<double>( speedbrake, 0.0, 1.0 );
765 FGControls::set_wing_sweep( double pos )
768 SG_CLAMP_RANGE<double>( wing_sweep, 0.0, 1.0 );
772 FGControls::move_wing_sweep( double amt )
775 SG_CLAMP_RANGE<double>( wing_sweep, 0.0, 1.0 );
779 FGControls::set_wing_fold( bool val )
785 FGControls::set_drag_chute( bool val )
791 FGControls::set_throttle_idle( bool val )
797 FGControls::set_throttle( int engine, double pos )
799 if ( engine == ALL_ENGINES ) {
800 for ( int i = 0; i < MAX_ENGINES; i++ ) {
802 SG_CLAMP_RANGE<double>( throttle[i], 0.0, 1.0 );
805 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
806 throttle[engine] = pos;
807 SG_CLAMP_RANGE<double>( throttle[engine], 0.0, 1.0 );
813 FGControls::move_throttle( int engine, double amt )
815 if ( engine == ALL_ENGINES ) {
816 for ( int i = 0; i < MAX_ENGINES; i++ ) {
818 SG_CLAMP_RANGE<double>( throttle[i], 0.0, 1.0 );
821 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
822 throttle[engine] += amt;
823 SG_CLAMP_RANGE<double>( throttle[engine], 0.0, 1.0 );
829 FGControls::set_starter( int engine, bool flag )
831 if ( engine == ALL_ENGINES ) {
832 for ( int i = 0; i < MAX_ENGINES; i++ ) {
836 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
837 starter[engine] = flag;
843 FGControls::set_fuel_pump( int engine, bool val )
845 if ( engine == ALL_ENGINES ) {
846 for ( int i = 0; i < MAX_ENGINES; i++ ) {
850 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
851 fuel_pump[engine] = val;
857 FGControls::set_fire_switch( int engine, bool val )
859 if ( engine == ALL_ENGINES ) {
860 for ( int i = 0; i < MAX_ENGINES; i++ ) {
861 fire_switch[i] = val;
864 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
865 fire_switch[engine] = val;
871 FGControls::set_fire_bottle_discharge( int engine, bool val )
873 if ( engine == ALL_ENGINES ) {
874 for ( int i = 0; i < MAX_ENGINES; i++ ) {
875 fire_bottle_discharge[i] = val;
878 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
879 fire_bottle_discharge[engine] = val;
885 FGControls::set_cutoff( int engine, bool val )
887 if ( engine == ALL_ENGINES ) {
888 for ( int i = 0; i < MAX_ENGINES; i++ ) {
892 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
893 cutoff[engine] = val;
899 FGControls::set_feed_tank( int engine, int tank )
901 if ( engine == ALL_ENGINES ) {
902 for ( int i = 0; i < MAX_ENGINES; i++ ) {
904 SG_CLAMP_RANGE<int>( feed_tank[i], -1, 4 );
907 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
908 feed_tank[engine] = tank;
909 SG_CLAMP_RANGE<int>( feed_tank[engine], -1, 4 );
912 // feed_tank[engine] = engine;
917 FGControls::set_mixture( int engine, double pos )
919 if ( engine == ALL_ENGINES ) {
920 for ( int i = 0; i < MAX_ENGINES; i++ ) {
922 SG_CLAMP_RANGE<double>( mixture[i], 0.0, 1.0 );
925 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
926 mixture[engine] = pos;
927 SG_CLAMP_RANGE<double>( mixture[engine], 0.0, 1.0 );
933 FGControls::move_mixture( int engine, double amt )
935 if ( engine == ALL_ENGINES ) {
936 for ( int i = 0; i < MAX_ENGINES; i++ ) {
938 SG_CLAMP_RANGE<double>( mixture[i], 0.0, 1.0 );
941 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
942 mixture[engine] += amt;
943 SG_CLAMP_RANGE<double>( mixture[engine], 0.0, 1.0 );
949 FGControls::set_prop_advance( int engine, double pos )
951 if ( engine == ALL_ENGINES ) {
952 for ( int i = 0; i < MAX_ENGINES; i++ ) {
953 prop_advance[i] = pos;
954 SG_CLAMP_RANGE<double>( prop_advance[i], 0.0, 1.0 );
957 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
958 prop_advance[engine] = pos;
959 SG_CLAMP_RANGE<double>( prop_advance[engine], 0.0, 1.0 );
965 FGControls::move_prop_advance( int engine, double amt )
967 if ( engine == ALL_ENGINES ) {
968 for ( int i = 0; i < MAX_ENGINES; i++ ) {
969 prop_advance[i] += amt;
970 SG_CLAMP_RANGE<double>( prop_advance[i], 0.0, 1.0 );
973 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
974 prop_advance[engine] += amt;
975 SG_CLAMP_RANGE<double>( prop_advance[engine], 0.0, 1.0 );
981 FGControls::set_magnetos( int engine, int pos )
983 if ( engine == ALL_ENGINES ) {
984 for ( int i = 0; i < MAX_ENGINES; i++ ) {
986 SG_CLAMP_RANGE<int>( magnetos[i], 0, 3 );
989 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
990 magnetos[engine] = pos;
991 SG_CLAMP_RANGE<int>( magnetos[engine], 0, 3 );
997 FGControls::move_magnetos( int engine, int amt )
999 if ( engine == ALL_ENGINES ) {
1000 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1002 SG_CLAMP_RANGE<int>( magnetos[i], 0, 3 );
1005 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1006 magnetos[engine] += amt;
1007 SG_CLAMP_RANGE<int>( magnetos[engine], 0, 3 );
1013 FGControls::set_nitrous_injection( int engine, bool val )
1015 if ( engine == ALL_ENGINES ) {
1016 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1017 nitrous_injection[i] = val;
1020 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1021 nitrous_injection[engine] = val;
1028 FGControls::set_cowl_flaps_norm( int engine, double pos )
1030 if ( engine == ALL_ENGINES ) {
1031 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1032 cowl_flaps_norm[i] = pos;
1033 SG_CLAMP_RANGE<double>( cowl_flaps_norm[i], 0.0, 1.0 );
1036 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1037 cowl_flaps_norm[engine] = pos;
1038 SG_CLAMP_RANGE<double>( cowl_flaps_norm[engine], 0.0, 1.0 );
1044 FGControls::move_cowl_flaps_norm( int engine, double amt )
1046 if ( engine == ALL_ENGINES ) {
1047 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1048 cowl_flaps_norm[i] += amt;
1049 SG_CLAMP_RANGE<double>( cowl_flaps_norm[i], 0.0, 1.0 );
1052 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1053 cowl_flaps_norm[engine] += amt;
1054 SG_CLAMP_RANGE<double>( cowl_flaps_norm[engine], 0.0, 1.0 );
1060 FGControls::set_feather( int engine, bool val )
1062 if ( engine == ALL_ENGINES ) {
1063 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1067 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1068 feather[engine] = val;
1074 FGControls::set_ignition( int engine, int pos )
1076 if ( engine == ALL_ENGINES ) {
1077 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1079 SG_CLAMP_RANGE<int>( ignition[i], 0, 3 );
1082 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1083 ignition[engine] = pos;
1084 SG_CLAMP_RANGE<int>( ignition[engine], 0, 3 );
1090 FGControls::set_augmentation( int engine, bool val )
1092 if ( engine == ALL_ENGINES ) {
1093 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1094 augmentation[i] = val;
1097 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1098 augmentation[engine] = val;
1104 FGControls::set_reverser( int engine, bool val )
1106 if ( engine == ALL_ENGINES ) {
1107 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1111 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1112 reverser[engine] = val;
1118 FGControls::set_water_injection( int engine, bool val )
1120 if ( engine == ALL_ENGINES ) {
1121 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1122 water_injection[i] = val;
1125 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1126 water_injection[engine] = val;
1132 FGControls::set_condition( int engine, double val )
1134 if ( engine == ALL_ENGINES ) {
1135 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1137 SG_CLAMP_RANGE<double>( condition[i], 0.0, 1.0 );
1140 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1141 condition[engine] = val;
1142 SG_CLAMP_RANGE<double>( condition[engine], 0.0, 1.0 );
1148 FGControls::set_dump_valve( bool val )
1155 FGControls::set_fuel_selector( int tank, bool pos )
1157 if ( tank == ALL_TANKS ) {
1158 for ( int i = 0; i < MAX_TANKS; i++ ) {
1159 fuel_selector[i] = pos;
1162 if ( (tank >= 0) && (tank < MAX_TANKS) ) {
1163 fuel_selector[tank] = pos;
1169 FGControls::set_to_engine( int tank, int engine )
1171 if ( tank == ALL_TANKS ) {
1172 for ( int i = 0; i < MAX_TANKS; i++ ) {
1173 to_engine[i] = engine;
1176 if ( (tank >= 0) && (tank < MAX_TANKS) ) {
1177 to_engine[tank] = engine;
1183 FGControls::set_to_tank( int tank, int dest_tank )
1185 if ( tank == ALL_TANKS ) {
1186 for ( int i = 0; i < MAX_TANKS; i++ ) {
1187 to_tank[i] = dest_tank;
1190 if ( (tank >= 0) && (tank < MAX_TANKS) ) {
1191 to_tank[tank] = dest_tank;
1197 FGControls::set_boost_pump( int index, bool val )
1199 if ( index == -1 ) {
1200 for ( int i = 0; i < (MAX_TANKS * MAX_BOOSTPUMPS); i++ ) {
1201 boost_pump[i] = val;
1204 if ( (index >= 0) && (index < (MAX_TANKS * MAX_BOOSTPUMPS)) ) {
1205 boost_pump[index] = val;
1212 FGControls::set_brake_left( double pos )
1215 SG_CLAMP_RANGE<double>(brake_left, 0.0, 1.0);
1219 FGControls::move_brake_left( double amt )
1222 SG_CLAMP_RANGE<double>( brake_left, 0.0, 1.0 );
1226 FGControls::set_brake_right( double pos )
1229 SG_CLAMP_RANGE<double>(brake_right, 0.0, 1.0);
1233 FGControls::move_brake_right( double amt )
1236 SG_CLAMP_RANGE<double>( brake_right, 0.0, 1.0 );
1240 FGControls::set_copilot_brake_left( double pos )
1242 copilot_brake_left = pos;
1243 SG_CLAMP_RANGE<double>(brake_left, 0.0, 1.0);
1247 FGControls::set_copilot_brake_right( double pos )
1249 copilot_brake_right = pos;
1250 SG_CLAMP_RANGE<double>(brake_right, 0.0, 1.0);
1254 FGControls::set_brake_parking( double pos )
1256 brake_parking = pos;
1257 SG_CLAMP_RANGE<double>(brake_parking, 0.0, 1.0);
1261 FGControls::set_steering( double angle )
1264 SG_CLAMP_RANGE<double>(steering, -80.0, 80.0);
1268 FGControls::set_nose_wheel_steering( bool nws )
1270 nose_wheel_steering = nws;
1274 FGControls::move_steering( double angle )
1277 SG_CLAMP_RANGE<double>(steering, -80.0, 80.0);
1281 FGControls::set_gear_down( bool gear )
1287 FGControls::set_antiskid( bool state )
1293 FGControls::set_tailhook( bool state )
1299 FGControls::set_launchbar( bool state )
1305 FGControls::set_catapult_launch_cmd( bool state )
1307 catapult_launch_cmd = state;
1311 FGControls::set_tailwheel_lock( bool state )
1313 tailwheel_lock = state;
1318 FGControls::set_alternate_extension( int wheel, bool val )
1320 if ( wheel == ALL_WHEELS ) {
1321 for ( int i = 0; i < MAX_WHEELS; i++ ) {
1322 alternate_extension[i] = val;
1325 if ( (wheel >= 0) && (wheel < MAX_WHEELS) ) {
1326 alternate_extension[wheel] = val;
1332 FGControls::set_wing_heat( bool state )
1338 FGControls::set_pitot_heat( bool state )
1344 FGControls::set_wiper( int state )
1350 FGControls::set_window_heat( bool state )
1352 window_heat = state;
1356 FGControls::set_carb_heat( int engine, bool val )
1358 if ( engine == ALL_ENGINES ) {
1359 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1363 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1364 carb_heat[engine] = val;
1370 FGControls::set_inlet_heat( int engine, bool val )
1372 if ( engine == ALL_ENGINES ) {
1373 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1374 inlet_heat[i] = val;
1377 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1378 inlet_heat[engine] = val;
1384 FGControls::set_engine_pump( int system, bool val )
1386 if ( system == ALL_HYD_SYSTEMS ) {
1387 for ( int i = 0; i < MAX_HYD_SYSTEMS; i++ ) {
1388 engine_pump[i] = val;
1391 if ( (system >= 0) && (system < MAX_HYD_SYSTEMS) ) {
1392 engine_pump[system] = val;
1398 FGControls::set_electric_pump( int system, bool val )
1400 if ( system == ALL_HYD_SYSTEMS ) {
1401 for ( int i = 0; i < MAX_HYD_SYSTEMS; i++ ) {
1402 electric_pump[i] = val;
1405 if ( (system >= 0) && (system < MAX_HYD_SYSTEMS) ) {
1406 electric_pump[system] = val;
1412 FGControls::set_battery_switch( bool state )
1414 battery_switch = state;
1418 FGControls::set_external_power( bool state )
1420 external_power = state;
1424 FGControls::set_APU_generator( bool state )
1426 APU_generator = state;
1430 FGControls::set_generator_breaker( int engine, bool val )
1432 if ( engine == ALL_ENGINES ) {
1433 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1434 generator_breaker[i] = val;
1437 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1438 generator_breaker[engine] = val;
1444 FGControls::set_bus_tie( int engine, bool val )
1446 if ( engine == ALL_ENGINES ) {
1447 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1451 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1452 bus_tie[engine] = val;
1458 FGControls::set_APU_bleed( bool state )
1464 FGControls::set_engine_bleed( int engine, bool val )
1466 if ( engine == ALL_ENGINES ) {
1467 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1468 engine_bleed[i] = val;
1471 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1472 engine_bleed[engine] = val;
1478 FGControls::set_mode( int new_mode )
1484 FGControls::set_outflow_valve( double pos )
1486 outflow_valve = pos;
1487 SG_CLAMP_RANGE<double>( outflow_valve, 0.0, 1.0 );
1491 FGControls::move_outflow_valve( double amt )
1493 outflow_valve += amt;
1494 SG_CLAMP_RANGE<double>( outflow_valve, 0.0, 1.0 );
1498 FGControls::set_dump( bool state )
1504 FGControls::set_pack_on( int pack, bool val )
1506 if ( pack == ALL_PACKS ) {
1507 for ( int i = 0; i < MAX_PACKS; i++ ) {
1511 if ( (pack >= 0) && (pack < MAX_PACKS) ) {
1512 pack_on[pack] = val;
1518 FGControls::set_landing_lights( bool state )
1520 landing_lights = state;
1524 FGControls::set_turn_off_lights( bool state )
1526 turn_off_lights = state;
1530 FGControls::set_taxi_light( bool state )
1536 FGControls::set_logo_lights( bool state )
1538 logo_lights = state;
1542 FGControls::set_nav_lights( bool state )
1548 FGControls::set_beacon( bool state )
1554 FGControls::set_strobe( bool state )
1560 FGControls::set_panel_norm( double intensity )
1562 panel_norm = intensity;
1563 SG_CLAMP_RANGE<double>( panel_norm, 0.0, 1.0 );
1567 FGControls::move_panel_norm( double amt )
1570 SG_CLAMP_RANGE<double>( panel_norm, 0.0, 1.0 );
1574 FGControls::set_instruments_norm( double intensity )
1576 instruments_norm = intensity;
1577 SG_CLAMP_RANGE<double>( instruments_norm, 0.0, 1.0 );
1581 FGControls::move_instruments_norm( double amt )
1583 instruments_norm += amt;
1584 SG_CLAMP_RANGE<double>( instruments_norm, 0.0, 1.0 );
1588 FGControls::set_dome_norm( double intensity )
1590 dome_norm = intensity;
1591 SG_CLAMP_RANGE<double>( dome_norm, 0.0, 1.0 );
1595 FGControls::move_dome_norm( double amt )
1598 SG_CLAMP_RANGE<double>( dome_norm, 0.0, 1.0 );
1602 FGControls::set_master_arm( bool val )
1608 FGControls::set_station_select( int station )
1610 station_select = station;
1611 SG_CLAMP_RANGE<int>( station_select, 0, MAX_STATIONS );
1615 FGControls::set_release_ALL( bool val )
1621 FGControls::set_stick_size( int station, int size )
1623 if ( station == ALL_STATIONS ) {
1624 for ( int i = 0; i < MAX_STATIONS; i++ ) {
1625 stick_size[i] = size;
1626 SG_CLAMP_RANGE<int>( stick_size[i], 1, 20 );
1629 if ( (station >= 0) && (station < MAX_STATIONS) ) {
1630 stick_size[station] = size;
1631 SG_CLAMP_RANGE<int>( stick_size[station], 1, 20 );
1637 FGControls::set_release_stick( int station, bool val )
1639 if ( station == ALL_STATIONS ) {
1640 for ( int i = 0; i < MAX_STATIONS; i++ ) {
1641 release_stick[i] = val;
1644 if ( (station >= 0) && (station < MAX_STATIONS) ) {
1645 release_stick[station] = val;
1651 FGControls::set_release_all( int station, bool val )
1653 if ( station == ALL_STATIONS ) {
1654 for ( int i = 0; i < MAX_STATIONS; i++ ) {
1655 release_all[i] = val;
1658 if ( (station >= 0) && (station < MAX_STATIONS) ) {
1659 release_all[station] = val;
1665 FGControls::set_jettison_all( int station, bool val )
1667 if ( station == ALL_STATIONS ) {
1668 for ( int i = 0; i < MAX_STATIONS; i++ ) {
1669 jettison_all[i] = val;
1672 if ( (station >= 0) && (station < MAX_STATIONS) ) {
1673 jettison_all[station] = val;
1679 FGControls::set_vertical_adjust( double pos )
1681 vertical_adjust = pos;
1682 SG_CLAMP_RANGE<double>( vertical_adjust, -1.0, 1.0 );
1686 FGControls::move_vertical_adjust( double amt )
1688 vertical_adjust += amt;
1689 SG_CLAMP_RANGE<double>( vertical_adjust, -1.0, 1.0 );
1693 FGControls::set_fore_aft_adjust( double pos )
1695 fore_aft_adjust = pos;
1696 SG_CLAMP_RANGE<double>( fore_aft_adjust, -1.0, 1.0 );
1700 FGControls::move_fore_aft_adjust( double amt )
1702 fore_aft_adjust += amt;
1703 SG_CLAMP_RANGE<double>( fore_aft_adjust, -1.0, 1.0 );
1707 FGControls::set_ejection_seat( int which_seat, bool val )
1709 if ( which_seat == ALL_EJECTION_SEATS ) {
1710 for ( int i = 0; i < MAX_EJECTION_SEATS; i++ ) {
1714 if ( (which_seat >= 0) && (which_seat < MAX_EJECTION_SEATS) ) {
1715 if ( eseat_status[which_seat] == SEAT_SAFED ||
1716 eseat_status[which_seat] == SEAT_FAIL )
1718 // we can never eject if SEAT_SAFED or SEAT_FAIL
1722 eject[which_seat] = val;
1728 FGControls::set_eseat_status( int which_seat, int val )
1730 if ( which_seat == ALL_EJECTION_SEATS ) {
1731 for ( int i = 0; i < MAX_EJECTION_SEATS; i++ ) {
1732 eseat_status[i] = val;
1735 if ( (which_seat >=0) && (which_seat < MAX_EJECTION_SEATS) ) {
1736 eseat_status[which_seat] = val;
1742 FGControls::set_cmd_selector_valve( int val )
1744 cmd_selector_valve = val;
1749 FGControls::set_off_start_run( int pos )
1751 off_start_run = pos;
1752 SG_CLAMP_RANGE<int>( off_start_run, 0, 3 );
1756 FGControls::set_APU_fire_switch( bool val )
1758 APU_fire_switch = val;
1762 FGControls::set_autothrottle_arm( bool val )
1764 autothrottle_arm = val;
1768 FGControls::set_autothrottle_engage( bool val )
1770 autothrottle_engage = val;
1774 FGControls::set_heading_select( double heading )
1776 heading_select = heading;
1777 SG_CLAMP_RANGE<double>( heading_select, 0.0, 360.0 );
1781 FGControls::move_heading_select( double amt )
1783 heading_select += amt;
1784 SG_CLAMP_RANGE<double>( heading_select, 0.0, 360.0 );
1788 FGControls::set_altitude_select( double altitude )
1790 altitude_select = altitude;
1791 SG_CLAMP_RANGE<double>( altitude_select, -1000.0, 100000.0 );
1795 FGControls::move_altitude_select( double amt )
1797 altitude_select += amt;
1798 SG_CLAMP_RANGE<double>( altitude_select, -1000.0, 100000.0 );
1802 FGControls::set_bank_angle_select( double angle )
1804 bank_angle_select = angle;
1805 SG_CLAMP_RANGE<double>( bank_angle_select, 10.0, 30.0 );
1809 FGControls::move_bank_angle_select( double amt )
1811 bank_angle_select += amt;
1812 SG_CLAMP_RANGE<double>( bank_angle_select, 10.0, 30.0 );
1816 FGControls::set_vertical_speed_select( double speed )
1818 vertical_speed_select = speed;
1819 SG_CLAMP_RANGE<double>( vertical_speed_select, -3000.0, 4000.0 );
1823 FGControls::move_vertical_speed_select( double amt )
1825 vertical_speed_select += amt;
1826 SG_CLAMP_RANGE<double>( vertical_speed_select, -3000.0, 4000.0 );
1830 FGControls::set_speed_select( double speed )
1832 speed_select = speed;
1833 SG_CLAMP_RANGE<double>( speed_select, 60.0, 400.0 );
1837 FGControls::move_speed_select( double amt )
1839 speed_select += amt;
1840 SG_CLAMP_RANGE<double>( speed_select, 60.0, 400.0 );
1844 FGControls::set_mach_select( double mach )
1847 SG_CLAMP_RANGE<double>( mach_select, 0.4, 4.0 );
1851 FGControls::move_mach_select( double amt )
1854 SG_CLAMP_RANGE<double>( mach_select, 0.4, 4.0 );
1858 FGControls::set_vertical_mode( int mode )
1860 vertical_mode = mode;
1861 SG_CLAMP_RANGE<int>( vertical_mode, 0, 4 );
1865 FGControls::set_lateral_mode( int mode )
1867 lateral_mode = mode;
1868 SG_CLAMP_RANGE<int>( lateral_mode, 0, 4 );
1872 FGControls::set_autopilot_engage( int ap, bool val )
1874 if ( ap == ALL_AUTOPILOTS ) {
1875 for ( int i = 0; i < MAX_AUTOPILOTS; i++ ) {
1876 autopilot_engage[i] = val;
1879 if ( (ap >= 0) && (ap < MAX_AUTOPILOTS) ) {
1880 autopilot_engage[ap] = val;