Fix for esp8266 ACK problem. Solution as suggested in #49 and #105

This commit is contained in:
Jens Dede 2021-07-15 22:33:27 +02:00
parent 6e79cc7bde
commit e11dc1e059
No known key found for this signature in database
GPG Key ID: 7BE9726754C19481
1 changed files with 6 additions and 1 deletions

View File

@ -304,7 +304,12 @@ void RFM69::sendACK(const void* buffer, uint8_t bufferSize) {
int16_t _RSSI = RSSI; // save payload received RSSI value int16_t _RSSI = RSSI; // save payload received RSSI value
writeReg(REG_PACKETCONFIG2, (readReg(REG_PACKETCONFIG2) & 0xFB) | RF_PACKET2_RXRESTART); // avoid RX deadlocks writeReg(REG_PACKETCONFIG2, (readReg(REG_PACKETCONFIG2) & 0xFB) | RF_PACKET2_RXRESTART); // avoid RX deadlocks
uint32_t now = millis(); uint32_t now = millis();
while (!canSend() && millis() - now < RF69_CSMA_LIMIT_MS) receiveDone(); while (!canSend() && millis() - now < RF69_CSMA_LIMIT_MS){
receiveDone();
#ifdef ESP8266
delay(1); // Give esp8266-based boards to handle background tasks
#endif
}
SENDERID = sender; // TWS: Restore SenderID after it gets wiped out by receiveDone() SENDERID = sender; // TWS: Restore SenderID after it gets wiped out by receiveDone()
sendFrame(sender, buffer, bufferSize, false, true); sendFrame(sender, buffer, bufferSize, false, true);
RSSI = _RSSI; // restore payload RSSI RSSI = _RSSI; // restore payload RSSI