diff --git a/Aircraft/c182rg/Models/gear_control/cessna_gear_control.xml b/Aircraft/c182rg/Models/gear_control/cessna_gear_control.xml index ae2db6f..06f8e7b 100644 --- a/Aircraft/c182rg/Models/gear_control/cessna_gear_control.xml +++ b/Aircraft/c182rg/Models/gear_control/cessna_gear_control.xml @@ -33,22 +33,38 @@ select light-gear-down-on - + gear/gear[0]/position-norm 0.999 - + + gear/gear[1]/position-norm + 0.999 + + + gear/gear[2]/position-norm + 0.999 + + select light-gear-up-on - + gear/gear[0]/position-norm - 0.0001 + 0.001 + + + gear/gear[1]/position-norm + 0.001 + + + gear/gear[2]/position-norm + 0.001 - + pick diff --git a/Aircraft/c182rg/Nasal/squatswitch.nas b/Aircraft/c182rg/Nasal/squatswitch.nas index 53837ac..075837d 100644 --- a/Aircraft/c182rg/Nasal/squatswitch.nas +++ b/Aircraft/c182rg/Nasal/squatswitch.nas @@ -1,40 +1,28 @@ # squatswitch.nas by Ron Jensen (GLP 2.0) -# Implement a squat switch +# Implement c182rg landing gear, including squat switch and +# other gear-related stuff original_gearDown = controls.gearDown; - svc = 1; # assume the best for now # Implement gear functionality. -# Check the relevant variables and act accordingly. gearFncy = func { - if ( svc == 0 ) {return}; - handle = getprop("/controls/gear/gear-handle-down"); + if (!getprop("/gear/serviceable")) { + # don't move the actual gear up or down now ... + settimer(gearFncy, 0.2); # ... but check back soon + return; + }; -#+ Should work, but doesn't work above 200 AGL: -# wow = getprop("/gear/gear[0]/wow"); -#+ The following is a kludge. It is a workaround. -#+ Evidently the JSB FDM only does wow calculations -#+ below 200 feet, so if the aircraft is initially located -#+ or relocated to an airborne position, wow will probably -#+ be wrong. -#+ We hope this situation is temporary. - wow = (getprop("/gear/gear[0]/compression-norm") > 0.001); - - if(handle==1 or !wow){ - original_gearDown( (handle == 1 ? 1 : -1) ); + wow = getprop("/gear/gear[0]/wow"); + if(handle or !wow){ + original_gearDown(handle ? 1 : -1); } else { # In the presumably-rare situation where the gear handle # is up, but there is weight on the wheels, we need to -# notice when the weight comes off. -# Let's do this with a timer, because: -# a) It is observed that some FDMs write to the wow property once -# per frame, even if its value hasn't changed, so for efficiency -# reasons let's not listen to it unless we need to, and -# b) There are nasty interactions (segmentation faults) between -# removable listeners and the "reset" routine used to implement -# the location-in-air popup. In contrast, the timer removes itself -# cleanly. +# notice when the weight comes off. Let's do this with a +# timer, because some FDMs write to the "wow" property once +# per frame, even if its value hasn't changed, making it +# inefficient to attach a listener. settimer(gearFncy, 0.2); } } @@ -53,5 +41,7 @@ controls.gearDown = func { gearFncy(); } -controls.gearToggle = func { controls.gearDown(getprop("/controls/gear/gear-handle-down") > 0 ? -1 : 1); } - +# Rebind gearToggle to use our *new* version of gearDown: +controls.gearToggle = func { + controls.gearDown(getprop("/controls/gear/gear-handle-down") > 0 ? -1 : 1); +} diff --git a/Aircraft/c182rg/Sounds/c182rg-sound.xml b/Aircraft/c182rg/Sounds/c182rg-sound.xml index 8cf1621..5f7e619 100644 --- a/Aircraft/c182rg/Sounds/c182rg-sound.xml +++ b/Aircraft/c182rg/Sounds/c182rg-sound.xml @@ -189,10 +189,24 @@ controls/engines/engine/throttle 0.3 - - controls/gear/gear-handle-down - 0 - + + + controls/gear/gear-handle-down + 0 + + + gear/gear[0]/position-norm + 0.999 + + + gear/gear[1]/position-norm + 0.999 + + + gear/gear[2]/position-norm + 0.999 + + diff --git a/Aircraft/c182rg/c182rg-set.xml b/Aircraft/c182rg/c182rg-set.xml index 323ce4b..f4a9927 100644 --- a/Aircraft/c182rg/c182rg-set.xml +++ b/Aircraft/c182rg/c182rg-set.xml @@ -38,6 +38,15 @@ Maintainer: Stuart Buchanan stuart_d_buchanan -at- yahoo.co.uk false + + + + + Aircraft/c182rg/Models/c182rg-dpm.xml false diff --git a/Nasal/pbrake.nas b/Nasal/pbrake.nas new file mode 100644 index 0000000..4ec0f12 --- /dev/null +++ b/Nasal/pbrake.nas @@ -0,0 +1,7 @@ +############################## +# If initial position is on the ground, set brake. +# This is so I can start FGFS unattended and not lose the airplane. + +if (getprop("/sim/presets/onground")) { + setprop("/controls/gear/brake-parking", 1); +}