Jump to content

Configuring Warthog


Avio

Recommended Posts

I use TM Warthog throttle and a TM16000 stick for flying the Huey and wonder what is the most convenient way of configuring for example a 3-way switch to mirror a virtual 3-way switch in the Huey (example the Nav light Steady-Off-Flash).

 

Right now I can only get the throttle's 3-way pinky to simulate only 2 states - Flash or Steady, as the centre position doesn't send any keypress to the sim therefore does not command to Off switch.

 

I am not sure about using lua file or programming in it. Is there an easier work-around? Any good download of ready lua file for the Huey (just the Warthog throttle side)?

 

Any help appreciated.

Link to comment
Share on other sites

No easy workaround, unless you consider TARGET to be one :lol:. I might whip up a diff.lua for you, but I'm still figuring things out myself.

 

Edit: OK, karls had this figured out: http://forums.eagle.ru/showthread.php?t=124480. But any time DCS is updated it will probably be screwed up, so might want to learn TARGET.


Edited by aeliusg
Link to comment
Share on other sites

Gosh this is all looking like some alien language from another galaxy ...

 

Surprise that TM couldn't give a more user-friendly way of allowing switches to be mapped to a game's controls without going into programming level.

 

If anyone could help with giving an example of how to edit an existing diff.lua file such that (for example), to configure the throttle's pinky to become the nav light switch states (Flash-Off-Steady), that would be awesome. Still trying to grip with what those 1 or -1 stands for, among other stuff.


Edited by Avio
Link to comment
Share on other sites

Gosh this is all looking like some alien language from another galaxy ...

 

Surprise that TM couldn't give a more user-friendly way of allowing switches to be mapped to a game's controls without going into programming level.

 

Are you using the GUI, or writing scripts? While the scripting language can appear a bit daunting, if you have never programmed before, the GUI is fairly straight forward once you have been through the short manual.

ASUS ROG Maximus VIII Hero, i7-6700K, Noctua NH-D14 Cooler, Crucial 32GB DDR4 2133, Samsung 950 Pro NVMe 256GB, Samsung EVO 250GB & 500GB SSD, 2TB Caviar Black, Zotac GTX 1080 AMP! Extreme 8GB, Corsair HX1000i, Phillips BDM4065UC 40" 4k monitor, VX2258 TouchScreen, TIR 5 w/ProClip, TM Warthog, VKB Gladiator Pro, Saitek X56, et. al., MFG Crosswind Pedals #1199, VolairSim Pit, Rift CV1 :thumbup:

Link to comment
Share on other sites

Gosh this is all looking like some alien language from another galaxy ...

 

Surprise that TM couldn't give a more user-friendly way of allowing switches to be mapped to a game's controls without going into programming level.

 

If anyone could help with giving an example of how to edit an existing diff.lua file such that (for example), to configure the throttle's pinky to become the nav light switch states (Flash-Off-Steady), that would be awesome. Still trying to grip with what those 1 or -1 stands for, among other stuff.

 

Put the following under keys in your diff.lua (using Notepad++ or equivalent):

 

["d3002pnilu3002cd7vd1vpnilvu0"] = {

["added"] = {

[1] = {

["key"] = "JOY_BTN13",

},

},

["name"] = "Nav Lights Steady/Off ",

},

 

This is for Pinky Up. Then bind Pinky Down to Nav Lights Flash.

 

What d3002pnilu3002cd7vd1vpnilvu0 means:

 

d means down (a button press), 3002 is the action (look in the regular .lua), p means pressed (holding down the button), u means up (button unpressed), cd means cockpit_device_id (see in regular .lua), vd means value_down (see in .lua, in this case it is 1 because pressing the button - down - turns nav lights to steady, in action 3002), vp means value_pressed, vu means value_up (action 3002 with value 0 returns nav lights to the off state, set value_up to 0 to have it turn off when the button is "up")


Edited by aeliusg
Link to comment
Share on other sites

Thanks for all the help folks. Still struggling to grapple with all these ...

 

Assigning Up or Down functions is understandable, but the centre position returns NO key press and I just wonder how to assign centre position such that it commands an OFF function.

 

Edit : Just to be sure, the throttle pinky I refer to is the 3-way toggle switch at the left-most part of the left throttle, not the red color button on it. Sorry if I got this mixed up. Thanks.


Edited by Avio
Link to comment
Share on other sites

No problem. Are you using TARGET or the diff.lua method?

 

DCS reads a NO key press as an "up". When a button is not pressed, it is "up". The diff.lua edit I posted gives you a two-way toggle between Button 13 (Pinky Forward/Up) and Button 13 "up", that is when Button 13 is not pressed. You then bind Pinky Back/Down to the other nav lights function, and you have your three-way toggle.

Link to comment
Share on other sites

No problem. Are you using TARGET or the diff.lua method?

 

DCS reads a NO key press as an "up". When a button is not pressed, it is "up". The diff.lua edit I posted gives you a two-way toggle between Button 13 (Pinky Forward/Up) and Button 13 "up", that is when Button 13 is not pressed. You then bind Pinky Back/Down to the other nav lights function, and you have your three-way toggle.

 

Thanks aeliusg. I'm editing from the diff.lua file. As shown in my Edit in previous post, the switch I refer to is actually the 3-way toggle switch, not the red button. What I want is to be able to let the toggle-forward to be Light-Steady, toggle-backward to be Light-Flash, and toggle-middle to be OFF. So far I see only value assignment for Up or Down, is there one for Middle? Thanks.

Link to comment
Share on other sites

My apology once again, I think I got mixed up big time after staring at all those codes. It is the right switch we are talking after all ...

 

Here's the lua part I'm looking at :-

 

["keyDiffs"] = {

["d3002pnilunilcd7vd-1vpnilvunil"] = {

["added"] = {

[1] = {

["key"] = "JOY_BTN13",

},

},

["name"] = "Nav Lights Flash",

},

["d3002pnilunilcd7vd1vpnilvunil"] = {

["added"] = {

[1] = {

["key"] = "JOY_BTN14",

},

},

["name"] = "Nav Lights Steady",

},

How may I insert such that I can command for an OFF when this toggle switch is returned to middle position? This is what I hope to do. Thanks.

Link to comment
Share on other sites

Thanks aeliusg. I'm editing from the diff.lua file. As shown in my Edit in previous post, the switch I refer to is actually the 3-way toggle switch, not the red button. What I want is to be able to let the toggle-forward to be Light-Steady, toggle-backward to be Light-Flash, and toggle-middle to be OFF. So far I see only value assignment for Up or Down, is there one for Middle? Thanks.

 

OK, I see where you're stuck at. In the regular commands there are three states for action 3002, cockpit_device_id 7. This is the long way to say the Nav Lights toggle switch. -1 is Flash, 0 is Off, 1 is Steady. By default these are all separated into three bindable commands.

 

d3002pnilunilcd7vd1vpnilvunil is the Steady command. This only works for a button press or "down" bind. The d3002 part in the beginning means that "down" activates action 3002. p is nil, or no action when the button is held pressed. u is also nil, so no action when the button is not pressed. cd7 is there to narrow it down to the nav lights switch, you don't have to worry about this, but make sure it is cd7 and not anything else. vd1 says that when you press the button down, the value for the action is 1. This turns the lights to steady. vpnil, no value; vunil, no value.

 

Now the Pinky Toggle switch is essentially two buttons and a middle position with no signal, as you know. There's no way to define the middle position, except as a NO press like you said. DCS uses the "up" part of the command for NO press. So you split the three-way toggle into two commands: a normal command, and an down-up (pressed/NO press) command. The normal command can be Pinky Back for Nav Lights Flash. At this point putting the Pinky Switch in the middle again won't turn off a thing. Now bind Pinky Forward to Nav Lights Steady. At this point, moving it back to the middle also won't do a damn thing.

 

Now here's where the lua editing comes in. Take the d3002pnilunilcd7vd1vpnilvunil stuff and change it to d3002pnilu3002cd7vd1vpnilvu0. This gives you the toggle. As long as the Pinky Switch isn't set forward, the command will count it as "up" and send value 0 to action 3002, toggling lights off.

Link to comment
Share on other sites

Here you go Avio:

	        ["d3002pnilu3002cd7vd1vpnilvu0"] = {
		["added"] = {
			[1] = {
				["key"] = "JOY_BTN13",
			},
		},
		["name"] = "Nav Lights Steady Toggle",
	},
	["d3002pnilu3002cd7vd-1vpnilvu0"] = {
		["added"] = {
			[1] = {
				["key"] = "JOY_BTN14",
			},
		},
		["name"] = "Nav Lights Flash Toggle",
	},

 

This should work.

Link to comment
Share on other sites

On a side note, the reason for this problem is a bit technical, but not too hard to understand once you know the background (and I hope I don't screw this up, but I think I got it right; if not, I'll gladly correct any mistakes).

 

Handling of input devices such as mice and joysticks in Windows is done by a library called "DirectInput" which is part of "DirectX", both created by Microsoft.

 

Unfortunately, DirectInput has not seen any major upgrades in a long time and as far as I know we're still stuck with a maximum of 32 buttons and 8 axes per device in the age of DirectX 11 and Windows 8.

 

When creating the Warthog, Thrustmaster had to put up with and work around these limitations. First, they divided Stick and Throttle into separate DirectX devices. For the Stick, that's okay. But if you count the buttons on the Throttle and its base, they exceed 32 by far. I'm not talking about the physical knobs and switches - DirectInput doesn't care about hardware. I'm talking about their different positions.

 

For the following explanation I'll be using the Flaps switch as an example, but the same is true for other switches like Boat Switch, China Hat, ENG OPER and so on.

 

So, the Flaps switch has 3 physical positions: UP, MR, DN (Up, Maneuver, Down).

 

Thrustmaster worked around the DirectX limitation this way: the Flaps switch center position does not send a DirectX button command. From the point of view of DirectX, the Flaps switch sends these commands (according to the TARGET Device Analyzer):

  • Up: DirectX Button 22
  • Center: None, doesn't exist as far as DirectX is concerned
  • Down: DirectX Button 23

 

Thrustmaster's own software, TARGET, can easily deduct that when neither DirectX 22 nor DirectX 23 are "On", the switch must be in the center position. Thus, TARGET can easily identify the Up, Center and Down positions of this switch.

 

But from the point of view of DCS (and Windows and any other application that relies on DirectX), the Flaps switch on the Throttle base is only a 2-way switch, it only sends DirectX 22 (Up) and DirectX 23 (Down) - there is no DirectX command assigned to the center position.

 

That's why, unfortunately, we're stuck with using TARGET or finding other workarounds until Microsoft finally decides to update DirectInput so that it can include more than 32 buttons per device and Thrustmaster issues a new firmware so that the Warthog actually sends a DirectX button command for any single button position.

 

Yeah, this sucks big time, being able to address I-don't-know-how-many IP addresses per square foot of the Earth's surface but being limited to 32 buttons per DirectX device. :music_whistling:

Link to comment
Share on other sites

Thanks aeliusg. I cut and paste the codes you gave above into my lua but suddently the pinky switch does not work at all. Strange. Btw, what's the difference between "vu0" and "vunil"?

 

Make sure you've replaced your previous bindings (Nav Lights Flash/Nav Lights Off/Nav Lights Steady). You should only have Nav Lights Flash Toggle and Nav Lights Steady Toggle.

 

Also, make sure you have the modified data.lua installed: http://forums.eagle.ru/showthread.php?t=124480 (see attachment, this goes in the Scripts\Input\ folder in your DCS install)

 

"nil" is nil in the sense of a "blank". There is simply nothing, like before the big bang. "0" is the particular value which stands for Nav Lights Off when used in conjunction with action 3002, cockpit_device_id 7. The programmers could have chosen "10" for it, or even "-2000".

 

I hope you can get it working tonight. I will try TARGET tomorrow, and if you wish, I can walk you through that as well. 1.2.10 did not break the data.lua mod, but anytime they update that particular file, I suppose it will be broken.

 

EDIT: Nice explanation, Yurgon. Unfortunately, it seems Microsoft does not care. Their recent Xinput protocol is even less functional (for our purposes).


Edited by aeliusg
  • Like 1
Link to comment
Share on other sites

Thanks everyone for your great patient.

 

Finally beginning to grasp it -- managed to get it to work finally!

 

Now I tried assigning the LASTE switch to the Off/Safe/Armed functions but using the same magic didn't seem to work :-

 

["d3020pnilu3020cd9vd1vpnilvu0"] = {

["added"] = {

[1] = {

["key"] = "JOY_BTN27",

},

},

["name"] = "Armament Off/Safe/Armed Up",

},

["d3020pnilu3020cd9vd-1vpnilvu0"] = {

["added"] = {

[1] = {

["key"] = "JOY_BTN28",

},

},

["name"] = "Armament Off/Safe/Armed Down",

},

 

Any idea how I could get the codes right here? This switch should start at the bottom most position, which is Off, then Safe, then Armed. But just couldn't get it right.

 

Btw, I replaced the original data.lua file as advised. Will this affect other stuff? Also, when DCS has a new patch, will this get affected? Thanks.

 

Edit -- Noticed in the Option setting, a double-entry was created for those switches under editing, and the hotkey once assigned couldn't be Cleared off. Is it possible to delete away the duplicate entry?


Edited by Avio
Link to comment
Share on other sites

Thanks everyone for your great patient.

 

Finally beginning to grasp it -- managed to get it to work finally!

 

Now I tried assigning the LASTE switch to the Off/Safe/Armed functions but using the same magic didn't seem to work :-

 

 

["d3020pnilu3020cd9vd1vpnilvu0"] = {

["added"] = {

[1] = {

["key"] = "JOY_BTN27",

},

},

["name"] = "Armament Off/Safe/Armed Up",

},

["d3020pnilu3020cd9vd-1vpnilvu0"] = {

["added"] = {

[1] = {

["key"] = "JOY_BTN28",

},

},

["name"] = "Armament Off/Safe/Armed Down",

},

 

 

Any idea how I could get the codes right here? This switch should start at the bottom most position, which is Off, then Safe, then Armed. But just couldn't get it right.

 

Btw, I replaced the original data.lua file as advised. Will this affect other stuff? Also, when DCS has a new patch, will this get affected? Thanks.

 

Edit -- Noticed in the Option setting, a double-entry was created for those switches under editing, and the hotkey once assigned couldn't be Cleared off. Is it possible to delete away the duplicate entry?

 

This should work:

 

		["d3020pnilu3020cd9vd-1vpnilvu1"] = {
		["added"] = {
			[1] = {
				["key"] = "JOY_BTN28",
			},
		},
		["name"] = "Armament Off/Safe/Armed Down Toggle",
	},
	["d3020pnilu3020cd9vd1vpnilvu-1"] = {
		["added"] = {
			[1] = {
				["key"] = "JOY_BTN27",
			},
		},
		["name"] = "Armament Off/Safe/Armed Up Toggle",
	},

 

The commands for the Armament Toggle switch are different yet again. They only increment up and down, but as long as you have your switch in the ALT position when loading into the sim, this should still work. Replace all of your Armament Off/Safe/Armed commands in the diff.lua with only these two, and you shouldn't have any duplicates.

 

BTW, karls' data.lua only adds some extra routines so we can add new commands with the diff.lua. The change from 1.2.9 to 1.2.10 did not affect it, but I expect the EDGE update will break it totally. On the other hand, maybe ED is doing some revamping themselves, and we won't have to modify it next go around. In any case, we'll still be around to help.

 

I will try using TARGET later as it may be a more long-term solution, but it has its own drawbacks with the virtual controller stuff.


Edited by aeliusg
Link to comment
Share on other sites

Hi aeliusg, Thanks for that. Before getting your reply I did managed to get it to work, but with only the Safe and Armed positions, leaving out the Switch's Alt position. Not with PC now and can't recall what I did. I just played about with the "1" and "-1" values to get that.

 

Will take another look and try out yours and see how it goes. Thanks again.

 

Yep, let's hope the next update won't affect the lua. Only wish TM and/or DCS could make the controllers' setup a breeze for everybody. Mastering a DCS aircraft is in itself already a Huge challenge, and I'm sure most would rather spend time flying than configuring. But I must say there is satisfaction though when things work out :megalol:.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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