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 +// }