From 0bb04d876b0c8767cc58d30ddb934c2acd81f48d Mon Sep 17 00:00:00 2001 From: Mads Date: Fri, 21 Jul 2023 19:37:26 +0200 Subject: [PATCH] Add optimal PA settings for LLCC68 --- .../SX126x_LoRa_transmitter/SX126x_LoRa_transmitter.ino | 2 +- keywords.txt | 1 + src/SX126x.cpp | 4 ++-- src/SX126x_driver.h | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/SX126x/SX126x_LoRa_transmitter/SX126x_LoRa_transmitter.ino b/examples/SX126x/SX126x_LoRa_transmitter/SX126x_LoRa_transmitter.ino index a56f629..3c48a5b 100644 --- a/examples/SX126x/SX126x_LoRa_transmitter/SX126x_LoRa_transmitter.ino +++ b/examples/SX126x/SX126x_LoRa_transmitter/SX126x_LoRa_transmitter.ino @@ -46,7 +46,7 @@ void setup() { Serial.println("Set frequency to 915 Mhz"); LoRa.setFrequency(915000000); - // Set TX power, default power for SX1262 and SX1268 are +22 dBm and for SX1261 is +14 dBm + // Set TX power, default power for SX1262, SX1268 and LLCC68 are +22 dBm and for SX1261 is +14 dBm // This function will set PA config with optimal setting for requested TX power Serial.println("Set TX power to +17 dBm"); LoRa.setTxPower(17, SX126X_TX_POWER_SX1262); // TX power +17 dBm for SX1262 diff --git a/keywords.txt b/keywords.txt index 786f763..d1bd86d 100644 --- a/keywords.txt +++ b/keywords.txt @@ -135,6 +135,7 @@ SX126X_FSK_MODEM LITERAL1 SX126X_LORA_MODEM LITERAL1 SX126X_TX_POWER_SX1261 LITERAL1 SX126X_TX_POWER_SX1262 LITERAL1 +SX126X_TX_POWER_LLCC68 LITERAL1 SX126X_TX_POWER_SX1268 LITERAL1 SX126X_RX_GAIN_POWER_SAVING LITERAL1 SX126X_RX_GAIN_BOOSTED LITERAL1 diff --git a/src/SX126x.cpp b/src/SX126x.cpp index 36bb165..3628326 100644 --- a/src/SX126x.cpp +++ b/src/SX126x.cpp @@ -238,7 +238,7 @@ void SX126x::setTxPower(uint8_t txPower, uint8_t version) paDutyCycle = 0x04; hpMax = 0x00; power = 0x0E; - } else if (txPower >= 14 && version == SX126X_TX_POWER_SX1262) { + } else if (txPower >= 14 && (version == SX126X_TX_POWER_SX1262 || version == SX126X_TX_POWER_LLCC68)) { paDutyCycle = 0x02; hpMax = 0x02; power = 0x16; @@ -250,7 +250,7 @@ void SX126x::setTxPower(uint8_t txPower, uint8_t version) paDutyCycle = 0x01; hpMax = 0x00; power = 0x0D; - } else if (txPower >= 10 && version == SX126X_TX_POWER_SX1268) { + } else if (txPower >= 10 && (version == SX126X_TX_POWER_SX1268 || version == SX126X_TX_POWER_LLCC68)) { paDutyCycle = 0x00; hpMax = 0x03; power = 0x0F; diff --git a/src/SX126x_driver.h b/src/SX126x_driver.h index 78c300e..f50d695 100644 --- a/src/SX126x_driver.h +++ b/src/SX126x_driver.h @@ -57,6 +57,7 @@ // SetPaConfig #define SX126X_TX_POWER_SX1261 0x01 // device version for TX power: SX1261 #define SX126X_TX_POWER_SX1262 0x02 // : SX1262 +#define SX126X_TX_POWER_LLCC68 0x06 // : LLCC68 #define SX126X_TX_POWER_SX1268 0x08 // : SX1268 // SetRxTxFallbackMode