From 999933b7bfbf5d3116873ee1ff2467a3577157ac Mon Sep 17 00:00:00 2001 From: Felix Rusu Date: Wed, 5 Jun 2019 11:30:45 -0400 Subject: [PATCH] define RFM69_ACK_TIMEOUT --- RFM69.h | 4 +++- RFM69_ATC.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/RFM69.h b/RFM69.h index 05359b7..10a53e2 100644 --- a/RFM69.h +++ b/RFM69.h @@ -152,6 +152,8 @@ #define RFM69_CTL_SENDACK 0x80 #define RFM69_CTL_REQACK 0x40 +#define RFM69_ACK_TIMEOUT 30 // 30ms roundtrip req for 61byte packets + //Native hardware ListenMode is experimental //It was determined to be buggy and unreliable, see https://lowpowerlab.com/forum/low-power-techniques/ultra-low-power-listening-mode-for-battery-nodes/msg20261/#msg20261 //uncomment to try ListenMode, adds ~1K to compiled size @@ -186,7 +188,7 @@ class RFM69 { void setNetwork(uint8_t networkID); bool canSend(); virtual void send(uint16_t toAddress, const void* buffer, uint8_t bufferSize, bool requestACK=false); - virtual bool sendWithRetry(uint16_t toAddress, const void* buffer, uint8_t bufferSize, uint8_t retries=2, uint8_t retryWaitTime=40); // 40ms roundtrip req for 61byte packets + virtual bool sendWithRetry(uint16_t toAddress, const void* buffer, uint8_t bufferSize, uint8_t retries=2, uint8_t retryWaitTime=RFM69_ACK_TIMEOUT); virtual bool receiveDone(); bool ACKReceived(uint16_t fromNodeID); bool ACKRequested(); diff --git a/RFM69_ATC.h b/RFM69_ATC.h index 8c54582..a28fa52 100644 --- a/RFM69_ATC.h +++ b/RFM69_ATC.h @@ -44,7 +44,7 @@ class RFM69_ATC: public RFM69 { void sendACK(const void* buffer = "", uint8_t bufferSize=0); //void setHighPower(bool onOFF=true, uint8_t PA_ctl=0x60); //have to call it after initialize for RFM69HW //void setPowerLevel(uint8_t level); // reduce/increase transmit power level - bool sendWithRetry(uint16_t toAddress, const void* buffer, uint8_t bufferSize, uint8_t retries=2, uint8_t retryWaitTime=40); // 40ms roundtrip req for 61byte packets + bool sendWithRetry(uint16_t toAddress, const void* buffer, uint8_t bufferSize, uint8_t retries=2, uint8_t retryWaitTime=RFM69_ACK_TIMEOUT); void enableAutoPower(int16_t targetRSSI=-90); // TWS: New method to enable/disable auto Power control void setMode(uint8_t mode); // TWS: moved from protected to try to build block()/unblock() wrapper