fix: Add #ifdef PIN_USER_BTN_ANA guard for boards without analog button

- Protect MomentaryButton instantiation with #ifdef PIN_USER_BTN_ANA
- Use dummy pin 0 when PIN_USER_BTN_ANA is not defined
- Allows compilation on boards without analog button support
- Applied to both SX1262 and SX1276 variants
This commit is contained in:
Piero Andreini 2026-04-05 12:04:08 +02:00
parent b849d1c01b
commit ea72dd0f97
2 changed files with 16 additions and 0 deletions

View file

@ -8,8 +8,16 @@ TEthEliteBoard board;
DISPLAY_CLASS display;
#endif
#ifdef PIN_USER_BTN_ANA
// If the analog pin is defined, use it for both button instances
MomentaryButton user_btn(PIN_USER_BTN_ANA, 1000, true);
MomentaryButton analog_btn(PIN_USER_BTN_ANA, 1000, true); // alias for UITask analog button support
#else
// If NOT defined, route user_btn to pin 0
// and create analog_btn as a dummy alias to satisfy UITask requirements
MomentaryButton user_btn(0, 1000, true);
MomentaryButton analog_btn(0, 1000, true);
#endif
static SPIClass spi;
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi);

View file

@ -8,8 +8,16 @@ TEthEliteBoard board;
DISPLAY_CLASS display;
#endif
#ifdef PIN_USER_BTN_ANA
// If the analog pin is defined, use it for both button instances
MomentaryButton user_btn(PIN_USER_BTN_ANA, 1000, true);
MomentaryButton analog_btn(PIN_USER_BTN_ANA, 1000, true); // alias for UITask analog button support
#else
// If NOT defined, route user_btn to pin 0
// and create analog_btn as a dummy alias to satisfy UITask requirements
MomentaryButton user_btn(0, 1000, true);
MomentaryButton analog_btn(0, 1000, true);
#endif
static SPIClass spi;
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1, spi);