Joystick-config: fix ToggleButton, add AP-DISC
Fix the created binding for toggle buttons. Add autopilotDisconnect helper to controls.nas, and expose the new function in the joystick configurator dialog. Fixes from Henning Stahlke
This commit is contained in:
parent
d315d69530
commit
f125b75429
3 changed files with 22 additions and 1 deletions
|
@ -558,6 +558,13 @@ var applyApplicableBrakes = func(v, which = 0) {
|
|||
}
|
||||
}
|
||||
|
||||
var autopilotDisconnect = func() {
|
||||
var aps = props.getNode("/controls/autoflight").getChildren("autopilot");
|
||||
foreach (var ap; aps) {
|
||||
ap.getChild("engage").setBoolValue(0);
|
||||
}
|
||||
}
|
||||
|
||||
# 1: Deploy, -1: Release
|
||||
var deployChute = func(v) setprop("/controls/flight/drag-chute", v);
|
||||
|
||||
|
|
|
@ -418,7 +418,7 @@ var PropertyToggleButton = {
|
|||
|
||||
var c = prop.getNode("binding", 1).getNode("command", 1).getValue();
|
||||
var p = prop.getNode("binding", 1).getNode("property", 1).getValue();
|
||||
return ((c == "property-toggle") and (p == me.prop));
|
||||
return ((c == "property-toggle") and (p == me.binding));
|
||||
},
|
||||
|
||||
getBinding: func(button) {
|
||||
|
@ -566,6 +566,7 @@ var buttonBindings = [
|
|||
NasalHoldButton.new("Brakes (air/wheel)", "controls.applyApplicableBrakes(1);", "controls.applyApplicableBrakes(0);"),
|
||||
NasalHoldButton.new("Parking brakes", "controls.parkingBrakeToggle(0);", "controls.parkingBrakeToggle(1);"),
|
||||
NasalHoldButton.new("NWS toggle", "controls.toggleNWS(0);", "controls.toggleNWS(1);"),
|
||||
NasalButton.new("Autopilot disconnect", "controls.autopilotDisconnect();",0),
|
||||
|
||||
PropertyToggleButton.new("Total Freeze", "/sim/freeze/clock"),
|
||||
|
||||
|
|
|
@ -486,6 +486,19 @@ var assignButton = func(cmd) {
|
|||
</binding>
|
||||
</button>
|
||||
|
||||
<button>
|
||||
<row>10</row>
|
||||
<col>3</col>
|
||||
<halign>fill</halign>
|
||||
<legend>Autopilot disconnect</legend>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
assignButton("Autopilot disconnect");
|
||||
</script>
|
||||
</binding>
|
||||
</button>
|
||||
|
||||
<text>
|
||||
<row>0</row>
|
||||
<col>4</col>
|
||||
|
|
Loading…
Reference in a new issue