MobiFlight Community Support

Welcome to the forum for MobiFlight! Feel free to reach out to the community in case you have questions, issues or just want to share great ideas or details about your latest home cockpit project.

You like MobiFlight? Donate via PayPal and support the MobiFlight development. Thanks! 

05/03/2024 - This forum is read-only

The community support for MobiFlight has moved exclusively over to our Discord server. Register for free and enjoy more interactive functions like image and video upload, voice chat. More than 7,000 registered users around the world make it a great experience!

See you on our MobiFlight Community Discord server.

A HUGE Thank You to everyone who participated in the forum, especially obviously to Pizman and Stephan who did an outstanding job over so many years providing an incredible service to the MobiFlight community.

The forum is still providing a lot of good content, hence we keep this information accessible.

Go to page 1Go to page 112Go to page 3Go to page 2
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi gunterat

This is pretty sure the wrong place....
The Lua Tool is simply to "fire" a Macro/script by a Input in Mobiflight.

So basicly you can start a script that read Data from your APU Switch.... But normaly those scripts should run all time ( For example in FSUIPC Autostart and connected to loaded Aircraft= AerosoftAirbus for example.

Summary this TOOL here is normaly used to make INPUTS .... Not to read data to a Custom Offset for usage to light LED or get data for 7Segment Dispalys !

******
About Your Problem:

You have a wrong Lvar OR... You need a self build Logic here.
Pretty sure "AB_OVH_APU_MASTER" show you Position of the Switch ! ( Thats what i think at first moment)
So i think there must be also exist a Lvar that show you the Status for LED.
I Have no List of Lvars of this Aircraft.... If you got it then recheck if there exist other "APU****" Lvars. Maby you find it.

If there realy not exist a Lvar for the LED´s then you "maby" need a own Logic. ( I dont think so and belive there is a Lvar !!!!)

Please check the data.... If you not find help we try to build a improvisional solution !
Good Luck !
2018-12-16 05:36
Avatar
gunterat
Posts: 53
Supporter
Hi Pizman,
thank you and yes, I could find it, the two LVars showing the status for the LEDs are:

AB_OVH_APU_MASTER_LIGHT_FAULT
AB_OVH_APU_MASTER_LIGHT_ON

I think these states should be written to an offset - but how :)?
Thank you in advance!
Günter
2018-12-16 09:55
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Sorry Günter... Thats not my part. As i told often.... My Lua skills are too poor at the moment.

Basicly something like....
iconCode:

Variable1 = ipc.readLvar("L:AB_OVH_APU_MASTER_LIGHT_FAULT")
ipc.writeUB(0x66C0, Variable1) 


All in a loop... Maby with this "While do" commands.

Summary as i said in a other topic here maby the problem is that we will do permanent writes to the Offsets here.
I´m not a programmer but i think maby a better solution is a IF ELSE here... Like...
Get Lvar Status... Wait xx milliseconds ... Get Lvar Status again .... Check if status change or is still same like in last read.... If it change write it to Offset. If Not start from beginning.

Maby the "event.xxxx" command is alo usefull here... But i not know how we should use it with a Lvar !

Hope this help you to find a solution !
Good Luck !
2018-12-18 00:24
Avatar
gunterat
Posts: 53
Supporter
I hope too :) Thank you very much!
Best regards
Günter
I GOT IT !!
I found the solution in the Avsim-forum resp. I got help from proficient LUA-Supporters. Ultimately I have even 2 working solutions now, whereas I think the code with the lua instruction event.Lvar() needs less resources and works a little bit better.
For all who are interested, here is the link: https://www.avsim.com/forums/topic/539279-fsuipc-and-lua-script/?page=2
Best regards!
Günter
[Last edited by gunterat, 2019-01-01 15:35]
2018-12-18 09:09
Go to page 1Go to page 112Go to page 3Go to page 2