mirror of
https://github.com/alexhopeoconnor/firmware.git
synced 2026-10-18 09:21:43 +10:00
Merge branch 'develop' into pioarduino
This commit is contained in:
+14
-21
@@ -177,13 +177,6 @@ void initDeepSleep()
|
||||
if (wakeCause != ESP_SLEEP_WAKEUP_UNDEFINED) {
|
||||
LOG_DEBUG("Disable any holds on RTC IO pads");
|
||||
for (uint8_t i = 0; i <= GPIO_NUM_MAX; i++) {
|
||||
#if defined(USE_GC1109_PA)
|
||||
// Skip GC1109 FEM power pins - they are held HIGH during deep sleep to keep
|
||||
// the LNA active for RX wake. Released later in SX126xInterface::init() after
|
||||
// GPIO registers are set HIGH first, avoiding a power glitch.
|
||||
if (i == LORA_PA_POWER || i == LORA_PA_EN)
|
||||
continue;
|
||||
#endif
|
||||
if (rtc_gpio_is_valid_gpio((gpio_num_t)i))
|
||||
rtc_gpio_hold_dis((gpio_num_t)i);
|
||||
|
||||
@@ -452,8 +445,13 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r
|
||||
gpio_num_t pin = (gpio_num_t)(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN);
|
||||
gpio_wakeup_enable(pin, GPIO_INTR_LOW_LEVEL);
|
||||
#endif
|
||||
#ifdef INPUTDRIVER_ENCODER_BTN
|
||||
gpio_wakeup_enable((gpio_num_t)INPUTDRIVER_ENCODER_BTN, GPIO_INTR_LOW_LEVEL);
|
||||
#if defined(INPUTDRIVER_TWO_WAY_ROCKER_BTN) || defined(INPUTDRIVER_ENCODER_BTN)
|
||||
#if defined(INPUTDRIVER_TWO_WAY_ROCKER_BTN)
|
||||
#define INPUTDRIVER_WAKE_BTN_PIN INPUTDRIVER_TWO_WAY_ROCKER_BTN
|
||||
#else
|
||||
#define INPUTDRIVER_WAKE_BTN_PIN INPUTDRIVER_ENCODER_BTN
|
||||
#endif
|
||||
gpio_wakeup_enable((gpio_num_t)INPUTDRIVER_WAKE_BTN_PIN, GPIO_INTR_LOW_LEVEL);
|
||||
#endif
|
||||
#if defined(WAKE_ON_TOUCH)
|
||||
gpio_wakeup_enable((gpio_num_t)SCREEN_TOUCH_INT, GPIO_INTR_LOW_LEVEL);
|
||||
@@ -494,8 +492,9 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r
|
||||
// Disable wake-on-button interrupt. Re-attach normal button-interrupts
|
||||
gpio_wakeup_disable(pin);
|
||||
#endif
|
||||
#if defined(INPUTDRIVER_ENCODER_BTN)
|
||||
gpio_wakeup_disable((gpio_num_t)INPUTDRIVER_ENCODER_BTN);
|
||||
#ifdef INPUTDRIVER_WAKE_BTN_PIN
|
||||
gpio_wakeup_disable((gpio_num_t)INPUTDRIVER_WAKE_BTN_PIN);
|
||||
#undef INPUTDRIVER_WAKE_BTN_PIN
|
||||
#endif
|
||||
#if defined(WAKE_ON_TOUCH)
|
||||
gpio_wakeup_disable((gpio_num_t)SCREEN_TOUCH_INT);
|
||||
@@ -564,7 +563,8 @@ void enableModemSleep()
|
||||
|
||||
bool shouldLoraWake(uint32_t msecToWake)
|
||||
{
|
||||
return msecToWake < portMAX_DELAY && (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER);
|
||||
return msecToWake < portMAX_DELAY && (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER ||
|
||||
config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER_LATE);
|
||||
}
|
||||
|
||||
void enableLoraInterrupt()
|
||||
@@ -585,15 +585,8 @@ void enableLoraInterrupt()
|
||||
gpio_pullup_en((gpio_num_t)LORA_CS);
|
||||
#endif
|
||||
|
||||
#if defined(USE_GC1109_PA)
|
||||
// Keep GC1109 FEM powered during deep sleep so LNA remains active for RX wake.
|
||||
// Set PA_POWER and PA_EN HIGH (overrides SX126xInterface::sleep() shutdown),
|
||||
// then latch with RTC hold so the state survives deep sleep.
|
||||
digitalWrite(LORA_PA_POWER, HIGH);
|
||||
rtc_gpio_hold_en((gpio_num_t)LORA_PA_POWER);
|
||||
digitalWrite(LORA_PA_EN, HIGH);
|
||||
rtc_gpio_hold_en((gpio_num_t)LORA_PA_EN);
|
||||
gpio_pulldown_en((gpio_num_t)LORA_PA_TX_EN);
|
||||
#if HAS_LORA_FEM
|
||||
loraFEMInterface.setRxModeEnableWhenMCUSleep();
|
||||
#endif
|
||||
|
||||
LOG_INFO("setup LORA_DIO1 (GPIO%02d) with wakeup by gpio interrupt", LORA_DIO1);
|
||||
|
||||
Reference in New Issue
Block a user