Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32 : No way to flush the stream. #68

Open
xgnata opened this issue Jul 28, 2024 · 0 comments
Open

ESP32 : No way to flush the stream. #68

xgnata opened this issue Jul 28, 2024 · 0 comments

Comments

@xgnata
Copy link

xgnata commented Jul 28, 2024

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 <typename... Args>
void SerialAndTelnet(Args &&...args)
{
(ToSerialAndTelnet(args), ...);
}

template <typename... Args>
void SerialAndTelnetln(Args &&...args)
{
if constexpr (sizeof...(Args) == 0)
{
ToSerialAndTelnet('\n');
}
else
{
(ToSerialAndTelnet(args), ...);
ToSerialAndTelnet('\n');
}
}
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant