Swapping Buttons Functionality

Hi!

I got my second Proffie V3 saber. It’s an upgrade from a CF8. I want to swap the 2 buttons functionality. Currently, I have the following:

#ifdef CONFIG_BUTTONS
Button PowerButton(BUTTON_POWER, auxPin, “pow”);
Button AuxButton(BUTTON_AUX, powerButtonPin, “aux”);
#endif

I swap “pow”, and “aux”, and I still get the same functionality for the buttons after compiling. Do I have to swap the middle arguments (auxPin and powerButtonPin) instead? If so, what’s the purpose of “pow” and “aux”?

Ok, so, in your example the buttons are already flip flopped, so it seems you want to unflop them.

Here’s what’s going on in that code:

Button PowerButton(BUTTON_POWER, auxPin, "pow");

There’s only two things that you care about, BUTTON_POWER and auxPin.

The former specifies the button’s function, and the latter specifies the pin that it uses.

The name in quotes is just that, a name, and it’ll show up in log information in the Serial Monitor, but doesn’t matter for functionality.

If you want to unflop them, you’d go from using auxPin with BUTTON_POWER, to using powerButtonPin with BUTTON_POWER, and vice-versa.

Please see the POD for more info:

1 Like

Yea I think you’d swap the physical pin names.

The name in quotes, i think, is also the name internally the thing gets in the code, so you’d leave those as is and just swap the pins.

1 Like

Thanks guys for the explanation :slight_smile: I was expecting it to be something silly :upside_down_face:

The “name” argument can be used in serial monitor if you want to specify button commands:

Good to know. I’m new to Proffie and don’t know many things.