forked from xiaozhi/xiaozhi-esp32
fix audio pm (#1004)
This commit is contained in:
@@ -70,6 +70,12 @@ void SleepTimer::CheckTimer() {
|
||||
if (on_enter_light_sleep_mode_) {
|
||||
on_enter_light_sleep_mode_();
|
||||
}
|
||||
|
||||
auto& audio_service = app.GetAudioService();
|
||||
bool is_wake_word_running = audio_service.IsWakeWordRunning();
|
||||
if (is_wake_word_running) {
|
||||
audio_service.EnableWakeWordDetection(false);
|
||||
}
|
||||
|
||||
app.Schedule([this, &app]() {
|
||||
while (in_light_sleep_mode_) {
|
||||
@@ -86,12 +92,17 @@ void SleepTimer::CheckTimer() {
|
||||
lvgl_port_resume();
|
||||
|
||||
auto wakeup_reason = esp_sleep_get_wakeup_cause();
|
||||
ESP_LOGI(TAG, "Wake up from light sleep, wakeup_reason: %d", wakeup_reason);
|
||||
if (wakeup_reason != ESP_SLEEP_WAKEUP_TIMER) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
WakeUp();
|
||||
});
|
||||
|
||||
if (is_wake_word_running) {
|
||||
audio_service.EnableWakeWordDetection(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (seconds_to_deep_sleep_ != -1 && ticks_ >= seconds_to_deep_sleep_) {
|
||||
|
||||
Reference in New Issue
Block a user