From dca79872bfe32e9511e75982ee60a2eae991d525 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 23 Sep 2025 23:03:25 -0500 Subject: [PATCH] simplify --- esphome/components/usb_host/usb_host.h | 1 + esphome/components/usb_host/usb_host_client.cpp | 12 +++++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/esphome/components/usb_host/usb_host.h b/esphome/components/usb_host/usb_host.h index afd76595db..d2ff4da068 100644 --- a/esphome/components/usb_host/usb_host.h +++ b/esphome/components/usb_host/usb_host.h @@ -35,6 +35,7 @@ static const size_t SETUP_PACKET_SIZE = 8; static const size_t MAX_REQUESTS = 16; // maximum number of outstanding requests possible. static constexpr size_t USB_EVENT_QUEUE_SIZE = 32; // Size of event queue between USB task and main loop static constexpr size_t USB_TASK_STACK_SIZE = 4096; // Stack size for USB task (same as ESP-IDF USB examples) +static constexpr UBaseType_t USB_TASK_PRIORITY = 5; // Higher priority than main loop (tskIDLE_PRIORITY + 5) // used to report a transfer status struct TransferStatus { diff --git a/esphome/components/usb_host/usb_host_client.cpp b/esphome/components/usb_host/usb_host_client.cpp index 450bd0a932..d8da440658 100644 --- a/esphome/components/usb_host/usb_host_client.cpp +++ b/esphome/components/usb_host/usb_host_client.cpp @@ -191,13 +191,11 @@ void USBClient::setup() { } // Create and start USB task - xTaskCreatePinnedToCore(usb_task_fn, "usb_task", - USB_TASK_STACK_SIZE, // Stack size - this, // Task parameter - 5, // Priority (higher than main loop) - &this->usb_task_handle_, - 1 // Core 1 - ); + xTaskCreate(usb_task_fn, "usb_task", + USB_TASK_STACK_SIZE, // Stack size + this, // Task parameter + USB_TASK_PRIORITY, // Priority (higher than main loop) + &this->usb_task_handle_); if (this->usb_task_handle_ == nullptr) { ESP_LOGE(TAG, "Failed to create USB task");