diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index edbfc64b..4f6e3a60 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -6159,9 +6159,8 @@ true - property-adjust - controls/flight/elevator-trim - 0.01 + nasal + @@ -6169,9 +6168,8 @@ true - property-adjust - controls/flight/elevator-trim - -0.01 + nasal + diff --git a/Nasal/Libraries/libraries.nas b/Nasal/Libraries/libraries.nas index a6299545..a597a1c9 100644 --- a/Nasal/Libraries/libraries.nas +++ b/Nasal/Libraries/libraries.nas @@ -459,6 +459,23 @@ setlistener("/controls/flight/elevator-trim", func { } }, 0, 0); +# For the cockpit rotation and anywhere else you want to use it +var cmdDegCalc = 0; +var slewPitchWheel = func(d) { + cmdDegCalc = math.round(pts.Fdm.JSBsim.Hydraulics.ElevatorTrim.cmdDeg.getValue(), 0.1); + if (d > 0) { # DN + if (cmdDegCalc < 4) { + cmdDegCalc = (cmdDegCalc + 0.1) / 13.5; # Add and normalize, NOT 4! 13.5 = 1 on either polarity + pts.Controls.Flight.elevatorTrim.setValue(cmdDegCalc); + } + } else { # UP + if (cmdDegCalc > -13.5) { + cmdDegCalc = (cmdDegCalc - 0.1) / 13.5; # Subtract and normalize + pts.Controls.Flight.elevatorTrim.setValue(cmdDegCalc); + } + } +} + ########## # Lights # ########## diff --git a/Nasal/Libraries/property-tree-setup.nas b/Nasal/Libraries/property-tree-setup.nas index f35ebb56..9eebf749 100644 --- a/Nasal/Libraries/property-tree-setup.nas +++ b/Nasal/Libraries/property-tree-setup.nas @@ -97,8 +97,11 @@ var Fdm = { elevator: props.globals.getNode("/fdm/jsbsim/fbw/elevator-sidestick"), }, Hydraulics: { + ElevatorTrim: { + cmdDeg: props.globals.getNode("/fdm/jsbsim/hydraulics/elevator-trim/cmd-deg"), + }, Rudder: { - trimDeg: props.globals.getNode("fdm/jsbsim/hydraulics/rudder/trim-deg"), + trimDeg: props.globals.getNode("/fdm/jsbsim/hydraulics/rudder/trim-deg"), }, }, Inertia: { diff --git a/Systems/a320-fcs.xml b/Systems/a320-fcs.xml index 67c2f4a7..6f189fa6 100644 --- a/Systems/a320-fcs.xml +++ b/Systems/a320-fcs.xml @@ -317,7 +317,7 @@ /controls/flight/elevator-trim - -1.00 + -1.0 0.296296 diff --git a/revision.txt b/revision.txt index 72f523f3..86ee83a4 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -39 \ No newline at end of file +40 \ No newline at end of file