Jump to content
Sign in to follow this  
Damlimey

question about offset output values.

Recommended Posts

Hi all,

I am attempting to read the Radio Altitude offset (0x31E4) and used the tracer to look at the output values. However, for any given altitude, the output values vary by tens of thousands as they scroll up the console. This variation suggests that it will be very difficult for me to read a value and instigate an action at a given altitude. The offset status list shows this offset as a 4 bit value.

Is there a solution to this? Is there a better offset I can use?

I'm very puzzled.

Thanks in advance.

Share this post


Link to post
Share on other sites

With all offsets you need to refer to the FSUIPC5 Offsets Status document in /modules/FSUIPC Documents folder.

The entry for Radio Altitude reads:

31E4     4      Radio altitude in metres * 65536

The first element is the offset in hexadecimal 0x31E4. The second is the size in bytes (8 bits) not bits. The important element is the scaling - metres * 65536 - which means that the radio altitude has been multiplied by 65536 before it is stored.

To access the Rad Alt you need to use unsigned double (UD) for 4 bytes (UB=single byte, UW=2 bytes or one word totalling 16bits, UD=4 bytes or 32bits). In LUA the code would be ht = ipc.readUD(0x31E4). This needs to be divided by 65536 to give metres and multiplied by 3.28 to give the radio altitude in feet. Or divide ht by 19980 to go straight to feet.  

In LINDA Tracer to monitor an Offset in the LINDA Console, you need these setting and then click Start.

RadAltOffset.jpg 

  • Like 1

Andrew Gransden

Scotland, UK

LINDA Support/Developer - VATSIM and BAVirtual - Airbus Flyer

i7 1TB SSD GTX980 - FSX/P3D - Aerosoft Airbus A318/A319/A320/A321 - FS2Crew

Share this post


Link to post
Share on other sites

Thank you for this though I do have one final question; how do I represent the maths in the .Lua file?

Would it be: if (ht/19980) <= 65 then..?

Thanks in advance.

Share this post


Link to post
Share on other sites

That is about right. There are plenty of examples in the supplied code like common.lua and a google search for LUA programming is a good source. It is better to avoid putting calculations inside a if/then statement. This makes it easier to debug. 

Edited by ScotFlieger

Andrew Gransden

Scotland, UK

LINDA Support/Developer - VATSIM and BAVirtual - Airbus Flyer

i7 1TB SSD GTX980 - FSX/P3D - Aerosoft Airbus A318/A319/A320/A321 - FS2Crew

Share this post


Link to post
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
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...