Only enable wakeup via EXT_CHRG_DETECT if we shut down due to low power (#10263)

This commit is contained in:
Jonathan Bennett
2026-04-23 15:37:35 -05:00
committed by GitHub
co-authored by GitHub
parent 7b3f58875a
commit 837637b70c
3 changed files with 10 additions and 4 deletions
+1
View File
@@ -100,6 +100,7 @@ class Power : public concurrency::OSThread
virtual int32_t runOnce() override;
void setStatusHandler(meshtastic::PowerStatus *handler) { statusHandler = handler; }
const uint16_t OCV[11] = {OCV_ARRAY};
bool isLowBattery() { return low_voltage_counter >= 10; };
#ifdef ARCH_ESP32
int beforeLightSleep(void *unused);
@@ -20,6 +20,7 @@
#include "variant.h"
#include "nrf.h"
#include "power.h"
#include "wiring_constants.h"
#include "wiring_digital.h"
@@ -65,7 +66,11 @@ void variant_shutdown()
nrf_gpio_pin_sense_t sense1 = NRF_GPIO_PIN_SENSE_LOW;
nrf_gpio_cfg_sense_set(PIN_BUTTON1, sense1);
nrf_gpio_cfg_input(EXT_CHRG_DETECT, NRF_GPIO_PIN_PULLUP); // Configure the pin to be woken up as an input
nrf_gpio_pin_sense_t sense2 = NRF_GPIO_PIN_SENSE_LOW;
nrf_gpio_cfg_sense_set(EXT_CHRG_DETECT, sense2);
// If we are sleeping because of low battery, wake up when the solar charger detects power.
// But if the user intentionally put us to sleep with the button, don't wake up just because the lights are on
if (power->isLowBattery()) {
nrf_gpio_cfg_input(EXT_CHRG_DETECT, NRF_GPIO_PIN_PULLUP); // Configure the pin to be woken up as an input
nrf_gpio_pin_sense_t sense2 = NRF_GPIO_PIN_SENSE_LOW;
nrf_gpio_cfg_sense_set(EXT_CHRG_DETECT, sense2);
}
}
@@ -138,7 +138,7 @@ static const uint8_t A0 = PIN_A0;
#define HAS_SOLAR
#define OCV_ARRAY 4080, 3990, 3935, 3880, 3825, 3770, 3715, 3660, 3605, 3550, 3450
#define OCV_ARRAY 4080, 3990, 3935, 3880, 3825, 3770, 3715, 3660, 3605, 3550, 3490
#ifdef __cplusplus
}