adjust MessageOutput for changes in espressif/arduino-esp32

the "serial console" over USB would be garbled badly after switching to
"platform = espressif32@6.7.0". this did not happen to the upstream
version of MessageOutput. we used Serial.flush(), which seemed to be
good in the respective context. however, the changes in

github.com/espressif/arduino-esp32/pull/9462

made flush() detrimental. we remove the use of flush(), as it seems not
to be required (in particular, the upstream project does not use it).
This commit is contained in:
Bernhard Kirchen 2024-06-13 22:21:44 +02:00
parent 034026f782
commit f21f58c67d

View File

@ -27,7 +27,6 @@ void MessageOutputClass::register_ws_output(AsyncWebSocket* output)
void MessageOutputClass::serialWrite(MessageOutputClass::message_t const& m) void MessageOutputClass::serialWrite(MessageOutputClass::message_t const& m)
{ {
// on ESP32-S3, Serial.flush() blocks until a serial console is attached.
// operator bool() of HWCDC returns false if the device is not attached to // operator bool() of HWCDC returns false if the device is not attached to
// a USB host. in general it makes sense to skip writing entirely if the // a USB host. in general it makes sense to skip writing entirely if the
// default serial port is not ready. // default serial port is not ready.
@ -37,7 +36,6 @@ void MessageOutputClass::serialWrite(MessageOutputClass::message_t const& m)
while (written < m.size()) { while (written < m.size()) {
written += Serial.write(m.data() + written, m.size() - written); written += Serial.write(m.data() + written, m.size() - written);
} }
Serial.flush();
} }
size_t MessageOutputClass::write(uint8_t c) size_t MessageOutputClass::write(uint8_t c)