Jump to content

How to set up toggle switches (a tutorial)


Recommended Posts

I find only find one "Jettison arm" in "clickabledata", and that is related to...

devices.WEAP_INTERFACE which is device 12 (not 22)

device_commands.Button_22 so the command number would be 3022 and not 3001

On this basis, I created the following line of code which seems to work:

{down = 3022, up = 3022, value_down = 1.0, value_up = -1.0, cockpit_device_id = 12, name = _('Jettison Fuse 2-Pos ARM/DISARM'), category = _('Ins Weapons Status and Control Panel PUI-800')},

But since the codes you used are totally different I'm not sure that this is really what you want. Let me know!

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

22 minutes ago, LeCuvier said:

I'm not sure that this is really what you want. Let me know!

@LeCuvier

as always... you have saved me again!

This is exactly what I needed.. I was doing some more digging and had transposed the Up/Down value with the cockpit device ID, but I think You've finally made me see the light!!

thank you , thank you, thank you!

Link to comment
Share on other sites

53 minutes ago, epolta said:

as always... you have saved me again!

@LeCuvier: Just when I think I've got this figured out,,, and start getting cocky.. I mess it all up again!

OK, Here's a few more I'm working on, but they don't seem to work and my brain hurts really bad now 😞

 

two - two position switches for autopilot altitude mode and Heading mode.

AND... one last 3 position for the landing lights.

 

HELP!

 

 

-- Work in Progress

{down = 3033, up = 3033, value_down = 1.0, value_up = 0.0, cockpit_device_id = 6, name = _('Autopilot BARO/RALT altitude hold 2-Pos'), category = _('Ins Autopilot')},
{down = 3028, up = 3028, value_down = 1.0, value_up = 0.0, cockpit_device_id = 3, name = _('Autopilot Desired heading/track 2-Pos'), category = _('Ins Autopilot')},

{down = 3044, up = 3044, value_down = 1, value_up = 0, cockpit_device_id = 1 name = _('Landing Light 3-Pos Landing/Off'), category = _('Ins Landing Lights & Voice Warning Panel')},
{down = 3044, up = 3044, value_down = -1, value_up = 0, cockpit_device_id = 1, name = _('Landing Light 3-Pos Retract/Off'), category = _('Ins Landing Lights & Voice Warning Panel')},

Link to comment
Share on other sites

Let's try the first one step by step:

1. look up "devices.AUTOPILOT" in file "devices.lua" --> cockpit_device_id device_ID = 33

2. the button number in "clickabledata.lua" = 6 --> command code = 3000 + 6 = 3006

3. The value_up value for 2-position ON/OFF switches in the Ka-50 is mostly = -1.0

Looking at your first line, it seems that you got command and device mixed up.

So let's try this:

{down = 3006, up = 3006, value_down = 1.0, value_up = -1.0, cockpit_device_id = 33, name = _('Autopilot BARO/RALT altitude hold 2-Pos'), category = _('Ins Autopilot')},

Test it in the sim, and it works. I let you tackle the other commands using the same logic - you should get there.

If you get stuck, just holler and we'll look at it again.

Best regards to sunny Arizona!

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

5 hours ago, LeCuvier said:

Let's try the first one step by step:

1. look up "devices.AUTOPILOT" in file "devices.lua" --> cockpit_device_id device_ID = 33

2. the button number in "clickabledata.lua" = 6 --> command code = 3000 + 6 = 3006

3. The value_up value for 2-position ON/OFF switches in the Ka-50 is mostly = -1.0

Looking at your first line, it seems that you got command and device mixed up.

So let's try this:


{down = 3006, up = 3006, value_down = 1.0, value_up = -1.0, cockpit_device_id = 33, name = _('Autopilot BARO/RALT altitude hold 2-Pos'), category = _('Ins Autopilot')},

Test it in the sim, and it works. I let you tackle the other commands using the same logic - you should get there.

If you get stuck, just holler and we'll look at it again.

Best regards to sunny Arizona!

I think you have officially taught me to fish! Got em working... Thanks for your patience and mentoring 🙂

Link to comment
Share on other sites

  • 4 weeks later...

@LeCuvier

I'm back with another question...

I recently swapped out my warthog throttle for a virpil, but I want to maintain the 3 position flap functionality found on the warthog. To do this, I've added a button box on the side of the throttle with a  3 position switch, but I notice in the joystick default lua there isn't a middle flap position defined, so the normal tricks you've taught me don't work 😞 I took a look at the clickable data and the device IDs and took a stab at it with no luck. Can this be done?

{down = 3002, up = 3002, cockpit_device_id = 39 , value_down = 1, value_up = 0, name = _('Flaps Up else middle'), category = _('Systems')},
{down = 3002, up = 3002, cockpit_device_id = 39 , value_down = -1, value_up = 0, name = _('Flaps Down else middle'), category = _('Systems')},

 

Link to comment
Share on other sites

@epolta: You don't give me any clue as to which aircraft this is for. The device ID's and command numbers differ from aircraft to aircraft. Also, without knowing which aircraft, I cannot test a solution

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

2 hours ago, LeCuvier said:

@epolta: You don't give me any clue as to which aircraft this is for. The device ID's and command numbers differ from aircraft to aircraft. Also, without knowing which aircraft, I cannot test a solution

Oops..

A-10C2

Link to comment
Share on other sites

Well that's easy. The file "Throttle - HOTAS Warthog.lua"   has these two lines for the 3-position flap switch:

{combos = {{key = 'JOY_BTN22'}}    ,down = iCommandPlane_FLAPS_UP, up = iCommandPlane_FLAPS_MNR_from_UP,name = _('Toggle Flaps Up'), category = _('Systems')},
{combos = {{key = 'JOY_BTN23'}}    ,down = iCommandPlane_FLAPS_DN, up = iCommandPlane_FLAPS_MNR_from_DN,name = _('Toggle Flaps Dn'), category = _('Systems')},

The statement "combos = {{key = 'JOY_BTN22'}} " creates the default binding for the TM WH throttle and is obviously useless for the VRP throttle, so we take that out of both lines and get:

{down = iCommandPlane_FLAPS_UP, up = iCommandPlane_FLAPS_MNR_from_UP,name = _('Toggle Flaps Up'), category = _('Systems')},
{down = iCommandPlane_FLAPS_DN, up = iCommandPlane_FLAPS_MNR_from_DN,name = _('Toggle Flaps Dn'), category = _('Systems')},

Paste these two lines into "default.lua". So now you can bind these commands to the 3-position switch on your button box or on the VRP throttle.

I didn't test as it seems trivial. Good luck!

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

1 hour ago, LeCuvier said:

Well that's easy. The file "Throttle - HOTAS Warthog.lua"   has these two lines for the 3-position flap switch:


{combos = {{key = 'JOY_BTN22'}}    ,down = iCommandPlane_FLAPS_UP, up = iCommandPlane_FLAPS_MNR_from_UP,name = _('Toggle Flaps Up'), category = _('Systems')},
{combos = {{key = 'JOY_BTN23'}}    ,down = iCommandPlane_FLAPS_DN, up = iCommandPlane_FLAPS_MNR_from_DN,name = _('Toggle Flaps Dn'), category = _('Systems')},

The statement "combos = {{key = 'JOY_BTN22'}} " creates the default binding for the TM WH throttle and is obviously useless for the VRP throttle, so we take that out of both lines and get:


{down = iCommandPlane_FLAPS_UP, up = iCommandPlane_FLAPS_MNR_from_UP,name = _('Toggle Flaps Up'), category = _('Systems')},
{down = iCommandPlane_FLAPS_DN, up = iCommandPlane_FLAPS_MNR_from_DN,name = _('Toggle Flaps Dn'), category = _('Systems')},

Paste these two lines into "default.lua". So now you can bind these commands to the 3-position switch on your button box or on the VRP throttle.

I didn't test as it seems trivial. Good luck!

easy for you 🙂 LOL.. As always.. Thanks!

Link to comment
Share on other sites

  • 2 weeks later...

I've got another one that's stumping me right now for the FW-190A8. I've recently updated my button box and the canopy is only an on/off switch. I'm trying to get the switch to close the canopy when pressed, and open the canopy when "un-pressed". I haven't seen these before. This is what I'm trying but it doesn't seem to work. Anyone have any ideas? Thanks!

 

{pressed = device_commands.Button_2, released = device_commands.Button_2, cockpit_device_id  = devices.CPT_MECH, value_pressed = 1.0, value_released = -1.0, name = _('Canopy Closing else Opening'), category = _('Systems')},

 

 

Link to comment
Share on other sites

@epolta: you got creative there! I don't recall ever seeing the event "released".

I tried a few things, including replacement of "released" with "up" and using "device_commands.Button_1", but that didn't help.
When I increased "value_down" to 4.0 the command actually pushed the throttle to FULL and my fighter (on the runway) stood with its tail in the air. Really weird!

I also tried increasing the gain, no effect.

So after all kinds of messing around I had to give up. This command needs to be used with a pair of pushbuttons, or a 3-position ON1-OFF-ON2 switch. I use the Autopilot switch on my TM WH throttle.

Sorry I couldn't help you.

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

5 hours ago, LeCuvier said:

@epolta: you got creative there! I don't recall ever seeing the event "released".

I tried a few things, including replacement of "released" with "up" and using "device_commands.Button_1", but that didn't help.
When I increased "value_down" to 4.0 the command actually pushed the throttle to FULL and my fighter (on the runway) stood with its tail in the air. Really weird!

I also tried increasing the gain, no effect.

So after all kinds of messing around I had to give up. This command needs to be used with a pair of pushbuttons, or a 3-position ON1-OFF-ON2 switch. I use the Autopilot switch on my TM WH throttle.

Sorry I couldn't help you.

No problem.. Thanks for looking! I was definitely scratching my head on this one and like a good student, I wanted to show the teacher my work... LOL.. OK, swapping that switch back to an On/Off/On as I'm encountering many modules that seem to require that functionality for canopy controls.

Link to comment
Share on other sites

Has anyone had any luck, or would it even be possible to add bindings in the A-10C2 for:

AAP Steerpoint Selector Knob CW & CCW

AAP CDU Selector Knob CW & CCW

CMS Mode Selector CW & CCW

I'd like to use rotary encoders to be able to switch between the respective modes, but don't see a binding or a way in clickable data to enable that functionality?

 

thanks!

Link to comment
Share on other sites

In "clickabledata.lua" these are all implemented with the "multiposition_switch_limited" object, and that does not support increment/decrement commands like CW/CCW. It works with absolute command values like 0.0, 0.1, 0.2... for positions 0, 1, 2...

Thus, works the same as the bindable commands in "default.lua" which take one pushbutton for each position. Designed for people with unlimited number of inputs. Ridiculous!

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

18 minutes ago, LeCuvier said:

In "clickabledata.lua" these are all implemented with the "multiposition_switch_limited" object, and that does not support increment/decrement commands like CW/CCW. It works with absolute command values like 0.0, 0.1, 0.2... for positions 0, 1, 2...

Thus, works the same as the bindable commands in "default.lua" which take one pushbutton for each position. Designed for people with unlimited number of inputs. Ridiculous!

I agree! When I built my button box I wanted to utilize the rotaries because they are more flexible - vs the rotary dials. I think I can get by by binding each rotary to AAP Steerpoint Selector Knob: Flight Plan/Mission vs CW/CCW etc.. I'll be missing a few bindings but can probably make it work.

Link to comment
Share on other sites

Has there been changes since June 2020 as to what file to edit?

Thanks to this thread I did some changes to my Viggen and Fw190A8 switches for my TM Warthog throttle back in May last year.

Those changes worked great and were saved in the Throttle - HOTAS Warthog.lua file.

Since June I haven't had time for DCS but when I came back to fly now I noticed that updates had removed my changes. Fortunately I had backups of them.

But after restoring the backup Throttle - HOTAS Warthog.lua file I still don't see the mappings I made in DCS.

Link to comment
Share on other sites

You have probably started DCS World after updates but before you restored the modified file. So the program did not find your custom commands and therefore deleted the bindings to them.

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

24 minutes ago, LeCuvier said:

You have probably started DCS World after updates but before you restored the modified file. So the program did not find your custom commands and therefore deleted the bindings to them.

No, the custom commands are still there in the Throttle - HOTAS Warthog.lua file but I can't find them anymore in DCS. That's why I was beginning to wonder if this file is no longer used and changes need to be made to the default.lua file instead...
It's located under D:\Games\DCS World\Mods\aircraft\FW-190A8\Input\FW-190A8\Joystick\

Link to comment
Share on other sites

I suspect that ED has added/changed commands since you created the modified file. You should probably add your custom commands to the current stock file. Also make sure that ED hasn't created the same commands as you have added. If they have, don't add that command to the new file.

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

Hi guys, I need help assigning a rotary encoder to the BINGO dial for the AV8B. There is no coding in the joystick LUA file whatsoever but it is clickable. 

 

I am trying to create 2 lines in the joystick LUA.  In the clickabledata.lua this is the line for the BINGO dial:

 

elements["PTN_380"] = default_axis_cycle(_("Bingo Fuel Set Knob"),                            devices.FQIS, fqi_commands.BingoSet,        380, 0, 0.01, false)
 

 

I want to assign a rotary encoder to it so that when I rotate the knob clockwise the bingo fuel number increase and decreases with a anti-clockwise rotation. I have been trying for several hours now to get this coding done but have no success. I think the problem is that it's "axis-cycle" and I have no idea how to code this. Any ideas?

Link to comment
Share on other sites

I tried to create commands for the Bingo Fuel Knob:

1. for pushbuttons or rotary encoder: I could only increment/decrement the value by 1.
   I had the same problem earlier, trying to create commands for the UFC COMM1 and COMM2 Knobs.

2. axis: I could apparently set it over the full range (slider, set to invert) but it acts in a somewhat weird manner. I believe that the clickable cockpit control is not working right.
   I insert the line of code for the "Axis" section of the file, but I don't think that anybody would want to use it.

{action = 3380, cockpit_device_id = 21, name = _('Bingo Fuel Knob Axis')}, -- acts in a weird manner

 

  • Thanks 1

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

2 hours ago, Bbow said:

Hmmm, strange one. So with the rotary encoder, value of 1 does that mean changing the Bingo fuel from 0000 to 0100 , 0200, 0300 etc etc? Because that is how it should be. 

 

 

no, just 0001 and only once. Totally useless.

  • Thanks 1

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

  • Recently Browsing   0 members

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