So two components
1. A "Generator 1 Out" annunciator Warning Light.
2. A "WARN LTS TEST" Warning Lights Test switch to turn on the lights manually even when the failure is not met.
We can get the "Generator 1 Out" light to illuminate when the generator is turned off or failed in the sim.
We want at the same time to have the ability to manually turn on the light when the Warning Lights Test switch is pressed.
Since the switch is not an item I can fsx_variable_subscribe from I cant seem to create a multi variable function.
Is there any way we can add a subscribe to the position of the switch and the fsx_variable_subscribe at the same time in the same function?
Code: Select all
output_WarnLtsTest = hw_led_add("0 WarnLtsTest",0)
led_is_alt1charging = hw_led_add("WL Generator 1 WARN",0)
function switch_gen1_callback(position) --------------------------GEN 1 SWITCH-------------------------
print("Gen 1 SW" .. position)
if position == 0 then
fsx_variable_write("GENERAL ENG GENERATOR ACTIVE:1", "bool", false)
elseif position == 1 then
fsx_variable_write("GENERAL ENG GENERATOR ACTIVE:1", "bool", true)
end
end
function switch_WarnLtsTest_callback(position) ----------------------WARN LTS TEST SWITCH-------------------------
print("WarnLts SW" .. position)
if position == 0 then
hw_led_set(output_WarnLtsTest, 0)
elseif position == 1 then
hw_led_set(output_WarnLtsTest, 1)
end
end
function is_alt1charging(alt1charging) ----------------------FAULT GEN 1 LIGHT-------------------------
if(alt1charging == false)then
hw_led_set(led_is_alt1charging, 1)
else
hw_led_set(led_is_alt1charging, 0)
end
end
fsx_variable_subscribe("GENERAL ENG GENERATOR ACTIVE:1", "Bool", is_alt1charging)
hw_switch_add("EL - Gen1", 1, switch_gen1_callback)
hw_switch_add("EL - Warn Lts Test SW", 1, switch_WarnLtsTest_callback)