mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
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:
parent
b849d1c01b
commit
ea72dd0f97
2 changed files with 16 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue