MCPcopy Create free account
hub / github.com/LowPowerLab/RFM69 / sendACK

Method sendACK

RFM69.cpp:372–387  ·  view source on GitHub ↗

should be called immediately after reception in case sender wants ACK

Source from the content-addressed store, hash-verified

370
371// should be called immediately after reception in case sender wants ACK
372void 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
390void RFM69::sendFrame(uint16_t toAddress, const void* buffer, uint8_t bufferSize, bool requestACK, bool sendACK) {

Callers 2

HandleHandshakeACKFunction · 0.45
HandleWirelessHEXDataFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected