Jump to content
The simFlight Network Forums
Sign in to follow this  
KAPTEJNLN

Goflight MCP Displays (Lua file)

Recommended Posts

... the sleep would be upto the user to find out what works out best on there set up.

Well, it is more to do with how fast you need to see it change. Set it to a normal update frequency by default. Probably 100 (for 10 updates per second), or at minimum 50 (for 20).

Pete

Share this post


Link to post
Share on other sites

well should i up load here or in a new post? i think a new 1would be best

Yes, new post with explanation. If you can assure me it is fully tested I'll make it a stickie. Make sure the title is relevant, please. you'll need to mention the AirbusX as well as the GF-MCP in the title -- and Lua, not "lau". ;-)

Pete

Share this post


Link to post
Share on other sites

ok Pete,

How to do and edit is included in the file as manual. About tested well have tested it some times, also in a big frame killer as Billund X, and seems to work as it should.

By the way i have a nother thing as now i use the script from guenseli for some buttons and was wondering how to get them turn on and of like default goflight ? as it would be nice to se when things are in use and not. but that was a whish

so soon i would post named: AirbusX - Lua file - GF-MCP Display´s

some thing like that is that good enough?

Share this post


Link to post
Share on other sites
i use the script from guenseli for some buttons and was wondering how to get them turn on and of like default goflight ? as it would be nice to se when things are in use and not.

You do it just like the Lua for the digital displays -- in fact add them in there. You need to read the L:var and when it changes use the GFD library function "gfd.SetLight" to turn a light on, and "gfd.ClearLight" to turn it off. You'll need to work out the ID's for the lights. I don't remember if they are numbered from 0 from the left or right, but probably left.

... so soon i would post named: AirbusX - Lua file - GF-MCP Display´s

some thing like that is that good enough?

Yes, fine.

Regards

Pete

Share this post


Link to post
Share on other sites

Pete i was think of it would be posible to create an Lua plug in as it would be much programing as i also have some push buttons on my 2 gf-p8 so would it be posible to create 1 file whit on and off funktion and then select it togeter whit lau Airbus X as it runs in fsuipc this way:

Control sendt when button pressed Airbus X parameter XXX and then use the led plug in (control send when button released) do you think that could be possible ?

best regards Lars

Share this post


Link to post
Share on other sites
Pete i was think of it would be posible to create an Lua plug in as it would be much programing as i also have some push buttons on my 2 gf-p8 so would it be posible to create 1 file whit on and off funktion and then select it togeter whit lau Airbus X as it runs in fsuipc this way:

Control sendt when button pressed Airbus X parameter XXX and then use the led plug in (control send when button released) do you think that could be possible ?

Sorry, but I don't understand what you want to do. None of that makes any sense to me I'm afraid. Can you try explaining what it is you want to do a different way?

Pete

Share this post


Link to post
Share on other sites

well sorry just forget it have been thinking but dont thik it is posible as no input would be provided i think, and also if it did work it would be the same amount of work.

But i am working on the Airbus X Lua from guenseli as it is there i have the push buttons. so i am not sure how to do it as it is a bit different from the one before. so im not in to that you was talking about before.

-- LL toggle on/off
if ipcPARAM == 109 then


LVarSet = "L:Landlight_switch"
val = 0
valL = 66060

if ipc.readLvar(LVarSet) == 0 then
val = 2
valL = 66059
end

ipc.writeLvar(LVarSet, val)
ipc.control(valL)
ipc.writeLvar("L:SmallOverheadPushButtons", 1)
end

Share this post


Link to post
Share on other sites

But i am working on the Airbus X Lua from guenseli as it is there i have the push buttons. so i am not sure how to do it as it is a bit different from the one before. so im not in to that you was talking about before.

No, it is similar, surely. For example, for the Altitude display you read an L:Var, and if it has changed you set a display. Doing the same with the lights is almost identical. Just a different L:Var and different gfd commands to light or extinguish the LED -- I even told you which commands they were, remember?

Look, here's your code for the Altitude:

prevalt = -1

...

    alt = ipc.readLvar("L:AB_AP_ALT_Select")
    if (alt ~= prevalt) then
         stringalt = string.format("%05d", alt)
         gfd.setDisplay(GFMCP,0,4,stringalt)
         prevalt = alt
    end

So, for Landing Lights:

prevlandlt = -1

...

    landlt = ipc.readLvar("L:Landlight_switch")
    if (landlt ~= prevlandlt) then
         if landlt == 0 then
             gfd.ClearLight(GFMCP,0,) -- change  to the correct light number!
         else
             gfd.SetLight(GFMCP,0,) -- change  to the correct light number!
         end
         prevalt = alt
    end

Just find out (by experiment, maybe) what light number it is and put that where I've shown .

You can insert any number of these in your ipcReady.lua.

Regards

Pete

Share this post


Link to post
Share on other sites

well i tryeid but cant get it working. know sleep is missing but was just to test have edite prevalt = alt in your text to prevlandlt = landlt. but that dident help, is it just mee or if i remember right should there be another code insted of else. like anothere if landlt == 1 then or so. i also tryeid to set gfd.SetLight(GFP8,0,1) before gfd.ClearLight(GFP8,0,1) i mean just moved them so the other was first and the other as nr 2. but it dosent work to.

as it seems there is something missing as when ipc.readLvar("L:Landlight_switch") is active it should turn on or off but what indicate what should happen ? as in the dokument from guenseli there was some codes that indicate it on and off.

prevlandlt = -1
while 1 do

landlt = ipc.readLvar("L:Landlight_switch")
if (landlt ~= prevlandlt) then
	if landlt == 0 then
		gfd.ClearLight(GFP8,0,1) 
	else
		gfd.SetLight(GFP8,0,1) 
	prevlandlt = landlt
	end
end

Share this post


Link to post
Share on other sites
well i tryeid but cant get it working.

Where did you put the code you showed? Is it running?

if i remember right should there be another code insted of else. like anothere if landlt == 1 then or so.

No. If the L:Landlight_switch is 0 when off and not 0 when on, you only need if and else.

i also tryeid to set gfd.SetLight(GFP8,0,1) before gfd.ClearLight(GFP8,0,1) i mean just moved them so the other was first and the other as nr 2. but it dosent work to.

I don't think your code is running. Where did you put it? How are you starting it?

as it seems there is something missing as when ipc.readLvar("L:Landlight_switch") is active it should turn on or off but what indicate what should happen ? as in the dokument from guenseli there was some codes that indicate it on and off.

Sorry, I don't know what you mean here.

Pete

Share this post


Link to post
Share on other sites

well the code shown was from my ipcReady folder where i have deltet all other things so it only is that code. about running well I THINK SO but gives me an error log for that set up. if it wasent running no error log right?

UPDATE found it and "end" was missing in my file so it stil is like the script i had fogot to get all end back after a change. but stil not working i was woundering about what you mean by: How are you starting it? as that might be the problem if not proberly set up

Share this post


Link to post
Share on other sites
well the code shown was from my ipcReady folder where i have deltet all other things so it only is that code.

But i thought you were using that Lua file to maintain your GF-MCP digital displays?

about running well I THINK SO but gives me an error log for that set up. if it wasent running no error log right?

So it had an error? That would stop it running, of course.

UPDATE found it and "end" was missing in my file so it stil is like the script i had fogot to get all end back after a change. but stil not working

So is there another error listed in the Log?

i was woundering about what you mean by: How are you starting it?

I meant, how were you making it run, where had you put the code. You've answered that now. You've discarded all of your GF-MCP work and are only now concerned with a single LED.

Pete

Share this post


Link to post
Share on other sites

WELL year i am, but i know 1 thing for sure hav as few things (only requeret things) in the dokument when tryeing it out, becaus when finished it would be include in my dokument again.

about error log no it shows:

********* LUA: "ipcReady" Log [from FSUIPC version 4.60a] *********
   124411 System time = 14/09/2010 18:14:03, Simulator time = 19:11:49 (02:11Z)
   124411 LUA: beginning "C:\Program Files (x86)\SPIL\Modules\ipcReady.lua"

So dont know why it dosent work.

UPDATE wait a sec my last test it worked on mcp would do some more testing as tryeid today but dident work codes are same as before i see but will keep you updated

Share this post


Link to post
Share on other sites

well i know it now but seems very funny as my test erlyer it dosent worked missed an end in the post from today that does the trick so here it is.

prevlandlt = -1

while 1 do

landlt = ipc.readLvar("L:Landlight_switch")
	if (landlt ~= prevlandlt) then
	if landlt == 0 then
		gfd.ClearLight(GFP8,0,1)
	else
		gfd.SetLight(GFP8,0,1) 
	end--> was missing
	prevlandlt= landlt
	end
end

did that test today but dident work, but luckly it does now

Share this post


Link to post
Share on other sites

well just finished my Lua file and works so have a littel note under gf display post from the other day. as a littel hint to others. I think i reached the end of it now, mabee an update of the short codes as i found anothere 1 that crash fs but els.

but all the good stuff comes from you Pete and thanks for it, as it is so appreciated, whit out your program and knowledge this would not be abel other ways then pay for an driver or so which i think never would be made. I whish the best for the future.

I know it was a fight to understand me and sorry for that.

Best regards Lars

Share this post


Link to post
Share on other sites

hello pete back again,

well last year you told me this about led:

prevAP1 = -1

...

landlt = ipc.readLvar("L:Landlight_switch")

if (landlt ~= prevlandlt) then

if landlt == 0 then

gfd.ClearLight(GFMCP,0,) -- change to the correct light number!

else

gfd.SetLight(GFMCP,0,) -- change to the correct light number!

end

prevalt = alt

end

now i was working to get the led working whit the led for the ap, but i have some problems becaus i got it working for the AP1 and AP2 engage buttons but when i try FX. for autothrottle led it dosent light up. just woundering if there could be any troble whit the others ? as in the xml files i saw they are like the others variables 0 for off and 1 for on. but just woundering why some can and others could.

as this was for the AP1:

prevlandlt = -1

while 1 do

AP1 = ipc.readLvar("L:AB_AP_AP1")

if (AP1 ~= prevAP1) then

if AP1 == 1 then

gfd.SetLight(GFMCPPRO,0,2)

else

gfd.ClearLight(GFMCPPRO,0,2)

end

prevprevAP1 = AP1

end

as now i got the MCP-PRO so i would like to upgrade it for people. hope you have som input or so, about what might cause it

UPDATE: well by tryeing some of the codes that dident work whit the led number for ap1 the led light up so now i have to find the problem why i cant use the others as 0-4 works over that i try 5 - 6 but dident work.

Share this post


Link to post
Share on other sites
well by tryeing some of the codes that dident work whit the led number for ap1 the led light up so now i have to find the problem why i cant use the others as 0-4 works over that i try 5 - 6 but dident work.

I don't think there are any LEDs 5 and 6. There are 17 LEDs and I think they are numbered

0, 1, 2 ,3, 4, 7, 9, 10, 14, 15, 16, 17, 18, 19, 20, 21 and 23.

but I'm not sure. The way to find out is to try each possible number from 0 to 31 in turn and see which one lights for which number.

Regards

Pete

Share this post


Link to post
Share on other sites

I don't think there are any LEDs 5 and 6. There are 17 LEDs and I think they are numbered

0, 1, 2 ,3, 4, 7, 9, 10, 14, 15, 16, 17, 18, 19, 20, 21 and 23.

but I'm not sure. The way to find out is to try each possible number from 0 to 31 in turn and see which one lights for which number.

Regards

Pete

yep those numbers seems right and for the A/T led it is 100

so thanks again pete, as note if you have the pro does your device also light up whit out driver by pressing APP button (the led + led at A/T would light up)? as i tryeid it whit my and think what have i done i dident run driver then i try it at another pc where there was no Goflight driver, and it did the same. so just woundering.

Share this post


Link to post
Share on other sites

so thanks again pete, as note if you have the pro does your device also light up whit out driver by pressing APP button (the led + led at A/T would light up)?

I don't know. The MCP Pro isn't connected at present. If this is a serious question, remind me next week some time and I'll try connecting it, if i can find it in all this junk ... <G>

(sorry, things are a bit of a mess here after some serious upgrading of my cockpit).

Pete

Share this post


Link to post
Share on other sites

it was a is a serious question.

i know i ask much but i wanted to upgrade so the display could be used for both MACH and IAS but i dont know how. I mean i know there have to be something that tels whitch 1 is in use as the codes we used, was only for 1 of them, just to get it more compleat. Also because presently i work on Captainsim 757, where it would be nice to include it as well.

about captainsim 757 i have a quistion as so far i got al led and buttons work right whit out goflight driver as wel, (not CRS1+2 at this moment as i cant finde a way to get those displays work right but thats another story) but i also dident find a lvar for the Increase and decrease for HDG, ALT, VS, SPD. but found that by give the line here for altitude i can changes as i give interface direct to the display. what i need is something that tels the a minimum and maximum variable as if you just keep decrease it would show EX. -2000 not smart for an altitude indicator (not that big problem but for HDG it is as when 360 it continue to 361 as there is no limit

here is the code:

if ipcPARAM == 0 then

LVarSet = "L:MCP_Altitude_Disp"

LVarGet = ipc.readLvar(LVarSet)

ipc.writeLvar(LVarSet, LVarGet-100)

end

I hope you have som input.

best regards L.N.

Share this post


Link to post
Share on other sites

it was a is a serious question.

What "your device also light up whit out driver by pressing APP button (the led + led at A/T would light up)?".

I asked if it was serious because I can't imagine what circumstances you'd care what the hardware does when only powered and not connected to any software. Perhaps you could explain?

i know i ask much but i wanted to upgrade so the display could be used for both MACH and IAS but i dont know how. I mean i know there have to be something that tels whitch 1 is in use as the codes we used, was only for 1 of them, just to get it more compleat. Also because presently i work on Captainsim 757, where it would be nice to include it as well.

So, is this a question I can answer without any driver for the MCP Pro? What exactly are you asking? I don't know anything about the Captainsim 757 I'm afraid.

about captainsim 757 i have a quistion as so far i got al led and buttons work right whit out goflight driver as wel,

Ah, perhaps "without driver" you mean only "without the GoFlight driver, GFDevFSX or whatever? I have never used any Go Flight drivers, only GFDev.DLL to allow FSUIPC to access the devices.

Could you please formulate a question that I can understand and answer, bearing in mind I do not have your aircraft and know nothing about it?

here is the code:

if ipcPARAM == 0 then

LVarSet = "L:MCP_Altitude_Disp"

LVarGet = ipc.readLvar(LVarSet)

ipc.writeLvar(LVarSet, LVarGet-100)

end

And this is the code to do what, precisely? just reduce the altitude by 100? How is this related to the MCP Pro question?

Regards

Pete

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

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.