Detecting TM Warthog Toggle Switch State - Dropping the F18's hook - ED Forums
 


Notices

Reply
 
Thread Tools Display Modes
Old 11-14-2018, 01:24 PM   #1
obious
Junior Member
 
Join Date: Apr 2011
Location: London
Posts: 72
Default Detecting TM Warthog Toggle Switch State - Dropping the F18's hook

Hi All,

I've been playing around with the default.lua file of the F-18 to detect the 'off' position when a toggle switch on the TM Warthog throttle (specifically the 'Fuel Flow ENG L' toggle) is set to off/override on the physical switch. I want to use the toggle switch to map to the F-18's hook up/down switch.

So far I've been able to get it to recognise the 'off'/override setting on the TM Warthog but only after physically toggling the ENG L Fuel Flow switch from off to on first. Only then does it work

Here's what I've done in the default.lua:

{ down = gear_commands.HookHandle, up = gear_commands.HookHandle, cockpit_device_id = devices.GEAR_INTERFACE, value_down = 1.0, value_up = 0.0, name = _('Arresting Hook Handle - Down'), category = {_('Right Vertical Panel')}}

Does anyone know how to change the .lua file so that when I start DCS in the F18, it recognises the position of the switch on the TM Warthog instantly (ie flipping the toggle to 'off'/fuel flow override causes the hook to drop without having to cycle the toggle)?

Thanks
__________________
Asus Rampage IV Extreme - Intel 3930K @ 4.7Ghz - Zotac GTX 1080TI - Corsair Dominator Platinum 2400Mhz 16GB RAM - Samsung 860 Evo SSD - Thrustmaster Warthog, Pendular Rudder Pedals - Oculus Rift
obious is offline   Reply With Quote
Old 11-14-2018, 05:08 PM   #2
LeCuvier
Senior Member
 
Join Date: May 2013
Location: South of France
Posts: 1,169
Default

Your code is correct, except that it has the same name as the stock command and in reality you are using the stock command with your 2-position switch. You must use a name that's different from the name of the stock command.
Also, I hope that in the default.lua you have not forgotten to put a comma at the end of the code line.
I use this code:
Code:
{down = gear_commands.HookHandle, up = gear_commands.HookHandle, cockpit_device_id = devices.GEAR_INTERFACE, value_down =  1.0, value_up =  0.0, name = _('Arresting Hook Handle 2-Pos UP/DOWN'), category = {_('Right Vertical Panel')}},
It works fine here and I don't need to cycle the button when it was in the ON position at mission start. Of course I have ticked the option "Synchronize Cockpit Controls with HOTAS Controls at Missio Start".
PS:
You use the term "toggle switch" per the definition in good old electrical engineering. I learned the term "toggle switch" (I'm not a native English speaker) in the world of mini computers where you used to have banks of toggle switches to set/rest individual bits of a word. I quote Wikipedia:
"In some contexts, particularly computing, a toggle switch, or the action of toggling, is understood in the different sense of a mechanical or software switch that alternates between two states each time it is activated, regardless of mechanical construction. For example, the caps lock key on a computer causes all letters to be generated in capitals after it is pressed once; pressing it again reverts to lower-case letters".
The short of the long: the term "toggle switch" is ambiguous. I say "maintained 2-position switch" when I refer to a switch like the ENG FUEL FLOW switch on the WH throttle.
__________________
LeCuvier
Windows 10 Pro 64Bit | i7-4790 CPU |16 GB RAM|SSD System Disk|SSD Gaming Disk| MSI GTX-1080 Gaming 8 GB| Acer XB270HU | TM Warthog HOTAS | VKB Gladiator Pro | MongoosT-50 | MFG Crosswind Pedals | TrackIR 5

Last edited by LeCuvier; 11-14-2018 at 05:23 PM.
LeCuvier is offline   Reply With Quote
Old 11-14-2018, 06:48 PM   #3
obious
Junior Member
 
Join Date: Apr 2011
Location: London
Posts: 72
Default

Thanks LeCuvier. Turning on "Synchronize Cockpit Controls with HOTAS Controls at Mission Start" worked for the 'maintained 2-position switch' (which I imagine a lot of people, myself included, would have to google to realise I mean a toggle switch) issue I was having but there's a weird bug with the TM WH stick when doing so.

After hitting the 'Finish' button/un-pausing after loading a mission, the plane immediately sharply veers to the left without an stick input from myself and also seemingly being in the 'dead' zone. Needless to say this caused a bit of panic the first time I tried the above changes as I did so with my Rift on
__________________
Asus Rampage IV Extreme - Intel 3930K @ 4.7Ghz - Zotac GTX 1080TI - Corsair Dominator Platinum 2400Mhz 16GB RAM - Samsung 860 Evo SSD - Thrustmaster Warthog, Pendular Rudder Pedals - Oculus Rift
obious is offline   Reply With Quote
Old 11-14-2018, 07:08 PM   #4
LeCuvier
Senior Member
 
Join Date: May 2013
Location: South of France
Posts: 1,169
Default

Quote:
Originally Posted by obious View Post
T
After hitting the 'Finish' button/un-pausing after loading a mission, the plane immediately sharply veers to the left without an stick input from myself and also seemingly being in the 'dead' zone. Needless to say this caused a bit of panic the first time I tried the above changes as I did so with my Rift on
This sounds like there are multiple inputs bound to some of your axes. This happens routinely when you have installed a new module or added a game controller.
Go to Options/Controls/Axes. Scroll through all lines and remove all unwanted bindings.
__________________
LeCuvier
Windows 10 Pro 64Bit | i7-4790 CPU |16 GB RAM|SSD System Disk|SSD Gaming Disk| MSI GTX-1080 Gaming 8 GB| Acer XB270HU | TM Warthog HOTAS | VKB Gladiator Pro | MongoosT-50 | MFG Crosswind Pedals | TrackIR 5
LeCuvier is offline   Reply With Quote
Old 11-14-2018, 10:37 PM   #5
obious
Junior Member
 
Join Date: Apr 2011
Location: London
Posts: 72
Default

Yup, that seems to have been the issue; my TM MFDs were mapped to the throttle and stick axis for some reason.

One thing I've noticed about the "Synchronize Cockpit Controls..." on startup is that whilst it does activate the 2-pos switches in the sense that I don't have to cycle them for DCS to recognise their inputs, the mapped/associated cockpit switch doesn't reflect that of the 2-pos. To put simply, if the Fuel Flow ENG L 2-pos is down on my TM Warthog, the Master Arm in the Hornet (which I've mapped it) is set to ARM when I start the game (which it shouldn't; it should be set to SAFE which would reflect the TM WH). What else am I missing?

Here's what I've got so far
Code:
{down = gear_commands.HookHandle, up = gear_commands.HookHandle, cockpit_device_id = devices.GEAR_INTERFACE, value_down =  1.0, value_up =  0.0, name = _('Custom Arresting Hook Handle UP/DOWN'), category = {_('Right Vertical Panel'), _('Custom')}},
{down = SMS_commands.MasterArmSw, up = SMS_commands.MasterArmSw, cockpit_device_id = devices.SMS, value_down =  1.0, value_up =  0.0, name = _('Custom Master Arm Switch - ARM'), category = {_('Instrument Panel'), _('Master Arm Panel')}},
{down = gear_commands.LaunchBarSw, up = gear_commands.LaunchBarSw, cockpit_device_id = devices.GEAR_INTERFACE, value_down =  1.0, value_up = 0.0, name = _('Custom Launch Bar Control Switch - EXTEND/RETRACT'), category = {_('Left Vertical Panel')}},
__________________
Asus Rampage IV Extreme - Intel 3930K @ 4.7Ghz - Zotac GTX 1080TI - Corsair Dominator Platinum 2400Mhz 16GB RAM - Samsung 860 Evo SSD - Thrustmaster Warthog, Pendular Rudder Pedals - Oculus Rift

Last edited by obious; 11-14-2018 at 10:46 PM.
obious is offline   Reply With Quote
Old 11-15-2018, 12:47 AM   #6
Sokol1_br
Veteran
 
Sokol1_br's Avatar
 
Join Date: Apr 2007
Posts: 3,214
Send a message via MSN to Sokol1_br
Default

Quote:
Originally Posted by obious View Post
Yup, that seems to have been the issue; my TM MFDs were mapped to the throttle and stick axis for some reason.
This is normal, for every USB controller that you plug in computer, DCS assign the basic axes control (aileron, elevator, throttle, rudder) for then - even if this axes don't exist in the controller, example VKB T-Rudder one axis pedal. You need clear this "ghost" assignments.
Sokol1_br is offline   Reply With Quote
Old 11-15-2018, 07:56 AM   #7
LeCuvier
Senior Member
 
Join Date: May 2013
Location: South of France
Posts: 1,169
Default

The synchronization at mission start works well for the switches that are in the "ON" position. For those that are in the OFF position, I think that the default position programmed in the game overrides the physical switch position. What you observed happened probably in a mission that starts in the air. If your mission started on the ground I think the master arm switch in the cockpit would have been down.
This override does not seem to happen when the physical switch is ON. Once I had the EAC switch on the WH throttle bound to a modified command for the landing gear, that combined the "UP" and "DOWN" on a single switch.
I had for some reason left the switch in the ON position when I started a take-off mission. Shortly after mission start my landing gear started to retract and left my plane in an awkward position. So that would confirm my theory.
__________________
LeCuvier
Windows 10 Pro 64Bit | i7-4790 CPU |16 GB RAM|SSD System Disk|SSD Gaming Disk| MSI GTX-1080 Gaming 8 GB| Acer XB270HU | TM Warthog HOTAS | VKB Gladiator Pro | MongoosT-50 | MFG Crosswind Pedals | TrackIR 5
LeCuvier is offline   Reply With Quote
Old 11-15-2018, 08:15 AM   #8
LeCuvier
Senior Member
 
Join Date: May 2013
Location: South of France
Posts: 1,169
Default

Quote:
Originally Posted by Sokol1_br View Post
This is normal, for every USB controller that you plug in computer, DCS assign the basic axes control (aileron, elevator, throttle, rudder) for then - even if this axes don't exist in the controller, example VKB T-Rudder one axis pedal. You need clear this "ghost" assignments.
This is caused by code lines containg the "combos" statement in the default.lua, like
Code:
{combos = defaultDeviceAssignmentFor("roll"),    action = iCommandPlaneRoll,  name = _('Roll'), category = {_('Flight Control')}},
for axis commands.

You could delete the "combos = defaultDeviceAssignmentFor("roll")," statements from these lines, but in most cases it's easier to click the button to reset the bindings for the respective game controller and create the desired bindings from scratch. Some aircraft also have "combos" statements for switches like JOY_BTN1 for fire gun etc. which causes every game controller to have a default binding for the gun.
It's good practice, after installation of a new aircraft or addition of a game controller, to check for these default bindings and get rid of them with the Reset button before you start creating your bindings.
__________________
LeCuvier
Windows 10 Pro 64Bit | i7-4790 CPU |16 GB RAM|SSD System Disk|SSD Gaming Disk| MSI GTX-1080 Gaming 8 GB| Acer XB270HU | TM Warthog HOTAS | VKB Gladiator Pro | MongoosT-50 | MFG Crosswind Pedals | TrackIR 5
LeCuvier is offline   Reply With Quote
Old 11-16-2018, 07:02 PM   #9
Czech6
Junior Member
 
Join Date: Aug 2018
Location: Arizona
Posts: 20
Default

I got around the issue of the physical 2-way toggle being in the wrong position on start by assigning one of the five LED's at the front of the Warthog base to the "down" position of the switch (down being towards the back of the Warthog throttle base).


So, prior to loading a mission I check that I have five (toggles) down and five green (LED's). That's for a ground start. You would have to remember to change the physical setting to the opposite position prior to loading an air start mission (landing gear).


Also, I use this as part of my downwind pre-landing checklist as well as my pre-mission start, and pre-take off. Five Down and Green.
Czech6 is offline   Reply With Quote
Old 11-16-2018, 08:12 PM   #10
obious
Junior Member
 
Join Date: Apr 2011
Location: London
Posts: 72
Default

Interesting. How do you set the LEDs? I didn’t even know they were LEDs...
__________________
Asus Rampage IV Extreme - Intel 3930K @ 4.7Ghz - Zotac GTX 1080TI - Corsair Dominator Platinum 2400Mhz 16GB RAM - Samsung 860 Evo SSD - Thrustmaster Warthog, Pendular Rudder Pedals - Oculus Rift
obious is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 01:05 PM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.