[RF69] Using range check macro

pull/142/head
jgromes 2020-03-30 19:31:20 +02:00
rodzic 7f083bb083
commit 532c1e6fe9
1 zmienionych plików z 2 dodań i 8 usunięć

Wyświetl plik

@ -359,10 +359,7 @@ int16_t RF69::setFrequency(float freq) {
}
int16_t RF69::setBitRate(float br) {
// check allowed bitrate
if((br < 1.2) || (br > 300.0)) {
return(ERR_INVALID_BIT_RATE);
}
RADIOLIB_CHECK_RANGE(br, 1.2, 300.0, ERR_INVALID_BIT_RATE);
// check bitrate-bandwidth ratio
if(!(br < 2000 * _rxBw)) {
@ -496,10 +493,7 @@ int16_t RF69::setFrequencyDeviation(float freqDev) {
}
int16_t RF69::setOutputPower(int8_t power) {
// check output power range
if((power < -18) || (power > 17)) {
return(ERR_INVALID_OUTPUT_POWER);
}
RADIOLIB_CHECK_RANGE(power, -18, 17, ERR_INVALID_OUTPUT_POWER);
// set mode to standby
setMode(RF69_STANDBY);