3 position switch compatibility

I wasn’t sure where this put in, but being wiring, thought I would try here. I also searched and didn’t see what I was looking for.

I have an E11 blaster kit I need to start on and plan the electronics out. It came with a fire selector switch in the grip. I has 4 pins - G, 1, 2, 3. (I assume, I need to meter it)

Is the blaster prop ready for this kind of switch to set stun/kill/auto? How would I wire that?
Maybe G to GND, “stun” position to BTN1, “fire” to BTN2, and “auto” to BTN3? That would essentially change any position to a long press, so I assume some prop changes are needed.

No, but it wouldn’t be that hard to fix.
Easiest thing would be to set it up as three latching switches, and then you would need to add some cases to the prop to make it work. (Latching switches only have EVENT_LATCH_ON and EVENT_LATCH_OFF, no long-, short- or double-clicks.)

I also realized I would need the 2 regular buttons as well.

Would I set these buttons in the config for the blaster? Something like this:

#ifdef CONFIG_BUTTONS
Button PowerButton(BUTTON_POWER, powerButtonPin, "pow");
Button AuxButton(BUTTON_AUX, auxPin, "aux");
Button LatchingButton(BUTTON_1, aux2Pin, "b1");
Button LatchingButton(BUTTON_2, rxPin, "b2");
Button LatchingButton(BUTTON_3, txPin, "b3");
#endif

There is no BUTTON_1/2/3.
You can see all the available button names here:

For a blaster, you probably want BUTTON_FIRE, but beware that it as the same number as BUTTON_UP and BUTTON_TRIGGER_FOUR

Now the good news is that latching events are not the same as regular button events, so you can actually re-use the same button IDs for this switch, and it would still work.

For instance, you could use BUTTON_TRIGGER_ONE/TWO/THREE for the three latching buttons, but you would have to make sure that there are no latching events for BUTTON_POWER in your prop, since it would be the same as BUTTON_TRIGGER_ONE.

1 Like

It occurs to me that two latching switches might be enough.
If neither is “on”, then it must be the third state.