You can chat about native SDK questions and issues here.
User avatar
By zephram
#75351 Hi guys,

i just began to learn ESP8266 and try to figure out how to program simple applications on it while not starving system tasks like WiFi handling etc. I know that the SoC needs to care about internal processing at least every xx msecs or so. My goal is to realize a looped function that is recalled after a minimum amount of time, without neglecting the systems need to care about its internals like wifi handlung, fedding the watchdog etc. As the NON-OS SDK does not offer a yield() function like the arduino environment i dont know exactly how to do this...

One way is to call a user routine by a timer periodically, but this will waste some amount of cpu cycles for the user task, as shown in: https://github.com/esp8266/source-code- ... ser_main.c

Another way is to let a task schedule itself after is has done its work, like in this example: https://www.penninkhof.com/2015/03/how- ... n-esp8266/

In the second example the author sets a call to: os_delay_us(1000) in order to let the system perform its tasks.

My question now is: Will the system perform its own tasks when a user task functions has returned because system tasks having higher priority anyways ? Cant the call to os_delay_us be omitted anyways because of that ?

At least i am unclear if os_delay_us(short delaytime) has the side effect of letting the system perform its tasks, like delay on arduino or sming does...

Greetings Zephram