LoRa: Enable LowDataRateOptimize for symbol length >16ms
This commit is contained in:
parent
1275c5876d
commit
7f2663366e
16
LoRa.cpp
16
LoRa.cpp
|
@ -418,6 +418,8 @@ void LoRaClass::setSpreadingFactor(int sf)
|
||||||
}
|
}
|
||||||
|
|
||||||
writeRegister(REG_MODEM_CONFIG_2, (readRegister(REG_MODEM_CONFIG_2) & 0x0f) | ((sf << 4) & 0xf0));
|
writeRegister(REG_MODEM_CONFIG_2, (readRegister(REG_MODEM_CONFIG_2) & 0x0f) | ((sf << 4) & 0xf0));
|
||||||
|
|
||||||
|
handleLowDataRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
long LoRaClass::getSignalBandwidth()
|
long LoRaClass::getSignalBandwidth()
|
||||||
|
@ -437,6 +439,18 @@ long LoRaClass::getSignalBandwidth()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LoRaClass::handleLowDataRate(){
|
||||||
|
int sf = (readRegister(REG_MODEM_CONFIG_2) >> 4);
|
||||||
|
if ( long( (1<<sf) / (getSignalBandwidth()/1000)) > 16) {
|
||||||
|
// set auto AGC and LowDataRateOptimize
|
||||||
|
writeRegister(REG_MODEM_CONFIG_3, (1<<3)|(1<<2));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// set auto AGC
|
||||||
|
writeRegister(REG_MODEM_CONFIG_3, (1<<2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void LoRaClass::setSignalBandwidth(long sbw)
|
void LoRaClass::setSignalBandwidth(long sbw)
|
||||||
{
|
{
|
||||||
int bw;
|
int bw;
|
||||||
|
@ -464,6 +478,8 @@ void LoRaClass::setSignalBandwidth(long sbw)
|
||||||
}
|
}
|
||||||
|
|
||||||
writeRegister(REG_MODEM_CONFIG_1, (readRegister(REG_MODEM_CONFIG_1) & 0x0f) | (bw << 4));
|
writeRegister(REG_MODEM_CONFIG_1, (readRegister(REG_MODEM_CONFIG_1) & 0x0f) | (bw << 4));
|
||||||
|
|
||||||
|
handleLowDataRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoRaClass::setCodingRate4(int denominator)
|
void LoRaClass::setCodingRate4(int denominator)
|
||||||
|
|
Loading…
Reference in New Issue