should be called immediately after reception in case sender wants ACK
| 370 | |
| 371 | // should be called immediately after reception in case sender wants ACK |
| 372 | void RFM69::sendACK(const void* buffer, uint8_t bufferSize) { |
| 373 | ACK_REQUESTED = 0; // TWS added to make sure we don't end up in a timing race and infinite loop sending Acks |
| 374 | uint16_t sender = SENDERID; |
| 375 | int16_t _RSSI = RSSI; // save payload received RSSI value |
| 376 | writeReg(REG_PACKETCONFIG2, (readReg(REG_PACKETCONFIG2) & 0xFB) | RF_PACKET2_RXRESTART); // avoid RX deadlocks |
| 377 | uint32_t now = millis(); |
| 378 | while (!canSend() && millis() - now < RF69_CSMA_LIMIT_MS){ |
| 379 | receiveDone(); |
| 380 | #ifdef ESP8266 |
| 381 | delay(1); // Give esp8266-based boards to handle background tasks. Seems to work better than yield(). |
| 382 | #endif |
| 383 | } |
| 384 | SENDERID = sender; // TWS: Restore SenderID after it gets wiped out by receiveDone() |
| 385 | sendFrame(sender, buffer, bufferSize, false, true); |
| 386 | RSSI = _RSSI; // restore payload RSSI |
| 387 | } |
| 388 | |
| 389 | // internal function |
| 390 | void RFM69::sendFrame(uint16_t toAddress, const void* buffer, uint8_t bufferSize, bool requestACK, bool sendACK) { |
no outgoing calls
no test coverage detected