From d863c02ffe1fd1bf5fa73aadeb151f3877b6b13f Mon Sep 17 00:00:00 2001 From: Andrea Guglielmini Date: Thu, 12 Dec 2019 02:50:55 +0100 Subject: [PATCH] [CC1101] txPower updated according to chosen freq. --- src/modules/CC1101/CC1101.cpp | 6 +++++- src/modules/CC1101/CC1101.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modules/CC1101/CC1101.cpp b/src/modules/CC1101/CC1101.cpp index 35e4a293..fd2b9098 100644 --- a/src/modules/CC1101/CC1101.cpp +++ b/src/modules/CC1101/CC1101.cpp @@ -315,7 +315,8 @@ int16_t CC1101::setFrequency(float freq) { _freq = freq; } - return(state); + // Update the TX power accordingly to new freq. (PA values depend on chosen freq) + return setOutputPower(_power); } int16_t CC1101::setBitRate(float br) { @@ -389,6 +390,9 @@ int16_t CC1101::setFrequencyDeviation(float freqDev) { } int16_t CC1101::setOutputPower(int8_t power) { + // Store the value. + _power = power; + // round to the known frequency settings uint8_t f; if(_freq < 374.0) { diff --git a/src/modules/CC1101/CC1101.h b/src/modules/CC1101/CC1101.h index 7622efcd..08cc7ea0 100644 --- a/src/modules/CC1101/CC1101.h +++ b/src/modules/CC1101/CC1101.h @@ -833,6 +833,7 @@ class CC1101: public PhysicalLayer { bool _promiscuous; uint8_t _syncWordLength; + int8_t _power; int16_t config(); int16_t directMode();