I want to wire up a hilt so that it can either be set to run with normal two-button configs, or one button configs with the Power button duplicated, and I just want to check the syntax.
That should give you a compile error (double define error), I think?
But you could try:
#define NUM_BUTTONS 2
Button PowerButton(BUTTON_POWER, powerButtonPin, "pow1");
// Button "name" ("EVENT_RELEASED", pin, "message for serial monitor"
// don't change the button names (decide which event will be released, choose correct pin, "message for serial monitor can be whatever you want")
Button AuxButton(BUTTON_POWER, auxPin, "pow2");
You can have 2 buttons “doing the same thing” but your prop would have to be modified to accommodate the fact that they do the same thing.
Or you’d need to wire them both in parallel (same pin & NUM_BUTTONS 1)
The prop relies heavily on ifdefs that point to NUM_BUTTONS, like #if NUM_BUTTONS == 1
If I specify two buttons, at the CONFIG_TOP section, it will only compile two button controls.
Or do I need to specify #define NUM_BUTTONS 1
even though there are two lines under CONFIG_BUTTONS?
This.
Basically, you want it to function as a 1-button saber, and you’re only feeding the prop events from one button.
The only weird part can be that if you press one button, then the other, there is a possibility that the prop gets a but confused, but chances are fairly low, and you can just avoid doing that next time…
Just in case you missed, you’ll have to change the second button to be “BUTTON_AUX” if you want to use as a 2 button. If the both buttons are set to BUTTON_POWER in the CONFIG_BUTTONS section you’ll never trigger the second (Aux) control.
That is correct.
NUM_BUTTONS is a hint for the prop. The prop may ignore that hint.
Nothing fails at compilation time if you define more or less than NUM_BUTTON buttons in CONFIG_BUTTONS, but some of your buttons might not work.