blynkkk / blynk-library

Blynk library for IoT boards. Works with Arduino, ESP32, ESP8266, Raspberry Pi, Particle, ARM Mbed, etc.
https://blynk.io
MIT License
3.83k stars 1.39k forks source link

Make BlynkTimer "noob" proof? #383

Closed Fettkeewl closed 6 years ago

Fettkeewl commented 6 years ago

Since you are trying to fix the code to prevent beginners from flooding I'd suggest, based on this example: https://community.blynk.cc/t/nodemcu-with-10x-multiple-ds18b20-temperatures/20585?u=fettkeewl

That in BlynkTimer, at the run function, you track a variable for to prevent WDT and blynk disconnects `#ifdef BlynkSimpleEsp8266_h long watchdog = millis();

endif `

Then in the for loop

do the same with ifdef and check against the variable (from various sources soft wdt is 3 seconds for the esp8266) if millis - watchdog > 2500 do a yield if millis - watchdog > blynkHeartbeat (-0,5 sec) do a blynk.run

Is it understandable?

vshymanskyy commented 6 years ago

Sorry we're not going to fix that. Library already does yield for esp8266 during any Blynk.virtualWrite, Blynk.run(), etc. If user blocks for 5 seconds, he gets by a watchdog. That's expected.