January 31, 20206 yr 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.
January 31, 20206 yr 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. 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
January 31, 20206 yr Author 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.
January 31, 20206 yr 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 January 31, 20206 yr 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
Archived
This topic is now archived and is closed to further replies.