From 7b787bb68f260f8dfa3f693abff80285c4abf964 Mon Sep 17 00:00:00 2001 From: LowPowerLab Date: Fri, 16 Aug 2013 21:35:34 -0400 Subject: [PATCH] Update RFM69.cpp --- RFM69.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/RFM69.cpp b/RFM69.cpp index b344ebc..214948c 100644 --- a/RFM69.cpp +++ b/RFM69.cpp @@ -130,11 +130,12 @@ void RFM69::setAddress(byte addr) writeReg(REG_NODEADRS, _address); } -// power: 0=min, 31=max -void RFM69::setPowerLevel(byte powerLevel) +// set output power: 0=min, 31=max +// this results in a "weaker" transmitted signal, and directly results in a lower RSSI at the receiver +void RFM69Network::setPowerLevel(byte powerLevel) { _powerLevel = powerLevel; - writeReg(REG_PALEVEL, readReg(REG_PALEVEL) & (_powerLevel > 31 ? 31 : _powerLevel)); + writeReg(REG_PALEVEL, (readReg(REG_PALEVEL) & 0xE0) | (_powerLevel > 31 ? 31 : _powerLevel)); } bool RFM69::canSend() @@ -405,4 +406,4 @@ void RFM69::readAllRegs() // writeReg(REG_TEMP1, RF_TEMP1_MEAS_START); // while ((readReg(REG_TEMP1) & RF_TEMP1_MEAS_RUNNING)); // return readReg(REG_TEMP2); -// } \ No newline at end of file +// }