From a8b6c38488052263c53b01948f50ce22ed818af3 Mon Sep 17 00:00:00 2001 From: Jack Hance Date: Wed, 12 Jun 2024 10:46:10 -0500 Subject: [PATCH] [CC1101] Fix getRSSI data source (#1121) * [CC1101] Fix getRSSI data source * [CC1101] Fix packet mode not resetting directModeEnabled bool --- src/modules/CC1101/CC1101.cpp | 5 ++++- src/modules/CC1101/CC1101.h | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/modules/CC1101/CC1101.cpp b/src/modules/CC1101/CC1101.cpp index 72830ce0..cfce1f2a 100644 --- a/src/modules/CC1101/CC1101.cpp +++ b/src/modules/CC1101/CC1101.cpp @@ -1023,7 +1023,7 @@ int16_t CC1101::directMode(bool sync) { SPIsendCommand(RADIOLIB_CC1101_CMD_IDLE); int16_t state = 0; - this->directModeEnabled = sync; + this->directModeEnabled = true; if(sync) { // set GDO0 and GDO2 mapping state |= SPIsetRegValue(RADIOLIB_CC1101_REG_IOCFG0, RADIOLIB_CC1101_GDOX_SERIAL_CLOCK , 5, 0); @@ -1083,6 +1083,9 @@ int16_t CC1101::setPacketMode(uint8_t mode, uint16_t len) { state = SPIsetRegValue(RADIOLIB_CC1101_REG_PKTLEN, len); RADIOLIB_ASSERT(state); + // no longer in a direct mode + this->directModeEnabled = false; + // update the cached values this->packetLength = len; this->packetLengthConfig = mode; diff --git a/src/modules/CC1101/CC1101.h b/src/modules/CC1101/CC1101.h index e61c5fc4..af315a37 100644 --- a/src/modules/CC1101/CC1101.h +++ b/src/modules/CC1101/CC1101.h @@ -845,7 +845,7 @@ class CC1101: public PhysicalLayer { /*! \brief Gets RSSI (Recorded Signal Strength Indicator) of the last received packet. - In asynchronous direct mode, returns the current RSSI level. + In direct or asynchronous direct mode, returns the current RSSI level. \returns RSSI in dBm. */ float getRSSI() override; @@ -1003,7 +1003,7 @@ class CC1101: public PhysicalLayer { bool promiscuous = false; bool crcOn = true; - bool directModeEnabled = true; + bool directModeEnabled = false; int8_t power = RADIOLIB_CC1101_DEFAULT_POWER;