From a61de8e6e93fa031f9ddda0163a007971efb0d1b Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 12 Jul 2020 14:24:16 +0100 Subject: [PATCH] Speedbrake to PTS --- Nasal/Libraries/libraries.nas | 28 ++++++++++++------------- Nasal/Libraries/property-tree-setup.nas | 1 + 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Nasal/Libraries/libraries.nas b/Nasal/Libraries/libraries.nas index b28233c6..42128236 100644 --- a/Nasal/Libraries/libraries.nas +++ b/Nasal/Libraries/libraries.nas @@ -386,29 +386,29 @@ controls.stepSpoilers = func(step) { } var deploySpeedbrake = func { - 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); + if (pts.Gear.Wow[1].getBoolValue() or pts.Gear.Wow[2].getBoolValue()) { + if (pts.Controls.Flight.speedbrake.getValue() < 1.0) { + pts.Controls.Flight.speedbrake.setValue(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); + if (pts.Controls.Flight.speedbrake.getValue() < 0.5) { + pts.Controls.Flight.speedbrake.setValue(0.5); + } else if (pts.Controls.Flight.speedbrake.getValue() < 1.0) { + pts.Controls.Flight.speedbrake.setValue(1.0); } } } var retractSpeedbrake = func { - 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); + if (pts.Gear.Wow[1].getBoolValue() or pts.Gear.Wow[2].getBoolValue()) { + if (pts.Controls.Flight.speedbrake.getValue() > 0.0) { + pts.Controls.Flight.speedbrake.setValue(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); + if (pts.Controls.Flight.speedbrake.getValue() > 0.5) { + pts.Controls.Flight.speedbrake.setValue(0.5); + } else if (pts.Controls.Flight.speedbrake.getValue() > 0.0) { + pts.Controls.Flight.speedbrake.setValue(0.0); } } } diff --git a/Nasal/Libraries/property-tree-setup.nas b/Nasal/Libraries/property-tree-setup.nas index 35703454..c0af1be4 100644 --- a/Nasal/Libraries/property-tree-setup.nas +++ b/Nasal/Libraries/property-tree-setup.nas @@ -32,6 +32,7 @@ var Controls = { flaps: props.globals.getNode("/controls/flight/flaps"), flapsTemp: 0, flapsPos: props.globals.getNode("/controls/flight/flaps-pos"), + speedbrake: props.globals.getNode("/controls/flight/speedbrake"), speedbrakeArm: props.globals.getNode("/controls/flight/speedbrake-arm"), }, Gear: {