ESP-Mesh - Multiple messages transmitted
Posted: Tue Mar 28, 2023 9:09 am
I am using ESP-IDF with esp_mesh to synchronise time between multiple ESP32 Nodes.
Most of this works fine, except I am noticing the following happening:
- Node A sends message to Node B, but gets an ESP_ERR_MESH_TIMEOUT from the esp_mesh_send call
- Node B does receive this message
- Going forward after the timeout, every message that node A sends is received by other nodes twice
The issue seems to be on the transmit side. When I reboot every other (receiving) node, and let them reconnect, they still receive double messages.
The issue also seems to stack. So after 3 of these timeouts, messages are received 4 times instead of 1.
I am using the following code to transmit:
and the following code to receive
From logging on the sender side, I can confirm that esp_mesh_send is only called once.
Is there any parameter I should be looking at to help prevent this issue? Or should I be clearing some buffer when an error occurs?
Sidenote is that I am using ESP_Mesh ESP_now simultaneously in this project. I expect this to work, but perhaps I am missing something?
Most of this works fine, except I am noticing the following happening:
- Node A sends message to Node B, but gets an ESP_ERR_MESH_TIMEOUT from the esp_mesh_send call
- Node B does receive this message
- Going forward after the timeout, every message that node A sends is received by other nodes twice
The issue seems to be on the transmit side. When I reboot every other (receiving) node, and let them reconnect, they still receive double messages.
The issue also seems to stack. So after 3 of these timeouts, messages are received 4 times instead of 1.
I am using the following code to transmit:
Code: Select all
mesh_data_t dataType{
.data = (uint8_t*) &m_tcpSendBuffer,
.size = static_cast<uint16_t>(data.size() + sizeof(PacketHeader_t)),
.proto = MESH_PROTO_BIN,
.tos = MESH_TOS_P2P};
auto sendResult = esp_mesh_send(&espDestination, &dataType, MESH_DATA_P2P, nullptr, 0);
Code: Select all
mesh_data_t dataInfo{
.data = (uint8_t*) &m_tcpReceiveBuffer,
.size = static_cast<uint16_t>(TCP_PACKET_SIZE)
};
int flag = 0;
auto receiveResult = esp_mesh_recv(&sourceMacAddress, &dataInfo, 0, &flag, nullptr, 0);
From logging on the sender side, I can confirm that esp_mesh_send is only called once.
Is there any parameter I should be looking at to help prevent this issue? Or should I be clearing some buffer when an error occurs?
Sidenote is that I am using ESP_Mesh ESP_now simultaneously in this project. I expect this to work, but perhaps I am missing something?