From 214a566d9a317c8538b2b893f78376f65d02159c Mon Sep 17 00:00:00 2001 From: jgromes Date: Sun, 26 May 2024 08:43:02 +0200 Subject: [PATCH] [CC1101] Make frequency range check bounds inclusive --- src/modules/CC1101/CC1101.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modules/CC1101/CC1101.cpp b/src/modules/CC1101/CC1101.cpp index 73006578..57835377 100644 --- a/src/modules/CC1101/CC1101.cpp +++ b/src/modules/CC1101/CC1101.cpp @@ -424,11 +424,13 @@ int16_t CC1101::readData(uint8_t* data, size_t len) { int16_t CC1101::setFrequency(float freq) { // check allowed frequency range - if(!(((freq > 300.0) && (freq < 348.0)) || - ((freq > 387.0) && (freq < 464.0)) || - ((freq > 779.0) && (freq < 928.0)))) { + #if RADIOLIB_CHECK_PARAMS + if(!(((freq >= 300.0) && (freq <= 348.0)) || + ((freq >= 387.0) && (freq <= 464.0)) || + ((freq >= 779.0) && (freq <= 928.0)))) { return(RADIOLIB_ERR_INVALID_FREQUENCY); } + #endif // set mode to standby SPIsendCommand(RADIOLIB_CC1101_CMD_IDLE);