Jump to content
The simFlight Network Forums

LED output from FSUIPC


Recommended Posts

Hi,

I have a registered version of FSUIPC. I use iFly737 in my simulator which consist of a single seat MIP with TQ and pedestal and overhead. I use IFLYTOFSUIPC.

I wish to connect my self made fire panel. All the switches are working properly thru FSUIPC. I wish to connect the let output. My question is how to assign led output within FSUIPC using the offsets from IFLYTOFSUIPC?

Thank you

Link to comment
Share on other sites

I have a registered version of FSUIPC. I use iFly737 in my simulator which consist of a single seat MIP with TQ and pedestal and overhead. I use IFLYTOFSUIPC.

I wish to connect my self made fire panel. All the switches are working properly thru FSUIPC. I wish to connect the let output. My question is how to assign led output within FSUIPC using the offsets from IFLYTOFSUIPC?

 

FSUIPC itself does not provide any display capabilities. It cannot because each type of display hardware is unique and needs specific programming, unlike buttons and axes for which there's a standard Microsoft-defined interface.

 

I don't know how you've connected your home-made fire panel, but presumably you know how to program it if you made it?

 

 

The Lua plug-ins library collection does have facilities for programming GoFlight hardware displays (in the gfd library), and more general USB "HID" devices (in the com library. In fact the com library could be used to program any serial port device, or USB device masquerading as a serial port device. But only you know your hardware.

 

Regards

Pete

Link to comment
Share on other sites

My fire panel is connected with a Goflight DIO board. Should I create a Lua program to enable the Led display of the board?

 

Yes. The GF DIO is catered for in the Lua gfd library. You have full control over all facilities of the DIO in that library. You just need a small Lua plug-in, driven by events for offset changes (event.offset function)  which call specific functions to light or entiguish the LEDs.  The Lua would be started by an [Auto ...] section for the relevant aircraft Profile.

 

Regards

Pete

Link to comment
Share on other sites

I don't know how do do that. I need a headstart... could you please help?

 

Documentation and examples are provided in the FSUIPC Documents folder installed into your FS Modules folder. It isn't hard, it is barely programming. I'm willing to help and answer specific questions but I do not provide a plug-in programming service. Sorry. You need to at least have a look at what's there and check some examples. The example plug-in "gfdDisplay.lua" shows the use of Go Flight display functions, and there are lots of examples about of plug-ins reading and testing offset values. You could also browse through some of the many examples in the User Contributions subforum.

 

Pete

Link to comment
Share on other sites

  • 2 weeks later...

I read the tutorial and tried the script "PitotHeat" with a led connected to the DIO LED1 and it works fine.

 

I am trying to light the LED1 on the DIO when the FAULT LIGHT is lited on the Fire Panel. the offset is 9410 bit 6 (per IFLYTOFSUIPC).

I tried the following script:

 

function FaultLight(offset, value) -- Beginning of the function
    if value == 1 then -- Checks to see if value equals one
        gfd.SetLight(GFDIO, 0, LED1) -- Turns ON light#1, of unit#0 on the GFDIO
    else
        gfd.ClearLight(GFDIO, 0, LED1) -- Turns OFF light#1, of unit#0 on the GFDIO
    end -- end of the "if...then" statement
end -- end of the function
event.offset("9410", "6", "FaultLight")
 
It did not work.
 
I than changed the last line to: event.offset("x24B8", "x0F", "FaultLight") and it also did not work.
 
Can you please direct me as to what I am doing wrong?
 
Thanks,
Arieh
Link to comment
Share on other sites

 

I read the tutorial and tried the script "PitotHeat" with a led connected to the DIO LED1 and it works fine.

 

I am trying to light the LED1 on the DIO when the FAULT LIGHT is lited on the Fire Panel. the offset is 9410 bit 6 (per IFLYTOFSUIPC).

I tried the following script:

 

function FaultLight(offset, value) -- Beginning of the function
    if value == 1 then -- Checks to see if value equals one
        gfd.SetLight(GFDIO, 0, LED1) -- Turns ON light#1, of unit#0 on the GFDIO
    else
        gfd.ClearLight(GFDIO, 0, LED1) -- Turns OFF light#1, of unit#0 on the GFDIO
    end -- end of the "if...then" statement
end -- end of the function
event.offset("9410", "6", "FaultLight")
 
It did not work.
 
I than changed the last line to: event.offset("x24B8", "x0F", "FaultLight") and it also did not work.
 
Can you please direct me as to what I am doing wrong?

 

 

Oh dear! You are inventing your own syntax for the Lua functions? Please read the documentation more carefully. Also look in the FSUIPC log file when a Lua program does not work and you will see the Errors reported!

 

This is all wrong:

 

event.offset("9410", "6", "FaultLight")

 

"6" is not a data type. Read the data types list permissable. "UB" is okay for "Unsigned Byte", but "6" means nothing whatoever and will be a reported error.

 

Is 9410 a decimal offset value? It's unusual to see offsets exressed in decimal. Are you sure it isn't 0x9410? (No "" needed).

 

To test bit 6 in a byte you have to use the logic.And function to get the bit out of all the others. Like so:

 

if logic.And(value, 64) ~= 0 then -- Checks to see if bit 6 is set

 

You And with 64 because bit 6 is 2^6 = 2 x 2 x 2 x 2 x 2 x 2 = 64. See the FAQ thread on bits and bytes.

 

Pete

Link to comment
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
×
×
  • 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.