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

Moderator: igrr

User avatar
By eketjall
#58477
icons wrote:maybe this can help?
https://learn.adafruit.com/multi-taskin ... -the-delay


Delays let's the WiFi do stuff "in the background".
It is also recommended to add delays in long loops for that reason if a understand it correctly.

My problem wasn't realy the delay it self, more than it was needed for the serial output and caused a problem for the wifi while connecting.

Guess a should realy solve it by checking WiFi status more than just connected, add timeouts etc
User avatar
By icons
#59032 i've been having issues with nodemcu module and fastled especially where there are delays, havent found a work around myself, but will get to it hopefully soon. It seems to me that when the program reaches delay, everything stops, including wifi so the program just keeps looping and I cannot connect to wifi.
User avatar
By mrburnette
#59073
icons wrote:i've been having issues with nodemcu module and fastled especially where there are delays, havent found a work around myself, but will get to it hopefully soon. It seems to me that when the program reaches delay, everything stops, including wifi so the program just keeps looping and I cannot connect to wifi.


Every iteration of loop() performs a refresh of the back-end native code. Depending on where one looks, the back-end needs to be tickled every 30mS to 50mS. Failure to adequately break-up long sections of Arduino code will cause a WDT reset.

In addition to the loop() repeat which automatically releases time from the Arduino foreground task, there are delay(n>0), delay(0), and yield().

One would think that these would be identical in their functionality, but yield() and delay(0) seem to take different code branches and delay(1) will often provide relief when yield() will not.

Bottom line, it is the Arduino programmer that much ensure that the native code RF section is "feed". I recommend all ESP8266 programmers to profile their code so that they understand where the uC time is being spent inside their programs.

The use of wdt_reset() seems to be necessary even if the RF section is disabled.
https://www.hackster.io/rayburne/esp8266-turn-off-wifi-reduce-current-big-time-1df8ae

Ray