Go Down

Topic: Questions about painless mesh (Read 168 times) previous topic - next topic

lesept

Hi
Does anyone use the painless mesh library ?

I'm having a few issues that I don't understand and I'd like toknow more about this.

I'm setting a mesh with one ESP32 acting also as a webserver and some ESP8266 (2 at the moment). Whenever a ESP8266 connect to the mesh, the ESP32 should be warned using the following instruction:
Code: [Select]
  mesh.onChangedConnections(&changedConnectionCallback);
  mesh.onNewConnection(&newConnectionCallback);

Sometimes it works OK (not very often though) but the rest of the times only 1 ESP8266 is seen. When I connect the second one, only the changedConnectionCallback is triggered, not the newConnectionCallback. And I'm using the newConnectionCallback to get the information about the new node (id, etc).

In the newConnectionCallback the ESP32 sends a message to the new node, asking for its id (a private id I set to all the nodes). The ESP8266 is supposed to send back the id and a status information. Sometimes this information exchange takes up to 20 seconds, which seems very long to me. And there is no other connected node at that time (only the ESP32 and one ESP87266).

Is this normal ?

Anotherissue is to get the IP address of the ESP32. The instruction is
Code: [Select]
    IPAddress myAPIP = IPAddress(mesh.getStationIP());
When first executed, just after connecting to my wifi, I get 0.0.0.0.
The real IP address is only provided after some time or in another function which is called later.

Does anyone know why ?

I can post the entire code, but it's quite long...
Thanks for your help
A force d'essayer on finit par réussir... Donc, plus ça rate, plus on a de chances que ça marche (proverbe Sharduinok).

lesept

I have printed the time (actually only the seconds) during the execution of the loop. It seems weird, because in the beginning of the program, I only see times printed each 5 seconds, and after roughly 40 seconds, the execution is much quicker...

Here is what is on the serial monitor:
Code: [Select]
-----------------------------------
| < Connect to 0.0.0.0:81 > |
------------------------------------
--> Changed connections
--> New Connection, nodeId = 3946743615
18
23
28
33
38
43
48
53
58
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44
44

It's weird also that the seconds jump from 58 to 44... ?

Here is the loop :
Code: [Select]
void loop() {
  userScheduler.execute();
  mesh.update();

  //  do nothing until next minute
  getLocalTime(&timeinfo);
    Serial.println (timeinfo.tm_sec);
  if (timeinfo.tm_sec == 0) {
    if (!isVerified) {
      int timeNow = timeinfo.tm_hour * 60 + timeinfo.tm_min;
      if (timeNow == 0) setTimesBE (); // update slots at midnight
      Serial.printf ("\nTime : % d\n", timeNow);
      verifyDevices (timeNow);
    }
  } else isVerified = false;
}

The 2 first lines are required for painless mesh (unless I understood wrongly) and the rest verifies the devices (the ESP8266s) only when the seconds are 0.


Any idea ?
A force d'essayer on finit par réussir... Donc, plus ça rate, plus on a de chances que ça marche (proverbe Sharduinok).

Go Up