Skip to content

Commit 2611068

Browse files
change(ESP_NOW_Serial): No teardown on retry limit.
After max retries is met once the ESP_NOW_Serial_Class performs "end()" which removes the peer from ESP_NOW. Further messages to and from ESP_NOW_Serial are not received or sent. Peer should stay in ESP_NOW to re-establish connection even with data loss. This change will "retry and drop" the data piece by piece instead of aborting the connection. Description of Change ESP_NOW_Serial "Peer" will not remove itself from ESP_NOW_Peer list when data sent is not received by a peer. ESP_NOW_Serial::end() is still called when ESP_NOW::send() fails Tests scenarios Tested on a pair of M5Stack Stamp ESP32-C3. Confirmed that transmission is able to continue after: disconnecting the Receiving module from power. Attempting to send data. , and then restoring power to Receiving module Previously, transmission halted as the cleanup/teardown in ESP_NOW_Serial::end() was triggered. Related links I did not create an issue for this. Issue was NowSerial had to be re-initialized essentially for every byte without knowing if the peer was present/restored. Workaround was to use broadcast address for TX and a separate ESP_NOW_Serial peer with MAC address for RX.
1 parent e70f4d3 commit 2611068

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

libraries/ESP_NOW/src/ESP32_NOW_Serial.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,10 @@ void ESP_NOW_Serial_Class::onSent(bool success) {
264264
//the data is lost in this case
265265
vRingbufferReturnItem(tx_ring_buf, queued_buff);
266266
queued_buff = NULL;
267-
xSemaphoreGive(tx_sem);
268-
end();
269267
log_e(MACSTR " : RE-SEND_MAX[%u]", MAC2STR(addr()), resend_count);
268+
//send next packet?
269+
//log_d(MACSTR ": NEXT", MAC2STR(addr()));
270+
checkForTxData();
270271
}
271272
}
272273
}

0 commit comments

Comments
 (0)