mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
Added Wakeup
If put in Hibernation it would not wakeup
This commit is contained in:
parent
64e89359e4
commit
88337fc058
2 changed files with 24 additions and 0 deletions
|
|
@ -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++) {
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue