Painlessmesh and OTA

Hello

I'm using the painlessmesh library for a project based on ESP32, it works very well actually. There is one feature I couldn't get to work in my project. It's the OTA (sender).
The code is here:
https://gitlab.com/painlessMesh/painlessMesh/-/blob/develop/examples/otaSender/otaSender.ino

The example works. BUT, it never reaches the loop function because of the infinite while loop.
If I try to remove this lines:

while (true) {
            //This program will not reach loop() so we dont have to worry about
            //file scope.
            mesh.update();
            usleep(1000);
}

and put the mesh.update in the Arduino loop function like on the other, none-OTA examples, the MCU crashes.

What is going on????

What's is the difference between the infinite while loop, and the loop function?

Has it to do with the file scope as the programmer wrote in comment??

Thank you

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.