mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-16 07:42:37 +00:00
implement dynamic userbutton overwrite. fix #2434
This commit is contained in:
@@ -309,7 +309,8 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r
|
||||
// assert(esp_sleep_enable_uart_wakeup(0) == ESP_OK);
|
||||
#endif
|
||||
#ifdef BUTTON_PIN
|
||||
esp_sleep_enable_ext0_wakeup((gpio_num_t)BUTTON_PIN, LOW); // when user presses, this button goes low
|
||||
esp_sleep_enable_ext0_wakeup((gpio_num_t)(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN),
|
||||
LOW); // when user presses, this button goes low
|
||||
#endif
|
||||
#if defined(LORA_DIO1) && (LORA_DIO1 != RADIOLIB_NC)
|
||||
gpio_wakeup_enable((gpio_num_t)LORA_DIO1, GPIO_INTR_HIGH_LEVEL); // SX126x/SX128x interrupt, active high
|
||||
@@ -338,7 +339,8 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r
|
||||
esp_sleep_wakeup_cause_t cause = esp_sleep_get_wakeup_cause();
|
||||
#ifdef BUTTON_PIN
|
||||
if (cause == ESP_SLEEP_WAKEUP_GPIO)
|
||||
LOG_INFO("Exit light sleep gpio: btn=%d\n", !digitalRead(BUTTON_PIN));
|
||||
LOG_INFO("Exit light sleep gpio: btn=%d\n",
|
||||
!digitalRead(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN));
|
||||
#endif
|
||||
|
||||
return cause;
|
||||
|
||||
Reference in New Issue
Block a user