[CC1101] Make frequency range check bounds inclusive
This commit is contained in:
parent
139fc7ee35
commit
214a566d9a
1 changed files with 5 additions and 3 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue