What are Offsets?

C-JBCS
Posts: 35
Joined: Wed Mar 12, 2014 5:55 pm
Location: Barrie, Ontario

What are Offsets?

Post by C-JBCS »

Hello, I was hoping someone might be able to tell met what Offsets are with regard to P3D and FSX.

I read a forum post here a while ago that made mention of work done to Offsets in the last client release...

Does it have to do with programing squawk box transponder Ident and mode C buttons through FSUIPC to your joystick similar to the PTT button? If not, is something like that possible?

Thanks.

Jay
gavink42
Posts: 171
Joined: Mon Apr 16, 2012 7:08 pm
Location: KMEM

Re: What are Offsets?

Post by gavink42 »

As I understand it, offsets are locations in memory that may be used to interact with FSX/P3D.

These memory addresses can contain data such as aircraft speed, engine RPM, altitude, course, etc. They can also be used to control the sim, as in setting a bit to turn on/off a light, raise/lower landing gear, change the heading bug, and so on.

Data that's read from memory can drive a physical gauge or turn on/off a physical panel light. Writing data to these addresses can "turn" knobs, press buttons and flip switches.

Sometimes, an offset is the only way to control something that isn't in the normal control settings menu of the sim.

The list of offsets is extensive, as it must cover much of what the sim and aircraft are doing (or need to do).

I'm far from an expert at them, but have used FSUIPC to remap virtual switches in the plane to physical switches and buttons.

Hope this helps!

-Gavin
- PP ASEL, instrument, complex, high performance
- Member AOPA, EAA, IMC Club, Piper Owner Society
- Cherokee 180C owner
C-JBCS
Posts: 35
Joined: Wed Mar 12, 2014 5:55 pm
Location: Barrie, Ontario

Re: What are Offsets?

Post by C-JBCS »

Thanks Gavin!

By chance, would anyone out there have a joystick button set to ident over the PE Client? And perhaps even a Norm/Standby switch?

I only ask this as when I have to ident, I have to alt/enter out of P3D and select it from the client menu.... My PE squawkbox doesn't float over my full screened sim. I don't mind that it doesn't, especially if there was a way to ise joystick buttons to execute those functions.

Thanks
gavink42
Posts: 171
Joined: Mon Apr 16, 2012 7:08 pm
Location: KMEM

Re: What are Offsets?

Post by gavink42 »

The only FSUIPC offset listed in the documentation for transponder setting is 0x0354, which is for the 4-digit squawk code.

This page: http://squawkbox.ca/doc/sdk/fsuipc.php lists SquawkBox 3 offsets (0x7b91 for mode and 0x7b93 for ident). But I don't know if they're implemented in the PE version.

-Gavin
- PP ASEL, instrument, complex, high performance
- Member AOPA, EAA, IMC Club, Piper Owner Society
- Cherokee 180C owner
Thomas_Horn
Posts: 77
Joined: Fri Jan 02, 2015 3:18 am

Re: What are Offsets?

Post by Thomas_Horn »

I have written a Lua script to program my PFC hardware (Avionics stack) to work with the A2A Cessna 172R. I can now switch the Transponder mode from standby to "Mode C" with my Transponder knob, and this is also reflected on the PE panel (corresponding lights are illuminated).
I also tried to implement the "Ident" Button on my Hardware with the following command:

ipc.writeUB("7B93",1)

But here I cannot see any action on the PE panel (no flashing "ident" light). Maybe it works anyway,since the Offset is set correctly as verified by FSUIPC logging...but how can I check?

- Thomas
X-Plane 11.32, Windows 10, 4.8 GHz 7700K, 16 GB RAM. 4K 55'' Screen resolution with Nvidia GTX 1070. ELITE and PFC flight controls
C-JBCS
Posts: 35
Joined: Wed Mar 12, 2014 5:55 pm
Location: Barrie, Ontario

Re: What are Offsets?

Post by C-JBCS »

Thomas_Horn wrote:I have written a Lua script to program my PFC hardware (Avionics stack) to work with the A2A Cessna 172R. I can now switch the Transponder mode from standby to "Mode C" with my Transponder knob, and this is also reflected on the PE panel (corresponding lights are illuminated).
I also tried to implement the "Ident" Button on my Hardware with the following command:

ipc.writeUB("7B93",1)

But here I cannot see any action on the PE panel (no flashing "ident" light). Maybe it works anyway,since the Offset is set correctly as verified by FSUIPC logging...but how can I check?

- Thomas
I'd be really interested in this Thomas. But I gotta say it sounds way over my head. Is there an easy way to implement controlling PE's transponder via the A2A cockpit transponder?
Thomas_Horn
Posts: 77
Joined: Fri Jan 02, 2015 3:18 am

Re: What are Offsets?

Post by Thomas_Horn »

Unfortunately it needs some programming work...but I am not a skilled programmer either - its quite easy:
1. In the FSUIPC.ini file create an "auto" segment for the A2A Cessna 172R, usually with:

Code: Select all

[auto.C172R]
lua Cessna172R
2. The Lua File "Cessna172R.lua" which contains the code is actually just a small text file with the file extension ".lua" instead of ".txt", you can write with Notepad or any other simple Texteditor. The file has to be saved in the same directory where the FSUIPC files are located (in FSX that's FSX\modules).

3. The lua file itself is very simple as already mentioned above: You should find all the documentation on the forum site of Peter Dawson: http://forum.simflight.com/topic/66137-documentation/
For the Transponder Mode status switch I would use the following code (if you do not have a hardware knob for the Mode selector), Be aware this is not tested, I used different code for my PFC hardware.

Code: Select all

function CheckTransponder(varname, value)
if value == 4 then
ipc.control(1120,1)
else
ipc.control(1119,1)
end
end
event.Lvar("xpdr_onoff_knob_pos", 1000, "CheckTransponder")
So, what this code actually does is checking wether you have changed the Transponder Mode button (with mouse) ,once per second (you can change this interval if necessary). If it is set to "Alt", then the PE transponder changes to "Mode C". All other modes on the Cessna Transponder are identified as "Standby" by the system. (Squawkbox actually only has to modes: "Alt/Mode C" and "Standby".

Again: Don´t blame we if this does not work correctly for you, I did not test this code, but that is at least the principle on how to change internal controls to your needs.
Actually it as very nice feature, you can change a lot of things with these lua files...If you are interested, here is a very nice introduction for non-programmers into using lua scripts for FSX (Prepar3D should be the same code since it also uses the same FSUIPC.dll)
http://www.anadrac.com/FSUIPC-Lua-Tutorial/index.html

- Thomas
X-Plane 11.32, Windows 10, 4.8 GHz 7700K, 16 GB RAM. 4K 55'' Screen resolution with Nvidia GTX 1070. ELITE and PFC flight controls
C-JBCS
Posts: 35
Joined: Wed Mar 12, 2014 5:55 pm
Location: Barrie, Ontario

Re: What are Offsets?

Post by C-JBCS »

Thanks Thomas, Sorry for the late reply, I didn't realize your instructions were up here until now. I will certainly be giving it a shot. Thanks for the help.
Perk
Posts: 22
Joined: Thu Dec 19, 2013 10:20 am

Re: What are Offsets?

Post by Perk »

Still can't seem to get the transponder to work in the A2A C172. FSUIPC logs seems to indicate that it's actually calling the LUA file:

99155 LUA.0: Waiting for an event in "F:\Games\P3D\Modules\A2A C172.lua"
145503 LUA.0: LVar Change event: calling "CheckTransponderState" in "F:\Games\P3D\Modules\A2A C172.lua"
145549 LUA.0: Waiting for an event in "F:\Games\P3D\Modules\A2A C172.lua"
157749 LUA.0: LVar Change event: calling "CheckTransponderState" in "F:\Games\P3D\Modules\A2A C172.lua"
157749 LUA.0: Waiting for an event in "F:\Games\P3D\Modules\A2A C172.lua"

But I never seem to get a change in values on 1119, 1120, or 1122... maybe I'm just monitoring them wrong?

[Monitor]
Display=2
Monitor0=0,1120,0,0
Monitor1=0,1119,0,0
Monitor2=0,1122,0,0
Keith Smith
Posts: 9939
Joined: Sat Oct 09, 2010 8:38 pm
Location: Pompton Plains, NJ
Contact:

Re: What are Offsets?

Post by Keith Smith »

I wouldn't spend a ton of time on it. Instead, I would connect to PE, set the transponder mode to 'normal' within the PE client directly, the minimize the client and fly.

Unlike previous years where it was SOP to squawk standby unless you were about to takeoff or you were at an airport with an ASDE-X surveillance system (as noted on the airport diagram), the AIM now recommends you keep the altitude function on any time the plane is in motion. Switching it to ALT immediately after connecting is not going to cause any problems.
Post Reply