Jump to content
The simFlight Network Forums

Question about Lua


Recommended Posts

if I turn the autopilot off, the Caution LED should flash three times.

Should it? What aircraft is this with?

Is it possible to realize this with Lua?

Where is this LED?

If so, would you give me a hint how the code-line should look like?

Since I don't know what device you are using which has an LED I can't say whether it is easily drivable from Lua or not.

Regards

Pete

Link to comment
Share on other sites

I mean the Master Warning which should flash 3 times when the autopilot is switched off in the A320.

Please have a look at this video, you can see it at 1:21.

http://www.youtube.com/watch?v=YR5-AWcZEWY

In my system, the LED is connected to a FDS Interface Card. I could assign a free offset to the LED

but I have no idea how I need to write the LUA-code to make it switch on and off three times.

I hope you can give me some advice on that.

Regards

Fritz

Link to comment
Share on other sites

I mean the Master Warning which should flash 3 times when the autopilot is switched off in the A320.

Please have a look at this video, you can see it at 1:21.

Oh, i don't need to see a video. I've just not heard of it -- I don't know much about Airbuses I'm afraid!

In my system, the LED is connected to a FDS Interface Card. I could assign a free offset to the LED

but I have no idea how I need to write the LUA-code to make it switch on and off three times.

I hope you can give me some advice on that.

You can use a bit in the free user area, 0x66C0 - 0x66FF

Have you looked at Lua at all, any of the provided examples, for instance, or the many offerings in the User Contributions subforum? I'd rather help YOU solve it rather than simply do it for you, because then you (and others reading this) will understand it and be able to develop other things as and when.

In particular, you need to find the A/P Master offset. This is easy enough for the default A/P -- it is 0x07BC which will change from being non-zero to zero when you switch it off. But if you are using an add-on aircraft with its own A/P it might not be easy to determine the A?P going off.

If it is the default A/P you'd use the "event.offset" function to detect when it changed. This would call a function where you'd test the result (the "value" provided) for zero (e.g. "if val == 0 then ..."), and if so set the bit in your chosen LED offset so it lights, then sleep a while, using ipc.sleep(number of milliseconds), then clear the bit, sleep a while, set the bit, sleep a while, clear the bit, sleep a while, ... for the number of flashes you want. Adjust the sleep times for the flash length and gap length you want.

You'd set and clear the bit using the ipc.setbits and ipc.clearbits functions.

Finally, you'd save the resulting Lua file into the FS Modules folder as "ipcReady.lua"so it starts running when FS is ready to fly. Or if it's only for a particular aircraft you'd name it something else and put its name into the FSUIPC INI file in an [Auto ...] section bearing the aircraft's name or a Profile name, if you are using profiles.

I'll answer questions and help you make it work, but I won't write it for you (though i see I nearly did! ;-) ).

Regards

Pete

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.