The issue of sending ESP32 WiFi mesh to the root node
Posted: Sat Aug 17, 2024 9:22 am
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?
```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?