summaryrefslogtreecommitdiff
path: root/lora_pkt_fwd
diff options
context:
space:
mode:
authorJason Reiss <jreiss@multitech.com>2021-04-08 14:38:17 -0500
committerJason Reiss <jreiss@multitech.com>2021-04-08 14:38:17 -0500
commit2127cf20cbc9c28e5efe81cf034a716892bfc8e5 (patch)
treefac9cc309cbbf1b57b61d9593a034c74d04a27f8 /lora_pkt_fwd
parent22c62ff3fe0c373bf2c3ef94b1fc30dbecb086c1 (diff)
downloadpacket_forwarder_mtac_full-2127cf20cbc9c28e5efe81cf034a716892bfc8e5.tar.gz
packet_forwarder_mtac_full-2127cf20cbc9c28e5efe81cf034a716892bfc8e5.tar.bz2
packet_forwarder_mtac_full-2127cf20cbc9c28e5efe81cf034a716892bfc8e5.zip
load lut into lgw when temp comp is enabled4.0.8
Diffstat (limited to 'lora_pkt_fwd')
-rw-r--r--lora_pkt_fwd/src/lora_pkt_fwd.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/lora_pkt_fwd/src/lora_pkt_fwd.c b/lora_pkt_fwd/src/lora_pkt_fwd.c
index 87eaaa0..80bd66a 100644
--- a/lora_pkt_fwd/src/lora_pkt_fwd.c
+++ b/lora_pkt_fwd/src/lora_pkt_fwd.c
@@ -374,7 +374,7 @@ void lookup_power_settings(float tx_pwr, int8_t* rf_power, int8_t* dig_gain) {
for (int i = 0; i < TEMP_LUT_SIZE_MAX; i++) {
// If the current temp is lower than the first temp or we reach the end of the table
- if ((tx_temp_lut->dig[0].temp > tx_temp_lut->temp_comp_value || i == TEMP_LUT_SIZE_MAX-1) ||
+ if ((tx_temp_lut.lut[0].temp > temp_comp_value || i == TEMP_LUT_SIZE_MAX-1) ||
(tx_temp_lut.lut[i].temp <= temp_comp_value && tx_temp_lut.lut[i+1].temp > temp_comp_value)) {
for (int j = 0; j < TX_GAIN_LUT_SIZE_MAX; j++) {
for (int h = 0; h < 4; h++) {
@@ -849,6 +849,7 @@ static int parse_SX1301_configuration(const char * conf_file) {
MSG("INFO: Loading temperature compensated LUT values\n");
for (i = 0; i < TX_GAIN_LUT_SIZE_MAX; i++) {
+ txlut.size++;
txlut.lut[i].rf_power = tx_temp_lut.base[i].rf_power;
txlut.lut[i].pa_gain = tx_temp_lut.base[i].pa_gain;
txlut.lut[i].mix_gain = tx_temp_lut.base[i].mix_gain;
@@ -856,6 +857,17 @@ static int parse_SX1301_configuration(const char * conf_file) {
txlut.lut[i].dac_gain = 3;
MSG("LUT %d RF: %d PA: %d MIX: %d DIG: %d DAC: %d\n", i, txlut.lut[i].rf_power, txlut.lut[i].pa_gain, txlut.lut[i].mix_gain, txlut.lut[i].dig_gain, txlut.lut[i].dac_gain);
}
+
+ /* all parameters parsed, submitting configuration to the HAL */
+ if (txlut.size > 0) {
+ MSG("INFO: Configuring TX LUT with %u indexes\n", txlut.size);
+ if (lgw_txgain_setconf(&txlut) != LGW_HAL_SUCCESS) {
+ MSG("ERROR: Failed to configure concentrator TX Gain LUT\n");
+ return -1;
+ }
+ } else {
+ MSG("WARNING: No TX gain LUT defined\n");
+ }
} else {
/* set configuration for tx gains */