I sent a message to the root node in this way from the child node:
```c++
static uint8_t tx_buf[10];
for(int i = 0; i < 10; i++) {
tx_buf = i;
}
mesh_data_t data;
data.data = tx_buf;
data.size = sizeof(tx_buf);
data.proto = MESH_PROTO_BIN;
data.tos = MESH_TOS_P2P;
esp_mesh_send(nullptr, &data, MESH_DATA_P2P, NULL, 0);
```
I follow here, where the 'to' parameter of esp_cesh_dend is displayed as NULL, so it can be sent to the root node:https://docs.espressif.com/projects/esp ... -reference
But I encountered error code 4008 and the data.size equals 0 when receiving at the root node, which is as follows:
```c++
err = esp_mesh_recv(&from, &data, portMAX_DELAY, &flag, nullptr, 0);
if(err != ESP_OK || data.size != sizeof(msg_t)) {
ESP_LOGI(TAG, "fuck: err: %x size:%d", err, data.size);
continue;
}
```
Is it a bug?
The issue of sending ESP32 WiFi mesh to the root node
-
- Posts: 16
- Joined: Fri Aug 16, 2024 1:55 am
-
- Posts: 198
- Joined: Sun Jun 23, 2024 6:18 pm
Re: The issue of sending ESP32 WiFi mesh to the root node
The error code 4008 corresponds to ESP_ERR_MESH_ARGUMENT, indicating that one or more of the arguments passed to esp_mesh_send are invalid.
Check the mesh_data_t Structure: Ensure that the data.data is not NULL and that data.size is correctly set.
The mesh network should be correctly set up and the node sending the data should be properly registered in the network.
Check the mesh_data_t Structure: Ensure that the data.data is not NULL and that data.size is correctly set.
The mesh network should be correctly set up and the node sending the data should be properly registered in the network.
-
- Posts: 16
- Joined: Fri Aug 16, 2024 1:55 am
Re: The issue of sending ESP32 WiFi mesh to the root node
Sorry, I forgot to set the data.size so I got the 4008 error code. And now, I have set data.size so that I can receive the correct data.aliarifat794 wrote: ↑Sat Aug 17, 2024 2:55 pmThe error code 4008 corresponds to ESP_ERR_MESH_ARGUMENT, indicating that one or more of the arguments passed to esp_mesh_send are invalid.
Check the mesh_data_t Structure: Ensure that the data.data is not NULL and that data.size is correctly set.
The mesh network should be correctly set up and the node sending the data should be properly registered in the network.
But I still have some question about WiFi-Mesh:
Since I have enabled the dynamic allocation network,how should I know that the root node has been switched so that I can do some processing for the old root node and make the new root node take some actions. Which event can the old root node use to know that it is about to be switched? Through which event does the new root node know that it has become a new root node?
Who is online
Users browsing this forum: Baidu [Spider], Bing [Bot] and 342 guests