[RFM9x] Using range check macro

This commit is contained in:
jgromes 2020-03-30 19:29:55 +02:00
parent 274b38d556
commit 08e4c3b13b
2 changed files with 2 additions and 8 deletions

View file

@ -35,10 +35,7 @@ int16_t RFM95::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncW
}
int16_t RFM95::setFrequency(float freq) {
// check frequency range
if((freq < 868.0) || (freq > 915.0)) {
return(ERR_INVALID_FREQUENCY);
}
RADIOLIB_CHECK_RANGE(freq, 868.0, 915.0, ERR_INVALID_FREQUENCY);
// set frequency
return(SX127x::setFrequencyRaw(freq));

View file

@ -35,10 +35,7 @@ int16_t RFM96::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncW
}
int16_t RFM96::setFrequency(float freq) {
// check frequency range
if((freq < 433.0) || (freq > 470.0)) {
return(ERR_INVALID_FREQUENCY);
}
RADIOLIB_CHECK_RANGE(freq, 433.0, 470.0, ERR_INVALID_FREQUENCY);
// set frequency
return(SX127x::setFrequencyRaw(freq));