I'm using the ESPTelnet in serveral tasks on ESP32.
The issue is that telnet.flush() does not flush the telnet stream on esp32.
There is no way to make sure that one stream has been fully sent before sending another one.
The mutex is useless because telnet.print() returns before the stream has been fully sent.
Serial.flush() does the job for Serial.
`template
void ToSerialAndTelnet(T msg)
{
xSemaphoreTake(xMutexPrint, portMAX_DELAY);
Serial.print(msg);
Serial.flush();
telnet.print(msg);
// how to make sure that the msg has been fully sent???
xSemaphoreGive(xMutexPrint);
}
Hi,
I'm using the ESPTelnet in serveral tasks on ESP32. The issue is that telnet.flush() does not flush the telnet stream on esp32. There is no way to make sure that one stream has been fully sent before sending another one. The mutex is useless because telnet.print() returns before the stream has been fully sent. Serial.flush() does the job for Serial.
`template
void ToSerialAndTelnet(T msg)
{
xSemaphoreTake(xMutexPrint, portMAX_DELAY);
Serial.print(msg);
Serial.flush();
telnet.print(msg);
// how to make sure that the msg has been fully sent???
xSemaphoreGive(xMutexPrint);
}
template
void SerialAndTelnet(Args &&...args)
{
(ToSerialAndTelnet(args), ...);
}
template
void SerialAndTelnetln(Args &&...args)
{
if constexpr (sizeof...(Args) == 0)
{
ToSerialAndTelnet('\n');
}
else
{
(ToSerialAndTelnet(args), ...);
ToSerialAndTelnet('\n');
}
}
`