Page 1 of 2
What are Offsets?
Posted: Fri Oct 24, 2014 5:36 pm
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
Re: What are Offsets?
Posted: Sat Oct 25, 2014 2:59 pm
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
Re: What are Offsets?
Posted: Wed Oct 29, 2014 8:50 am
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
Re: What are Offsets?
Posted: Wed Oct 29, 2014 10:06 am
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
Re: What are Offsets?
Posted: Fri Jan 02, 2015 3:32 am
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
Re: What are Offsets?
Posted: Fri Jan 02, 2015 11:58 pm
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?
Re: What are Offsets?
Posted: Sat Jan 03, 2015 5:36 am
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:
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
Re: What are Offsets?
Posted: Mon Jan 26, 2015 9:50 pm
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.
Re: What are Offsets?
Posted: Tue Mar 03, 2015 4:45 pm
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
Re: What are Offsets?
Posted: Thu Mar 05, 2015 1:53 pm
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.