Sequence for Mesh Connection

I am having a lot of problems where upon resetting the Boron/Argon, the attached mesh devices would never reconnect.

I would like to try in my code a manual connection (for Xenons) but not sure of the exact statements and wish to request the community’s help. For example, is this the correct sequence

SYSTEM_MODE(MANUAL);
SYSTEM_THREAD(ENABLED);

void setup()
{
 
 //Setup statements here

 int i = 0

While i < 200
i++;
Mesh.connect();
delay(3000);
if (Mesh.ready()) break;
}

I do not understand the While i < 200 loop - was it your idea to try Mesh.connect(); 200 times with a 3 second delay between each attempt or until connected?

Would it not be better to use

Mesh.connect();
waitFor(Mesh.ready(), 3000);

1 Like

Thank you @armor. Yes this is the intention but your code is a better alternative.

Is this the corrscts eqence …?

SYSTEM_MODE(MANUAL);
SYSTEM_THREAD(ENABLED);

The order of these macros does not matter in my experience.

Calling Mesh.connect(); repeatedly would probably have crashed the application thread - memory usage.

2 Likes