New gear light problem

Peer support for Air Manager desktop users

Moderators: russ, Ralph

Post Reply
Message
Author
va3htb
Posts: 2
Joined: Wed Nov 30, 2022 8:13 pm

New gear light problem

#1 Post by va3htb »

I built my own Arduino based box with l.e.d.s to indicate when the gear is down and locked. It worked just fine until they came out with msfs2020 40th year anniversary edition and they stopped working.

In frustration I went into the create/edit function for gear light hardware item. Ok don't beat up on me please I am not a programmer. I noticed that you could "send" values to the Arduino in this hardware item.
It didn't work. However if I send the value to the Arduino using the fsx code it did. So I switched the code from fs2020 to fsx and now my lights work.
As you can see all I did was swap the "variable_subscribe" from the fsx code to the fs2020 code.


fs2020_variable_subscribe("GEAR LEFT POSITION", "Percent",
"GEAR CENTER POSITION", "Percent",
"GEAR RIGHT POSITION", "Percent",
"ELECTRICAL MAIN BUS VOLTAGE", "Volts", function(gear_left, gear_center, gear_right, bus_volts)
local gear_used = gear_left + gear_center + gear_right
local power = bus_volts >= 8
hw_output_set(gear_transit_light, (gear_used > 0 and gear_used < 300) and power)
hw_output_set(gear_down_light_1, gear_left == 100 and power)
hw_output_set(gear_down_light_2, gear_center == 100 and power)
hw_output_set(gear_down_light_3, gear_right == 100 and power)
end)

fsx_variable_subscribe("GEAR LEFT POSITION", "Percent",
"GEAR CENTER POSITION", "Percent",
"GEAR RIGHT POSITION", "Percent",
"ELECTRICAL MAIN BUS VOLTAGE:", "Volts", function(gear_left, gear_center, gear_right, bus_volts)
local gear_used = gear_left + gear_center + gear_right
hw_output_set(gear_transit_light, (gear_used > 0 and gear_used < 300) and power)
hw_output_set(gear_down_light_1, gear_left == 100 and power)
hw_output_set(gear_down_light_2, gear_center == 100 and power)
hw_output_set(gear_down_light_3, gear_right == 100 and power)
end)

SimPassion
Posts: 5336
Joined: Thu Jul 27, 2017 12:22 am

Re: New gear light problem

#2 Post by SimPassion »

Not sure if it's related or not :

image.png
image.png

SimPassion
Posts: 5336
Joined: Thu Jul 27, 2017 12:22 am

Re: New gear light problem

#3 Post by SimPassion »

Anyway, I've checked with this and it works without any issue in 4.2 Beta 6

Code: Select all

fs2020_variable_subscribe("GEAR LEFT POSITION", "Percent",
"GEAR CENTER POSITION", "Percent",
"GEAR RIGHT POSITION", "Percent",
"ELECTRICAL MAIN BUS VOLTAGE", "Volts", function(gear_left, gear_center, gear_right, bus_volts)
local gear_used = gear_left + gear_center + gear_right
local power = bus_volts >= 8
-- hw_output_set(gear_transit_light, (gear_used > 0 and gear_used < 300) and power)
-- hw_output_set(gear_down_light_1, gear_left == 100 and power)
-- hw_output_set(gear_down_light_2, gear_center == 100 and power)
-- hw_output_set(gear_down_light_3, gear_right == 100 and power)
print("Transit "..tostring((gear_used > 0 and gear_used < 300) and power))
print("Left "..tostring(gear_left == 100 and power))
print("Center "..tostring(gear_center == 100 and power))
print("Right "..tostring(gear_right == 100 and power))
end)
image.png

[EDIT] Just checked with 4.1.5 at the moment and yes, it works also the same way without any issue
 

Post Reply