This repository was archived by the owner on Dec 1, 2026. It is now read-only.
Repository navigation
Conversation
HWCDC::write() retries a full TX ring up to 20 times at tx_timeout_ms (100 ms by default), so with a USB host attached but no program reading the port every write waits up to 2 s. od_emit() issues two writes per record, which stalls loop() about 4 s per log line and adds roughly 32 s to a BLE image upload. Set the HWCDC TX timeout to 0 so a write to a full ring returns at once and the bytes are dropped instead of waited for. Guarded to ESP32 builds where Serial is the native USB serial (ARDUINO_USB_MODE and ARDUINO_USB_CDC_ON_BOOT); nRF and the UART-only log build are unchanged. Closes OpenDisplay#188 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Member
|
This was fixed in the unified firmware, I will close it here now for housekeeping reasons |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #188
Problem
On ESP32 builds that log over the native USB serial port,
HWCDC::write()retries a full TX ring up to 20 times attx_timeout_ms(100 ms by default). With a USB host attached but no program reading the port, the 256-byte ring stays full and every write waits up to 2 s.od_emit()issues two writes per record (text, then"\r\n"), so each log line stallsloop()for about 4 s. Details and measurements are in #188.Change
One call after
Serial.begin()insetup():With a zero timeout, a write to a full ring returns immediately and the bytes are dropped instead of waited for. No other logging behaviour changes.
Guard
The call is compiled only when
Serialis the chip's native USB serial (HWCDC), i.e.TARGET_ESP32with bothARDUINO_USB_MODEandARDUINO_USB_CDC_ON_BOOTset:esp32-s3-N32R8-extuart(USB serial off, logs over UART): not compiled. It also never reaches thisSerial.begin()branch becauseOPENDISPLAY_LOG_UARTis defined.esp32-s3-N16R8-extuart: logs go to the UART, so this code path is not taken.Trade-off
Log output is now dropped rather than delayed whenever the ring is full. With no reader that was already the outcome, just 2 s later per write. With a reader attached, a burst that outruns the host draining 256 bytes can lose or truncate lines. A small non-zero timeout (a few ms) would reduce that at the cost of a short stall; happy to change it if preferred.
Testing
On a Seeed EE03 (ESP32-S3) + ED103TC2,
esp32-s3-N16R8, plugged into a PC with the COM port not opened, py-opendisplay over BLE (PIPE_WRITE):0x80START → ACK0x82END → ACK, partial transfer incl. refreshA full-frame push from Home Assistant to the same device took 19.7 s after the change.
Not covered: the binary that was measured carried this line on top of an unrelated local change to the partial-write path, not this exact commit. Only
esp32-s3-N16R8was built locally; the C3 / C6 envs were not. Log completeness under bursts with a reader attached was not stress-tested.🤖 Generated with Claude Code