Jump to content

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


Recommended Posts

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

Intel 12900k @ 5.2Ghz, RTX 4090, Samsung 1TB NVME, Thrustmaster Warthog & F-18 stick, Pendular Rudder Pedals - Quest Pro

AV8B N/A UFC Build Log

AV8B N/A PCBs for sale

Link to comment
Share on other sites

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:

{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.


Edited by LeCuvier

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

Link to comment
Share on other sites

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 :)

Intel 12900k @ 5.2Ghz, RTX 4090, Samsung 1TB NVME, Thrustmaster Warthog & F-18 stick, Pendular Rudder Pedals - Quest Pro

AV8B N/A UFC Build Log

AV8B N/A PCBs for sale

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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


{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')}},


Edited by obious

Intel 12900k @ 5.2Ghz, RTX 4090, Samsung 1TB NVME, Thrustmaster Warthog & F-18 stick, Pendular Rudder Pedals - Quest Pro

AV8B N/A UFC Build Log

AV8B N/A PCBs for sale

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

{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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Interesting. How do you set the LEDs? I didn’t even know they were LEDs...

 

 

 

 

You'd have to use TARGET.

 

 

I've been fiddling with a profile that uses about 94 DX buttons and includes mapping for the Warthog stick, throttle, and TWCS throttle. Due to the 8 DX axis limit, you'd have to edit the profile's EXCLUDE statements if you wanted to swap between the throttles.

 

 

The toggle switches have all positions mapped as ON positions, so everything will be set correctly when the mission starts.

 

 

Anyone is welcome to take a look at this if they want. You'll need to put all these files in the folder your scripts are located in, and go into TARGET's file paths options and remove the Program Files location. This is so the 128 button mod will work.

DCS_TMC_128.zip

DEFENSOR FORTIS

Spoiler

Systems: Falcon NW Talon: Ryzen 9 5950X @4.9GHz, 64GB DDR4, RTX 3090 FE; Falcon NW Mach V: Core i7 3930K @3.2GHz, 32GB DDR3, GTX 1080 FE

Cockpit: MonsterTech MTX F, 42" 4K TV, HP Reverb G2, Oculus Rift S, PointCTRL

Controls: RS F16SGRH CE, RS F18CGRH, VPC T-50CM2, VFX, WarBRD (Grips); VPC T-50CM2, RS FSSB R3L (Bases); Winwing F/A-18C, VPC T-50CM3, VPC T-50CM, TM Warthog, Cougar (Throttles); VPC ACE2 (Rudders)

 

Link to comment
Share on other sites

+1 RogueSqdn

 

One can run the leds using a target script which requires one to redo the bindings a fair bit since now one has a combined devices and not a joystick and a throttle.

 

I always recommend making a quick script to combine the devices before setting up control bindings.

That way one can play with the Leds at will.

Turn on an LED with a Press in the type field of the GUI and turn them off with a release.

 

My LEDs for the Spitfire for instance have the 5 lights come on as such:

1. Brakes

2. Gear

3. Flaps

4. Rad Flap

5. Carb Filter

Backlight. WEP/MIL

Win 10 pro 64 bit. Intel i7 4790 4 Ghz running at 4.6. Asus z97 pro wifi main board, 32 gig 2400 ddr3 gold ram, 50 inch 4K UHD and HDR TV for monitor. H80 cpu cooler. 8 other cooling fans in full tower server case. Soundblaster ZX sound card. EVGA 1080 TI FTW3. TM Hotas Wartog. TM T.16000M MFG Crosswinds Pedals. Trackir 5.

"Everyone should fly a Spitfire at least once" John S. Blyth

Link to comment
Share on other sites

  • Recently Browsing   0 members

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