kopia lustrzana https://github.com/jgromes/RadioLib
[SX128x] Add missing register write when setting SF (#1549)
rodzic
5f73a87a3a
commit
32c3570ad3
|
@ -695,7 +695,7 @@ int16_t SX128x::setSpreadingFactor(uint8_t sf) {
|
|||
int16_t state = setModulationParams(this->spreadingFactor, this->bandwidth, this->codingRateLoRa);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// update mystery register in LoRa mode - SX1280 datasheet v3.0 section 13.4.1
|
||||
// update mystery register in LoRa mode - SX1280 datasheet rev 3.2 section 14.4.1
|
||||
if(modem == RADIOLIB_SX128X_PACKET_TYPE_LORA) {
|
||||
uint8_t data = 0;
|
||||
if((this->spreadingFactor == RADIOLIB_SX128X_LORA_SF_5) || (this->spreadingFactor == RADIOLIB_SX128X_LORA_SF_6)) {
|
||||
|
@ -706,6 +706,15 @@ int16_t SX128x::setSpreadingFactor(uint8_t sf) {
|
|||
data = 0x32;
|
||||
}
|
||||
state = SX128x::writeRegister(RADIOLIB_SX128X_REG_LORA_SF_CONFIG, &data, 1);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// this register must also be updated for some reason
|
||||
state = SX128x::readRegister(RADIOLIB_SX128X_REG_FREQ_ERROR_CORRECTION, &data, 1);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
data |= 0x01;
|
||||
state = SX128x::writeRegister(RADIOLIB_SX128X_REG_FREQ_ERROR_CORRECTION, &data, 1);
|
||||
RADIOLIB_ASSERT(state);
|
||||
}
|
||||
|
||||
return(state);
|
||||
|
|
Ładowanie…
Reference in New Issue