Jump to content
The simFlight Network Forums

Question about reading offsets from GP:


Recommended Posts

This question was posted as a private message, but it is a normal Tech Support question so I am answering it here:

Here are the Offsets that I want to use in my program (VB6)

My variables are

Dim auitempair As Long

Dim auieng1 As Long

Dim auiheure As Long

Dim auiminute As Long

FSUIPC_Read(&HE8C, 4, VarPtr(auitempair), dwResult) for read theTemperature at the FL cruise in °C

I have write Label17 = Int(auitempair / 256), but it's not good, I have a résult like that 180165245.

This is because, as clearly documented, the value at 0E8C is only 2 bytes long, whilst you are reading 4 bytes -- the two high bytes are being filled in with the value from offset 0E8E.

Only read the sizes as documented. Set your 4-byte Int or Long values to zero BEFORE reading so that the top bytes are known to be zero. Either that, or read them into a short (16-bit) integer, if your language supports such a thing.

FSUIPC_Read(&H898, 4, VarPtr(auieng1), dwResult) for read the coef N1 of the engine 1 in % (like 24% for example)

I have write Label19 = auieng1, but it's not good, because I have, when the engine1 is running the result 3973.

Same problem.

FSUIPC_Read(&H238, 4, VarPtr(auiheure), dwResult) for read the actual hour in FS like 9 hour or 20 hour

I have write Label21 = auiheure, but I have not a number between 0 - 23, the result is like that 70225698

FSUIPC_Read(&H239, 4, VarPtr(auiminute), dwResult) for read the actual minute of the hour in FS

I have write Label23 = auiminute, but like the hour I have not a good result, because I have 802367894.

These are also the same, only worse, because these values are only 1 byte long.

PLEASE take proper note of the lengths of each value. They are all documented for a good reason!

Regards,

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.