[truck] Trying to figure a 3-way switch from a 2-switch mix

Programing help and example for all firmwares based on thus's th9 firmware.
Post Reply
Scurvy
Posts: 13
Joined: Sat Apr 14, 2012 2:12 pm
Country: -
Location: Lower Mainland, BC

[truck] Trying to figure a 3-way switch from a 2-switch mix

Post by Scurvy »

I've just installed a dig* into my truck, but I'm already using the 3-pos switch for winch control, so I'd like to setup another 3-pos switch using 2 2-pos switches. Is this possible with custom switches? I've tried to search for others doing it but my search-fu has failed me.

*DIG: The ability to change the engagement of a set of tires. Mine is only a rear wheel DIG, but it's a 3-position, so I get 4WD, Front Wheel Drive, and Rear Wheel Locked. It's used for rock crawlers to get around very tight corners. Basically the wheel locks and won't turn, allowing you to drag the front around corners. There are some models with both front/rear digs, but mine isn't one of them.

The servo is full-right for 4WD, Center for Front wheel drive (rear-wheel just spins free), full-left for rear-wheel lock.

I'm thinking about AIL and TRN switches. When AIL is off (!AIL), the truck is 4WD. When AIL is on, the truck is 2WD. When TRN is off, listen to AIL, when TRN is on, rear dig engaged. From what I can figure, the logic is:
!AIL AND !TRN: 100
AIL AND !TRN: 0
TRN (regardless of AIL): -100

Although the +/- may be backwards.

Can someone point me in the correct direction for this mix, or am I barking up the wrong tree?
i'm using eepe and ER9x.

I'm also wondering about a rear-wheel steer mix, but one thing at a time (yes I've seen the other one, and it may provide me pointers to figure mine out as well, but I'd like to get this one working first).

Thanks!
Adam

User avatar
MikeB
9x Developer
Posts: 17995
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: [truck] Trying to figure a 3-way switch from a 2-switch

Post by MikeB »

Basically you need to use some CUSTOM SWITCHES. These are logical switches (not physical) that have many possible configurations.
Try:
CS1: AND !AIL !TRN
CS2: AND AIL !TRN

then you use SW1 and SW2 to control a mix.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
gohsthb
Posts: 1412
Joined: Wed Dec 28, 2011 2:32 pm
Country: -
Location: Naperville, IL

Re: [truck] Trying to figure a 3-way switch from a 2-switch

Post by gohsthb »

No need for custom switches at all.
These 2 mixer lines should do what you need

Code: Select all

+100% HALF Switch(!AIL)
R -100% HALF Switch(TRN)
when the AIL switch is on there will be no active mixes on the channel, so it will default to 0. Try it in Eepe.
-Gohst
Scurvy
Posts: 13
Joined: Sat Apr 14, 2012 2:12 pm
Country: -
Location: Lower Mainland, BC

Re: [truck] Trying to figure a 3-way switch from a 2-switch

Post by Scurvy »

OK, just upgraded eepe in my debian to 379, to make sure everything's up-to-date.

@gohsthb: I've tried that, but for some reason whenever I trigger the TRN switch it only takes the signal to 64, not 100. It may not make a functional difference, but in the simulator it's strange. The rest works good tho, thanks!
Hadn't ever done mixing switches before, took me a few tries to figure what the "R" meant, lol

@MikeB: That's what I had thought I needed, but couldn't figure out the magic behind them. I'll try that too, thanks!
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: [truck] Trying to figure a 3-way switch from a 2-switch

Post by jhsa »

CS1: AND !AIL !TRN
CS1 will be on only when AIL switch AND TRN switch are both off. Then you can use CS1 in a mix for example, so the mix will be on when CS1 is on. "!" means inverse, or in this case OFF.
CS2: AND AIL !TRN
Here CS2 will be on only when AIL switch is on AND TRN switch is off..

I hope this helps to understand it better ;)

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

User avatar
gohsthb
Posts: 1412
Joined: Wed Dec 28, 2011 2:32 pm
Country: -
Location: Naperville, IL

Re: [truck] Trying to figure a 3-way switch from a 2-switch

Post by gohsthb »

Check that your limits aren't set, I have mine at +/- 100 so I get -100 or 100 output on the channel I put the mixes on. Here is the file from mine.
-Gohst
Attachments
document1.eepe
Created in Eepe r379
(1.41 KiB) Downloaded 358 times
Scurvy
Posts: 13
Joined: Sat Apr 14, 2012 2:12 pm
Country: -
Location: Lower Mainland, BC

Re: [truck] Trying to figure a 3-way switch from a 2-switch

Post by Scurvy »

Sorry that I wasn't clear. I understood what he was trying to say, I've just been unable to figure the pattern I need for this myself. ;) Basically the problem I was having was that I was trying to do it with 1 custom switch, not 2.

Haven't tested the custom switch version yet, will do that now. The switch-mix almost works, still not sure why it stops at 64 and not 100 when TRN is triggered. Thanks gohsthb, I HAD set a limit then forgotten about it! I may need a limit in the end anyway, but that'll be easy enough to do after testing the concept works with a real servo installed!

Works Perfect in the simulator, thanks again!

Post Reply

Return to “er9x / gruvin9x / th9 based firmwares”