diff --git a/Nasal/controls.nas b/Nasal/controls.nas
index 78cea711c..84be8cac7 100644
--- a/Nasal/controls.nas
+++ b/Nasal/controls.nas
@@ -268,16 +268,28 @@ setElevatorTrimToPosition = func() {
setElevatorTrimToPosition_listener = nil;
}
var nv = getprop("/controls/flight/elevator")+getprop("/controls/flight/elevator-trim");
+ nv = math.min(math.max(-1.0,nv),1.0);
var lv = getprop("/controls/flight/elevator");
- var setElevatorTrimToPosition_listener = setlistener("/controls/flight/elevator", func(v){
- if (v.getValue() != lv) {
- setprop("controls/flight/elevator",0);
- removelistener(setElevatorTrimToPosition_listener);
- print("set trim to ",nv);
- setprop("/controls/flight/elevator-trim", nv);
- }
- } , 0, 0);
-};
+ if (math.abs(lv) <= 0.001){
+ print("Elevator trim: centre");
+ setprop("/controls/flight/elevator-trim", 0);
+ } else {
+print("Trim when centered stick");
+ setElevatorTrimToPosition_listener = setlistener("/controls/flight/elevator", func(v){
+ if (math.abs(v.getValue()) <= 0.001) {
+ setprop("controls/flight/elevator",0);
+ removelistener(setElevatorTrimToPosition_listener);
+ setElevatorTrimToPosition_listener = nil;
+ print("set trim to ",nv);
+ setprop("/controls/flight/elevator-trim", nv);
+ }
+ else
+ print("Not trimming yet ",v.getValue());
+
+ }, 0, 0);
+ }
+}
+
##
# Handlers. These are suitable for binding to repeatable button press
# events. They are *not* good for binding to the keyboard, since (at
@@ -471,6 +483,9 @@ var applyBrakes = func(v, which = 0) {
if (which <= 0) { interpolate("/controls/gear/brake-left", v, fullBrakeTime); }
if (which >= 0) { interpolate("/controls/gear/brake-right", v, fullBrakeTime); }
}
+var applyTrigger = func(v) {
+setprop("/controls/armament/pickle", v);
+}
var applyParkingBrake = func(v) {
if (!v) { return; }
diff --git a/Nasal/joystick.nas b/Nasal/joystick.nas
index a5c985b9b..4443a3187 100644
--- a/Nasal/joystick.nas
+++ b/Nasal/joystick.nas
@@ -195,10 +195,11 @@ var NasalScaleAxis = {
};
var NasalLowHighAxis = {
- new: func(name, lowscript, highscript, prop) {
+ new: func(name, lowscript, highscript, prop, repeatable) {
var m = { parents: [NasalLowHighAxis, Axis.new(name, prop, 1) ] };
m.lowscript = lowscript;
m.highscript = highscript;
+ m.repeatable = repeatable;
return m;
},
@@ -209,6 +210,7 @@ var NasalLowHighAxis = {
m.lowscript = me.lowscript;
m.highscript = me.highscript;
+ m.repeatable = me.repeatable;
return m;
},
@@ -238,7 +240,9 @@ var NasalLowHighAxis = {
p.getNode("desc", 1).setValue(me.name);
p.getNode("low", 1).getNode("binding", 1).getNode("command", 1).setValue("nasal");
+ p.getNode("low", 1).getNode("repeatable", 1).setBoolValue(me.repeatable);
p.getNode("high", 1).getNode("binding", 1).getNode("command", 1).setValue("nasal");
+ p.getNode("high", 1).getNode("repeatable", 1).setBoolValue(me.repeatable);
if (me.inverted) {
p.getNode("low", 1).getNode("binding", 1).getNode("script", 1).setValue(me.highscript);
@@ -283,21 +287,24 @@ var axisBindings = [
PropertyScaleAxis.new("Propeller Pitch Engine 1", "/controls/engines/engine[1]/propeller-pitch"),
NasalLowHighAxis.new("View (horizontal)",
- "setprop(\"/sim/current-view/goal-heading-offset-deg\", getprop(\"/sim/current-view/goal-heading-offset-deg\") + 30);",
- "setprop(\"/sim/current-view/goal-heading-offset-deg\", getprop(\"/sim/current-view/goal-heading-offset-deg\") - 30);",
- "/sim/current-view/goal-heading-offset-deg"),
+ "setprop(\"/sim/current-view/goal-heading-offset-deg\", getprop(\"/sim/current-view/goal-heading-offset-deg\") + 2);",
+ "setprop(\"/sim/current-view/goal-heading-offset-deg\", getprop(\"/sim/current-view/goal-heading-offset-deg\") - 2);",
+ "/sim/current-view/goal-heading-offset-deg",1),
NasalLowHighAxis.new("View (vertical)",
- "setprop(\"/sim/current-view/goal-pitch-offset-deg\", getprop(\"/sim/current-view/goal-pitch-offset-deg\") - 20);",
- "setprop(\"/sim/current-view/goal-pitch-offset-deg\", getprop(\"/sim/current-view/goal-pitch-offset-deg\") + 20);",
- "/sim/current-view/goal-heading-offset-deg"),
+ "setprop(\"/sim/current-view/goal-pitch-offset-deg\", getprop(\"/sim/current-view/goal-pitch-offset-deg\") - 1);",
+ "setprop(\"/sim/current-view/goal-pitch-offset-deg\", getprop(\"/sim/current-view/goal-pitch-offset-deg\") + 1);",
+ "/sim/current-view/goal-heading-offset-deg",1),
PropertyScaleAxis.new("Aileron Trim", "/controls/flight/aileron-trim"),
PropertyScaleAxis.new("Elevator Trim", "/controls/flight/elevator-trim"),
PropertyScaleAxis.new("Rudder Trim", "/controls/flight/rudder-trim"),
PropertyScaleAxis.new("Brake Left", "/controls/gear/brake-left", 0.5, 1.0),
PropertyScaleAxis.new("Brake Right", "/controls/gear/brake-right", 0.5, 1.0),
- NasalLowHighAxis.new("Aileron Trim Incremental", "controls.aileronTrim(-1);", "controls.aileronTrim(1);", "/controls/flight/aileron-trim-delta"),
- NasalLowHighAxis.new("Elevator Trim Incremental", "controls.elevatorTrim(-1);", "controls.elevatorTrim(1);", "/controls/flight/elevator-trim-delta"),
- NasalLowHighAxis.new("Rudder Trim Incremental", "controls.rudderTrim(-1);", "controls.rudderTrim(1);", "/controls/flight/rudder-trim-delta"),
+ PropertyScaleAxis.new("Flaps", "/controls/flight/flaps", 0.5, 1.0),
+ PropertyScaleAxis.new("Wings", "/controls/flight/wings", 0.5, 1.0),
+ PropertyScaleAxis.new("Brake Right", "/controls/gear/brake-right", 0.5, 1.0),
+ NasalLowHighAxis.new("Aileron Trim inc.", "controls.aileronTrim(-1);", "controls.aileronTrim(1);", "/controls/flight/aileron-trim-delta", 1),
+ NasalLowHighAxis.new("Elevator Trim inc.", "controls.elevatorTrim(-1);", "controls.elevatorTrim(1);", "/controls/flight/elevator-trim-delta", 1),
+ NasalLowHighAxis.new("Rudder Trim inc.", "controls.rudderTrim(-1);", "controls.rudderTrim(1);", "/controls/flight/rudder-trim-delta", 1),
PropertyScaleAxis.new("View Horizontal Axis", "/sim/current-view/goal-heading-offset-deg", 180, 0),
PropertyScaleAxis.new("View Vertical Axis", "/sim/current-view/goal-pitch-offset-deg", 180, 0),
@@ -529,6 +536,7 @@ var buttonBindings = [
NasalButton.new("Elevator Trim Up", "controls.elevatorTrim(-1);", 1),
NasalButton.new("Elevator Trim Down", "controls.elevatorTrim(1);", 1),
+ NasalButton.new("Elevator Trim Pos", "controls.setElevatorTrimToPosition();", 1),
NasalButton.new("Rudder Trim Left", "controls.rudderTrim(-1);", 1),
NasalButton.new("Rudder Trim Right", "controls.rudderTrim(1);", 1),
NasalButton.new("Aileron Trim Left", "controls.aileronTrim(-1);", 1),
@@ -547,8 +555,11 @@ var buttonBindings = [
NasalHoldButton.new("Parking brakes", "controls.parkingBrakeToggle(0);", "controls.parkingBrakeToggle(1);"),
NasalHoldButton.new("NWS toggle", "controls.toggleNWS(0);", "controls.toggleNWS(1);"),
+ PropertyToggleButton.new("Total Freeze", "/sim/freeze/clock"),
+
# with all of these it is expected the the armament system in the selected aircraft
# will manage the wrap around and or reset to zero.
+ NasalHoldButton.new("Trigger", "controls.applyTrigger(1);","controls.applyTrigger(0);"),
PropertyAdjustButton.new("Pickle", "/controls/armament/pickle-target", "1"),
PropertyAdjustButton.new("Target next", "/controls/armament/target-selected", "1"),
PropertyAdjustButton.new("Target previous", "/controls/armament/target-selected", "-1"),
diff --git a/gui/dialogs/button-axis-config.xml b/gui/dialogs/button-axis-config.xml
index e294b8dc6..a57507d73 100644
--- a/gui/dialogs/button-axis-config.xml
+++ b/gui/dialogs/button-axis-config.xml
@@ -134,6 +134,30 @@ var assignAxis = func(cmd) {
+
+
@@ -185,11 +209,11 @@ var assignAxis = func(cmd) {
4
3
fill
-
+
nasal
@@ -197,11 +221,11 @@ var assignAxis = func(cmd) {
5
3
fill
-
+
nasal
@@ -209,11 +233,11 @@ var assignAxis = func(cmd) {
6
3
fill
-
+
nasal
diff --git a/gui/dialogs/button-config.xml b/gui/dialogs/button-config.xml
index 6cde0866a..74a930f41 100644
--- a/gui/dialogs/button-config.xml
+++ b/gui/dialogs/button-config.xml
@@ -21,8 +21,17 @@ var assignButton = func(cmd) {
]]>
-
- button-config
+
+
+
+ button-config
vbox
true
true
@@ -100,6 +109,19 @@ var assignButton = func(cmd) {
3
0
fill
+
+
+ nasal
+
+
+
+
+
+
+
+
+ 2
+ 5
+ fill
nasal
@@ -556,7 +615,7 @@ var assignButton = func(cmd) {
- 2
+ 3
5
fill
@@ -568,7 +627,7 @@ var assignButton = func(cmd) {
- 3
+ 4
5
fill
@@ -580,7 +639,7 @@ var assignButton = func(cmd) {
- 4
+ 5
5
fill
@@ -592,7 +651,7 @@ var assignButton = func(cmd) {
- 5
+ 6
5
fill
@@ -604,7 +663,7 @@ var assignButton = func(cmd) {
- 6
+ 7
5
fill
@@ -616,7 +675,7 @@ var assignButton = func(cmd) {
- 7
+ 8
5
fill
@@ -628,7 +687,7 @@ var assignButton = func(cmd) {
- 8
+ 9
5
fill
@@ -640,7 +699,7 @@ var assignButton = func(cmd) {
- 9
+ 10
5
fill
@@ -652,7 +711,7 @@ var assignButton = func(cmd) {
- 10
+ 11
5
fill