Fix low data-rate optimisation on SX1262

This commit is contained in:
Mark Qvist 2024-02-13 13:14:13 +01:00
parent 32424b91a6
commit 184d228991

View File

@ -755,8 +755,8 @@ void sx126x::setSpreadingFactor(int sf)
_sf = sf;
setModulationParams(sf, _bw, _cr, _ldro);
handleLowDataRate();
setModulationParams(sf, _bw, _cr, _ldro);
}
long sx126x::getSignalBandwidth()
@ -778,9 +778,11 @@ long sx126x::getSignalBandwidth()
}
void sx126x::handleLowDataRate(){
// TODO: Why was this enabled without any logic to check LDRO conditions?
//_ldro = 1;
//setModulationParams(_sf, _bw, _cr, _ldro);
if ( long( (1<<_sf) / (getSignalBandwidth()/1000)) > 16) {
_ldro = 0x01;
} else {
_ldro = 0x00;
}
}
void sx126x::optimizeModemSensitivity(){
@ -811,9 +813,9 @@ void sx126x::setSignalBandwidth(long sbw)
_bw = 0x06;
}
handleLowDataRate();
setModulationParams(_sf, _bw, _cr, _ldro);
handleLowDataRate();
optimizeModemSensitivity();
}