espressif / esp-mesh-lite

A lite version Wi-Fi Mesh, each node can access the network over the IP layer.
123 stars 17 forks source link

OTA LAN in inverted direction? (AEGHB-796) #122

Open Magnatto opened 2 weeks ago

Magnatto commented 2 weeks ago

Let's say I have 50 devices on a single mesh-lite and I want to do a LAN OTA update and only have the local network (so no external update). If i replace the root device with an updated version it will update all others eventually through esp_mesh_lite_transmit_file_start, that's great. But what if it's impossible or very incovenient to replace or know who is the root. Is there a way for me to replace ANY device with the updated version, so it may update the entire network, so the OTA LAN is trasmitted both ways, not just father to children?

tswen commented 1 week ago

https://github.com/tswen/esp-mesh-lite/blob/docs/mesh_lite_LAN_OTA/components/mesh_lite/User_Guide_CN.md#esp-mesh-lite-lan-ota

image

Magnatto commented 1 week ago

https://github.com/tswen/esp-mesh-lite/blob/docs/mesh_lite_LAN_OTA/components/mesh_lite/User_Guide_CN.md#esp-mesh-lite-lan-ota

image

Thanks for the reply, I understand this logic, which relies on an external URL and ALWAYS from root to children.

What I'm asking is if it's possible to NOT to rely on an external URL (replacing one of the devices in the network with an upgraded version), and for the OTA to spread from ANY device (not just from root to children).

This way I don't need an outside network connection (for client safety reasons), but can still update all devices from any given device in the network (since the root is not easily found among many devices and strict information requirements)

tswen commented 4 days ago

The external URL is just a fallback OTA method used when fetching firmware from the parent node fails. If you do not wish to upgrade via an external URL, you can set extern_url_ota_cb to NULL.

For LAN OTA, each node can only retrieve firmware from its parent node. If your root node has stored the binary file required by the child nodes in a specific partition, you can use esp_mesh_lite_ota_register_file_transfer_cb to provide the binary file to the child nodes. For a simple usage example, please refer to: https://github.com/espressif/esp-mesh-lite/blob/master/components/mesh_lite/include/esp_mesh_lite_core.h#L828-L885