Jump to content

G940 Leds - working program :)


Recommended Posts

I have unzip the files. Check the config file. Still can not get the LEDS to light up. Is some way to light them up ALL green. It would be nice to see something. Does logitech make anything to work work with the LEDS??

 

You will have to explain more what you have done and what doesn't work if you want us to be able to help you.

Link to comment
Share on other sites

  • 1 month later...
  • Replies 100
  • Created
  • Last Reply

Top Posters In This Topic

  • 1 month later...

E9rendil: No, you will have to change the export script to export the correct data for FC2

 

Schkorpio: Yes, if you not are happy with the supplied examples you have to configure g940leds.lua.

Link to comment
Share on other sites

Hi to all...i need a quick tuto, onhow to setup throttle leds just to switch form off to on, example, when i press first top left button (which in game I use as Jammer on/off), it switches from off to green led?

How to setup that? And how can I use it in other flight simulation games? Is it game related?

[sIGPIC][/sIGPIC]

Pilot from Croatia

Link to comment
Share on other sites

  • 1 month later...

Really nice work !

 

I programmed the exports I wanted for Lock On FC2, and it works pretty well. I also made intro/outro animations, just for fun

kitt-smiley.gif :)

 

Since I wanted to use blinking lights, I followed you recommendations and didn't use coroutines. I first tried to put my code in LuaExportAfterNextFrame() as you suggested, but it was too laggy.

 

I find using LuaExportActivityNextEvent() is a better solution than LuaExportAfterNextFrame(). This way you can use the time interval you want instead of every frame, which I find quite heavy.

I use 1.0 sec most of the time, and 0.4 sec when I want to make a light blink.

I think I will try coroutines though, to see what the problem with implementing blinking is.

 

Still about blinking, do you think it would be possible to handle such a feature directly in the program, instead of the LUA side ?

Functions like SetBlinkInterval=0.4 (I guess a common interval would be easier) and SetBlink=1or (button 1 would blink from off to red) would be awesome !

 

Another remark : I noticed that with time, using the axes of the throttle (including R1 and R2 wheels) makes the game laggy. I don't know if it due to the duration of the use or the number of missions. Anyway, restarting the program puts everything back in order.

 

 

Thanks for the good work !

Link to comment
Share on other sites

For those flying on Lock On FC 2, I have redesigned all the LUA part to set up a profile more easily :

 

It is a Modman package : you should install it with Modman (packed with version 7.3, I don't know if there are backward compatibility issues)

 

I have implemented the main statuses you might want to see on the buttons : engines, flaps, gear, radar, autopilot, modes, etc.

 

To assign status function to buttons, edit :

 

/Config/Export/G940leds/LO-FC2/profile.lua

 

You can also tweak the colors corresponding to each status here :

 

/Config/Export/G940leds/LO-FC2/colors.lua

 

This version has only been tested on Lock On FC2 (patched to 1.2.1)

I will check previous versions of Lock On if I have the time.

 

The DCS side I have provided is just a draft, trying to duplicate morg's profile with my implementation. But I can't test it since I don't have it (I'm not ready for a true-hardcore sim yet ^^). If you want to give it a try, you'll have to change the game setting in :

 

/Config/Export/G940leds/config.lua

 

In this file, you can also disable the little intro/outro animations and tune the refresh rate. (Which also changes the blinking rate, because yeah, blinking is implemented ! )

 

Feel free to suggest other functions you would like to use.

 

You can download the package here :

 

http://www.tardot.net/files/G940leds_1.1b.rar

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

I'm trying to run this for DCS:BS but can't seem to get the lights working in the game. Everything is working and it plays the intro and outro with the flashing buttons but in game nothing happens.

 

Any ideas?

 

 

Edit: After lots of tinkering I was able to make the morg version 1.1 Autopilot and targeting buttons work work by editing the export.lua (if you renamed example_export.lua)

 

CoroutineIndex = CoroutineIndex + 1

Coroutines[CoroutineIndex] = coroutine.create(g940leds_example)

--Coroutines[CoroutineIndex] = coroutine.create(g940leds_AutopilotTargetingMode)

LoCreateCoroutineActivity(CoroutineIndex, 0, 0.1) -- start directly and run every 0.1 seconds

 

You have to switch the comments so it looks like this:

 

CoroutineIndex = CoroutineIndex + 1

--Coroutines[CoroutineIndex] = coroutine.create(g940leds_example)

Coroutines[CoroutineIndex] = coroutine.create(g940leds_AutopilotTargetingMode)

LoCreateCoroutineActivity(CoroutineIndex, 0, 0.1) -- start directly and run every 0.1 seconds

 

The morg version has an error with the flight director if you crash or get shot down the LEDs will stop working...I'm tryinmg to fix it but its hard to get my head around


Edited by Slayer

[sIGPIC][/sIGPIC]

 

System Specs

 

Intel I7-3930K, Asrock EXTREME9, EVGA TITAN, Mushkin Chronos SSD, 16GB G.SKILL Ripjaws Z series 2133, TM Warthog and MFD's, Saitek Proflight Combat pedals, TrackIR 5 + TrackClip PRO, Windows 7 x64, 3-Asus VS2248H-P monitors, Thermaltake Level 10 GT, Obutto cockpit

 

Link to comment
Share on other sites

Erf, Sorry !

I would have been very surprised if my version for worked with DCS, with literally zero test :P

 

Anyway, thanks for your feedback. I can try and see if there are obvious errors if you provide me the following log files :

 

[DCS folder]/temp/Error.log

[DCS folder]/temp/G940leds.log

 

But again, I can't promise anything, since I don't have DCS. (and I am not planning to get it for the moment)

Link to comment
Share on other sites

  • 1 month later...

First off I just want to say amazing work on making this utility, I'm trying to get 6 of my throttle buttons to show the differnet ACS modes. Djuu I was wondering wether I could get some advice on how to get the ACS mode requested by G940export.lua

 

For instance what would I have to enter into G940export.lua to check if BARO_HOLD is on?

 

I've assumed I can make additions to colors and profile lua files to include the additional functions. I'm sorry to be a pain but I have no idea about lua stuff but one example of how to export an ACS mode would get me started. I've tried a few different combinations of primitive copying and pasting/replacing of text of different functions included the G940exportlua to no avail:helpsmilie:

Link to comment
Share on other sites

Morg,

 

I seem to get an odd performance problem when using g940leds.exe. I notice stutters that only occur when I use g940leds, they seem to get progressively worse the longer the flight, after around 1.5 hours the problem is really bad. I notice that the stutters occur when I use an axis on the g940 throttle, whats really interesting is that the stutters can be seen even after DCS has exited and just g940leds is still running, when wiggling an axis on the throttle and looking at the TIR5 application large stutters are seen and the TIR camera even losses connection for a moment sometimes (the left hand light blinks). I don't think this is a TIR problem, I have been using it for many months on DCS and other games, when I run the sim without using g940leds everything is fine.

 

I am on vista64, am using 1.1 version of your app, 5.09.131 logitech drivers, and am using g940leds_AutopilotTargetingMode() exactly as described in the documentation. Any ideas or are there any diagnostics that might help work out whats going wrong?

 

S!

FifthColumnist

Link to comment
Share on other sites

Fifthcolumnist, Djuu also noted this bug in G940leds 1.1 in one of his posts I don't know if morg is continuing to refine the software since he hasn't posted in about three months.

 

Anyway back to what I was asking again, I finally managed to wrap my noggin around the export script stuff and have made entries into G940export, colors and profiles lua to support the six different ACS modes for FC2.

Once you have installed Djuus files you can navigate to "Eagle Dynamics/Lockon Flaming Cliffs2/Config/Export/G940leds" backup Djuus original LO-FC2 file and overwrite with the modded files attached.

Hope this isn't treading on anyone's toes, Djuu if you want to repackage them please feel free. I'm really chuffed to have my buttons change colour when I press them to activate the different ACS modes. :D

LO-FC2.rar

Link to comment
Share on other sites

This sounds really sweet. I would love the buttons to change light when I press. I always catch myself looking down to see the autopilot buttons and the weapons buttons to check if I have them engaged or not. I read the thread but am having a hell of a time following. Hehe, I installed the one from morg using modman, or I thought I did. Probably did nothing obviously. Anyone got a more step by step guide maybe?

[sIGPIC][/sIGPIC]

Aaron

i7 2600k@4.4ghz, GTX1060-6gb, 16gb DDR3, T16000m, Track IR5

 

BS2-A10C-UH1-FC3-M2000-F18C-A4E-F14B-BF109

Link to comment
Share on other sites

  • 1 year later...
Morg,

 

I seem to get an odd performance problem when using g940leds.exe. I notice stutters that only occur when I use g940leds, they seem to get progressively worse the longer the flight, after around 1.5 hours the problem is really bad....

S!

FifthColumnist

Just in case anyone else has the problem: If you use the "every frame method" because you want the lights to blink exactly as they should, change the export.lua script part to send an udp packet only when values change.

I had the same problem and it was because the frequent calls to socket:send flooded G940Leds.exe with messages and generated unneccesary "network" traffic.

I can post the script changes when needed.

Я только понимаю Вокзал.

Link to comment
Share on other sites

  • 2 months later...

Hi everyone:

 

I would like to ask a question about programing the LEDs through c++ for il2. As i'm very green with this language i get a lot of error, i "killed" a few already but there's one i can't kill. This is the code i built to try and get the handler so i can use after with some setLED command, ahh yes the code:

// Test Led.cpp : main project file.

#include "stdafx.h"
#include <LogiJoystick.h>
#include <LogiControllerInput.h>

using namespace System;
using namespace LogitechControllerInput;

LogitechControllerInput::ControllerInput;
LPDIRECTINPUTDEVICE8 device_;
ControllerInput* g_controller;
;
int main()
{

   g_controller->Update();
   for (INT ii = 0; ii < LG_MAX_CONTROLLERS; ii++)
   {
       if (g_controller->IsConnected(ii))
       {
           int u=0;
       }
       if (g_controller->IsConnected(ii,LG_MODEL_G940_THROTTLE))
       {
           device_ = g_controller->GetDeviceHandle(ii);
       }
   
   }
   
}

The error i get is this one:

 

error LNK2028: unresolved token (0A000344) "public: void __thiscall LogitechControllerInput::ControllerInput::Update(void)" (?Update@ControllerInput@LogitechControllerInput@@$$FQAEXXZ) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)

I understand that's something i miss to implement.... but as green as i'm i dont figure out what's it.

 

Thanks a lot jus for reading.... and huge thanks if anyone points me in the right direction!!


Edited by E69_Jack_Aubrey
Link to comment
Share on other sites

  • 2 months later...

Hello,

 

Thanks for this wonderful piece of software that you wrote there.

I've got currently a working configuration with your leds utility on my G940.

It works like a dream, however, only in single player mode.

 

I noticed that in multi player mode, the export.lua file does not seem to work.

Have you ever succeeded to make your utility work in online multi player games?

 

I run black shark 2.

 

Sven

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

G940 leds EXPORT.LUA with also multiplayer client mode WORKING!

 

Hello all,

 

Allow me to reply to my own post. I am now also able to run G940 leds in single player mode, and also in multi player mode, both as the CLIENT and as the SERVER.

 

GREAT!!! :thumbup:

 

I found the issue after severe debugging in the lua scripts.

 

It seems that in multiplayer client mode, Coroutines don't work.

 

I have used therefore, a workaround in Export lua. Find my zipped export.lua attached. I have modified it so that you can follow exactly the G940 leds communication logic and the changes.

 

This is what i did:

 

  • I have removed all of the Croutines logic, instead, i am using the function

 
function LuaExportActivityNextEvent(t)
local tNext = t
-- This method WORKS also in multiplayer mission modes as the client!

-- Need to do a small test, because this function is called before actual exporting is started...
if G940Socket ~= nil then
tNext = G940Leds(tNext,G940Socket)
else
tNext = tNext + 1
end
return tNext
end

 

  • You'll notice the G940Socket variable, which is declared in the beginning of the file. The socket is opened here:

 
function LuaExportStart()
-- Here I open the G940Socket
G940Socket = G940SocketSetup(G940Socket)
end

 

  • When exporting finishes, i close the socket:

 
function LuaExportStop()
-- Closing G940 Socket connection before exporting is stopped.
G940Socket:send("bye=DCS Ka-50 is running and starting to send data!")
G940Socket:close()
end

 

  • I have created a new G940leds communication routine, which is called every time the ExportEvent happens. In multi player games, acting as the client, the issue is with the function GetDevice(0), which sometimes returns a 0 as the main panel. In such a case, processing of the leds logic should be skipped.
     

 
function G940Leds(t, c)

local tNext = t

c:send("hello=DCS Ka-50 is running and starting to send data! Great!")
local MainPanel = GetDevice(0)

if MainPanel ~= 0 then
 c:send("hello=DCS Ka-50 is sending now new data!")

 -- MainPanel:update_arguments() -- Uncomment if you want the leds to update while outside of the cockpit

 -- Lit button returns 0.1 when active. 0.2 when depressed but not active. 0.3 when depressed and active
 -- Indicators returns between 0.0 to 1.0, mostly only 0.0 and 1.0 but for example gear_handle moves between them
 --   Indicators with continous values are marked as such)

 -- Auto-pilot buttons and switches
 local bankhold = get_argument_str(MainPanel,330) -- Lit button
 local pitchhold = get_argument_str(MainPanel,331) -- Lit button
 local headinghold = get_argument_str(MainPanel,332) -- Lit button
 local altitudehold = get_argument_str(MainPanel,333) -- Lit button
 local flightdirector = get_argument_str(MainPanel,334) -- Lit button
 local ap_headingtrack = get_argument_str(MainPanel,336) -- 0.0 heading, 0.5 nothing (hold current course), 1.0 for track
 local ap_baroralt = get_argument_str(MainPanel,335) -- 0.0 barometric, 0.5 nothing, 1.0 radar

 -- Target mode
 local autoturn = get_argument_str(MainPanel,437) -- Lit button
 local airborne = get_argument_str(MainPanel,438) -- Lit button
 local forwardhemisphere = get_argument_str(MainPanel,439) -- Lit button
 local groundmoving = get_argument_str(MainPanel,440) -- Lit button

 -- Pushable warning lights
 local master_caution = get_argument_str(MainPanel,44) -- Indicator
 local engine_rpm_warning = get_argument_str(MainPanel,46) -- Indicator

 -- Misc
 local gear_handle = get_argument_str(MainPanel,65) -- Indicator (continous values)
 local navigation_lights = get_argument_str(MainPanel,146) -- 0.0 off, 0.1 10%, 0.2 50%, 0.3 100%
 local hover_lamp = get_argument_str(MainPanel,175) -- Indicator
 local ralt_lamp = get_argument_str(MainPanel,170) -- Indicator

 -- Weapons switches
 local master_arm = get_argument_str(MainPanel,387) -- Indicator
 local rate_of_fire = get_argument_str(MainPanel,398) -- Indicator
 local cannon_round = get_argument_str(MainPanel,399) -- Indicator
 local burst_length = get_argument_str(MainPanel,400) -- 0.0 for short. 0.1 for medium, 0.2 for long
 local manualautomode = get_argument_str(MainPanel,403) -- Indicator 1.0 for auto, 0.0 for manual
 local trainingmode = get_argument_str(MainPanel,432) -- Indicator 1.0 for traning mode, 0.0 for manual
 local tracking_gunsight = get_argument_str(MainPanel,436) -- Indicator 1.0 for tracking, 0.0 for gunsight
 local laser_standby = get_argument_str(MainPanel,435) -- Indicator

 -- PVI
 local nav_waypoints = get_argument_str(MainPanel,315) -- Lit button
 local nav_fixpoints = get_argument_str(MainPanel,316) -- Lit button
 local nav_airfields = get_argument_str(MainPanel,317) -- Lit button
 local nav_targets =   get_argument_str(MainPanel,318) -- Lit button
 local nav_initialnavpos =   get_argument_str(MainPanel,522) -- Lit button
 local nav_selfpos =   get_argument_str(MainPanel,319) -- Lit button
 local nav_course =   get_argument_str(MainPanel,320) -- Lit button
 local nav_wind =   get_argument_str(MainPanel,321) -- Lit button
 local nav_trueheading =   get_argument_str(MainPanel,322) -- Lit button

 -- Datalink
 local dlink_toall = get_argument_str(MainPanel,16) -- Lit button
 local dlink_wingman1 = get_argument_str(MainPanel,17) -- Lit button
 local dlink_wingman2 = get_argument_str(MainPanel,18) -- Lit button
 local dlink_wingman3 = get_argument_str(MainPanel,19) -- Lit button
 local dlink_wingman4 = get_argument_str(MainPanel,20) -- Lit button
 local dlink_vehicle = get_argument_str(MainPanel,21) -- Lit button
 local dlink_sam = get_argument_str(MainPanel,22) -- Lit button
 local dlink_other = get_argument_str(MainPanel,23) -- Lit buttons
 local dlink_ingress = get_argument_str(MainPanel,50) -- Lit buttons
 local dlink_send = get_argument_str(MainPanel,159) -- Lit buttons
 local dlink_ingresstotarget = get_argument_str(MainPanel,150) -- Lit buttons
 local dlink_erase = get_argument_str(MainPanel,161) -- Lit buttons

 -- Gear  (0.0 not, 1.0 yes)
 local lg_up = get_argument_str(MainPanel,59)
 local lg_down = get_argument_str(MainPanel,60)
 local rg_up = get_argument_str(MainPanel,61)
 local rg_down = get_argument_str(MainPanel,62)
 local ng_up = get_argument_str(MainPanel,63)
 local ng_down = get_argument_str(MainPanel,64)
 c:send("ClearOne=3;DCSSetOneGreen=3"..bankhold..";")
 c:send("ClearOne=4;DCSSetOneGreen=4"..pitchhold..";")
 c:send("ClearOne=7;DCSSetOneGreen=7"..headinghold..";")
 c:send("ClearOne=8;DCSSetOneGreen=8"..altitudehold..";")

 c:send("ClearOne=1;DCSSetOneRed=1"..autoturn..";")
 c:send("ClearOne=2;DCSSetOneRed=2"..forwardhemisphere..";")
 c:send("ClearOne=5;DCSSetOneRed=5"..airborne..";")
 c:send("ClearOne=6;DCSSetOneRed=6"..groundmoving..";")
 -- Need to update the buttons if autoenable is disabled
 c:send("set=;") -- Update the buttons

end
-- This puts the next event at 0.1 seconds
tNext = tNext + 0.1

return tNext

end

 

  • And of course the routine to open the G940leds communication socket:

-- Set up the socket, changing port is supported here, keep the port at the value given
function G940SocketSetup(c)
package.path  = package.path..";.\\LuaSocket\\?.lua"
package.cpath = package.cpath..";.\\LuaSocket\\?.dll"
socket = require("socket")
host = "localhost"
dstport = "33331"

c = socket.udp()
c:setpeername(host,dstport)

-- if default_output_file then
--  default_output_file:write("G940Socket has been Setup\r\n")
-- end

return c
end

 

Find my export.lua attached.

Export.zip


Edited by FlightControl
Updated my reply now with the real code overview.

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Find my edited post above! It provides a solution to configure the G940 leds for multi player missions, acting as the client.

 

Sven

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Hello Laidback, yes, i believe it will work also with A-10C. This concerns the core engine, and thus this trick will have similar mechanisms.

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

  • 4 months later...

Very good job svenvandevelde. I read your post http://forums.eagle.ru/showpost.php?p=1520309&postcount=69 and now trying to get to work LED in multiplayer LockOn Flaming Cliffs 2.

This mod from Djuuu (program of Morg) works in single player and now working in multiplayer.

I returned to work LuaExportActivityNextEvent, alternative to coroutines.

My custom profile:

G940leds.button[1] = "EngineLeft";

G940leds.button[2] = "EngineRight";

G940leds.button[3] = "Ecm";

G940leds.button[4] = "AutoPilot";

G940leds.button[5] = "Gear";

G940leds.button[6] = "AeroBrake";

G940leds.button[7] = "Flaps";

G940leds.button[8] = "Rws";

but be careful to change the profile.

If you employ AutoPilotOrThrust script reported error and programm stopped.

G940leds_1.1b.rar


Edited by ravencrow
Link to comment
Share on other sites

  • 1 month later...
Very good job svenvandevelde. I read your post http://forums.eagle.ru/showpost.php?p=1520309&postcount=69 and now trying to get to work LED in multiplayer LockOn Flaming Cliffs 2.

This mod from Djuuu (program of Morg) works in single player and now working in multiplayer.

I returned to work LuaExportActivityNextEvent, alternative to coroutines.

My custom profile:

G940leds.button[1] = "EngineLeft";

G940leds.button[2] = "EngineRight";

G940leds.button[3] = "Ecm";

G940leds.button[4] = "AutoPilot";

G940leds.button[5] = "Gear";

G940leds.button[6] = "AeroBrake";

G940leds.button[7] = "Flaps";

G940leds.button[8] = "Rws";

but be careful to change the profile.

If you employ AutoPilotOrThrust script reported error and programm stopped.

 

It is a pleasure to read that it worked for you.

 

Sven

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

  • 1 year later...

Hi there,

 

I modified (and cleaned up) the script to somewhat work with UH-1H Huey.

Simply copy attached "Export.lua" into "Saved Games\DCS\Scripts" folder.

(If "Scripts" directory does not exist, create it)

 

You also need to run "G940leds.exe" which is linked in the first post (and some later).

 

Features:

-Leds will be switched off, after mission ends

 

Button/LED mappings:

P1/5: Armament Safe Switch (OFF / GREEN / RED) - (Off / Safe / Armed)

P2/6: Weapon Selector: (AMBER / RED) - (7.62mm / Rockets)

P3: Flare (OFF/ GREEN) (Off / Safe)

P7: Fire Flare (OFF / Amber) - (Fire Flare)

P4: Gov Emergency (OFF / RED) - (Toggle Governour Emergency On/Off)

P8: Master Caution (OFF / RED) - (Reset Master Caution)

 

Hope you have fun :)

 

Greetings,

Frostregen

Export.lua

g940.thumb.jpg.136b634efb07bed81cb01ca70a6ba3c6.jpg

Link to comment
Share on other sites

  • Recently Browsing   0 members

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