kopia lustrzana https://github.com/jgromes/RadioLib
[SX128x] Add support for coding rate 4/4
rodzic
5d61453dbf
commit
ceb27967e1
|
@ -726,11 +726,24 @@ int16_t SX128x::setCodingRate(uint8_t cr, bool longInterleaving) {
|
||||||
|
|
||||||
// LoRa/ranging
|
// LoRa/ranging
|
||||||
if((modem == RADIOLIB_SX128X_PACKET_TYPE_LORA) || (modem == RADIOLIB_SX128X_PACKET_TYPE_RANGING)) {
|
if((modem == RADIOLIB_SX128X_PACKET_TYPE_LORA) || (modem == RADIOLIB_SX128X_PACKET_TYPE_RANGING)) {
|
||||||
RADIOLIB_CHECK_RANGE(cr, 5, 8, RADIOLIB_ERR_INVALID_CODING_RATE);
|
RADIOLIB_CHECK_RANGE(cr, 4, 8, RADIOLIB_ERR_INVALID_CODING_RATE);
|
||||||
|
|
||||||
// update modulation parameters
|
// update modulation parameters
|
||||||
if(longInterleaving && (modem == RADIOLIB_SX128X_PACKET_TYPE_LORA)) {
|
if(longInterleaving && (modem == RADIOLIB_SX128X_PACKET_TYPE_LORA)) {
|
||||||
|
switch(cr) {
|
||||||
|
case 4:
|
||||||
|
this->codingRateLoRa = 0;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
case 6:
|
||||||
this->codingRateLoRa = cr;
|
this->codingRateLoRa = cr;
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
this->codingRateLoRa = cr - 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return(RADIOLIB_ERR_INVALID_CODING_RATE);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this->codingRateLoRa = cr - 4;
|
this->codingRateLoRa = cr - 4;
|
||||||
}
|
}
|
||||||
|
|
|
@ -370,7 +370,8 @@ class SX128x: public PhysicalLayer {
|
||||||
\param freq Carrier frequency in MHz. Defaults to 2400.0 MHz.
|
\param freq Carrier frequency in MHz. Defaults to 2400.0 MHz.
|
||||||
\param bw LoRa bandwidth in kHz. Defaults to 812.5 kHz.
|
\param bw LoRa bandwidth in kHz. Defaults to 812.5 kHz.
|
||||||
\param sf LoRa spreading factor. Defaults to 9.
|
\param sf LoRa spreading factor. Defaults to 9.
|
||||||
\param cr LoRa coding rate denominator. Defaults to 7 (coding rate 4/7).
|
\param cr LoRa coding rate denominator. Defaults to 7 (coding rate 4/7). Allowed values range from 4 to 8. Note that a value of 4 means no coding,
|
||||||
|
is undocumented and not recommended without your own FEC.
|
||||||
\param syncWord 2-byte LoRa sync word. Defaults to RADIOLIB_SX128X_SYNC_WORD_PRIVATE (0x12).
|
\param syncWord 2-byte LoRa sync word. Defaults to RADIOLIB_SX128X_SYNC_WORD_PRIVATE (0x12).
|
||||||
\param pwr Output power in dBm. Defaults to 10 dBm.
|
\param pwr Output power in dBm. Defaults to 10 dBm.
|
||||||
\param preambleLength LoRa preamble length in symbols. Defaults to 12 symbols.
|
\param preambleLength LoRa preamble length in symbols. Defaults to 12 symbols.
|
||||||
|
@ -626,7 +627,8 @@ class SX128x: public PhysicalLayer {
|
||||||
int16_t setSpreadingFactor(uint8_t sf);
|
int16_t setSpreadingFactor(uint8_t sf);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Sets LoRa coding rate denominator. Allowed values range from 5 to 8.
|
\brief Sets LoRa coding rate denominator. Allowed values range from 4 to 8. Note that a value of 4
|
||||||
|
means no coding, is undocumented and not recommended without your own FEC.
|
||||||
\param cr LoRa coding rate denominator to be set.
|
\param cr LoRa coding rate denominator to be set.
|
||||||
\param longInterleaving Whether to enable long interleaving mode. Not available for coding rate 4/7,
|
\param longInterleaving Whether to enable long interleaving mode. Not available for coding rate 4/7,
|
||||||
defaults to false.
|
defaults to false.
|
||||||
|
|
Ładowanie…
Reference in New Issue