Sming - Open Source framework for high efficiency native ESP8266 development

User avatar
By helpme
#27141
tavalin wrote:Whilst I don't suggest it, you could probably implement your own Arduino style loop() yourself with a while loop and a function called loop. One of the issues with this, though, is that the watchdog timer isn't keen on these type of things and you may experience reboots if not done properly.


Does this mean that applications written using Arduino IDE risk facing reboots by the watchdog? Sming apps are safer?
User avatar
By GigAHerZ
#27148
hreintke wrote:GigAHerZ,
I don't understand your question.
When you want immediate execution, you can call the function directly., no use for timers etc.
But there is a Timer class in Sming which you can use on milli and microsecond level (not zero).


Well, basically my question is, is there a event stack/callback stack in the sdk/framework?

Because, when you execute a function and for example it wants to stack 2 another functions to be executed right after itself has been completed, then it could register timer with 0 time for both of the functions it wants to execute. Because time is 0, they will be executed right after the main function has been completed, but in the order they were registered to be executed. In addition, if, before those 2 functions were registered, system itself knew it wanted to do something in the first possible "free" moment, it already has put it's own function also into callback stack. So eventually, it may happen, that execution order is: main function -> system internal function -> my first function -> my second function.

In JavaScript world (and i'm not talking in the context of "popup language"), everything is event based and everything has callbacks. There you usually don't call out functions or actions directly (if it's not necessary) but register them into execution stack. This is how you keep your code not blocking other stuff, while at the same time you have only one thread. (But eventually it feels that everything works simultaneously)
User avatar
By hreintke
#27330 I can't/will be not to specific as I am not completely aware of all the details.
No there is no thing like the stack/callback functionality.
The processes/concurrency/interrupts are not implemented in the Sming Core.
For that Sming is using/depending on the ESP8266 SDK coming from Espressif.

Details should come from documentation of that.