Alessandro Usai Posted December 3, 2019 Report Share Posted December 3, 2019 Hi all, I want to add two offsets to FSUIPC in order to save the value of two Q400 variable. These two offsets will be read by Spad.neXt. So I wrote a LUA script that reads variables value (could be 0 or 255) and writes they to FSUIPC offset 66C0 and 66C3. I need to read both variables continuously so I thought of writing a C# program that every 50ms would write to the 0x0D70 offset, and pass the Lua command with the name of my lua script. From what I understand when the 0x0D70 offset is written FSUIPC executes the indicated script via the indicated command, so I expect to have FSUIPC offset 66C0 and 66C3 filled every 50ms with the value of Q400's variables and ready for Spad.neXt. Any comment/criticism/suggestion about this flow? Cheers, Alessandro Link to comment Share on other sites More sharing options...
John Dowson Posted December 3, 2019 Report Share Posted December 3, 2019 Why write a c# program when you could just use the lua event.timer function to call your lua function every 50ms? John Link to comment Share on other sites More sharing options...
Pete Dowson Posted December 3, 2019 Report Share Posted December 3, 2019 It's very inefficient having a Lua plug-in loaded, compiled and executed repeatedly -- especially so often. As John says, you can design you Lua plug in to operate at regular time intervals easily by using event.timer. You only have the plug-in loaded and compiled for you just the once that way -- loaded probably by an [Auto] section command. Are these Q400 values obtained from L:Vars? If so then just use the event.Lvar function instead, one for each of the LVars you need to monitor. The minimum monitor time there is currently set to 100 mSecs, not 50, but with two of them operating you might meet your 50 mSecs target. Pete Link to comment Share on other sites More sharing options...
Alessandro Usai Posted December 3, 2019 Author Report Share Posted December 3, 2019 Hi, excellent suggestion from both of you (I haven't no doubts about...). Fortunatly the flow is written on paper at the moment so I could easly modify it. I woul read more in deep the documentation in order to reach the best performance of the module. Many thanks, Alessandro Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now