diff --git a/variants/lilygo_t_eth_elite_sx1262/target.cpp b/variants/lilygo_t_eth_elite_sx1262/target.cpp index c9d9e189..c42236f3 100644 --- a/variants/lilygo_t_eth_elite_sx1262/target.cpp +++ b/variants/lilygo_t_eth_elite_sx1262/target.cpp @@ -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); diff --git a/variants/lilygo_t_eth_elite_sx1276/target.cpp b/variants/lilygo_t_eth_elite_sx1276/target.cpp index 03d6d38d..b0cb78be 100644 --- a/variants/lilygo_t_eth_elite_sx1276/target.cpp +++ b/variants/lilygo_t_eth_elite_sx1276/target.cpp @@ -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);