Fixed the issue where voice wake-up causes panic when DEBUG is enabled.

This commit is contained in:
kingingwang 2025-12-27 18:08:03 +08:00
parent 5d44633687
commit ab6de873a3
2 changed files with 18 additions and 2 deletions

View File

@ -82,6 +82,9 @@ GpioLed::GpioLed(gpio_num_t gpio, int output_invert, ledc_timer_t timer_num, led
};
ESP_ERROR_CHECK(esp_timer_create(&blink_timer_args, &blink_timer_));
xTaskCreate(EventTask, "LedEvent", 2048, this,
tskIDLE_PRIORITY + 2, &event_task_handle_);
ledc_initialized_ = true;
}
@ -194,7 +197,9 @@ void GpioLed::OnFadeEnd() {
bool IRAM_ATTR GpioLed::FadeCallback(const ledc_cb_param_t *param, void *user_arg) {
if (param->event == LEDC_FADE_END_EVT) {
auto led = static_cast<GpioLed*>(user_arg);
led->OnFadeEnd();
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
xTaskNotifyFromISR(led->event_task_handle_, 0x01, eSetValueWithOverwrite,
&xHigherPriorityTaskWoken);
}
return true;
}
@ -247,3 +252,12 @@ void GpioLed::OnStateChanged() {
return;
}
}
void GpioLed::EventTask(void* arg) {
GpioLed* led = static_cast<GpioLed*>(arg);
while (1) {
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
led->OnFadeEnd();
}
}

View File

@ -32,7 +32,9 @@ class GpioLed : public Led {
int blink_interval_ms_ = 0;
esp_timer_handle_t blink_timer_ = nullptr;
bool fade_up_ = true;
TaskHandle_t event_task_handle_;
static void EventTask(void* arg);
void StartBlinkTask(int times, int interval_ms);
void OnBlinkTimer();