Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Did you not see my last reply, just above yours?

Pete

Oh, hey. :shock: I must have loaded this page out of my cache or something, because it was not there when I opened it....

Just read it, and I am happy to test for you. There's no hurry from my side at all, just curiousity...

And yes I have a Camera, so I can record everything that happens when testing!

Let me know what to do when you are ready!

Thanks!

Jaap

Posted

Let me know what to do when you are ready!

I've added full support for the GF-WP6 in these versions:

FSUIPC 3.997f

FSUIPC 4.716

Wideclient 6.897

It turned out more complex than I thought. There are two different ways of setting the colours and there's interaction with the brightness facility. There's quite a bit of new code incorporated to support this, and I think i need to try to test it thoroughly myself. I will write a test plug-in for it, but I haven't got time at present, and if problems are shown it may get complicated to debug remotely. So I've asked GoFlight if they can supply one for me to test with. This may take a while, so please, for now, download whichever of the above it is you need, and have a play. Let me know what you find.

Here are the relevant display functions for the WP6:

gfd.SetBright(model, unit, n)

This sets the unit's display and indicator brightness, n=0 being off and n=15 being brightest.

gfd.SetColour(model, unit, id, n)

or

gfd.SetColour(model, unit, id, red, green, blue)

(Colour can be spelled "Color" instead if you wish).

This is currently only supported for the GF-WP6, and pre-sets the colour of indicator number 'id' either to the pre-determined colour 'n' (0-7, see below), or to the colour represented by separate red green and blue values, each one being a value from 0 - 100.

Note that this function does NOT actually address the hardware at all, but merely presets the colour to be used by the SetLight or SetLights functions described below.

Pre-determined colour values are:

0 black, 1 white, 2 red, 3 green, 4 blue, 5 magenta, 6 yellow, 7 cyan

gfd.SetLight(model, unit, id)

This simply turns on the indicator light identified by the id number, on the specified model and unit.

For the GF-WP6 you pre-set the colour using gfd.SetColour, above.

gfd.ClearLight(model, unit, id)

This simply turns off the indicator light identified by the id number, on the specified model and unit.

gfd.SetLights(model, unit, on, off)

This sets selected indicator lights on or off, on the specified model and unit.

The 'on' and 'off' parameters are masks to determine those indicators to be turned on (bits set in 'on') and those to be turned off (bits set in 'off') Indicators not referenced by bits in either mask are unchanged.

Indicators are numbered 0 to 31, with 0 being 2^0, worth 1 and so on. These numbers correspond to the indicator ids used in SetLight and ClearLight.

Regards

Pete

Posted

Hello Pete,

Sorry for my late answer, I have been working late the last couple days.

Thanks for your hard work, I will test it out tomorrow, and see what functions I can assign to the buttons, and of course if I can set the lights!

Have a nice evening!

Jaap

Posted

Sorry for my late answer, I have been working late the last couple days.

No problem. I've got loads of other things to do.

I've not heard back from GoFlight yet.

[LATER]

Magic! They just replied. I'll be getting one for a proper test here!

Regards

Pete

Posted

[LATER]

Magic! They just replied. I'll be getting one for a proper test here!

That's great, I'm glad to hear they give you the opportunity do do some thourough testing.

Just curious: do you have some kind of Cockpit setup to play around in, or does your interest solely lie in programming?

Well I have been playing some with the GF-WCP6. Go-Flight also released new software v2.02, so the Master Caution function is now operative too. I have downloaded the new FSUIPC and WIDEFS you provided in your last post.

The Button Programming now shows the expected info. Joystick and Button numbers are correctly recognized.

I found the the GFPower.lua I always run at startup reacts strange to the WP6. I have assigned the WP-6 buttons with GFConfig to:

Type-----------------Function

0- Master caution---None

1- Fuel Press------Caution

2- Gen Off---------Caution

3- Oil Press-------Caution

4- Volt Low--------Caution

5- Door -----------Caution

If any of the last five button/lights is on, the Caution Button/Light starts to blink, until I press it. Whenever a new failure state arises, it starts to blink again. When aircraft is started and all failures have been delt with, all lights are off.

When I start with GFPower.lua. The GF-WP6 is not dark as expected. The Master Caution is blinking and when I press it, it starts blinking faster. The other lights don't come on even if failures are present. All starts working normally after I start the APU and turn on the APU generator, but as soon as I turn those off, it's wrong again.

Any Idea's?

Also I tried to get the lights working via a simple LUA, but no luck so far. BTW. what should the Model designation be? GFWP6, or GFWCP?

First I removed all button settings from GFConfig, and removed the ipcready.lua I have for starting the GFPower and GoFlightleds.lua from the modules folder, so nothing else would be starting.

I tried this, saved as GF-WP6 Test.lua:

gfd.SetLights(GFWP6, 0, On)

Also tried GFWCP for model. But in both cases no lights went on. The Log shows that the lua started and ended normally. Must be doing something wrong?

Best Regards,

Jaap

Posted

That's great, I'm glad to hear they give you the opportunity do do some thourough testing.

Just curious: do you have some kind of Cockpit setup to play around in, or does your interest solely lie in programming?

I have a full 737NG cockpit, mainly PFC made, including the shell, but also including a full Cockpitsonic overhead. That uses 6 PCs and a 10 foot wide screen with outside scenery projected onto it. I use Project Magenta plus extra software from TSR.

I also have an Aerosoft (Oz) GA28R cockpit for a Piper Arrow III. That's for VFR flights.

I don't have any FS aircraft gauges showing at all. They are all deleted because the hardware is provided. I don''t have any real use for Goflight, VRInsight or Saitek equipment. That which I have is for developing software for others.

I found the the GFPower.lua I always run at startup reacts strange to the WP6.

In what way?

If any of the last five button/lights is on, the Caution Button/Light starts to blink, until I press it. Whenever a new failure state arises, it starts to blink again. When aircraft is started and all failures have been delt with, all lights are off.

It sounds like it's been explicitly programmed that way.

When I start with GFPower.lua. The GF-WP6 is not dark as expected. The Master Caution is blinking and when I press it, it starts blinking faster. The other lights don't come on even if failures are present. All starts working normally after I start the APU and turn on the APU generator, but as soon as I turn those off, it's wrong again.

Any Idea's?

What is GFpower for? What is it doing? I assume it's one of the examples I did years ago, or is it? Wasn't it only to load separate Luas for each unit?

Are you trying to use Lua GF programming at the same time as GF's own driver? There's a good possibility they don't mix.

Also I tried to get the lights working via a simple LUA, but no luck so far. BTW. what should the Model designation be? GFWP6, or GFWCP?

Either.

I tried this, saved as GF-WP6 Test.lua:

gfd.SetLights(GFWP6, 0, On)

Er, what was the value of your variable "On"? And why omit the "off" value. If you want to control all the lights with one line, like that, you have to give the numerical mask for those to go off as well as those to go on.

it looks like you've not referred to the documentation for the functions?

Also tried GFWCP for model. But in both cases no lights went on. The Log shows that the lua started and ended normally. Must be doing something wrong?

Please read the documentation for the SetLights, SetLight and ClearLight functions. The SetLights one is the most complex as that allows any selection of lights to be turned on and off simultaneously. Mostly you'd use the single light controls.

But unless you set the colour first, using the new SetColour function, they'll be whatever colour they were before you started. So if they were black, they'd probably look black whether on or off. Isn't that obvious? Black is a colour and will look the same as "off"!

If you really don't understand any of this it looks like I'll have to wait until the unit arrives.

Regards,

Pete

Posted

I have a full 737NG cockpit, mainly PFC made, including the shell, but also including a full Cockpitsonic overhead. That uses 6 PCs and a 10 foot wide screen with outside scenery projected onto it. I use Project Magenta plus extra software from TSR.

I also have an Aerosoft (Oz) GA28R cockpit for a Piper Arrow III. That's for VFR flights.

I don't have any FS aircraft gauges showing at all. They are all deleted because the hardware is provided. I don''t have any real use for Goflight, VRInsight or Saitek equipment. That which I have is for developing software for others.

Wow, that are quite some setups. I imagine you're never bored!!

In what way?

Lights behave different then whithout the GFPower.lua

But as you said that might be because of mixing lua and GfConfig....

It sounds like it's been explicitly programmed that way.

Yes, that is how it is supposed to work.

What is GFpower for? What is it doing? I assume it's one of the examples I did years ago, or is it? Wasn't it only to load separate Luas for each unit?

I use the GFPower.lua to make sure all my modules are off when in cold and dark Cockpit.

It's the one you provide with FSUIPC, with no alterations.

The GF166's and the GF-LGT I have will never go Dark otherwise.

Are you trying to use Lua GF programming at the same time as GF's own driver? There's a good possibility they don't mix.

Been doing that for quite some time now, never had problems

Er, what was the value of your variable "On"? And why omit the "off" value. If you want to control all the lights with one line, like that, you have to give the numerical mask for those to go off as well as those to go on.

Oh No, that was not intended to be part of a program or something, just wanted to see if I could get the lights on via a Lua

Tried the same with one of my GF-T8's and that worked....

But unless you set the colour first, using the new SetColour function, they'll be whatever colour they were before you started. So if they were black, they'd probably look black whether on or off. Isn't that obvious? Black is a colour and will look the same as "off"!

Also added some more lines to first set the color, then the brightness and then one of the buttons. Didn't work...

The log saw nothing wrong...

If you really don't understand any of this it looks like I'll have to wait until the unit arrives.

I must admit, I don't find it "Easy" ! I hope your GF-WP6 is delivered soon :wink:

Best Regards,

Jaap

Posted

Wow, that are quite some setups. I imagine you're never bored!!

I don't have time to be bored!

Lights behave different then whithout the GFPower.lua

But as you said that might be because of mixing lua and GfConfig....

I'd need to look af GFpower. I don't remember it.

It's the one you provide with FSUIPC, with no alterations.

The GF166's and the GF-LGT I have will never go Dark otherwise.

Okay. It will be setting lights off by using SetLights, but not by setting the colour to black. However, the GFDev.DLL probably sets lights off using colour black, and it is likely that the GF driver doesn't restore its own colour. I can't think of anything else which could be worng.

Oh No, that was not intended to be part of a program or something, just wanted to see if I could get the lights on via a Lua

Tried the same with one of my GF-T8's and that worked....

With "on" as the mask? That can't work unless you pre-defined the variable "on" to some non-zero value.

Also added some more lines to first set the color, then the brightness and then one of the buttons. Didn't work...

The log saw nothing wrong...

without seeing your code I can't really comment., but if it's like the SetLights example i'm not really surprised! ;-)

Have you read the documentation? What is it you don't understand?

Pete

Posted

I'd need to look af GFpower. I don't remember it.

Here it is:

-- Master GF Driver
-- Looks after power on/off checking, and runs other Lua's depending on connected units

local models = {} -- for counts of devices of each type
brightness = 10 --default brightness for all units

--##########################################################
-- initial power on/off checking
powerset = 0 -- 1 Batt, 2 Batt>18v, 4 Avionics, 8 Not failed

if ipc.readUD(0x281C) ~= 0 then
    powerset = 1 -- Battery is on to start
end
if ipc.readDBL(0x2834) > 18.0 then
    powerset = logic.Or(powerset, 2) -- Battery is > 18v
end
if ipc.readDBL(0x2E80) ~= 0 then
    powerset = logic.Or(powerset, 4) -- Avionics on
end
if ipc.readUB(0x0B6A) == 0 then
    powerset = logic.Or(powerset, 8) -- Electrics not failed
end

--##########################################################
-- Power on or off
local function setallbright(B)
		m = 0
		while m < 32 do
		    if models[m] ~= 0 then
		        u = 0
		        while u < models[m] do
				    		if m == GFLGT2 then
		 		        		-- to counter problem in LGT2
										-- brightness value is reversed!    	
								    gfd.SetBright(m, u, 15-B)
								else
		                gfd.SetBright(m, u, B)
		            end
		            u = u + 1
		        end
		    end
		    m = m + 1
	  end
end

local function checkpower()
    if powerset == 15 then
    		setallbright(brightness)
    else
    		setallbright(0)
    end
end

-- ########################################################
-- Detecting changes by events on offsets
local function keeptrack(value, n)
   if value == 0 then
      powerset = logic.And(powerset, 15 - n)
   else
      powerset = logic.Or(powerset, n)
   end
   checkpower()
end

-- Battery switch
function batt(offset, value)
		keeptrack(value, 1)
end

-- Battery voltage
function battvolt(offset, value)
    keeptrack(value, 2)
end

-- Avionics switch
function avionics(offset, value)
    keeptrack(value, 4)
end

-- Electrical failure
function elecfail(offset, value)
    keeptrack(1 - value, 8)
end

-- ########################################################
-- Main program (executed once only):
gfd.BlankAll()

-- Determine numbers of each device
m = 0
while m < 32 do
	  models[m] = gfd.GetNumDevices(m)
	  if models[m] ~= 0 then
	  		-- Run other Luas here, one for each type connected
	  		luaname = string.format("Lua %s", gfd.GetName(m))
	  		ipc.macro(luaname) 		
		end
	  m = m+1
end

checkpower()

event.offset(0x281C, "UD", "batt")
event.offset(0x2834, "DBL", "battvolt")
event.offset(0x0B6A, "UB", "elecfail")
event.offset(0x2E80, "UD", "avionics")

-- ########################################################

Okay. It will be setting lights off by using SetLights, but not by setting the colour to black. However, the GFDev.DLL probably sets lights off using colour black, and it is likely that the GF driver doesn't restore its own colour. I can't think of anything else which could be worng.

That's Clear, and I think that might have been because I left out the SetColour part!

without seeing your code I can't really comment., but if it's like the SetLights example i'm not really surprised! ;-)

This is what I have now, and it's not supposed to do anything but playing with the lights. It's not part of anything I need to do!

gfd.SetBright(GFWP6, 0, 10) 
gfd.SetColour(GFWP6, 0, 1, 1)
gfd.SetLight(GFWP6, 0, 1)
ipc.sleep(250)
gfd.ClearLight(GFWP6, 0, 1)


gfd.SetColour(GFWP6, 0, 2, 2)
gfd.SetLight(GFWP6, 0, 2)
ipc.sleep(250)
gfd.ClearLight(GFWP6, 0, 2)


gfd.SetColour(GFWP6, 0, 3, 3)
gfd.SetLight(GFWP6, 0, 3)
ipc.sleep(250)
gfd.ClearLight(GFWP6, 0, 3)


gfd.SetColour(GFWP6, 0, 4 ,4)
gfd.SetLight(GFWP6, 0, 4)
ipc.sleep(250)
gfd.ClearLight(GFWP6, 0, 4)


gfd.SetColour(GFWP6, 0, 5, 5)
gfd.SetLight(GFWP6, 0, 5)
ipc.sleep(250)
gfd.ClearLight(GFWP6, 0, 5)


gfd.SetColour(GFWP6, 0, 6, 7)
gfd.SetLight(GFWP6, 0, 6)
ipc.sleep(250)
gfd.ClearLight(GFWP6, 0, 6)

Apart from it being very rudimentary and might be missing some, it does turn on the lights one by one and turns them off again.

There's only one strange thing, and you probably see what's wrong with it right away: the last light does not come on at all.

That is the light I started out with, before I decided to add all the others, so at first I only had the last 4 lines, plus the SetBright line (line1)

Have you read the documentation? What is it you don't understand?

Read it several times, but I must be missing something. These programming languages are very hard for me to understand, but I'm trying my best.

Thanks for being so patient with me!

Jaap

Posted

Here it is

You didn't need to post it if you've not changed it! ;-)

I see it is only using the SetBright function in any case, which is passed more or less directly on to GFDev.DLL. So i think sorting that out will have to wait for my WP6.

Apart from it being very rudimentary and might be missing some, it does turn on the lights one by one and turns them off again.

There's only one strange thing, and you probably see what's wrong with it right away: the last light does not come on at all.

That's because, as with all indicators and buttons in GF units (and in FSUIPC generally), the lights are numbered from 0 (0-5 in this case) not 1. Your attempt to set light 6 is ignored.

Regards

Pete

Posted

That's because, as with all indicators and buttons in GF units (and in FSUIPC generally), the lights are numbered from 0 (0-5 in this case) not 1. Your attempt to set light 6 is ignored.

I know, and that is where the strangness starts: when I only do this:

gfd.SetBright(GFWP6, 0, 10) 
gfd.SetColour(GFWP6, 0, 0, 1)
gfd.SetLight(GFWP6, 0, 0)
ipc.sleep(250)
gfd.ClearLight(GFWP6, 0, 0)

(I have set id# 0 here) No lights come on.

But when I do this:

gfd.SetBright(GFWP6, 0, 10) 
gfd.SetColour(GFWP6, 0, 1, 1)
gfd.SetLight(GFWP6, 0, 1)
ipc.sleep(250)
gfd.ClearLight(GFWP6, 0, 1)

the First light on the module goes on and off!

That is why I also tried to address light #6 which should not be there.

Could there be a shift of some kind?

Posted

That is why I also tried to address light #6 which should not be there.

Could there be a shift of some kind?

No. that is very odd. The number of the light to simply passed on. Maybe, in this case, GoFlight have numbered them 1 to 6 after all. Number 6 won't get through my checks as being invalid for that device.

I think more of this will have to wait. I suspect that this is also the first use of the GFDev.DLL facilities supporting the WP6 and there may be bugs in that. I can't really diagnose and fix all the problems you may discover without adding a lot more diagnostic code, and it could take ages and a lot of my time. i think, now I know a WP6 in on the way, it is best to wait.

Thanks for trying!

Regards

Pete

Posted

No. that is very odd. The number of the light to simply passed on. Maybe, in this case, GoFlight have numbered them 1 to 6 after all. Number 6 won't get through my checks as being invalid for that device.

If you want to use the Lights through Lua, try these updates (which I've had to make for other reasons in any case):

For consistency in the gfd library I've kept the lights numbered 0-5. Internally that's merely changed for the WP6 to address lights 1-6. So you change nothing.

FSUIPC 3.997j

or

FSUIPC 4.718

or

Wideclient 6.898

Regards

Pete

Posted

Sorry for the delayed answer, been working late and hard... But finally.... Weekend!

I have tried your new versions and the lights now work as they should. That's great, thanks!

You probably have to wait for the GF-WP6 to arrive to do more testing, but do you think you can get the GFPower.lua working correctly with it too? That would be great.

Regards,

Jaap

Posted

...but do you think you can get the GFPower.lua working correctly with it too?

The problem there is that I've no idea why itt doesn't work, because, as you see, it simply uses the same standard setBright calls to GFDev.DLL that all other devices support too. If it doesn't work it might be a bug in GFDev.DLL, but i can't really report that without knowing for sure.

Why not just knock up a little test of the gfd.setBright function on it and see what it does?

Pete

Posted

I think more of this will have to wait. I suspect that this is also the first use of the GFDev.DLL facilities supporting the WP6 and there may be bugs in that. I can't really diagnose and fix all the problems you may discover without adding a lot more diagnostic code, and it could take ages and a lot of my time. i think, now I know a WP6 in on the way, it is best to wait.

Okay. Two WP-6's arrived here, courtesy of GoFlight (thanks GF!), and I've got everything working correctly now, according to all my tests.

The working gfd library is included in the new versions just released -- FSUIPC 4.719, FSUIPC 3.997k and WideClient 6.899. Please visit the Download Links subforum for these. The Lua plug-ins package with documentation is also updated (see its own thread in that subforum). You'll find a little demo/test in the example plug-ins called WP6test.lua.

Regards

Pete

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.