Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Pete,

According to the release notes, you introduced with version 4.958 the possibility to share ipc.set global variables also over the network via WideFS. This is btw a great feature.

I just want to inform, that by that obviously the time to set such variables might have changed. I have a lot of LUA modules communicating with GoFlight modules. As sometimes IDs and button numbers change, if you plug/unplug USB devices, I have defined them in one module globally by ipc.set() calls. In the several modules I then just use these variables. So should something change in button or module IDs, I just need to change it in one place.

This worked now for several years. And suddenly I had problems with a few modules, not working as expected. The strange thing: which modules are not working, changed from flight to flight. No pattern.

By debugging I found now out, that for one module not working the global variable for the buttons were not set, when I started the module. In my code I defined the global variables and then I started all my modules by ipc.runlua in the same script. And obviously the starting was quicker than the populating of this global variables (although everything was started out of one module).

And all my modules are running on the flight sim PC (P3D v3.4, Win 7/64).

I made the definition now earlier in my flow and at least at the last flights this seemed to correct the problem. I don't know, how the network replication could influence the timing, until the global variables are really visible to other modules. But maybe you have an idea.

It's hard to reproduce and did not happen with all aircrafts. But especially with the Q400 from Majestic, where I have a lot of modules running, it happened most of the time.

I have a work-around but it might also happen for other users.

 

Rgds

Reinhard

 

 

 

Posted
15 minutes ago, aua668 said:

I made the definition now earlier in my flow and at least at the last flights this seemed to correct the problem. I don't know, how the network replication could influence the timing, until the global variables are really visible to other modules. But maybe you have an idea.

To make other PCs on the network aware of a change in a Global Variable a "broadcast" has to be sent, to all PCs in the same WorkGroup. Tht does involve several extra calls into Windows (CreateFile, WriteFile, CloseFile to be exact -- not disk files, just packets for transfer). This might take a few milliseconds I suppose.

I don't fully understand what is going wrong for you. Is the small extra time causing the problem, and if so, why? Wouldn't other plug-ins be just as happy to see the values a little later? Have you actually measure the difference in times using the mSec count from ipc.elasedtime?

I can look at creating another thread just to do this, but this wouldn't be a trivial job and I don't have time before Christmas. I have to make a new release of FSUIPC (4.959) tomorrow, but then I'm away till January 5th. I can look then to see what I can do, but I'd like to understand how rthe problem arises first.

Can you remind me in January, please, so I can take a look?

Pete

 

Posted

Further to my last message here, in FSUIPC version 4.959, being released soon (certainly before tomorrow evening (Monday 19th), I've added an option in the [General] section of the INI file:

WideLuaGlobals=Yes

If this facility is not needed in a WideFS setup, the this can be changed to 'No' to make the ipc.set function exactly as before.

Making the timing the same even with it enabled is a much bigger job, and I'll look at that in January.

Pete

 

 

Posted

Pete,

Obviously it was that little bit time needed, to broadcast the variables, as I defined the variables and started then immediately afterwards the modules relying on these variables. As I detected, that obviously the timing was my problem, I did the definition earlier in my start-up sequence, which resolved my problems. So I found a work-around.

No need to change anything (never touch a running system) and with the new parameter everything can be controlled. My thread just should raise the awareness for other people, that global variables might be available later than before for other modules. Maybe this can be added to the ipc.set function in the LUA library document.

Best regards and Merry Christmas

Reinhard

 

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.