allow dialing up TX Power

This commit is contained in:
LowPowerLab 2016-04-04 11:03:40 -04:00
parent 3bfe8f1be7
commit 191daf4f3e
2 changed files with 22 additions and 0 deletions

View File

@ -156,6 +156,27 @@ void RFM69_ATC::interruptHook(uint8_t CTLbyte) {
}
}
//=============================================================================
// sendWithRetry() - overrides the base to allow increasing power when repeated ACK requests fail
//=============================================================================
bool RFM69_ATC::sendWithRetry(uint8_t toAddress, const void* buffer, uint8_t bufferSize, uint8_t retries, uint8_t retryWaitTime) {
uint32_t sentTime;
for (uint8_t i = 0; i <= retries; i++)
{
send(toAddress, buffer, bufferSize, true);
sentTime = millis();
while (millis() - sentTime < retryWaitTime)
{
if (ACKReceived(toAddress))
{
return true;
}
}
}
if (_transmitLevel < 31) _transmitLevel++;
return false;
}
//=============================================================================
// receiveBegin() - need to clear out our flag before calling base class.
//=============================================================================

View File

@ -47,6 +47,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(uint8_t toAddress, const void* buffer, uint8_t bufferSize, uint8_t retries=2, uint8_t retryWaitTime=40); // 40ms roundtrip req for 61byte packets
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