From 7f4a88b2338da8c72af11f7fcbca97de1d67ffd9 Mon Sep 17 00:00:00 2001 From: ortegafernando Date: Tue, 2 Jun 2020 08:12:21 +0200 Subject: [PATCH 1/9] Add readPowerLevel function --- RFM69.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RFM69.h b/RFM69.h index 66be994..f739cd6 100644 --- a/RFM69.h +++ b/RFM69.h @@ -197,6 +197,7 @@ class RFM69 { virtual void setPowerLevel(uint8_t level); // reduce/increase transmit power level void sleep(); uint8_t readTemperature(uint8_t calFactor=0); // get CMOS temperature (8bit) + uint8_t readPowerLevel(); // get powerLevel void rcCalibration(); // calibrate the internal RC oscillator for use in wide temperature variations - see datasheet section [4.3.5. RC Timer Accuracy] // allow hacking registers by making these public @@ -281,4 +282,4 @@ class RFM69 { #endif }; -#endif \ No newline at end of file +#endif From 5dedaea4064fcad95eb5c35fa3a70589e778cf5a Mon Sep 17 00:00:00 2001 From: ortegafernando Date: Tue, 2 Jun 2020 08:14:53 +0200 Subject: [PATCH 2/9] Add readPowerLevel function --- RFM69.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/RFM69.cpp b/RFM69.cpp index 937f090..64d4d73 100644 --- a/RFM69.cpp +++ b/RFM69.cpp @@ -844,6 +844,11 @@ uint8_t RFM69::readTemperature(uint8_t calFactor) // returns centigrade return ~readReg(REG_TEMP2) + COURSE_TEMP_COEF + calFactor; // 'complement' corrects the slope, rising temp = rising val } // COURSE_TEMP_COEF puts reading in the ballpark, user can add additional correction +uint8_t RFM69::readPowerLevel() // get powerLevel +{ + return _powerLevel; +} + void RFM69::rcCalibration() { writeReg(REG_OSC1, RF_OSC1_RCCAL_START); @@ -1120,4 +1125,4 @@ void RFM69::listenModeSendBurst( uint8_t targetNode, void* buffer, uint8_t size setMode(RF69_MODE_STANDBY); reinitRadio(); } -#endif \ No newline at end of file +#endif From 8d8e42a2aca6a70ca463d40967e2de29ff782c0d Mon Sep 17 00:00:00 2001 From: ortegafernando Date: Tue, 2 Jun 2020 15:53:56 +0200 Subject: [PATCH 3/9] Update RFM69.h --- RFM69.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RFM69.h b/RFM69.h index f739cd6..7c397e9 100644 --- a/RFM69.h +++ b/RFM69.h @@ -195,9 +195,9 @@ class RFM69 { void promiscuous(bool onOff=true); virtual void setHighPower(bool onOFF=true); // has to be called after initialize() for RFM69HW virtual void setPowerLevel(uint8_t level); // reduce/increase transmit power level + uint8_t readPowerLevel(); // get powerLevel void sleep(); uint8_t readTemperature(uint8_t calFactor=0); // get CMOS temperature (8bit) - uint8_t readPowerLevel(); // get powerLevel void rcCalibration(); // calibrate the internal RC oscillator for use in wide temperature variations - see datasheet section [4.3.5. RC Timer Accuracy] // allow hacking registers by making these public From 4c9aa5ea33aa1a3d67d83b825dd2de8f83d3107e Mon Sep 17 00:00:00 2001 From: ortegafernando Date: Tue, 2 Jun 2020 15:54:44 +0200 Subject: [PATCH 4/9] Update RFM69.h --- RFM69.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RFM69.h b/RFM69.h index 7c397e9..40d7119 100644 --- a/RFM69.h +++ b/RFM69.h @@ -195,7 +195,7 @@ class RFM69 { void promiscuous(bool onOff=true); virtual void setHighPower(bool onOFF=true); // has to be called after initialize() for RFM69HW virtual void setPowerLevel(uint8_t level); // reduce/increase transmit power level - uint8_t readPowerLevel(); // get powerLevel + uint8_t getPowerLevel(); // get powerLevel void sleep(); uint8_t readTemperature(uint8_t calFactor=0); // get CMOS temperature (8bit) void rcCalibration(); // calibrate the internal RC oscillator for use in wide temperature variations - see datasheet section [4.3.5. RC Timer Accuracy] From aef898228b92efcadd0a51484d0e055bd962c6b7 Mon Sep 17 00:00:00 2001 From: ortegafernando Date: Tue, 2 Jun 2020 15:56:38 +0200 Subject: [PATCH 5/9] Update RFM69.cpp --- RFM69.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/RFM69.cpp b/RFM69.cpp index 64d4d73..8d47b71 100644 --- a/RFM69.cpp +++ b/RFM69.cpp @@ -227,6 +227,11 @@ void RFM69::setPowerLevel(uint8_t powerLevel) writeReg(REG_PALEVEL, (readReg(REG_PALEVEL) & 0xE0) | _powerLevel); } +uint8_t RFM69::getPowerLevel() // get powerLevel +{ + return _powerLevel; +} + bool RFM69::canSend() { if (_mode == RF69_MODE_RX && PAYLOADLEN == 0 && readRSSI() < CSMA_LIMIT) // if signal stronger than -100dBm is detected assume channel activity @@ -844,11 +849,6 @@ uint8_t RFM69::readTemperature(uint8_t calFactor) // returns centigrade return ~readReg(REG_TEMP2) + COURSE_TEMP_COEF + calFactor; // 'complement' corrects the slope, rising temp = rising val } // COURSE_TEMP_COEF puts reading in the ballpark, user can add additional correction -uint8_t RFM69::readPowerLevel() // get powerLevel -{ - return _powerLevel; -} - void RFM69::rcCalibration() { writeReg(REG_OSC1, RF_OSC1_RCCAL_START);