Page 2 of 2

Re: Switching the PE Client to Mode C from the A/C xpndr

Posted: Tue Mar 05, 2019 3:24 am
by Godwin
Hello I am using Garmin G1000 with P3DV4 simulator. I couldnt able to switch to Mode Charlie and Ident function from the Garmin G1000. I tried adding 2 different LUA script file in the FSUIPC module also but still i am having issue. Below is the scripts I used. Please give some suggestions to fix the issue.

1st LUA Script

function CheckTransponderState(name, value)
if value == 2 then
ipc.control(1120,1)
ipc.display(" Mode Charlie Alt Pressed" , 5)
else
ipc.control(1119,1)
end
end

event.Lvar("G1000_XPDR_ON_ALT_Visible", 700, "CheckTransponderState")

and added below script in the FSUIPC.ini file

[Auto.F1tech Skyhawk 172R]
1=Lua GarminG1000

2nd LUA Script

function GarminG1000_OnXpdrModeChanged(varname, value)
if value == 4 then
if ipc.readUB(0x7b91) > 0 then
ipc.writeUB(0x7b91,0)
ipc.display("XPDR Mode C", 2)
end
else
if ipc.readUB(0x7b91) == 0 then
ipc.display("XPDR Mode Stdby", 2)
ipc.writeUB(0x7b91,1)
end
end
end

function GarminG1000_XpdrIdentPressed(varname, value)
local mode = ipc.readLvar("xpdr_onoff_knob_pos")

if mode >= 3 then
if value == 1 then
ipc.writeUB(0x7b93, 1)
ipc.display("XPDR IDENT", 1, 2)
end
end
end

event.Lvar("xpdr_onoff_knob_pos", 1000, "GarminG1000_OnXpdrModeChanged")
event.Lvar("xpdr_ident_button", 200, "GarminG1000_XpdrIdentPressed")

and added below script in the FSUIPC.ini file

[auto.GarminG1000_C182]
lua GarminG1000-XPDR

Re: Switching the PE Client to Mode C from the A/C xpndr

Posted: Tue Mar 05, 2019 8:08 am
by bbuckley
A few comments:
1. Make sure the filenames for the two LUA files are exactly the same as the names you put in the "Auto: " section. i.e. 'GarminG1000.lua' and 'GarminG1000-XPDR'.
2. Make sure the [Auto.F1tech Skyhawk 172R] exactly matches the FSUIPC5.ini file section for the aircraft profile, [Profile.F1tech Skyhawk 172R] and that you've properly set up the aircraft profiles in FSUIPC5.ini.
3. The GarminG1000.lua script looks correct to me otherwise. The other script I haven't studied or tried.
Bruce

Re: Switching the PE Client to Mode C from the A/C xpndr

Posted: Tue Mar 05, 2019 8:18 am
by Godwin
Ya both sections I entered correctly but still problem persist. Is the code valid to make the transponder work from virtual cockpit? my Garmin G1000 software is installed in the second PC and connected with emuteq PFD, MFD and Audio Panels and the system is connected through network.

Re: Switching the PE Client to Mode C from the A/C xpndr

Posted: Tue Mar 05, 2019 8:56 am
by bbuckley
We’ve now exceeded my ability to help. I use from VC but everything on one pc and no emuteq.

Re: Switching the PE Client to Mode C from the A/C xpndr

Posted: Tue Mar 05, 2019 9:08 pm
by MervA
Godwin,

It's been awhile doing the G1000, but i'm glad you brought it up as in checking I found out that I left a line of code that is not required still in it.

For those using this Lua file for the G1000 from Carenado, open it up in notepad or similar and remove the line shown below, this line shows the button pressed in a windows popup,
a bit annoying doing that.

Remove ----->>> ipc.display(" Mode Charlie Alt Pressed" , 5)

Or you can re download the file again from my web site, I updated it this morning.

---------------------------

Now Godwin it's been a long long time since i have used a network for Flight Sim gear, and from what I can glean from your post it looks like you may require Pete Dowson's WideServer for FSUIPC.
I have only used these Lua files in a non networking environment, and to answer your question " Yes " the script in my Lua file does work in P3D v4.x I tried it out this morning, the only problem is the ident,
even though it does work to some extent it does not work to my satisfaction, so I removed it, until I can figure out (if ever) how to get it to work properly, everone will have to press the ident on the PE Client
instead, which is a rare thing.



Cya !!
Merv

Re: Switching the PE Client to Mode C from the A/C xpndr

Posted: Thu Mar 21, 2019 5:47 am
by Godwin
MervA,

I tried as per your instruction i noticed first of all it is not working in my VC itself. I was trying to connect Mooney Bravo with G1000 using your code but no changes.I couldnt able to switch PE client transponder from transpnder ftted in the virtual cockpit.