You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current ReactESP implementation uses a somewhat special syntax, with the constructor expecting a lambda function or a function pointer that is called to setup the program:
ReactESP app([]() {
setup_code_here();
});
The traditional Arduino Framework setup() and loop() functions still exist but are predefined in reactesp.cpp.
This is fancy but also gimmicky and potentially confusing for developers who have not worked with C++ lambdas before. But worse, this approach is limiting and discourages using ReactESP in more traditional Arduino projects.
Instead, I'd like to move back to a more traditional Arduino execution model in which the program setup() and loop() are defined explicitly:
ReactESP app; // app is still defined but takes no arguments
void setup() {
setup_code_here(); // setup() contains the same setup code as the previous lambda function
}
void loop() {
app.tick(); // we have an explicit definition of loop() and call app.tick() manually
}
Besides being more obvious, a major added benefit is that with minor modifications, I think this approach would allow using ReactESP also with ESP-IDF instead of just the Arduino Framework.
The text was updated successfully, but these errors were encountered:
Current ReactESP implementation uses a somewhat special syntax, with the constructor expecting a lambda function or a function pointer that is called to setup the program:
The traditional Arduino Framework
setup()
andloop()
functions still exist but are predefined inreactesp.cpp
.This is fancy but also gimmicky and potentially confusing for developers who have not worked with C++ lambdas before. But worse, this approach is limiting and discourages using ReactESP in more traditional Arduino projects.
Instead, I'd like to move back to a more traditional Arduino execution model in which the program
setup()
andloop()
are defined explicitly:Besides being more obvious, a major added benefit is that with minor modifications, I think this approach would allow using ReactESP also with ESP-IDF instead of just the Arduino Framework.
The text was updated successfully, but these errors were encountered: