From 71a8866e4ba1000ffd5df0a871009a4545c0e855 Mon Sep 17 00:00:00 2001 From: Jason Reiss Date: Wed, 20 Jan 2021 17:24:10 -0600 Subject: Allow dig_gain to be set in txpkt for 64 tx output options --- libloragw/src/loragw_hal.c | 10 ++++++++-- libloragw/src/loragw_reg.c | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'libloragw/src') diff --git a/libloragw/src/loragw_hal.c b/libloragw/src/loragw_hal.c index c723be9..2627aaf 100644 --- a/libloragw/src/loragw_hal.c +++ b/libloragw/src/loragw_hal.c @@ -1439,8 +1439,14 @@ int lgw_send(struct lgw_pkt_tx_s pkt_data) { /* loading TX imbalance correction */ target_mix_gain = txgain_lut.lut[pow_index].mix_gain; - /* Set digital gain from LUT */ - lgw_reg_w(LGW_TX_GAIN, txgain_lut.lut[pow_index].dig_gain); + + if (pkt_data.dig_gain == -1 || pkt_data.dig_gain > 3) { + /* Set digital gain from LUT */ + lgw_reg_w(LGW_TX_GAIN, txgain_lut.lut[pow_index].dig_gain); + } else { + /* Set digital gain set by forwarder */ + lgw_reg_w(LGW_TX_GAIN, pkt_data.dig_gain); + } } if (pkt_data.rf_chain == 0) { /* use radio A calibration table */ diff --git a/libloragw/src/loragw_reg.c b/libloragw/src/loragw_reg.c index 5991384..b5a1d46 100644 --- a/libloragw/src/loragw_reg.c +++ b/libloragw/src/loragw_reg.c @@ -49,7 +49,7 @@ Maintainer: Sylvain Miermont #define PAGE_MASK 0x03 const uint8_t FPGA_VERSIONS_SUPPORTED[] = { 28, 31, 32, 33, 34, 35, 37 }; /* several versions could be supported */ -const uint8_t FPGA_VERSIONS_SUPPORTING_ATTENUATOR[] = { 32, 34, 35, 37 }; /* defines lgw_send power interpretation */ +const uint8_t FPGA_VERSIONS_SUPPORTING_ATTENUATOR[] = { 37 }; /* defines lgw_send power interpretation */ /* auto generated register mapping for C code : 11-Jul-2013 13:20:40 -- cgit v1.2.3