kopia lustrzana https://github.com/jgromes/RadioLib
[RFM9x] Fixed frequency setting not saved (#253)
rodzic
3205bd1c72
commit
f16f8e43f4
|
@ -43,8 +43,12 @@ int16_t RFM95::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncW
|
||||||
int16_t RFM95::setFrequency(float freq) {
|
int16_t RFM95::setFrequency(float freq) {
|
||||||
RADIOLIB_CHECK_RANGE(freq, 862.0, 1020.0, ERR_INVALID_FREQUENCY);
|
RADIOLIB_CHECK_RANGE(freq, 862.0, 1020.0, ERR_INVALID_FREQUENCY);
|
||||||
|
|
||||||
// set frequency
|
// set frequency and if successful, save the new setting
|
||||||
return(SX127x::setFrequencyRaw(freq));
|
int16_t state = SX127x::setFrequencyRaw(freq);
|
||||||
|
if(state == ERR_NONE) {
|
||||||
|
SX127x::_freq = freq;
|
||||||
|
}
|
||||||
|
return(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -44,8 +44,12 @@ int16_t RFM96::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncW
|
||||||
int16_t RFM96::setFrequency(float freq) {
|
int16_t RFM96::setFrequency(float freq) {
|
||||||
RADIOLIB_CHECK_RANGE(freq, 410.0, 525.0, ERR_INVALID_FREQUENCY);
|
RADIOLIB_CHECK_RANGE(freq, 410.0, 525.0, ERR_INVALID_FREQUENCY);
|
||||||
|
|
||||||
// set frequency
|
// set frequency and if successful, save the new setting
|
||||||
return(SX127x::setFrequencyRaw(freq));
|
int16_t state = SX127x::setFrequencyRaw(freq);
|
||||||
|
if(state == ERR_NONE) {
|
||||||
|
SX127x::_freq = freq;
|
||||||
|
}
|
||||||
|
return(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Ładowanie…
Reference in New Issue