5 #if defined(GPIO_PIN_BUTTON) && (GPIO_PIN_BUTTON != UNDEF_PIN)
9 static Button
<GPIO_PIN_BUTTON
, GPIO_BUTTON_INVERTED
> button
;
11 #if defined(TARGET_TX_BETAFPV_2400_V1) || defined(TARGET_TX_BETAFPV_900_V1) || defined(TARGET_TX_IFLIGHT)
12 #include "POWERMGNT.h"
13 void EnterBindingMode();
15 static void enterBindMode3Click()
17 if (button
.getCount() == 3)
23 static void cyclePower()
25 // Only change power if we are running normally
26 if (connectionState
< MODE_STATES
)
28 PowerLevels_e curr
= POWERMGNT::currPower();
31 POWERMGNT::setPower(MinPower
);
35 POWERMGNT::incPower();
37 devicesTriggerEvent();
42 #if defined(TARGET_RX) && (defined(PLATFORM_ESP32) || defined(PLATFORM_ESP8266))
43 static void rxWebUpdateReboot()
45 if (button
.getLongCount() > 4 && connectionState
!= wifiUpdate
)
47 connectionState
= wifiUpdate
;
49 if (button
.getLongCount() > 8)
56 static void initialize()
58 #if defined(TARGET_TX_BETAFPV_2400_V1) || defined(TARGET_TX_BETAFPV_900_V1) || defined(TARGET_TX_IFLIGHT)
59 button
.OnShortPress
= enterBindMode3Click
;
60 button
.OnLongPress
= cyclePower
;
62 #if defined(TARGET_RX) && (defined(PLATFORM_ESP32) || defined(PLATFORM_ESP8266))
63 button
.OnLongPress
= rxWebUpdateReboot
;
69 return DURATION_IMMEDIATELY
;
74 return button
.update();
77 device_t Button_device
= {
78 .initialize
= initialize
,