Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By mrburnette
#53590
helpme wrote:Am I right to say if Arduino switches to RTOS SDK, there is no longer the need to use yield()? If Arduino uses RTOS SDK, will the risk of ESP8266 resetting due to certain processes running for too long be negligible?



Were there a "real" RTOS implementation, the context switching would be beneath your sketch level, so you would not know that you were in a virtual thread.

But that is not today. Today, every repetition of loop() calls into the low-level RF section and "pets" the WDT.

As I just mentioned to another user complaining about yield(); IMO there is simply no excuse for a programmer to not know where her/his code is consuming uC cycles. Profiling with millis() the entry-exit of complex or 'loopy' code will give you the information you require about using delay(0) or yield(). I shoot for 30mS maximum but I have read that the worst-case can go up to about 50mS - but there is no reason to get that close to a reset IMO.

Or course, you could do like I do and simply write the sketch and test for a few hours (or days) to see if the WDT becomes annoyed with the sketch! Then place yields() where they are needed. Proactive is a better approach, however.

Ray