Jump to content
The simFlight Network Forums

Goflight Display/GPS Drives NAV1


Recommended Posts

I have read GFDisplay is not supported anymore, so i don´t use it(and don´t read the manual)

Now i don´t know which function/programm i should use, to solve my needs:

Using FSX and a Goflight P8 Pushbutton Module.

I have programmed a Button of the GF-P8 to GPS DRIVES NAV1.

Offset:132C 4 NAV/GPS switch, in FS2000 & FS2002. 0=NAV, 1=GPS

(I can also use gfconfig to do exactly this, but GF-P8 doesnt recognize the state

so when "GPS Drives NAV1"=ON, there is no active green LED.(I think gfconfig doesn´t support this.))

I want the LED light up when using the FSX-internal GPS (GPS Drives NAV1)

Please can you help me, what can i do ?

Thomas

Link to comment
Share on other sites

I have read GFDisplay is not supported anymore, so i don´t use it(and don´t read the manual)

I want the LED light up when using the FSX-internal GPS (GPS Drives NAV1)

Please can you help me, what can i do ?

Well, you can still use gfDisplay if you wished, it is just that if you don't know how to I'd rather not tell you as it is, in my opinion, too complex, too arcane.

The support for GF devices has been moved to the Lua plug-in system, with the "gfd" library functions able to drive displays much more ably. Check the Lua documents in your FSUIPC Documents subfolder.

Regards

Pete

Link to comment
Share on other sites

Thanks for the hint.

Now i have researched, coming to this result as follows:

Created "gps.lua" , assigning the first Button of the GF-P8 Module

using drop down menu in FSUIPC-Buttons Facility as "Lua Gps"


-- Goflight Module GF-P8
--
-- Button 01
-- Button function(Offset:66375,0 TOGGLE GPS DRIVES NAV1)
-- LED function(132C 4 NAV/GPS switch, in FS2000 & FS2002. 0=NAV, 1=GPS)
-- Model: GFP8
-- Unit: 101
-- Button: 0
if
ipc.readUW(0x281C) == 1
then
ipc.control(66375, 0)
end
if
ipc.readUW(0x132C) == 1
then
gfd.SetLight(GFP8, 101, 0)
end
--
-- Button 02
-- Button function()
-- LED function
-- Model: GFP8
-- Unit: 101
-- Button: 1

--
-- Button 03
-- Button function()
-- LED function
-- Model: GFP8
-- Unit: 101
-- Button: 2
[/CODE]

Toggle GPS DRIVES NAV1 is working, but no lights on the GF-P8 Module.

ATT no Button of the GF-P8 Module is controlled via gfconfig.

gfconfig is installed in its standard way.

Please give me another hint, whats wrong in my code, what did i miss out?

Kind Regards,

Thomas

Link to comment
Share on other sites

Toggle GPS DRIVES NAV1 is working, but no lights on the GF-P8 Module.

Because you are testing offset 132C when you press the button. With that code I might expect that the LED lights on the 102nd GP-P8 unit of yours when you press the button to turn OFF the GPS mode, assuming it was on when the button was pressed.

What is turning the light off when you toggle GPS mode off?

Have you really got 102 GF-P8 units connected to your system? GF numbers the units 0 for the first, 1 for the 2nd and so on. I can't imagine a sysyem with 102 of them!

Really you probably want the light controlled by an event, in a Lua which is actually preloaded and running all the time, waiting. You should program your button in FSUIPC's buttons tab not in the same Lua, it is unnecessary here.

Have an event.offset on offset 132C and use the value passed to the function to set or clear the light accordingly. You can have the Lua loaded automatically using the [Auto] facility in the FSUIPC INI file.

Regards

Pete

Link to comment
Share on other sites

Have you really got 102 GF-P8 units connected to your system? GF numbers the units 0 for the first, 1 for the 2nd and so on.

102 was the Number of the device in FSUIPC.ini, as i programmed the button(GF-P8 Button), so i thought this number(102) is also the "Unit" Number which is used by Lua.

Have an event.offset on offset 132C and use the value passed to the function to set or clear the light accordingly. You can have the Lua loaded automatically using the [Auto] facility in the FSUIPC INI file.

According to your advice and the "FSUIPC Lua Library.pdf", i tried as follows:

You should know, my programming skills are really, really poor...

Loaded via FSUIPC.ini

[Auto]

1=Lua Gps


function gpsledon(132C,1)
function gpsledoff(132C,0)
end
event.offset(132C, "UD", "gpsledon")
gfd.SetLight(GFP8, 0, 0) -- (Model GFP8, Unit 0, Led 0)
end
event.offset(132C, "UD", "gpsledoff")
gfd.ClearLight(GFP8, 0, 0) -- (Model GFP8, Unit 0, Led 0)
end
[/CODE]

Doesn´t work.

Tried something other... :

[CODE]
if
ipc.readUW(132C) == 1
then
gfd.SetLight(GFP8, 0, 0)
end
if
ipc.readUW(132C) == 0
then
gfd.ClearLight(GFP8, 0, 0)
end
[/CODE]

Also doesn´t work.

Sorry i can´t get rid of this...

Please give me another hint/example to sort my errors out.

Thank you!

Kind Regards, Thomas

Link to comment
Share on other sites

102 was the Number of the device in FSUIPC.ini, as i programmed the button(GF-P8 Button), so i thought this number(102) is also the "Unit" Number which is used by Lua.

No, Lua doesn't know anything about joystick numbers, which is what 102 is. Every device handled by FSUIPC's assignments needs a "joystick number" which for GF devices are artificially generated. They also get modified by WideFS client inputs which also support Go flight devices.

The Lua library handles GoFlight devices more directly and uses the numbers assigned by the Windows system.

I reformatted you code so you can see more clearly what is wrong: I've added comments withing.


function gpsledon(132C,1)
function gpsledoff(132C,0)
-- This function, which is INSIDE the other functiion, has no code at all, so it does nothing! No code = do nothing!!!
end
event.offset(132C, "UD", "gpsledon")
-- this event call is trying to call the function in which it actually resides. That function never gets called because nothing calls it!
-- Additionally, as clearly documented, the offset 132C must be given as "132C" or 0x132c.
gfd.SetLight(GFP8, 0, 0) -- (Model GFP8, Unit 0, Led 0)
end
event.offset(132C, "UD", "gpsledoff")
-- 132C is wrong as stated. And the function called does nothing.
gfd.ClearLight(GFP8, 0, 0) -- (Model GFP8, Unit 0, Led 0)
-- this will be executed once, if the program ever compiled (which it won't).
end

[/CODE]

Doesn´t work.

It won't even load. Look in the FSUIPC log file -- you'll see the error s listed there. ALWAYS look in the Log.

Tried something other... :

[CODE]
if
ipc.readUW(132C) == 1
then
gfd.SetLight(GFP8, 0, 0)
end
if
ipc.readUW(132C) == 0
then
gfd.ClearLight(GFP8, 0, 0)
end
[/CODE]

Also doesn´t work.

Of course not. 132C is not a hexadecimal number, and in any case this will execute only once when loaded then no more. What use would that be?

You've evidently not looked at any examples, of which there are many.Please see the example files provided with FSUIPC, and the many User Contributions in the Sub-Forum of that name.

I can answer questions and help you understand, but I am not going to write your programs for you. There's enough information available, but you seem to be ignoring it and not even referring correctly to the documentation.

Sorry,

Pete

Link to comment
Share on other sites

Finally, i´m glad got it to work. :idea:

Thank you for your effort and patience.

Investigated the log, and gone slightly deeper into the documentations and recent forum posts for examples and scripting techniques.

I put the script herein, maybe someone finds it helpful...

(hope there are no errors anymore...it gets loaded and it is working as i expect)



function gpsled(offset, value)
if
ipc.readUW(0x281C) == 1 -- IF BATTERY=ON
and
ipc.readUW(0x2E80) == 1 then -- IF AVIONICS=ON
if value ~= 0 then -- not equal ZERO
gfd.SetLight(GFP8, 0, 0)
else
gfd.ClearLight(GFP8, 0, 0)
end
end
end
event.offset(0x132C, "UD", "gpsled") -- NAV/GPS

[/CODE]

Kind Regards,

Thomas

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.