Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hello Pete and / or John.

This is an idea, maybe for the future? ( too late now for FSX) This seems it would be very helpful for those working on a sim cockpit.
An optional passing 3rd parameter on "event.Lvar".

Have been working on a project for a friend where ~226 l:vars needed to be assigned to offsets so that mobiflight/arduino can use them for the cockpit.
Mainly these are indicator lamps and the like - not updated/changed repetitively.
All done with it and seen there was quite a bit of repetition. (~215 semi-repetitive functions)
Thinking this would save (big time) on lua memory usage, writing of the script, and possibly quicker loading of the lua. 
Would something like this work? 
If it could work, any downsides?

Of course tested it with grand hopes, but alas.....
----------------------------------------------------------------------------------------
local poll_spd = 300

function write2ub (varname, value, offset)
     ipc.writeUB(offset, value)
end

function write2uw (varname, value, offset)
     ipc.writeUW(offset, value)
end

-- etc...

event.Lvar("lvar#1", poll_spd, "write2ub", 0x####)
event.Lvar("lvar#2", poll_spd, "write2ub", 0x####)
-- thru
event.Lvar("lvar#225", poll_spd, "write2uw", 0x####)
event.Lvar("lvar#226", poll_spd, "write2uw", 0x####)
----------------------------------------------------------------------------------------

Again, just an idea. Regards,
Roman

Posted
36 minutes ago, spokes2112 said:

This is an idea, maybe for the future? ( too late now for FSX) This seems it would be very helpful for those working on a sim cockpit.
An optional passing 3rd parameter on "event.Lvar".

At first reading it seems a pretty easy option to add, yes. I'll take a look at the code.

John's away at present but I'm sure he would also be favourable towards this, possibly for the next release of FSUIPC5 (for which we can't currently give a date).

Pete

 

Posted
17 hours ago, John Dowson said:

Yep, looks useful and pretty simple to add so I'll schedule for the next release. I'll post you a dll to test when done.

Hi Roman,

Please see the PM I've just sent.

Pete

 

  • Thanks 1

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.