[deep_sleep] fix deep_sleep not keeping awake when sleep_duration is defined (#7885)

This commit is contained in:
Max Slotov 2024-11-28 05:51:07 +02:00 committed by GitHub
parent c9b0490305
commit 7cdf5b55ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -52,11 +52,11 @@ void DeepSleepComponent::dump_config_platform_() {
bool DeepSleepComponent::prepare_to_sleep_() {
if (this->wakeup_pin_mode_ == WAKEUP_PIN_MODE_KEEP_AWAKE && this->wakeup_pin_ != nullptr &&
!this->sleep_duration_.has_value() && this->wakeup_pin_->digital_read()) {
this->wakeup_pin_->digital_read()) {
// Defer deep sleep until inactive
if (!this->next_enter_deep_sleep_) {
this->status_set_warning();
ESP_LOGW(TAG, "Waiting for pin_ to switch state to enter deep sleep...");
ESP_LOGW(TAG, "Waiting wakeup pin state change to enter deep sleep...");
}
this->next_enter_deep_sleep_ = true;
return false;