Jump to content
The simFlight Network Forums

assigning LVARs to Offsets


Recommended Posts

Hi,

To light the LEDs in my home-built overhead for the 767, I write the values of the LVARs to a free FSUIPC offset. I do that in the following way:
 

function checkOverhead()

    --Check lights overhead
    ipc.writeUB(0x4251, ipc.readLvar("L:O16_001_BUT"))
    ipc.writeUB(0x4252, ipc.readLvar("L:O16_001_LT2"))
    ipc.writeUB(0x4253, ipc.readLvar("L:O16_002_BUT"))
    ipc.writeUB(0x4254, ipc.readLvar("L:O16_002_LT2"))
    ipc.writeUB(0x4255, ipc.readLvar("L:O16_003_BUT"))
    ipc.writeUB(0x4256, ipc.readLvar("L:O16_003_LT2"))
    ipc.writeUB(0x4257, ipc.readLvar("L:O16_004_BUT"))

end

event.timer(100, "checkOverhead")

However, the list is getting longer (almost 200 outputs/LEDs), so it sometimes takes a long time (1 to 2 seconds) before the script checks whether a light is on and then turns on the corresponding LED in my overhead. Is there a way to make this work faster? I am using Captain Sim 767, with P3D and FSUIPC6.

Thanks!

Kees

Link to comment
Share on other sites

Hi Kees,

This forum is for .NET programming; your questions seems to be about Lua so this isn't really the best place to get help with that. 

However, you'll probably get better performance by using the lua event system for LVars:

event.Lvar("lvarname", interval, "function-name")

This will call the specified function when the value of the LVar changes. That function can then set the value in the offset. I think this will reduce the processing from the current situation where you are reading the writing every LVAR every 100ms.

I don't really know lua that well, so If you want more information about this, please ask John Downson in the main FSUIPC forum (not any of the sub-forums) at the link below.

 https://forum.simflight.com/forum/30-fsuipc-support-pete-dowson-modules/

Paul

Link to comment
Share on other sites

Hi Paul,

Thanks for your reply. I only now realize that I actually posted the message in the wrong forum. I had seen this function before, but it would be quite a job, because I would have to program about 200 different functions (one for each output). I was hoping there would be an easier solution.

I will also try it in John's forum.

Thx,

Kees

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.