Jump to content

Help with lua controls


Recommended Posts

A while back I made an electrical control panel box for use with the A-10C using a Teensy board. I'm using on-off switches in thinking I was going to use helios which works fine, but I've now I've decided to not use helios to control the switches because I like to keep resources low. I've modified the teensy .lua file to work with the switches but the problem is that for the electrical switches they buttons can become unsynchronized at start up or in air or runway starts the electrical systems shut off briefly then go back to the on position.

 

Here is an example of one of the lines I'm using:

{combos = {{key = "JOY_BTN5"}, }, down = iCommandPowerGeneratorLeft, up = iCommandPowerGeneratorLeft, name = "AC generator power left", category = "Electrical power control panel"},

 

For other commands, like the ones for the TM Warthog hotas which look like this:

{combos = {{key = "JOY_BTN15"}, }, down = iCommandPlane_HOTAS_LeftThrottleButton, up = iCommandPlane_HOTAS_LeftThrottleButton_Off, name = "HOTAS Left Throttle Button", category = "HOTAS"},

 

You can see there is on off command for the throttle. I'm wondering if there is a similar function to the electrical or other systems as well to try and save a bit of work so I don't have to rewrite my teensy code.

 

I'm fairly new to editing the lua files so forgive me if the answer is obvious.

Link to comment
Share on other sites

I haven't used the Teensy Board, but maybe this would help.

 

 

 

 

:pilotfly:

[sIGPIC][/sIGPIC]

Win7 Pro 64 | Asus Rampage III Extreme |Swiftech H2O cooled: CPU, Video, N. Bridge | i7 980X EE @4.5GHz | 16 GB DDR3 @1726 MHZ | AMD R9 290X 4GB DDR5 +EK H2O block+Backplate | BenQ XL2730Z 2560x1440 @144Hz | Samsung 850 EVO SSD 500GB | 2 - Samsung HD 1TB | Pinoeer BD-RW | ASUS Xonar DX 7.1 PCIe Audio | CoolerMaster Haf-X case | PC Power & Cooling Silencer 760W PS | HOTAS Cougar w/Evenstrain Mod | HOTAS Warthog | TM RCS Rudders + Mods | TM MFD's w/monitors | TrackIR5

Link to comment
Share on other sites

Thanks for the reply but that doesn't help me unfortunately. That's what inspired me to create mine though! He's using on-on switches if I remember right and I'm using on-off. I chose mine to save on inputs because the idea was the make the box modular and add more panels in the future (until I sadly later found out that a controller can only have a max of 32 inputs). Looks like my options are to run Helios, modify my code, or buy different switches at this point.

Link to comment
Share on other sites

I would look at it again. When I looked at his videos he was using ON-OFF or ON-OFF-ON switches. That's what I use. I think I have the right thread, the one by Tigershark.

 

Yes there is a USB limit to 32 buttons but somewhere on the forums a guy made a berakout board that had many more switch positions if I remember correctly.

 

 

 

:pilotfly:


Edited by CubPilot

[sIGPIC][/sIGPIC]

Win7 Pro 64 | Asus Rampage III Extreme |Swiftech H2O cooled: CPU, Video, N. Bridge | i7 980X EE @4.5GHz | 16 GB DDR3 @1726 MHZ | AMD R9 290X 4GB DDR5 +EK H2O block+Backplate | BenQ XL2730Z 2560x1440 @144Hz | Samsung 850 EVO SSD 500GB | 2 - Samsung HD 1TB | Pinoeer BD-RW | ASUS Xonar DX 7.1 PCIe Audio | CoolerMaster Haf-X case | PC Power & Cooling Silencer 760W PS | HOTAS Cougar w/Evenstrain Mod | HOTAS Warthog | TM RCS Rudders + Mods | TM MFD's w/monitors | TrackIR5

Link to comment
Share on other sites

Alright so I watched his 3rd video and he is using on-off switches as well, but it looks like according to the lua he had that it would have the same problem I would be having in that the switches won't be synced if I start with them in the wrong position.

 

Quick update the systems shutting off during a hot start, I was able to fix that with a small change in the code, but that still leaves the problem of switches not synced at start if left in wrong position.


Edited by kk0425
Link to comment
Share on other sites

Yes, that happens. There is an option that you can check in the UI screen, it might be under the Misc. Tab that says something like Sync switches on startup or something of that nature. Check mark that item.

 

So, start the Sim, PAUSE it, manually sync your physical switches to the position the virtual switches are at, then un-pause and if the LUA is modified correctly (if needed) your switches should stay in sync during the time you spend in the sim.

 

The need to sync some switches at startup is the price we pay to have physical switches.

 

 

 

:pilotfly:

  • Like 1

[sIGPIC][/sIGPIC]

Win7 Pro 64 | Asus Rampage III Extreme |Swiftech H2O cooled: CPU, Video, N. Bridge | i7 980X EE @4.5GHz | 16 GB DDR3 @1726 MHZ | AMD R9 290X 4GB DDR5 +EK H2O block+Backplate | BenQ XL2730Z 2560x1440 @144Hz | Samsung 850 EVO SSD 500GB | 2 - Samsung HD 1TB | Pinoeer BD-RW | ASUS Xonar DX 7.1 PCIe Audio | CoolerMaster Haf-X case | PC Power & Cooling Silencer 760W PS | HOTAS Cougar w/Evenstrain Mod | HOTAS Warthog | TM RCS Rudders + Mods | TM MFD's w/monitors | TrackIR5

Link to comment
Share on other sites

Fair enough. I'm trying to figure out why some switches are not synched and some are during a hot start only. Can't see why it would be different for some since they are all setup the same way with a loop in the the teensy board.

 

Hot start in MP really isn't too much of an issue since most servers have the plane set to cold anyway, and I prefer cold starts whenever possible.

 

Thanks for all your help, I'll keep picking away at it and see if I can find a solution.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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