-->
Page 1 of 1

Is there a negative impact of an empty loop()?

PostPosted: Tue Dec 24, 2019 8:01 am
by tius
Hope this is not a FAQ.

When doing everything event driven, you still need loop() to make the linker happy. Is there a negative impact of an empty loop() function in terms of cpu usage or power consumptions? Are there any alternatives?

Re: Is there a negative impact of an empty loop()?

PostPosted: Fri Jan 03, 2020 6:20 am
by QuickFix
In theory no (you could test it fairly easily), but the Wi-Fi-core needs air to breath, so you should build in a yield() inside the loop I guess.

Re: Is there a negative impact of an empty loop()?

PostPosted: Fri Jan 03, 2020 7:09 am
by tius
I'm not sure, but IMHO yield() is probably not required inside an empty loop() function as esp_schedule() is called within loop_wrapper() in core_esp8266_main.cpp (see also https://arduino-esp8266.readthedocs.io/ ... and-delays).

So I think an empty loop() should be fine :-)