mirror of
https://github.com/esphome/esphome.git
synced 2026-09-25 05:54:01 +00:00
[usb_uart] Fix FTDI RX data stall / corruption and input restart reliability (#17348)
Co-authored-by: Oliver Kleinecke <kleinecke.oliver@googlemail.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Oliver Kleinecke
Claude Sonnet 4.6
parent
40c3a4320f
commit
af4a6e7ec3
@@ -228,6 +228,11 @@ void USBUartComponent::loop() {
|
||||
}
|
||||
#endif
|
||||
|
||||
// If there is not enough space for the full chunk, let the device subclass
|
||||
// handle it (e.g. FTDI clears the buffer to prevent mid-telegram corruption).
|
||||
if (channel->input_buffer_.get_free_space() < chunk->length) {
|
||||
this->on_rx_overflow(channel);
|
||||
}
|
||||
// Push data to ring buffer (now safe in main loop)
|
||||
channel->input_buffer_.push(chunk->data, chunk->length);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user