[RFM9x] Fixed frequency setting not saved (#253)

This commit is contained in:
jgromes 2021-02-18 18:48:09 +01:00
parent f16f8e43f4
commit 0d3435c595
3 changed files with 17 additions and 5 deletions

View file

@ -116,8 +116,12 @@ int16_t SX1276::setFrequency(float freq) {
}
}
// set frequency
return(SX127x::setFrequencyRaw(freq));
// set frequency and if successful, save the new setting
int16_t state = SX127x::setFrequencyRaw(freq);
if(state == ERR_NONE) {
SX127x::_freq = freq;
}
return(state);
}
#endif

View file

@ -117,7 +117,11 @@ int16_t SX1277::setFrequency(float freq) {
}
// 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);
}
int16_t SX1277::setSpreadingFactor(uint8_t sf) {

View file

@ -53,8 +53,12 @@ int16_t SX1279::beginFSK(float freq, float br, float freqDev, float rxBw, int8_t
int16_t SX1279::setFrequency(float freq) {
RADIOLIB_CHECK_RANGE(freq, 137.0, 960.0, ERR_INVALID_FREQUENCY);
// set frequency
return(SX127x::setFrequencyRaw(freq));
// set frequency and if successful, save the new setting
int16_t state = SX127x::setFrequencyRaw(freq);
if(state == ERR_NONE) {
SX127x::_freq = freq;
}
return(state);
}
#endif