Jump to content

How to set up toggle switches (a tutorial)


Recommended Posts

Something has changed in one of the updates for me.... this mod doesn't seem to be working anymore for the F/A 18....

 

 

Could you please take a look for me?

 

 

Thanks,

Phil

@Phil, that mod is for the A-10C, and it is working here. I just tested it. I didn't actually try a takeoff or landing run, but I see the button in the landing gear panel going up and down.

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

@Phil, that mod is for the A-10C, and it is working here. I just tested it. I didn't actually try a takeoff or landing run, but I see the button in the landing gear panel going up and down.

 

 

 

 

Rats! LOL... yep, my post was asking originally for Anti Skid for A10C!

 

 

Many apologies.... well.. in that case.. can you do the same for the F/A18 as well please? Anti-skid lines for on and off..

 

 

 

And since I'm sticking my neck out all the way, could you also look at "Hook Bypass".. a separate line for Field and one for Carrier? (also for F/A 18C)

 

 

Your ability to configure these things never ceases to amaze me!!

 

 

Phil

Link to comment
Share on other sites

The F/A-18C already has 2 separate lines for "Anti Skid Switch - ON" and "Anti Skid Switch - OFF".

For the Hook Bypass switch, try these:

{down = cptlights_commands.HookBypass, cockpit_device_id = devices.CPT_LIGTHS, value_down =  -1.0,    name = _('Hook Bypass Switch FIELD'), category = {_('Left Vertical Panel')}},
{down = cptlights_commands.HookBypass, cockpit_device_id = devices.CPT_LIGTHS,    value_down =  1.0,    name = _('Hook Bypass Switch CARRIER'), category = {_('Left Vertical Panel')}},

I did them quickly, it's 1:30 A.M. and I need my beauty sleep, so I let you test 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

The F/A-18C already has 2 separate lines for "Anti Skid Switch - ON" and "Anti Skid Switch - OFF".

For the Hook Bypass switch, try these:

 

I did them quickly, it's 1:30 A.M. and I need my beauty sleep, so I let you test them.

 

 

Thanks for that quick mod...

 

I have just tested it & it's almost there.... I had to switch the value_down values :

 

{down = cptlights_commands.HookBypass, cockpit_device_id = devices.CPT_LIGTHS, value_down =  1.0,    name = _('Hook Bypass Switch FIELD'), category = {_('Left Vertical Panel')}},
{down = cptlights_commands.HookBypass, cockpit_device_id = devices.CPT_LIGTHS,    value_down =  -1.0,    name = _('Hook Bypass Switch CARRIER'), category = {_('Left Vertical Panel')}},

 

 

Nice 1 - thanks yet again for your help... :thumbup:

 

 

Phil

Link to comment
Share on other sites

...I have just tested it & it's almost there.... I had to switch the value_down valuesl

Thanks for pointing that out! I use a single line of code for a maintained 2-position switch, and I had just split that up for you. And yes, my switch operated in reverse...

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

@LeCuvier, thanks to your awesome explanations and patience, I managed to wrap up a "instant zoom" mod.

It's here : https://www.digitalcombatsimulator.com/fr/files/3311376/

Zip - VEAF :pilotfly:

 

If you want to learn, talk and fly with french-speaking friends, the Virtual European Air Force is here for you ! Meet us on our Discord and our forum

If you're a mission creator, you may want to check the VEAF Mission Creation Tools (and its GitHub repository) a set of open-source scripts and tools that make creating a dynamic mission a breeze !

Link to comment
Share on other sites

LeCuvier, Would you be able to tell me where i went wrong wit the code below? it seems i can get it half working but not totally.

 

This is a 3 position switch (On-Off-On) for IR Cool. I can get it to read 2 postions but not the third position. Any thoughts? Below is the code.

 

{ down = SMS_commands.IRCoolingSw, cockpit_device_id = devices.SMS, value_down = 0.2, name = _('IR Cooling Switch - ORIDE'), category = {_('Instrument Panel')}},

{ down = SMS_commands.IRCoolingSw, cockpit_device_id = devices.SMS, value_down = 0.1, name = _('IR Cooling Switch - NORM'), category = {_('Instrument Panel')}},

{ down = SMS_commands.IRCoolingSw, cockpit_device_id = devices.SMS, value_down = 0.0, name = _('IR Cooling Switch - OFF'), category = {_('Instrument Panel')}},

 

I tried with, but i couldnt get it to work right

 

{ down = SMS_commands.IRCoolingSw, up = SMS_commands.IRCoolingSw, cockpit_device_id = devices.SMS, value_down = 0.0, value_up = 0.1, value_up = 0.2, name = _('IR Cooling Switch - 3 Pos Switch'), category = {_('Instrument Panel')}},

Link to comment
Share on other sites

I got it! however the code looks messy to me. Maybe you have a more elegant solution?

 

{ down = SMS_commands.IRCoolingSw, cockpit_device_id = devices.SMS, value_down = 0.2, value_down = 0.1, name = _('IR Cooling Switch - ORIDE'), category = {_('Instrument Panel')}},

--{ down = SMS_commands.IRCoolingSw, cockpit_device_id = devices.SMS, value_down = 0.1, name = _('IR Cooling Switch - NORM'), category = {_('Instrument Panel')}},

--{ down = SMS_commands.IRCoolingSw, cockpit_device_id = devices.SMS, value_down = 0.0, name = _('IR Cooling Switch - OFF'), category = {_('Instrument Panel')}},

{ down = SMS_commands.IRCoolingSw, up = SMS_commands.IRCoolingSw, cockpit_device_id = devices.SMS, value_down = 0.0, value_up = 0.1, name = _('IR Cooling Switch 3 POS'),

Link to comment
Share on other sites

@Gonzo:

1. You could have saved me a few minutes by stating that this is for the Hornet!

2. Your first line has 2 "value_down" statements. That doesn't make a lot of sense. The second one should be "value_up".

3. I suppose you want to use a 3-position switch, similar to the flaps or autopilot switch on the TM WH Throttle. Here is how I would write them:

{down = SMS_commands.IRCoolingSw, up = SMS_commands.IRCoolingSw, cockpit_device_id = devices.SMS, value_down =  0.2, value_up =  0.1, name = _('IR Cooling Switch - ORIDE/NORM'), category = {_('Instrument Panel')}},
{down = SMS_commands.IRCoolingSw, up = SMS_commands.IRCoolingSw, cockpit_device_id = devices.SMS, value_down =  0.0, value_up =  0.1, name = _('IR Cooling Switch - OFF/NORM'), category = {_('Instrument Panel')}},

I didn't have time to test, but it should work.

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

@Gonzo:

1. You could have saved me a few minutes by stating that this is for the Hornet!

2. Your first line has 2 "value_down" statements. That doesn't make a lot of sense. The second one should be "value_up".

3. I suppose you want to use a 3-position switch, similar to the flaps or autopilot switch on the TM WH Throttle. Here is how I would write them:

{down = SMS_commands.IRCoolingSw, up = SMS_commands.IRCoolingSw, cockpit_device_id = devices.SMS, value_down =  0.2, value_up =  0.1, name = _('IR Cooling Switch - ORIDE/NORM'), category = {_('Instrument Panel')}},
{down = SMS_commands.IRCoolingSw, up = SMS_commands.IRCoolingSw, cockpit_device_id = devices.SMS, value_down =  0.0, value_up =  0.1, name = _('IR Cooling Switch - OFF/NORM'), category = {_('Instrument Panel')}},

I didn't have time to test, but it should work.

 

my apologies and thank you!

Link to comment
Share on other sites

  • 2 weeks later...

So here is one for you...

 

I have built a button box with several rotary Encoders which I am hoping to use for a number of dials in the A-10C.

Most of them are working as planned, but I am having trouble with some of the binds that are of the type multi-position_switch_limited

The example below is from clickabledata.lua for the A-10C and is the UHF Radio 100Mhz and 10Mhz dials.

 

elements["PTR-ANARC164-100MHZ-SELECTOR"] 	= multiposition_switch_limited(_("100 MHz Selector") , devices.UHF_RADIO, device_commands.Button_2, 162, 3, 0.1)
elements["PTR-ANARC164-10MHZ-SELECTOR"] 	= multiposition_switch_limited(_("10 MHz Selector"), devices.UHF_RADIO, device_commands.Button_3, 163, 10, 0.1)

 

Based on that I would think the operation of both would be the same the only difference apart from the Button number and Argument Number as expected is the number of arguments.

 

from the default.lua in the joystick folder you have these binds already

 

{down = iCommandPlaneUHF100MhzSelector1					, name = _('UHF 100Mhz selector switch 1'), category = _('UHF Radio')},
{down = iCommandPlaneUHF100MhzSelector2					, name = _('UHF 100Mhz selector switch 2'), category = _('UHF Radio')},
{down = iCommandPlaneUHF100MhzSelector3					, name = _('UHF 100Mhz selector switch 3'), category = _('UHF Radio')},
{down = iCommandPlaneUHF100MhzSelectorA					, name = _('UHF 100Mhz selector switch A'), category = _('UHF Radio')},
{down = iCommandPlaneUHF10MhzSelectorDec				, name = _('UHF 10Mhz selector decrease'), category = _('UHF Radio')},
{down = iCommandPlaneUHF10MhzSelectorInc				, name = _('UHF 10Mhz selector increase'), category = _('UHF Radio')},

 

as you can see for the 100Mhz Selector you have a bind for each position but for the 10Mhz dial there is a bind for Increase and Decrease, which when I bind them in game they work as I expect, each click of the encoder increases or decreases the digit by 1, but I cannot find a way to make the 100Mhz selector work in the same way.

 

I have tried the following but all that happens is the encoder changes them between position 1 and position 2 (In Pit values of 2 and 3 respectively)

{down = 3002, cockpit_device_id = 54,	value_down = 0.1	, name = _('UHF 100 MHz Selector Increase '), category = _('Button Box Special')},
{down = 3002, cockpit_device_id = 54,	value_down = -0.1	, name = _('UHF 100 MHz Selector Decrease '), category = _('Button Box Special')},

 

I cannot find anyway to make the button press increase the value by 0.1 instead of send the value of 0.1 if it is possible.

 

Any and all help would be appreciated


Edited by goldleader
Punctuation

i9-9900KS CPU @ 5.1GHz, Win10 Pro 64bit, Gigabyte Z390 Master Mobo, Corsair Vengance 64GB 3000Mhz Ram, 1 x ADATA SX8200 Pro 1Tb Drive (OS), 1 x ADATA SX8200 Pro 512Gb Drive (DCS), 1 x RTX 2080Ti AORUS Waterforce 11Gb, 3 x 27" ACER Predator 2560x1440px, 27" LG 2560x1440px HP Reverb G2, TrackIR5, HOTAS Warthog Throttle and Stick, 3 x HOTAS Cougar MFCDs, Elgato Streamdeck & Streamdeck XL

Link to comment
Share on other sites

I had tried that a long time ago and finally gave up.

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 had tried that a long time ago and finally gave up.

 

I had a feeling that would be the answer, :( I found a workaround which while not perfect will suffice.

Have just mapped two positions that are most used to those encoders, not perfect but will do.

i9-9900KS CPU @ 5.1GHz, Win10 Pro 64bit, Gigabyte Z390 Master Mobo, Corsair Vengance 64GB 3000Mhz Ram, 1 x ADATA SX8200 Pro 1Tb Drive (OS), 1 x ADATA SX8200 Pro 512Gb Drive (DCS), 1 x RTX 2080Ti AORUS Waterforce 11Gb, 3 x 27" ACER Predator 2560x1440px, 27" LG 2560x1440px HP Reverb G2, TrackIR5, HOTAS Warthog Throttle and Stick, 3 x HOTAS Cougar MFCDs, Elgato Streamdeck & Streamdeck XL

Link to comment
Share on other sites

I had a feeling that would be the answer, :( I found a workaround which while not perfect will suffice.

Have just mapped two positions that are most used to those encoders, not perfect but will do.

Pretty much the same here. What's the "A" position for anyway?

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 weeks later...

Bonjour LeCuvier....

 

Could I please call on your skills yet again?

 

Mirage 2000, Drag Chute line :

 

{down = iCommandPlaneParachute, name = _('Drag Chute DEPLOY'), category = _('Flight Control')},

Is it possible to create a 2-button entry?

 

i.e. deploy chute

undeploy(?) chute

 

Thanks in advance,

Phil

Link to comment
Share on other sites

2-Button command for M2000 Drag Chute

 

Voilà:

{down = 3457, cockpit_device_id = 22, value_down = -1.0, name = _('Drag Chute Lever FORW'), category = _('Flight Control')},    
{down = 3457, cockpit_device_id = 22, value_down = 1.0, name = _('Drag Chute Lever AFT'), category = _('Flight Control')},

These 2 lines added to the "default.lua" provide the bindings for 2 separate commands. The command 'Drag Chute Lever AFT' pulls the lever backwards to deploy the chute (Sortie). 'Drag Chute Lever FORW' will push the lever forward to drop the chute (Larguer). I have tested and the commands work fine.


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

As always.... thank you

 

 

Phil

 

 

p.s. I'd love to know where you find what the device IDs are....

 

 

"devices.lua"

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

  • 3 months later...

Ok, I am grealy confused.

 

I have the Winwing throttle and F-18 startup panel. I can map it just fine on the F-18, but I'm trying to set up bindings for the A-10C and A-10C II, and running into an issue.

 

The startup panel has toggle switches for L GEN and R GEN. I'd like to map these to (naturally enough) the left and right AC generators for the Warthog.

 

However, there are no on/off bindings in the default.lua for these functions, there is only:

{down = iCommandPowerGeneratorLeft , name = _('AC generator power left'), category = _('Electrical power control panel')},

{down = iCommandPowerGeneratorRight , name = _('AC generator power right'), category = _('Electrical power control panel')},

 

 

 

Is it possible to set up bindings for these such that Button 7 on the startup panel (the "up" position of the L GEN toggle switch) turns ON the AC generator power left, and the Button 8 on the startup panel (the "down" position of the L GEN toggle switch) turns OFF the AC generator power left? And likewise, button 21 (R GEN toggle switch "up") turns ON the AC generator power right, and button 22 (R GEN toggle switch "down") turns it off?

 

EDIT: Never mind, I am completely blind, it seems. Someone asked not exactly this same question, but a very similar one, just a couple of pages back and I somehow overlooked it. I was able to work out the answer from there. Here it is, for anyone else who might need the example:

{down = iCommandPowerGeneratorLeft, cockpit_device_id = 1, value_down = 1.0, name = _('Left AC Generator PWR'), category = _('Electrical power control panel')},

{down = iCommandPowerGeneratorLeft, cockpit_device_id = 1, value_down = 0.0, name = _('Left AC Generator RESET/OFF'), category = _('Electrical power control panel')},

{down = iCommandPowerGeneratorRight, cockpit_device_id = 1, value_down = 1.0, name = _('Right AC Generator PWR'), category = _('Electrical power control panel')},

{down = iCommandPowerGeneratorRight, cockpit_device_id = 1, value_down = 0.0, name = _('Right AC Generator RESET/OFF'), category = _('Electrical power control panel')},

 

 

EDIT 2: Nope. Still broken in air starts. Works correctly in ground starts. I don't know what is going on here.

 

EDIT 3: Looks like this switch is only set up as a pushbutton even in the clickable data, so i guess it isn't actually possible to bind it to a 2-position switch and have it work the way it's supposed to. That's exceedingly aggravating. If anyone happens to know of a way to make this work correctly, please let me know.

Link to comment
Share on other sites

@Wildwind: Commands like "iCommand..." generally don't use arguments, and if you include any they are simply ignored.

I created these new lines for your "default.lua":

{down = 3004, cockpit_device_id = 1 , value_down = 1.0, name = _('AC Gen Left Power ON'), category = _('Electrical power control panel')},
{down = 3004, cockpit_device_id = 1 , value_down = 0.0, name = _('AC Gen Left Power OFF'), category = _('Electrical power control panel')},
{down = 3005, cockpit_device_id = 1 , value_down = 1.0, name = _('AC Gen Right Power ON'), category = _('Electrical power control panel')},
{down = 3005, cockpit_device_id = 1 , value_down = 0.0, name = _('AC Gen Right Power OFF'), category = _('Electrical power control panel')},

and they should work for you.

The command numbers come from "clickabledata.lua" (button number + 3000), and the device _id numbers from "devices.lua".

PS: if you want to use maintained 2-position switches (like what the Hog's cockpit actually has) then you would need these 2 lines instead of the 4 above (ON and OFF command in one binding):

{down = 3004, up = 3004, cockpit_device_id = 1 , value_down = 1.0, value_up = 0.0, name = _('AC Gen Left Power 2-Pos ON/OFF'), category = _('Electrical power control panel')},
{down = 3005, up = 3005, cockpit_device_id = 1 , value_down = 1.0, value_up = 0.0, name = _('AC Gen Right Power 2-Pos ON/OFF'), category = _('Electrical power control panel')},

  • Like 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 weeks later...

Okay guys, I'm beyond frustrated at this point, hopefully someone can help me out. I have read through this thread and I have tried several different things that are mentioned on here and none of them work so far. I am trying to get a simple ON-OFF Toggle Switch, or even an ON-ON toggle switch, to work for the A10-C for functions that only have one selection, like the Battery PWR or the APU GEN PWR. I have tried the different .lua command lines suggested on here, none of them have worked. I tried using an ON-ON switch like someone used, by wiring a separate wire from each ON side of the switch to block a connecter and then connecting a wire from the block connecter to an input on the Groovy Game Gear GP-WIZ40 card and then the ground terminal on the switch to the ground input on the GP-WIZ40, and it doesn't work. I figure that doesn't work because since both ON terminals are connected thru the block connector, it's continually sending a signal that it's ON, so it's confused and or just doesn't work. Apparently it worked for someone else, not sure how though, and they didn't do anything with the .lua file. Can someone PLEASE help me figure this out. I have ON-OFF switches and I have ON-ON switches that I can use. I'm familiar on how to edit the default.lua file, but any of the lines suggested for ON-OFF toggle switches for single function assignments has not worked for me. Thanks!!

Windows 10

ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO

intel i7-8700k (Not overclocked)

16 GB Ram

EVGA GeForce GTX 108ti SC Black Edition

SSD

Trackir

Link to comment
Share on other sites

To kenpilot

Is your controler card showing inside of game? There should be 3 tabs on back of switch or 2 or maybe 6 depending on type of switch, so with the 3 or 6 tabs center tab is signal in  then top and bottom tab is signal out. With 2 tab it doesn't matter which one you use for signal in. A picture of your wire job would be helpful. I use arduinos and dcs-bios but that is a whole new ball of worms.

16080631553867476148008828801331.jpg


Edited by Chickenbone72
Link to comment
Share on other sites

31 minutes ago, Chickenbone72 said:

To kenpilot

Is your controler card showing inside of game? There should be 3 tabs on back of switch or 2 or maybe 6 depending on type of switch, so with the 3 or 6 tabs center tab is signal in  then top and bottom tab is signal out. With 2 tab it doesn't matter which one you use for signal in. A picture of your wire job would be helpful. I use arduinos and dcs-bios but that is a whole new ball of worms.

16080631553867476148008828801331.jpg

 

 

Yes, DCS recognizes the Groovy Game Gear Card. My ON-ON switch has 3 terminals.  I have a wire connected to the top (#1) termina of the switch and that wire goes to a block connector screw terminal, I then have a wire connected to the middle terminal (#2) of the switch that I connect to the GND terminal of the Groovy Game GP-WIZ40 card. Then I have a wire connected to the bottom terminal (#3) of the switch that is then connected to the same block connector, but under a different screw terminal. I have a jumper that connects all of the screw terminals on the block connector. I then have a wire that is connected under another screw terminal on the block connector that is then connected to the A input of the Groovy Game GP-WIZ40 card. Does that make sense? If not, I'll go take a picture. 

Windows 10

ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO

intel i7-8700k (Not overclocked)

16 GB Ram

EVGA GeForce GTX 108ti SC Black Edition

SSD

Trackir

Link to comment
Share on other sites

  • Recently Browsing   0 members

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