diff --git a/variants/radiomaster_900_bandit/BanditBoard.h b/variants/radiomaster_900_bandit/BanditBoard.h index ada41d2f..b4de0604 100644 --- a/variants/radiomaster_900_bandit/BanditBoard.h +++ b/variants/radiomaster_900_bandit/BanditBoard.h @@ -110,6 +110,18 @@ public: const char *getManufacturerName() const override { return "RadioMaster Bandit"; } + // Add wake-enabled power off + void powerOff() override { +#if defined(PIN_USER_BTN) + esp_sleep_enable_ext0_wakeup((gpio_num_t)PIN_USER_BTN, LOW); // Wake when button pressed (LOW) +#elif defined(PIN_USER_JOYSTICK) + // For analog joystick, you'd need to use the center button GPIO + esp_sleep_enable_ext0_wakeup((gpio_num_t)PIN_USER_JOYSTICK, LOW); +#endif + // Enter deep sleep + esp_deep_sleep_start(); + } + void onBeforeTransmit() override { // Use user-defined TX LED color for (byte i = 2; i <= 6; i++) { diff --git a/variants/radiomaster_900_bandit_nano/BanditNanoBoard.h b/variants/radiomaster_900_bandit_nano/BanditNanoBoard.h index 8fabcc23..eea09de8 100644 --- a/variants/radiomaster_900_bandit_nano/BanditNanoBoard.h +++ b/variants/radiomaster_900_bandit_nano/BanditNanoBoard.h @@ -67,6 +67,18 @@ const int NUM_CAL_POINTS = sizeof(calibration) / sizeof(calibration[0]); class BanditNanoBoard : public ESP32Board { private: public: + // Add wake-enabled power off + void powerOff() override { +#if defined(PIN_USER_BTN) + esp_sleep_enable_ext0_wakeup((gpio_num_t)PIN_USER_BTN, LOW); // Wake when button pressed (LOW) +#elif defined(PIN_USER_JOYSTICK) + // For analog joystick, you'd need to use the center button GPIO + esp_sleep_enable_ext0_wakeup((gpio_num_t)PIN_USER_JOYSTICK, LOW); +#endif + // Enter deep sleep + esp_deep_sleep_start(); + } + // Return fake battery status, battery/fixed power is not monitored. uint16_t getBattMilliVolts() override { return 5000; }