1
0
Fork 0

Switches and options (#262)

* Cockpit door switch and basic lock logic

* Little fix for leftturnoff light

* Toottip for transponder knob (it's very hard to me guess the mode selected)

* Foot warmer switches cpt and fo

* FGCamera compatibility for 0-9 view selection keys

* Enable mouse wheel for landing light switches

Co-authored-by: Inuyaksa <inuyaksa@yahoo.com>
This commit is contained in:
legoboyvdlp 2022-01-07 13:43:55 +00:00 committed by GitHub
parent 9003b1cf18
commit 5359cdb3ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 372 additions and 5 deletions

View file

@ -812,6 +812,10 @@
<brake-left type="double">0</brake-left>
<brake-right type="double">0</brake-right>
</autobrake>
<cabin>
<footwarmer-cpt type="bool">0</footwarmer-cpt>
<footwarmer-fo type="bool">0</footwarmer-fo>
</cabin>
<CVR>
<erase type="bool">0</erase>
<gndctl type="bool">0</gndctl>
@ -819,6 +823,9 @@
<test type="bool">0</test>
<tone type="bool">0</tone>
</CVR>
<doors>
<doorc-switch type="int">0</doorc-switch>
</doors>
<electric>
<avionics-switch type="bool">true</avionics-switch>
</electric>
@ -1604,6 +1611,7 @@
<options n="0">
<system n="0">
<keyboard-mode type="bool">0</keyboard-mode>
<fgcamera-keys-enabled type="bool">0</fgcamera-keys-enabled>
</system>
<steep-ils type="bool">0</steep-ils>
<steep-ils-avail type="bool">0</steep-ils-avail>
@ -2240,11 +2248,20 @@
<command>nasal</command>
<script>mcdu.button("1", 1);</script>
</binding>
<binding>
<condition>
<property>/options/system/fgcamera-keys-enabled</property>
</condition>
<command>fgcamera-select</command>
<camera-id>1</camera-id>
<camera-type>aircraft</camera-type>
</binding>
<binding>
<condition>
<not><property>/FMGC/keyboard-left</property></not>
<not><property>/FMGC/keyboard-right</property></not>
<not><property>/options/system/keyboard-mode</property></not>
<not><property>/options/system/fgcamera-keys-enabled</property></not>
</condition>
<command>property-assign</command>
<property>/sim/current-view/view-number</property>
@ -2278,11 +2295,20 @@
<command>nasal</command>
<script>mcdu.button("2", 1);</script>
</binding>
<binding>
<condition>
<property>/options/system/fgcamera-keys-enabled</property>
</condition>
<command>fgcamera-select</command>
<camera-id>2</camera-id>
<camera-type>aircraft</camera-type>
</binding>
<binding>
<condition>
<not><property>/FMGC/keyboard-left</property></not>
<not><property>/FMGC/keyboard-right</property></not>
<not><property>/options/system/keyboard-mode</property></not>
<not><property>/options/system/fgcamera-keys-enabled</property></not>
</condition>
<command>property-assign</command>
<property>/sim/current-view/view-number</property>
@ -2317,11 +2343,20 @@
<command>nasal</command>
<script>mcdu.button("3", 1);</script>
</binding>
<binding>
<condition>
<property>/options/system/fgcamera-keys-enabled</property>
</condition>
<command>fgcamera-select</command>
<camera-id>3</camera-id>
<camera-type>aircraft</camera-type>
</binding>
<binding>
<condition>
<not><property>/FMGC/keyboard-left</property></not>
<not><property>/FMGC/keyboard-right</property></not>
<not><property>/options/system/keyboard-mode</property></not>
<not><property>/options/system/fgcamera-keys-enabled</property></not>
</condition>
<command>property-assign</command>
<property>/sim/current-view/view-number</property>
@ -2356,11 +2391,20 @@
<command>nasal</command>
<script>mcdu.button("4", 1);</script>
</binding>
<binding>
<condition>
<property>/options/system/fgcamera-keys-enabled</property>
</condition>
<command>fgcamera-select</command>
<camera-id>4</camera-id>
<camera-type>aircraft</camera-type>
</binding>
<binding>
<condition>
<not><property>/FMGC/keyboard-left</property></not>
<not><property>/FMGC/keyboard-right</property></not>
<not><property>/options/system/keyboard-mode</property></not>
<not><property>/options/system/fgcamera-keys-enabled</property></not>
</condition>
<command>property-assign</command>
<property>/sim/current-view/view-number</property>
@ -2395,11 +2439,20 @@
<command>nasal</command>
<script>mcdu.button("5", 1);</script>
</binding>
<binding>
<condition>
<property>/options/system/fgcamera-keys-enabled</property>
</condition>
<command>fgcamera-select</command>
<camera-id>5</camera-id>
<camera-type>aircraft</camera-type>
</binding>
<binding>
<condition>
<not><property>/FMGC/keyboard-left</property></not>
<not><property>/FMGC/keyboard-right</property></not>
<not><property>/options/system/keyboard-mode</property></not>
<not><property>/options/system/fgcamera-keys-enabled</property></not>
</condition>
<command>property-assign</command>
<property>/sim/current-view/view-number</property>
@ -2436,11 +2489,20 @@
<command>nasal</command>
<script>mcdu.button("6", 1);</script>
</binding>
<binding>
<condition>
<property>/options/system/fgcamera-keys-enabled</property>
</condition>
<command>fgcamera-select</command>
<camera-id>6</camera-id>
<camera-type>aircraft</camera-type>
</binding>
<binding>
<condition>
<not><property>/FMGC/keyboard-left</property></not>
<not><property>/FMGC/keyboard-right</property></not>
<not><property>/options/system/keyboard-mode</property></not>
<not><property>/options/system/fgcamera-keys-enabled</property></not>
</condition>
<command>property-assign</command>
<property>/sim/current-view/view-number</property>
@ -2485,6 +2547,14 @@
<property>/sim/current-view/view-number</property>
<value></value>
</binding-->
<binding>
<condition>
<property>/options/system/fgcamera-keys-enabled</property>
</condition>
<command>fgcamera-select</command>
<camera-id>7</camera-id>
<camera-type>aircraft</camera-type>
</binding>
<binding>
<condition>
<not><property>/FMGC/keyboard-left</property></not>
@ -2513,6 +2583,14 @@
<command>nasal</command>
<script>mcdu.button("8", 1);</script>
</binding>
<binding>
<condition>
<property>/options/system/fgcamera-keys-enabled</property>
</condition>
<command>fgcamera-select</command>
<camera-id>8</camera-id>
<camera-type>aircraft</camera-type>
</binding>
<!--binding>
<condition>
<not><property>/FMGC/keyboard-left</property></not>
@ -2527,7 +2605,7 @@
<condition>
<not><property>/FMGC/keyboard-left</property></not>
<not><property>/FMGC/keyboard-right</property></not>
<property>/options/system/keyboard-mode</property>
<property>/options/system/keyboard-mode</property>
</condition>
<command>nasal</command>
<script>
@ -2552,6 +2630,14 @@
<command>nasal</command>
<script>mcdu.button("9", 1);</script>
</binding>
<binding>
<condition>
<property>/options/system/fgcamera-keys-enabled</property>
</condition>
<command>fgcamera-select</command>
<camera-id>9</camera-id>
<camera-type>aircraft</camera-type>
</binding>
<!--binding>
<condition>
<not><property>/FMGC/keyboard-left</property></not>

View file

@ -51,6 +51,7 @@ setprop("/systems/acconfig/out-of-date", 0);
setprop("/systems/acconfig/mismatch-code", "0x000");
setprop("/systems/acconfig/mismatch-reason", "XX");
setprop("/systems/acconfig/options/keyboard-mode", 0);
setprop("/systems/acconfig/options/fgcamera-keys-enabled", 0);
setprop("/systems/acconfig/options/weight-kgs", 1);
setprop("/systems/acconfig/options/adirs-skip", 0);
setprop("/systems/acconfig/options/allow-oil-consumption", 0);
@ -214,6 +215,7 @@ var renderingSettings = {
var readSettings = func {
io.read_properties(pts.Sim.fgHome.getValue() ~ "/Export/A320-family-config.xml", "/systems/acconfig/options");
setprop("/options/system/keyboard-mode", getprop("/systems/acconfig/options/keyboard-mode"));
if (getprop("/sim/fgcamera/enable")) setprop("/options/system/fgcamera-keys-enabled", getprop("/systems/acconfig/options/fgcamera-keys-enabled")); # read only when FGCamera enabled
setprop("/options/system/weight-kgs", getprop("/systems/acconfig/options/weight-kgs"));
setprop("/options/system/save-state", getprop("/systems/acconfig/options/save-state"));
setprop("/controls/adirs/skip", getprop("/systems/acconfig/options/adirs-skip"));
@ -228,6 +230,7 @@ var readSettings = func {
var writeSettings = func {
setprop("/systems/acconfig/options/keyboard-mode", getprop("/options/system/keyboard-mode"));
setprop("/systems/acconfig/options/fgcamera-keys-enabled", getprop("/options/system/fgcamera-keys-enabled"));
setprop("/systems/acconfig/options/weight-kgs", getprop("/options/system/weight-kgs"));
setprop("/systems/acconfig/options/save-state", getprop("/options/system/save-state"));
setprop("/systems/acconfig/options/adirs-skip", getprop("/controls/adirs/skip"));

View file

@ -242,6 +242,27 @@
<live>true</live>
</checkbox>
<checkbox>
<label>Enable FGCamera 0-9 keys</label>
<halign>left</halign>
<enable>/sim/fgcamera/enable</enable>
<property>/options/system/fgcamera-keys-enabled</property>
<binding>
<command>property-toggle</command>
<property>/options/system/fgcamera-keys-enabled</property>
</binding>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>nasal</command>
<script>
acconfig.writeSettings();
</script>
</binding>
<live>true</live>
</checkbox>
<!-- TODO Comment back in, when fully implemented -->
<checkbox>
<label>Weight in KG</label>

View file

@ -850,6 +850,19 @@
<script>atc.transponderPanel.modeSwitch(getprop("controls/atc/mode-knob") + 1);</script>
</binding>
</action>
<hovered>
<binding>
<command>set-tooltip</command>
<tooltip-id>atc_stby_mode</tooltip-id>
<label>Mode: %s</label>
<property>controls/atc/mode-knob</property>
<mapping>nasal</mapping>
<script>
var modes = ['STANDBY','ALT','XPNDR','TA ONLY','TA/RA'];
return modes[arg[0]];
</script>
</binding>
</hovered>
</animation>
<animation>
@ -1505,6 +1518,122 @@
</action>
</animation>
<!-- Cocktpit Door Switch -->
<animation>
<type>rotate</type>
<object-name>CockpitDoorSwitch</object-name>
<object-name>CockpitDoorSwitch.mark</object-name>
<property>controls/doors/doorc-switch</property>
<interpolation>
<entry><ind>-1</ind><dep>-25</dep></entry>
<entry><ind> 0</ind><dep> 0</dep></entry>
<entry><ind> 1</ind><dep> 25</dep></entry>
</interpolation>
<axis>
<object-name>CockpitDoorSwitch.axis</object-name>
</axis>
</animation>
<animation>
<type>pick</type>
<object-name>CockpitDoorSwitch</object-name>
<object-name>CockpitDoorSwitch.mark</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<condition>
<not><property>devices/status/keyboard/shift</property></not>
</condition>
<command>property-assign</command>
<property>controls/doors/doorc-switch</property>
<value>1</value>
</binding>
<binding>
<condition>
<property>devices/status/keyboard/shift</property>
</condition>
<command>property-assign</command>
<property>controls/doors/doorc-switch</property>
<value>-1</value>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/sounde/switch1</property>
<value>1</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>controls/doors/doorc-switch</property>
<value>0</value>
</binding>
</mod-up>
</action>
<action>
<button>1</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>controls/doors/doorc-switch</property>
<value>-1</value>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/sounde/switch1</property>
<value>1</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>controls/doors/doorc-switch</property>
<value>0</value>
</binding>
</mod-up>
</action>
<hovered>
<binding>
<command>set-tooltip</command>
<tooltip-id>doorc-switch-lock</tooltip-id>
<label>Cockpit door switch</label>
</binding>
</hovered>
</animation>
<animation>
<type>select</type>
<object-name>CockpitDoorOpen</object-name>
<object-name>CockpitDoorSwitch.mark</object-name>
<condition>
<or>
<equals>
<property>controls/switches/annun-test</property>
<value>1</value>
</equals>
<not-equals>
<property>sim/model/door-positions/doorc/lock-status</property>
<value>1</value>
</not-equals>
</or>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>CockpitDoorFault</object-name>
<condition>
<or>
<equals>
<property>controls/switches/annun-test</property>
<value>1</value>
</equals>
<equals>
<property>sim/model/door-positions/doorc/lock-status</property>
<value>-9</value>
</equals>
</or>
</condition>
</animation>
<!-- Terr on ND -->
<animation>
<type>pick</type>
@ -2132,6 +2261,76 @@
</axis>
</animation>
<!-- Foot warner switches -->
<animation>
<type>rotate</type>
<object-name>foot_warmer_cpt_sw</object-name>
<object-name>foot_warmer_cpt_sw.mark</object-name>
<property>controls/cabin/footwarmer-cpt</property>
<interpolation>
<entry><ind>1</ind><dep>-20</dep></entry>
<entry><ind>0</ind><dep>20</dep></entry>
</interpolation>
<axis>
<object-name>foot_warmer_cpt_sw.axis</object-name>
</axis>
</animation>
<animation>
<type>pick</type>
<object-name>foot_warmer_cpt_sw</object-name>
<object-name>foot_warmer_cpt_sw.mark</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-cycle</command>
<property>controls/cabin/footwarmer-cpt</property>
<value>1</value>
<value>0</value>
</binding>
<binding>
<command>property-toggle</command>
<property>/sim/sounde/switch1</property>
</binding>
</action>
</animation>
<animation>
<type>rotate</type>
<object-name>foot_warmer_fo_sw</object-name>
<object-name>foot_warmer_fo_sw.mark</object-name>
<property>controls/cabin/footwarmer-fo</property>
<interpolation>
<!-- Axis inverted!! -->
<entry><ind>1</ind><dep>20</dep></entry>
<entry><ind>0</ind><dep>-20</dep></entry>
</interpolation>
<axis>
<object-name>foot_warmer_fo_sw.axis</object-name>
</axis>
</animation>
<animation>
<type>pick</type>
<object-name>foot_warmer_fo_sw</object-name>
<object-name>foot_warmer_fo_sw.mark</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-cycle</command>
<property>controls/cabin/footwarmer-fo</property>
<value>1</value>
<value>0</value>
</binding>
<binding>
<command>property-toggle</command>
<property>/sim/sounde/switch1</property>
</binding>
</action>
</animation>
<!-- ECAM Controls -->
<animation>
<type>pick</type>
@ -8286,8 +8485,6 @@
<object-name>pedals_block_capt</object-name>
<object-name>pedals_indicator_1</object-name>
<object-name>Pedestal-Low</object-name>
<object-name>CockpitDoorFault</object-name>
<object-name>CockpitDoorOpen</object-name>
<object-name>CockpitDoorSwitch</object-name>
<object-name>CockpitDoorSwitch.mark</object-name>
<object-name>CockpitDoorVideoButton</object-name>

View file

@ -5186,6 +5186,7 @@
<object-name>LandingLtLSwtch</object-name>
<action>
<button>0</button>
<button>3</button>
<repeatable>false</repeatable>
<binding>
<command>property-cycle</command>
@ -5201,6 +5202,7 @@
</action>
<action>
<button>1</button>
<button>4</button>
<repeatable>false</repeatable>
<binding>
<command>property-cycle</command>
@ -5222,6 +5224,7 @@
<object-name>LandingLtRSwtch</object-name>
<action>
<button>0</button>
<button>3</button>
<repeatable>false</repeatable>
<binding>
<command>property-cycle</command>
@ -5237,6 +5240,7 @@
</action>
<action>
<button>1</button>
<button>4</button>
<repeatable>false</repeatable>
<binding>
<command>property-cycle</command>

View file

@ -64,6 +64,10 @@ var cargofwd = aircraft.door.new("/sim/model/door-positions/cargofwd", 10);
# Seat armrests in the flight deck (unused)
var armrests = aircraft.door.new("/sim/model/door-positions/armrests", 2);
# Cockpit door - TODO animation
var cockpitdoor = aircraft.door.new("/sim/model/door-positions/doorc", 1);
setprop("/sim/model/door-positions/doorc/lock-status",0);
# door opener/closer
var triggerDoor = func(door, doorName, doorDesc) {
if (getprop("/sim/model/door-positions/" ~ doorName ~ "/position-norm") > 0) {
@ -79,6 +83,24 @@ var triggerDoor = func(door, doorName, doorDesc) {
}
};
setlistener("/controls/doors/doorc-switch",func(a){
if (getprop("systems/electrical/bus/dc-2")>25 or getprop("systems/electrical/bus/dc-1")>25) {
var pos = a.getValue();
var current = getprop("/sim/model/door-positions/doorc/lock-status");
if (pos == 1 and current == 0) { ## LOCK
settimer( func {
if (a.getValue() == pos) setprop("/sim/model/door-positions/doorc/lock-status",1);
},0.4);
}
else if (pos == -1 and current == 1) { ## UNLOCK
settimer( func {
if (a.getValue() == pos) setprop("/sim/model/door-positions/doorc/lock-status",0);
},0.2);
}
#setprop("/sim/model/door-positions/doorc/lock-status",-9); ## FAULT
}
});
###########
# Systems #
###########

View file

@ -7,6 +7,11 @@
# Sounds #
##########
var playSoundOnce = func(path,delay) {
setprop(path,1);
settimer(func {setprop(path,0);},delay);
}
setlistener("/sim/sounde/btn1", func {
if (!getprop("/sim/sounde/btn1")) {
return;
@ -122,4 +127,11 @@ var pushbuttonSound = props.globals.getNode("/sim/sounde/pushbutton");
var pushbutton = func() {
pushbuttonSound.setValue(1);
settimer(func {pushbuttonSound.setValue(0);},0.20);
}
}
setlistener("/sim/model/door-positions/doorc/lock-status",func(lock) {
if (lock.getValue() == 1)
playSoundOnce("/sim/sounde/doorc_locking",0.5);
else
playSoundOnce("/sim/sounde/doorc_unlocking",0.5);
},0,0);

View file

@ -1800,6 +1800,28 @@
</volume>
</relay>
<relay>
<name>CockpitDoorLocking</name>
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/Cockpit/cockpitdoor_lock.wav</path>
<property>/sim/sounde/doorc_locking</property>
<volume>
<property>/sim/current-view/internal</property>
<factor>1</factor>
</volume>
</relay>
<relay>
<name>CockpitDoorUnlocking</name>
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/Cockpit/cockpitdoor_unlock.wav</path>
<property>/sim/sounde/doorc_unlocking</property>
<volume>
<property>/sim/current-view/internal</property>
<factor>0.8</factor>
</volume>
</relay>
<announcements>
<name>fa_boarding</name>
<mode>once</mode>

Binary file not shown.

Binary file not shown.

View file

@ -89,7 +89,7 @@
</test>
</switch>
<switch name="controls/lighting/leftturnoff">
<switch name="/controls/lighting/leftturnoff">
<default value="0"/>
<test logic="AND" value="1">
/controls/lighting/turnoff-light-switch eq 1