PDA

View Full Version : Fuel level offset



Phil Waecker
02-02-2005, 01:37 AM
Hello,

I want to read the fuel level of for example the left main tank (offset
0B7C). So I add in sysvar the following
0B7C 4 leftfuellevel

The problem is I don't really understand the value I get back. I would like
LBS but it seems (SDK dixit) that the value is multiplied by 65535 ... Can
someone help me ?

Regards

Phil

Peter Dowson
02-02-2005, 07:44 AM
On 2/2/2005 12:37:10 AM, Phil Waecker wrote:
>Hello,
>
>I want to read the fuel level
>of for example the left main
>tank (offset 0B7C). So I add
>in sysvar the following
>0B7C 4 leftfuellevel
>
>The problem is I don't really
>understand the value I get
>back. I would like LBS but it
>seems (SDK dixit) that the
>value is multiplied by 65535
>... Can someone help me ?

That's an FS offset, documented in the FSUIPC offsets list, which is also
available on the PM documentation site.

You could find out a lot more about this stuff by using the nice utility,
FSInterrogate, available inside the FSUIPC SDK --
http://www.schiratti.com/dowson.

Regards,

Pete

Phil Waecker
02-02-2005, 07:55 AM
So if I understand well when you write :
Fuel: left main tank level, % * 128 * 65536

this means the value is the percentage of fuel in the tank and I have to
divide it by 128*65536 ?

Regards

Phil

Peter Dowson
02-02-2005, 08:19 AM
On 2/2/2005 6:55:04 AM, Phil Waecker wrote:
>So if I understand well when
>you write :
>Fuel: left main tank level, %
>* 128 * 65536
>
>this means the value is the
>percentage of fuel in the tank
>and I have to divide it by
>128*65536 ?

Well, almost. The term "percentage" is very loosely used in FS I'm afraid. In
most cases they use it when they really mean "proportion". To get the
percentage I think you need to not only divide by 128 * 65536 but also multiply
by 100. Otherwise you end up with a fraction between 0 and 1, with 0
empty, 1 full.

I assume pmSystems is using floating point in its calculations, otherwise you
should ad 32768 first, then divide by 65536 (the addition is to round up
large fractions) then multiply by 100 then add 64 (same reason) before
finally dividing by 128. That should give you a reasonably accurate
percentage.

Pete

Phil Waecker
02-02-2005, 11:04 AM
Thanks very much. I will try that tonight !

Phil

Phil Waecker
02-02-2005, 03:15 PM
I tried it out and it works ! Your assumption was correct pmsys uses floating
vars so I didn't need to add or substract anything all I had to do was
multiply by 65536*128 and I got a value between 0 and 1.

Phil