loramesh example crashing on LoPy4
-
hi everyone!
@catalini got a couple of LoPy4 devices (with ext. board 3.1), upgraded the firmware to v1.20.0.rc11 and tested the raw lora successfully between two devices.
after that i moved on to loramesh since this is very interresting for my application.i flashed the example code from the documentation (https://docs.pycom.io/tutorials/lora/lora-mesh.html) including the library source file (https://github.com/pycom/pycom-libraries/blob/master/lib/lora_mesh/loramesh.py) onto two lopy's, but after powering them they both did not connect to the loramesh.
both devices act the same:
the rgbled stays red and after around 50 seconds of hanging in the first while loop getting "state: detached" it breaks the while, says "neighbors found: 0" and crashes with an error in this line: https://github.com/pycom/pycom-libraries/blob/adb22c2d005b8ce83d8a9a6b31bbe5265135018a/lib/lora_mesh/main.py#L68i will post the exact error tomorrow.
am i understanding the whole mesh thing wrong or is it right that the first device powered up will "start" the mesh and the others will "log in" to it?!
how are the roles of the mesh members selected?thanks for your help
best regards
-
thanks for your reply, i fixed the problem and raised a pull-request!
-
hi @cuca94, glad you tried pymesh example.
The error is due to the methodrc_cb()
which should have 2 parameters, as it's in docs: https://development.pycom.io/firmware-and-api-reference/pycom/network/lora/pymesh#mesh-rx_cb-handler-argument
If you fix it, maybe you could raise a pull-request.am i understanding the whole mesh thing wrong or is it right that the first device powered up will "start" the mesh and the others will "log in" to it?!
In principle it's correct.
how are the roles of the mesh members selected?
The firmware is identical for all devices, so every device could take any role, dinamically. First one powered, is most-likely the Leader. The following ones are Child, but they become Routers (after a random time up to 2 mins). Overall the max number of Routers is 16, so the 17th will stay Child.