towsim Posted October 7, 2013 Posted October 7, 2013 I am just playing around with some hardware switches for the A10-C and run into a problem. As an example, I take the TGP On/Off switch from the AHCP panel. In the options menu, the TGP switch is handled as a toggle switch. So one pulse switches it on, the next pulse switches it off. It is obviously not foreseen to follow the logic of a hardware switch with two positions, on and off. Here my question: Is it possible to modify any LUA script so as to use the TGP switch as On/off instead as a toggle switch? For the moment I fake the function by defining two input devices for the TGP switch. That works reliable but costs one more input line and there is no possibility to synchronize the cockpit switch with the hardware switch on startup. I think, with all the pit builders here in the community, I am not the first who had this problem. Regards Mike [sIGPIC][/sIGPIC]
Milli Posted October 7, 2013 Posted October 7, 2013 Hello there. See post number 15, 16 and 17 on this page. Link in post 15 takes you to lots more info. http://forums.eagle.ru/showthread.php?t=107557 Hope it helps. Regards, Milli
towsim Posted October 8, 2013 Author Posted October 8, 2013 Hi Milli, thank you for answering. I studied the link and found it very useful. If I take it as described, I can save at least one input line per switch. The only missing color in my rainbow is, that the initial state of the hardware switches cannot be synchronized with the cockpit display. But it is a step forward. I will post my test results here as soon as my panel is ready. Thanks, Mike [sIGPIC][/sIGPIC]
Milli Posted October 8, 2013 Posted October 8, 2013 Glad it helped. I only use it for my gear up/down switch on my very basic panel. And yes, there is no synchronisation between the hardware and what is initially displayed in the cockpit. I always have to remember to set the hardware switch up or down when the mission is loading. I will be interested in your findings. Regards, Milli
towsim Posted October 9, 2013 Author Posted October 9, 2013 Here my results, found out for my A10-C desktop panel: Interface, Joystick Controller B256A13 This USB board is very comfortable because it does not need any additional driver software. It is recognized by DCS and appears two times as 'Joy 1 A0037' in the options menu. Since it has two joysticks on board, up to 254 switches can be connected to the board. Options Menu Before any modification to LUA scripts are made, all desired switches should be set up in the options menu. This is necessary, because DCS writes the later modified scripts every time the options menu is invoked. ON/OFF switches Unfortunately, some DCS switches are supported only as toggle switches like bell buttons, but are actually ON/OFF switches in the cockpit. If your external hardware uses a ON/OFF switch, a small modification in a LUA script is necessary. First you have to identify your device. DCS maintains a specific LUA script for each external device which is HID compatible. For Joysticks and similar devices go to C:\Users\[username]\Saved Games\DCS\Config\Input\A-10C\joystick You find there all LUA scripts of the supported devices. In my case, for the B256A13 board, I found two scripts, Joy1 A0037 {D3A18E60-25DC-11e3-8001-444553540000}.lua Joy1 A0037 {D3A1DC80-25DC-11e3-8002-444553540000}.lua As an example, I take the TGP switch from the AHCP panel. For all modification of LUA scripts Notepad++ should be used. Open the LUA script of the device of your choice. Search for 'TGP' in the file you will find the line {down = iCommandPlaneAHCPTGPOnOff, name = "TGP switch ON/OFF", category = "Armament HUD Control Panel"}, Modify the line so as to have {down = iCommandPlaneAHCPTGPOnOff, up = iCommandPlaneAHCPTGPOnOff, name = "TGP switch ON/OFF", category = "Armament HUD Control Panel"}, This causes an action every time the switch lever is moved, regardless of the direction. The disadvantage of this solution is, that the hardware switch position must be correct on startup. Otherwise you have a reversed logic with this switch. ON/OFF/ON switches These type of switches have 3 positions. The up and down position cause a signal while the mid position (OFF) has no connection. The Land/Taxi light switch has 3 defined positions in the LUA script. But the OFF position cannot be used because the switch gives no signal. The modification is as Follows. search for ' iCommandPlaneLGPLandLight' You will fin the line {combos = {{key = "JOY_BTN15"}, }, down = iCommandPlaneLGPLandLight, name = "Landing Lights On", category = "Landing gear panel"}, Insert an 'up' command so as to have {combos = {{key = "JOY_BTN15"}, }, down = iCommandPlaneLGPLandLight, up = iCommandPlaneLGPLightsOff, name = "Landing Lights On", category = "Landing gear panel"}, ' iCommandPlaneLGPLightsOff' is lend from another line in the file, which would normally be used for the mid position of the switch. The same modification must be done for the 'taxi lights' line: {combos = {{key = "JOY_BTN16"}, }, down = iCommandPlaneLGPTaxiLight, up = iCommandPlaneLGPLightsOff, name = "Taxi Lights On", category = "Landing gear panel"}, Now the logic calls iCommandPlaneLGPLightsOff every time you leave the most up position and the most down position. Even here, the correct switch position must be set on startup. But the position can be corrected after startup which is not possible with ON/OFF switches. The attached image shows my desktop panel for which the modifications were made. The panel does not reflect the original layout of the A10-C panel. It was made for desktop use, because there is not enough space in my office for a complete pit. All other rooms are under the sovereignty of my wife. My desk is even used for software development, therefore a comfortable compromise was necessary. Regards, Mike [sIGPIC][/sIGPIC]
Milli Posted October 9, 2013 Posted October 9, 2013 So, I'm going to have to keep remembering to flip my switch at mission load up time. Thank god I've only got one :) Regards, Milli
towsim Posted October 11, 2013 Author Posted October 11, 2013 Accidently, I came behind a possibility to configure ON/OFF switches so as to be synchronized on simulation startup. It implies, that 'Synchronize Cockpit Controls with HOTAS Controls at Mission Start' is set in the Options/Misc menu. The entire procedure bases on modifications of a specific device LUA file found in C:\Users\[user nasm]\Saved Games\DCS\Config\Input\A-10C. In my case, I used the Joy1 A0037 {D3A1DC80-25DC-11e3-8002-444553540000}.lua for the B256A13 Joystick controller board. DCS obviously makes a difference if a procedure is named for an up or down command or if a key ID is set instead. Do not ask for the logic behind it, I have no idea. The example shows a definition for the AHCP HUD mode , Day/Night. In its original definition the corresponding entry is: {combos = {{key = "JOY_BTN21"}, }, down = iCommandPlaneAHCPHUDModeDayNight, name = "HUD Mode switch Day/Night", category = "Armament HUD Control Panel"}, This definition works like a bell button. Every time you move your JOY_BTN21 hardware switch to the ON position, it sends a push signal to DCS, causing the cockpit switch to toggle. The OFF position sends no signal. Therefore no action is observed with the OFF position. In the previous post I described the possibility to get a signal in any case, for OFF and ON. But the initial state at mission start was not synchronized. If not manually set in the correct position, the switch worked in reversed mode. The following modification let DCS check the hardware switch position at startup: {combos = {{key = "JOY_BTN21"}, }, down = 3006, up = 3006, cockpit_device_id = 7, value_down = 0, value_up = 1, name = "HUD Mode switch Day/Night", category = "Armament HUD Control Panel"}, The key ID 3006 is taken from clickabledata.lua , AHCP section, and the device ID for the AHCP panel (7) from devices.lua. The key words 'value_down' and 'value_up' define the number to be send to the software switch in DCS. A little trap door is the signal evaluation by DCS . 'ON' does not mean an active signal in all cases. I found some switches which needed an active signal for the OFF position. So it has to be tested for every single switch which position needs which signal. The ON/OFF/ON switches can be defined in a similar way. But the mid (OFF) position is not recognized at startup, only the two possible ON positions give a signal. The advantage of this mod is simply the possibility to have all ON/OFF switches in the same position like set with the hardware switches. It does not work with spring loaded switches. Because this types have an additional logic for ON and OFF internally. Regards, Mike [sIGPIC][/sIGPIC]
Milli Posted October 11, 2013 Posted October 11, 2013 Thanks towsim. I will have a look at this. Regards, Milli
Recommended Posts