Serial.setTxTimeoutMs() function doesn't work?
Posted: Tue Aug 20, 2024 7:11 pm
Hello!
I'm working on a couple of different projects using the ESP32 core and Arduino development environment. I have a lot of "Serial.println()" statements in my code for debugging, but the code also needs to work well without the serial monitor connected, and that can at times cause slowness as described here: https://github.com/espressif/arduino-esp32/issues/6983
On one of my projects (an M5Stack M5Dial), I use the fix they suggest which is to put "Serial.setTxTimeoutMs(0);" in the setup function, and it works well.
But on my other project, which runs on an ESP32-WROOM-32 dev board, using that function causes the code not to compile. I've reduced it to this fairly simple sketch:
(Seriously, that's all it takes to reproduce this problem)
The compilation error I get is:
Anyhow, does anyone have any ideas how I can fix this?
I'm working on a couple of different projects using the ESP32 core and Arduino development environment. I have a lot of "Serial.println()" statements in my code for debugging, but the code also needs to work well without the serial monitor connected, and that can at times cause slowness as described here: https://github.com/espressif/arduino-esp32/issues/6983
On one of my projects (an M5Stack M5Dial), I use the fix they suggest which is to put "Serial.setTxTimeoutMs(0);" in the setup function, and it works well.
But on my other project, which runs on an ESP32-WROOM-32 dev board, using that function causes the code not to compile. I've reduced it to this fairly simple sketch:
Code: Select all
void setup() {
Serial.setTxTimeoutMs(0);
}
void loop() {
// put your main code here, to run repeatedly:
}
The compilation error I get is:
This is using the most recent (3.0.4) version of the ESP32 Arduino board library, but I tried a random older version (2.0.17) and it didn't work either. Interestingly, the M5Dial seems to use version 2.1.1 of the ESP32 library that I don't see available for download in the Arduino IDE?K:\ESP32_Serial_SetTXTimeoutIssue\ESP32_Serial_SetTXTimeoutIssue.ino: In function 'void setup()':
K:\ESP32_Serial_SetTXTimeoutIssue\ESP32_Serial_SetTXTimeoutIssue.ino:2:12: error: 'class HardwareSerial' has no member named 'setTxTimeoutMs'; did you mean 'setRxTimeout'?
Serial.setTxTimeoutMs(0);
^~~~~~~~~~~~~~
setRxTimeout
exit status 1
Compilation error: 'class HardwareSerial' has no member named 'setTxTimeoutMs'; did you mean 'setRxTimeout'?
Anyhow, does anyone have any ideas how I can fix this?