-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Standard Arduino practices cause WDT to reset esp8266 #540
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
Comments
@Makuna doing it is not a bad idea, but it might put the current code to wait when that is not expected. |
Does the standard Arduino even have a WDT enabled by default? I also see no mention of a WDT in this project's README, other than this little bit:
Also, no mention how to find and use this "alpha" version (which I assume is based on master?) |
The standard Arduino (AVR) does NOT have the WDT turned on by default. AVR does support a WDT in the processor (I use it) but its uncommon to find it being used. |
This is what is done in some available() methods, and the proposal is to replicate something similar to all of them.
|
reding the source behind, I come to conclusion that yield will be called every next time, but first, inside the same loop() call. Am i getting this right? |
I think that code is flawed, you are correct in one way, but it has a problem, if the loop is entered when micros is near the top of the range, then wraps, this test will calculate true faster than it normally will. Here is my working example, removing the static variable completely. It also only yields when there is nothing available, with the thought that if there is something available, the caller will want to get to it quickly.
|
calling yield after the first time makes perfect sense when we are talking about network streams, because after consuming the first available, we need to yield to get the next packet in the buffer. |
you are correct on the flawed comparison |
What I list above will only yield if there is no data available, but it will yield often after 10ms since the last loop start. |
looks great |
new pull to help solve this #551 |
please review the new pull, it is cleaner and provides a consistent experiences. |
1154545 Merged |
One standard practice in many examples is to wait for serial input in a tight loop like ...
This will cause the WDT to trigger.
Can we insert a yield inside the available() when it would return false so that this common code fragment would not cause a processor reset?
The text was updated successfully, but these errors were encountered: