[CC1101] Make frequency range check bounds inclusive

This commit is contained in:
jgromes 2024-05-26 08:43:02 +02:00
parent 139fc7ee35
commit 214a566d9a

View file

@ -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);