From 21062e9ba25e09e2ec66a84f1507aa46de548f66 Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Sun, 22 Jul 2018 10:13:33 -0400 Subject: [PATCH 1/4] Control: Add PLD function to autospoiler --- Systems/a320-spoiler.xml | 9 ++++++++- revision.txt | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Systems/a320-spoiler.xml b/Systems/a320-spoiler.xml index fb075409..15a9f285 100644 --- a/Systems/a320-spoiler.xml +++ b/Systems/a320-spoiler.xml @@ -50,7 +50,14 @@ spoilers/throttle[1] ge 0.01 /controls/flight/speedbrake-arm ne 1 - + + spoilers/throttle[0] lt 0.01 + spoilers/throttle[1] lt 0.01 + /controls/flight/speedbrake-arm eq 1 + spoilers/main-gear-and eq 1 + /velocities/groundspeed-kt ge 72 + + spoilers/throttle[0] lt 0.01 spoilers/throttle[1] lt 0.01 /controls/flight/speedbrake-arm eq 1 diff --git a/revision.txt b/revision.txt index e1f7107c..d314d87a 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -4603 \ No newline at end of file +4604 \ No newline at end of file From 17a12bad5963a93cf5a33068cd7ae298d2f1c64a Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Sun, 22 Jul 2018 12:14:32 -0400 Subject: [PATCH 2/4] Sim: add support for spoiler joystick binding --- A320-main.xml | 59 +++++++++++++-------------- Models/FlightDeck/a320.flightdeck.xml | 3 +- Nasal/libraries.nas | 25 ++++++++++++ revision.txt | 2 +- 4 files changed, 56 insertions(+), 33 deletions(-) diff --git a/A320-main.xml b/A320-main.xml index ae8d070f..15ecbee0 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -314,28 +314,28 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + @@ -379,25 +379,25 @@ Cockpit Crew - + 200 440 Passengers - + 1500 27000 Forward Cargo - + 300 8765 Aft Cargo - + 300 8765 @@ -540,7 +540,6 @@ 0 0.0 0 - 0 0.0 0 0 @@ -1370,7 +1369,7 @@ property-cycle - controls/flight/speedbrake + /controls/flight/speedbrake 0.0 1.0 @@ -1392,14 +1391,14 @@ property-cycle - controls/flight/speedbrake + /controls/flight/speedbrake 0.0 0.5 1.0 property-assign - controls/flight/speedbrake-arm + /controls/flight/speedbrake-arm 0 diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index 9dd871b2..243143a2 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -4935,9 +4935,8 @@ rotate SpdBrk - controls/flight/speedbrake + fdm/jsbsim/spoilers/speedbrake-nul 45 - SpdBrk.axis diff --git a/Nasal/libraries.nas b/Nasal/libraries.nas index b60b87f2..a046043d 100644 --- a/Nasal/libraries.nas +++ b/Nasal/libraries.nas @@ -399,6 +399,31 @@ var flaptimer = maketimer(0.5, func { } }); +controls.stepSpoilers = func(step) { + setprop("/controls/flight/speedbrake-arm", 0); + if (step == 1) { + deploySpeedbrake(); + } else if (step == -1) { + retractSpeedbrake(); + } +} + +var deploySpeedbrake = func { + if (getprop("/controls/flight/speedbrake") < 0.5) { + setprop("/controls/flight/speedbrake", 0.5); + } else if (getprop("/controls/flight/speedbrake") < 1.0) { + setprop("/controls/flight/speedbrake", 1.0); + } +} + +var retractSpeedbrake = func { + if (getprop("/controls/flight/speedbrake") > 0.5) { + setprop("/controls/flight/speedbrake", 0.5); + } else if (getprop("/controls/flight/speedbrake") > 0.0) { + setprop("/controls/flight/speedbrake", 0.0); + } +} + var slewProp = func(prop, delta) { delta *= getprop("/sim/time/delta-realtime-sec"); setprop(prop, getprop(prop) + delta); diff --git a/revision.txt b/revision.txt index d314d87a..1a819b2b 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -4604 \ No newline at end of file +4605 \ No newline at end of file From 53527ba0e3c72428d3d362fa66131e23188ae359 Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Sun, 22 Jul 2018 12:19:58 -0400 Subject: [PATCH 3/4] Sim: add support for spoiler joystick binding --- Nasal/libraries.nas | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/Nasal/libraries.nas b/Nasal/libraries.nas index a046043d..28272cb8 100644 --- a/Nasal/libraries.nas +++ b/Nasal/libraries.nas @@ -409,18 +409,30 @@ controls.stepSpoilers = func(step) { } var deploySpeedbrake = func { - if (getprop("/controls/flight/speedbrake") < 0.5) { - setprop("/controls/flight/speedbrake", 0.5); - } else if (getprop("/controls/flight/speedbrake") < 1.0) { - setprop("/controls/flight/speedbrake", 1.0); + if (getprop("/gear/gear[1]/wow") == 1 or getprop("/gear/gear[2]/wow") == 1) { + if (getprop("/controls/flight/speedbrake") < 1.0) { + setprop("/controls/flight/speedbrake", 1.0); + } + } else { + if (getprop("/controls/flight/speedbrake") < 0.5) { + setprop("/controls/flight/speedbrake", 0.5); + } else if (getprop("/controls/flight/speedbrake") < 1.0) { + setprop("/controls/flight/speedbrake", 1.0); + } } } var retractSpeedbrake = func { - if (getprop("/controls/flight/speedbrake") > 0.5) { - setprop("/controls/flight/speedbrake", 0.5); - } else if (getprop("/controls/flight/speedbrake") > 0.0) { - setprop("/controls/flight/speedbrake", 0.0); + if (getprop("/gear/gear[1]/wow") == 1 or getprop("/gear/gear[2]/wow") == 1) { + if (getprop("/controls/flight/speedbrake") > 0.0) { + setprop("/controls/flight/speedbrake", 0.0); + } + } else { + if (getprop("/controls/flight/speedbrake") > 0.5) { + setprop("/controls/flight/speedbrake", 0.5); + } else if (getprop("/controls/flight/speedbrake") > 0.0) { + setprop("/controls/flight/speedbrake", 0.0); + } } } From d53fd0122b10d65d47fae2d7809101dca3833b00 Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Sun, 22 Jul 2018 13:55:24 -0400 Subject: [PATCH 4/4] Control: Spoiler correction --- Systems/a320-spoiler.xml | 68 ++++++---------------------------------- revision.txt | 2 +- 2 files changed, 11 insertions(+), 59 deletions(-) diff --git a/Systems/a320-spoiler.xml b/Systems/a320-spoiler.xml index 15a9f285..ae3553d6 100644 --- a/Systems/a320-spoiler.xml +++ b/Systems/a320-spoiler.xml @@ -103,15 +103,7 @@ - - - /systems/hydraulic/green-psi ge 1500 - spoilers/main-gear-and eq 0 - - - /systems/hydraulic/green-psi ge 1500 - /systems/failures/spoiler-l1 eq 1 - + /systems/hydraulic/green-psi ge 1500 spoilers/main-gear-and eq 1 @@ -201,11 +193,7 @@ - - - /systems/hydraulic/yellow-psi ge 1500 - /systems/failures/spoiler-l2 eq 1 - + /systems/hydraulic/yellow-psi ge 1500 spoilers/main-gear-and eq 0 @@ -276,11 +264,7 @@ - - - /systems/hydraulic/blue-psi ge 1500 - /systems/failures/spoiler-l3 eq 1 - + /systems/hydraulic/blue-psi ge 1500 /systems/failures/spoiler-l3 eq 0 @@ -344,11 +328,7 @@ - - - /systems/hydraulic/yellow-psi ge 1500 - /systems/failures/spoiler-l4 eq 1 - + /systems/hydraulic/yellow-psi ge 1500 /systems/failures/spoiler-l4 eq 0 @@ -412,11 +392,7 @@ - - - /systems/hydraulic/green-psi ge 1500 - /systems/failures/spoiler-l5 eq 1 - + /systems/hydraulic/green-psi ge 1500 spoilers/main-gear-and eq 1 @@ -454,15 +430,7 @@ - - - /systems/hydraulic/green-psi ge 1500 - spoilers/main-gear-and eq 0 - - - /systems/hydraulic/green-psi ge 1500 - /systems/failures/spoiler-r1 eq 1 - + /systems/hydraulic/green-psi ge 1500 spoilers/main-gear-and eq 1 @@ -552,11 +520,7 @@ - - - /systems/hydraulic/yellow-psi ge 1500 - /systems/failures/spoiler-r2 eq 1 - + /systems/hydraulic/yellow-psi ge 1500 spoilers/main-gear-and eq 0 @@ -627,11 +591,7 @@ - - - /systems/hydraulic/blue-psi ge 1500 - /systems/failures/spoiler-r3 eq 1 - + /systems/hydraulic/blue-psi ge 1500 /systems/failures/spoiler-r3 eq 0 @@ -695,11 +655,7 @@ - - - /systems/hydraulic/yellow-psi ge 1500 - /systems/failures/spoiler-r4 eq 1 - + /systems/hydraulic/yellow-psi ge 1500 spoilers/main-gear-and eq 0 @@ -764,11 +720,7 @@ - - - /systems/hydraulic/green-psi ge 1500 - /systems/failures/spoiler-r5 eq 1 - + /systems/hydraulic/green-psi ge 1500 spoilers/main-gear-and eq 1 diff --git a/revision.txt b/revision.txt index 1a819b2b..7e6bab41 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -4605 \ No newline at end of file +4606 \ No newline at end of file