-
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Telnet library causes unexpected context switches #73
Comments
Hey Tim, |
Hi Lennart, I cloned your code in as a static library in my project and then removed the the yield() line, which resolved the task issue I found. Your code seems to work fine without it in place there and with my vTaskDelay calls in place of yield(). I've now done this on 4 different modules in my system, all ESP32 based, an old NodeMCU unit, a couple of ESP32 S2 and ESP32 S3. I suggest documenting the need for the yield() in the main code and just place this next to your telnet.loop(); function call, that way any of your tasks can run and the person implementing can decide the best place to place that task if they are doing anything more complicated. Great code btw, I particularly like the ANSI solution, it was cleaner than how I'd done it in my code base for my CLI's, which exist over UART, Bluetooth and Telnet. |
Hey,
Thanks, I took quite some inspiration from Bruce Robertson's ANSITerm. |
Whilst looking at the Telnet library on one of my projects, I have found that unexpected context switches are taking place. I am using a number of FreeRTOS tasks within my code and since using the Telnet library, unexpected switches are taking place.
I have tracked this down to EspTRelnetBase.cpp, line 32, which does a yield().
This obviously causes a context switch in FreeRTOS, hence my task which as the telnet.loop() function in it, no longer completes in one go, so effectively you have divided my timer by two - the piece up to the yield, and then next time round, the piece after the yield.
The yield() should not be present in the library, since the library should not adversely affect other code running on the ESP32. If a yield is genuinely required, it must be in the main code, not buried within the library.
The text was updated successfully, but these errors were encountered: