Jump to content
The simFlight Network Forums

Plugin to Convert L:Var to Offset?


Recommended Posts

Hello everyone,

 

I've been working with the OpenCockpits USB Output Card. It requires you to use offsets to trigger the outputs. In the panel I'm using, most of the Annunciators depend on L:Vars. Is there a plugin that I can use to "disguise" the LVars as Offsets?

Link to comment
Share on other sites

I've been working with the OpenCockpits USB Output Card. It requires you to use offsets to trigger the outputs. In the panel I'm using, most of the Annunciators depend on L:Vars. Is there a plugin that I can use to "disguise" the LVars as Offsets?

 

Not a ready-made one. It's only a few lines in any case -- just a function called by event.Lvar (thereby supplying it the value), where the given value is written to a user offset (in the range 0x66C0-0x66FF). Choose to write it as UB (8 bits), uW (16 bits), or UD (32 bits), as needed for your value content -- the functions for that are ipc.writeUB, ipc.writeUW and ipc.write.UD respectively. Look them up.

 

Pete

Link to comment
Share on other sites

In the past I have used the 'user defined' offsets as the 'output' for an internal L:Var.

 

Read the L:Var and write it to the offset.

 

Those offsets are 0x66C0 to 0x66FF

 

The opposite direction can also be implemented...read a user defined offset and send that value to the appropriate L:var.

 

  Paul

 

It seems Pete types faster than me :)

Link to comment
Share on other sites

Wait, does that mean that I can only write 63 LVars to offsets?

 

If you are referring to the 64 bytes of free use offset addresses from 66C0 to 66FF, no. It would only be 64 separate values if each was 8 bits in size (i.e. 8 indicators or a values between 0 and 255 or -128 and +127). At one extreme it could accommodate 512 one bit values, and, at the other, 8 x 64-bit values or double floating point numbers.

 

What do you mean by "only" in any case? Are you planning to construct some add-on which uses thousands of L:Vars ar the same time?

 

Other offsets could be used, at the risk of clashing with other applications you may or may not want to run. If you do such a thing, please do not distribute it for others to use because it would inevitably result in problems which would come my way. If you plan on producing something for general use you need to apply for a range of dedicated offsets just as all other freeware and commercal users of FSUIPC have done.

 

Pete

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.