Lights: connect to elec

This commit is contained in:
Jonathan Redpath 2019-02-18 20:53:32 +00:00
parent 4896535cf3
commit 4df204ba79
12 changed files with 87 additions and 40 deletions

View file

@ -694,6 +694,10 @@
<windowprobeheat type="double">0.5</windowprobeheat>
<qnh-knb>100000</qnh-knb>
<strobe type="double">0.0</strobe>
<beacon type="bool">0</beacon>
<wing-lights type="bool">0</wing-lights>
<landing-lights-l type="float">0.0</landing-lights-l>
<landing-lights-r type="float">0.0</landing-lights-r>
</switches>
<tray n="0">
<lefttrayext type="double">0</lefttrayext>

View file

@ -344,7 +344,7 @@ var beforestart_b = func {
systems.ADIRS.skip(1);
systems.ADIRS.skip(2);
setprop("/controls/adirs/mcducbtn", 1);
setprop("/controls/lighting/beacon", 1);
setprop("/controls/switches/beacon", 1);
setprop("/controls/lighting/nav-lights-switch", 1);
setprop("/controls/radio/rmp[0]/on", 1);
setprop("/controls/radio/rmp[1]/on", 1);
@ -430,8 +430,8 @@ var taxi_b = func {
setprop("/controls/radio/rmp[1]/on", 1);
setprop("/controls/radio/rmp[2]/on", 1);
setprop("/controls/lighting/taxi-light-switch", 0.5);
setprop("/controls/lighting/landing-lights[1]", 0.5);
setprop("/controls/lighting/landing-lights[2]", 0.5);
setprop("/controls/switches/landing-lights-l", 0.5);
setprop("/controls/switches/landing-lights-r", 0.5);
settimer(taxi_c, 2);
}
var taxi_c = func {
@ -466,8 +466,8 @@ var takeoff = func {
removelistener(eng_one_chk_c);
setprop("/controls/switches/strobe", 0.5);
setprop("/controls/lighting/taxi-light-switch", 1);
setprop("/controls/lighting/landing-lights[1]", 1);
setprop("/controls/lighting/landing-lights[2]", 1);
setprop("/controls/switches/landing-lights-l", 1);
setprop("/controls/switches/landing-lights-r", 1);
setprop("/controls/flight/speedbrake-arm", 1);
setprop("/controls/flight/flaps", 0.290);
setprop("/controls/flight/slats", 0.666);

View file

@ -4680,7 +4680,7 @@
<repeatable>false</repeatable>
<binding>
<command>property-toggle</command>
<property>controls/lighting/beacon</property>
<property>controls/switches/beacon</property>
</binding>
<binding>
<command>nasal</command>
@ -4692,7 +4692,7 @@
<name>Beacon lights rotate</name>
<type>rotate</type>
<object-name>BeaconLtSwtch</object-name>
<property>controls/lighting/beacon</property>
<property>controls/switches/beacon</property>
<interpolation>
<entry><ind>0</ind><dep>35</dep></entry>
<entry><ind>1</ind><dep>-35</dep></entry>
@ -4718,7 +4718,7 @@
<repeatable>false</repeatable>
<binding>
<command>property-toggle</command>
<property>controls/lighting/wing-lights</property>
<property>controls/switches/wing-lights</property>
</binding>
<binding>
<command>nasal</command>
@ -4730,7 +4730,7 @@
<name>Wing lights rotate</name>
<type>rotate</type>
<object-name>WingLtSwtch</object-name>
<property>controls/lighting/wing-lights</property>
<property>controls/switches/wing-lights</property>
<interpolation>
<entry><ind>0</ind><dep>35</dep></entry>
<entry><ind>1</ind><dep>-35</dep></entry>
@ -4868,7 +4868,7 @@
<repeatable>false</repeatable>
<binding>
<command>property-cycle</command>
<property>controls/lighting/landing-lights[1]</property>
<property>controls/switches/landing-lights-l</property>
<value>0</value>
<value>0.5</value>
<value>1</value>
@ -4883,7 +4883,7 @@
<repeatable>false</repeatable>
<binding>
<command>property-cycle</command>
<property>controls/lighting/landing-lights[1]</property>
<property>controls/switches/landing-lights-l</property>
<value>1</value>
<value>0.5</value>
<value>0</value>
@ -4904,7 +4904,7 @@
<repeatable>false</repeatable>
<binding>
<command>property-cycle</command>
<property>controls/lighting/landing-lights[2]</property>
<property>controls/switches/landing-lights-r</property>
<value>0</value>
<value>0.5</value>
<value>1</value>
@ -4919,7 +4919,7 @@
<repeatable>false</repeatable>
<binding>
<command>property-cycle</command>
<property>controls/lighting/landing-lights[2]</property>
<property>controls/switches/landing-lights-r</property>
<value>1</value>
<value>0.5</value>
<value>0</value>
@ -4935,7 +4935,7 @@
<name>landing light rotate</name>
<type>rotate</type>
<object-name>LandingLtLSwtch</object-name>
<property>controls/lighting/landing-lights[1]</property>
<property>controls/switches/landing-lights-l</property>
<interpolation>
<entry><ind>0</ind><dep>35</dep></entry>
<entry><ind>1</ind><dep>-35</dep></entry>
@ -4956,7 +4956,7 @@
<name>landing light rotate</name>
<type>rotate</type>
<object-name>LandingLtRSwtch</object-name>
<property>controls/lighting/landing-lights[2]</property>
<property>controls/switches/landing-lights-r</property>
<interpolation>
<entry><ind>0</ind><dep>35</dep></entry>
<entry><ind>1</ind><dep>-35</dep></entry>

View file

@ -7,8 +7,6 @@
<path>green-navlight.ac</path>
<nopreview/>
<effect>
<inherits-from>Aircraft/IDG-A32X/Models/lights/ALS/green-navlight</inherits-from>
<object-name>green-navlightals</object-name>

View file

@ -13,10 +13,10 @@
<type>select</type>
<object-name>Light</object-name>
<condition>
<greater-than>
<property>controls/lighting/nav-lights-switch</property>
<value>0</value>
</greater-than>
<equals>
<property>/sim/model/lights/nav-lights</property>
<value>1</value>
</equals>
</condition>
</animation>

View file

@ -25,10 +25,16 @@
<object-name>Cone</object-name>
<condition>
<and>
<or>
<greater-than-equals>
<property>systems/electrical/bus/ac-ess</property>
<property>systems/electrical/bus/ac1</property>
<value>110</value>
</greater-than-equals>
<greater-than-equals>
<property>systems/electrical/bus/ac2</property>
<value>110</value>
</greater-than-equals>
</or>
<greater-than-equals>
<property>/sim/model/lights/nose-lights</property>
<value>0.5</value>

View file

@ -26,7 +26,7 @@
<condition>
<and>
<greater-than-equals>
<property>systems/electrical/bus/ac-ess</property>
<property>systems/electrical/bus/ac1</property>
<value>110</value>
</greater-than-equals>
<property>controls/lighting/landing-lights[2]</property>

View file

@ -28,7 +28,7 @@
<condition>
<and>
<greater-than-equals>
<property>systems/electrical/bus/ac-ess</property>
<property>systems/electrical/bus/ac2</property>
<value>110</value>
</greater-than-equals>
<property>controls/lighting/landing-lights[2]</property>

View file

@ -13,10 +13,10 @@
<type>select</type>
<object-name>Light</object-name>
<condition>
<greater-than>
<property>controls/lighting/nav-lights-switch</property>
<value>0</value>
</greater-than>
<equals>
<property>/sim/model/lights/nav-lights</property>
<value>1</value>
</equals>
</condition>
</animation>

View file

@ -13,10 +13,10 @@
<type>select</type>
<object-name>Light</object-name>
<condition>
<greater-than>
<property>controls/lighting/nav-lights-switch</property>
<value>0</value>
</greater-than>
<equals>
<property>/sim/model/lights/nav-lights</property>
<value>1</value>
</equals>
</condition>
</animation>

View file

@ -35,6 +35,10 @@ var variousReset = func {
setprop("/controls/switches/wiperRspd", 0); # -1 = INTM 0 = OFF 1 = LO 2 = HI
setprop("/controls/lighting/strobe", 0);
setprop("/controls/lighting/beacon", 0);
setprop("/controls/switches/beacon", 0);
setprop("/controls/switches/wing-lights", 0);
setprop("/controls/switches/landing-lights-l", 0);
setprop("/controls/switches/landing-lights-r", 0);
setprop("/controls/lighting/wing-lights", 0);
setprop("/controls/lighting/nav-lights-switch", 0);
setprop("/controls/lighting/landing-lights[1]", 0);

View file

@ -40,6 +40,7 @@ setprop("/engines/engine[1]/oil-qt-actual", qty2);
##########
var beacon_switch = props.globals.getNode("/controls/switches/beacon", 1);
var beacon_ctl = props.globals.getNode("/controls/lighting/beacon", 1);
var beacon = aircraft.light.new("/sim/model/lights/beacon", [0.1, 1], "/controls/lighting/beacon");
var strobe_switch = props.globals.getNode("/controls/switches/strobe", 1);
var strobe_light = props.globals.getNode("/controls/lighting/strobe", 1);
@ -47,6 +48,8 @@ var strobe = aircraft.light.new("/sim/model/lights/strobe", [0.05, 0.06, 0.05, 1
var tail_strobe = aircraft.light.new("/sim/model/lights/tailstrobe", [0.1, 1], "/controls/lighting/strobe");
var logo_lights = getprop("/sim/model/lights/logo-lights");
var nav_lights = props.globals.getNode("/sim/model/lights/nav-lights");
var wing_switch = props.globals.getNode("/controls/switches/wing-lights", 1);
var wing_ctl = props.globals.getNode("/controls/lighting/wing-lights", 1);
var dome_light = props.globals.initNode("/sim/model/lights/dome-light", 0.0, "DOUBLE");
var wow = getprop("/gear/gear[2]/wow");
var slats = getprop("/controls/flight/slats");
@ -58,8 +61,10 @@ var settingT = getprop("/controls/lighting/taxi-light-switch");
var settingTurnoff = getprop("/controls/lighting/turnoff-light-switch");
var setting = getprop("/controls/lighting/nav-lights-switch");
var domeSetting = getprop("/controls/lighting/dome-norm");
var landl = getprop("/controls/lighting/landing-lights[1]");
var landr = getprop("/controls/lighting/landing-lights[2]");
var landL = props.globals.getNode("controls/lighting/landing-lights[1]", 1);
var landR = props.globals.getNode("controls/lighting/landing-lights[2]", 1);
var landlSw = props.globals.getNode("/controls/switches/landing-lights-l", 1);
var landrSw = props.globals.getNode("/controls/switches/landing-lights-r", 1);
###################
# Tire Smoke/Rain #
@ -505,7 +510,7 @@ var lightsLoop = maketimer(0.2, func {
wow = getprop("/gear/gear[2]/wow");
slats = getprop("/controls/flight/slats");
if (getprop("/systems/electrical/bus/ac1") > 0 or getprop("/systems/electrical/bus/ac2") > 0) {
if (getprop("/systems/electrical/bus/ac1") > 0 or getprop("/systems/electrical/bus/ac2") > 0 or getprop("/systems/electrical/bus/dc1") > 0 or getprop("/systems/electrical/bus/dc2") > 0) {
setprop("/systems/electrical/nav-lights-power", 1);
} else {
setprop("/systems/electrical/nav-lights-power", 0);
@ -540,15 +545,45 @@ var lightsLoop = maketimer(0.2, func {
# strobe
strobe_sw = strobe_switch.getValue();
if (strobe_sw == 1) {
if (strobe_sw == 1 and getprop("/systems/electrical/bus/ac2") > 0) {
strobe_light.setValue(1);
} elsif (strobe_sw == 0.5 and getprop("/gear/gear[1]/wow") == 0 and getprop("/gear/gear[2]/wow") == 0) {
} elsif (strobe_sw == 0.5 and getprop("/gear/gear[1]/wow") == 0 and getprop("/gear/gear[2]/wow") == 0 and getprop("/systems/electrical/bus/ac2") > 0) {
# todo: use lgciu output 5
strobe_light.setValue(1);
} else {
strobe_light.setValue(0);
}
# beacon
if (beacon_switch.getValue() == 1 and (getprop("/systems/electrical/bus/ac1") > 0 or getprop("/systems/electrical/bus/ac2") > 0)) {
beacon_ctl.setValue(1);
} else {
beacon_ctl.setValue(0);
}
# wing
if (wing_switch.getValue() == 1 and (getprop("/systems/electrical/bus/ac1") > 0 or getprop("/systems/electrical/bus/ac2") > 0)) {
wing_ctl.setValue(1);
} else {
wing_ctl.setValue(0);
}
# landL
if (landlSw.getValue() == 1 and getprop("/systems/electrical/bus/ac1") > 0) {
landL.setValue(1);
} else {
landL.setValue(0);
}
if (landrSw.getValue() == 1 and getprop("/systems/electrical/bus/ac2") > 0) {
landR.setValue(1);
} else {
landR.setValue(0);
}
# signs
if (getprop("/systems/pressurization/cabinalt-norm") > 11300) {