Jump to content

Recommended Posts

Posted

Hi All

Anybody can show me a example "how to" send data (ex. master Caution light) to TCP/UDP - Also an example of sending Input through TCP/UDP like "Master Caution push" to the sim ??

 

How is the sting send to and from look like ??

 

Regads

Frank

Posted
Anybody can show me a example "how to" send data (ex. master Caution light) to TCP/UDP - Also an example of sending Input through TCP/UDP like "Master Caution push" to the sim ??

 

See Gadroc's Export.lua which is what was the key for my understanding how it all works.

 

Also, see my post on a little bit more detail on how to address each switch in sim.

 

Basically, you will have an app that listens on a UDP port for values from the sim sent by the Export.lua script and can act accordingly (e.g. turn on a master caution light). Then conversely, the script listens for UDP packets in a specific format that will press a button or flip a switch.

 

This last bit is from memory so it may not be 100% accurate:

 

For your specific case of the Master Caution, Export.lua will send you a stream of packets indicating the state of the light (blinking on and off). Something like this:

404=1

404=0

404=1

404=0

etc.

(there are some other bits in the string you receive but I can't remember the exact format now).

 

To press the Master Caution button and cancel the warning, you would send UDP packets back to the sim in the form of:

C24,3001,1.0

C24,3001,0.0

 

The Export lua parses that and presses (the 1.0) then releases (the 0.0) the MC button by executing the performClickableAction() function.

Posted (edited)

Those annunciator values come from "DCS World\Mods\aircrafts\A-10C\Cockpit\Scripts\mainpanel_init.lua"

 

snippet:

caution_lamp(404,SystemsSignals.flag_MASTER_WARNING_STUB)    -- MASTER WARNING
caution_lamp(480,SystemsSignals.flag_ENG_START_CYCLE)    -- CAUTION LIGHT PANEL
caution_lamp(481,SystemsSignals.flag_L_HYD_PRESS)        -- CAUTION LIGHT PANEL
caution_lamp(482,SystemsSignals.flag_R_HYD_PRESS)        -- CAUTION LIGHT PANEL
caution_lamp(483,SystemsSignals.flag_GUN_UNSAFE)        -- CAUTION LIGHT PANEL
caution_lamp(484,SystemsSignals.flag_ANTISKID)            -- CAUTION LIGHT PANEL
caution_lamp(485,SystemsSignals.flag_L_HYD_RES)            -- CAUTION LIGHT PANEL
caution_lamp(486,SystemsSignals.flag_R_HYD_RES)            -- CAUTION LIGHT PANEL

In the Export.lua, there is an array at the beginning where you define which events you're interested in:

 

gArguments = {[404]="%.1f"}

The ProcessMainPanel() function will only execute the SendData() function if the event is listed in that array.

Edited by SparkyOV
Posted

I'm not sure I follow your question... are you asking if you can turn on a warning light? To my knowledge, no...you cannot do that. Gauges and indicator lights are read-only.

Posted (edited)

Ah, ok. Please re-read my other post. I explain where to find the codes for switches. Basically you will send a UDP packet back to the sim in the form of:

 

C[device ID],[button ID],[value]

 

E.g. if you wanted to "press and release" the FUNC button on the UFC, you would send:

C8,3013,1.0

C8,3013,0.0

 

E.g. to toggle TGP to ON, you would send:

C7,3004,1.0

 

TGP OFF would be:

C7,3004,-1.0

Edited by SparkyOV
Posted

Thanks....

and this code goes to the buttom of the export.lua ????

 

--get the device...

ahcp = GetDevice(7) --the AHCP device ID

 

--set which switch to manipulate

gunpac_switch = 3002 --the GUN/PAC switch ID

 

--set the position you want

switch_pos_down = 0.0 --switch down for GUNARM

switch_pos_mid = 0.1 --switch middle for SAFE

switch_pos_up = 0.2 --switch up for GUN/PAC

 

--perform the actual "click" up to GUN/PAC

ahcp:performClickableAction(gunpac_switch, switch_pos_up)

 

--or safe...

ahcp:performClickableAction(gunpac_switch, switch_pos_mid)

 

--or down for GUNARM...

ahcp:performClickableAction(gunpac_switch, switch_pos_down)

Posted

No no...that was a specific example of how to directly control a toggle using "performClickableAction".

 

The export.lua that I attached earlier is the generic way to toggle any switch via a UDP packet.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...