Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi, 

I am the developer of MobiFlight and I was using the 2.0 version of your library so far. We actually had some issues with missing writes and reads and I believe that is something that you also addressed in your 3.x version (at least the change log mentions something that pretty much sounds like the problem I was having...)

I am migrating to the 3.x version now and I observed a strange behavior when using EventIDs/FSControls.

With 2.0 Version I was using the following code and the logic that was explained in the FSUIPC documentation (cache is pretty much just a wrapper for your library that manages creating the required offsets and the respective reading and writing udpates):

cache.setOffset(ParamOffset, Param);
cache.setOffset(BaseOffset, EventId);
cache.Write();

So I am setting the offset for param, I am setting EventID at the offset for the EventID/FSControls. Write then simply triggers FSUIPCConnection.process().

In version 2, I was able to do this and the effect was as expected. Every time I set the offset the Event will be triggered in the flight sim.
Example: Increase COM1 freq, you call the method once with the right EventID and Param and the COM1 freq will be increased once accordingly. Call the method various times, the COM1 freq will be increased multiple times.

In version 3 however, If i set these offsets once, it seems that they are continuously executed on every FSUIPCConnection.process(). It looks like if the offsets are written every time. When I write to other FSUIPC Offsets that don't deal with the EventIDs/FSControls, I don't

I changed my code to call the newly added method FSUIPCConnection.SendControlToFS and it seems to be working just fine now again, but I would still like to understand what has changed in regard to writing offsets to make sure I don't miss to change other parts of my logic too.

Thanks

Sebastian

Posted

Hi Sebastian,

The main change was that offsets marked as write-only now write every time you process them, even if you haven't set a new value. 

It sounds like your offsets for sending the events/controls were marked as Write-Only.

had to change this because for some offsets you need to set the same value as before. The DLL didn't see this as a change in value so the offset didn't get written the second time. There were also problems if you wanted to write a 0 as the first value. Because the initial value is 0 you couldn't write a 0 as the first value.

With the new behaviour, you need to put write-only offsets into a named group and only process them when you need to send the new values to the sim.

Offsets the are not marked as Write-Only work the same as before. They read unless you've set a new value; then they will write.

Paul

Posted

Thanks for you answer!

i used to actually send the EventIDs as write only (because there is no need to read these Offsets ever) but I removed it when I noticed the behavior in the new version as described earlier and I tried it without it. I must have not rebuilt properly because I was under the impression that the behavior was still the same without write-only. Today i tested again and now the Event is triggered once but I have to write 0s to the offset before trying to send the EventID again. Otherwise the lib would not notice that I am trying to set the Offset again with the same values (e.g. multiple increments of the COM1 freq).

There must be some kind of check in the lib now that checks if the offset has really changed since the last time or maybe FSUIPC used to reset the FSControl Offset after writing to it and that got synced back to your Offset value in the past - because it was definitely working with v2 of the library.

Anyways, It looks like that for my purpose the SendControlToFS() is the better way to go for now so I will use it instead.

Is there a way to have a look at the source for your library? Being able to look at the code would help to understand how and why things work the way they work.

Have a great day!

Sebastian

 

Posted
Quote

There must be some kind of check in the lib now that checks if the offset has really changed since the last time or maybe FSUIPC used to reset the FSControl Offset after writing to it and that got synced back to your Offset value in the past - because it was definitely working with v2 of the library.

Yes, the checking for changing values has also changed. Before it was sometimes writing when it shouldn't and causing problems for some users. Now it compares the current and previous values so you can't write the same value twice with a read/write offset. If you need to do that you should be using a write-only offset in a named group.

The SendControlToFS() is easier to use than manually writing to those offsets. The DLL uses those offsets behind the scenes anyway so it's not really any different.

I've no plans to publish the source code at the moment.

Paul

Posted

Hey Paul

thanks for your prompt replies. It helped to understand what's going on.

The MobiFlight users were definitely affected by some of these little glitches. First tests with the updated version look really promising and I hope to be able to release a new more stable version soon.

Thanks again!

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.