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

pull/261/head
jgromes 2021-02-18 18:48:09 +01:00
rodzic f16f8e43f4
commit 0d3435c595
3 zmienionych plików z 17 dodań i 5 usunięć

Wyświetl plik

@ -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

Wyświetl plik

@ -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) {

Wyświetl plik

@ -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