summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarsh Sharma <harsh.sharma@multitech.com>2021-01-29 16:43:45 -0600
committerHarsh Sharma <harsh.sharma@multitech.com>2021-01-29 16:43:45 -0600
commitbe85ff3b063601e467f9212e7ce9aa1b7afd4bd9 (patch)
tree9d4910b74fd430dbf713a847cb0487cd646c1bcb
parent5ab2ffb580da0a84cb6ffe88545ec5e4f3d2e6f3 (diff)
parent71a8866e4ba1000ffd5df0a871009a4545c0e855 (diff)
downloadlora_gateway_mtac_full-be85ff3b063601e467f9212e7ce9aa1b7afd4bd9.tar.gz
lora_gateway_mtac_full-be85ff3b063601e467f9212e7ce9aa1b7afd4bd9.tar.bz2
lora_gateway_mtac_full-be85ff3b063601e467f9212e7ce9aa1b7afd4bd9.zip
Merge branch 'master' of gitlab.multitech.net:lora_enterprise/lora_gateway_mtac_full
-rw-r--r--libloragw/inc/loragw_hal.h3
-rw-r--r--libloragw/src/loragw_hal.c10
-rw-r--r--libloragw/src/loragw_reg.c2
3 files changed, 11 insertions, 4 deletions
diff --git a/libloragw/inc/loragw_hal.h b/libloragw/inc/loragw_hal.h
index f6dc8dc..41faec7 100644
--- a/libloragw/inc/loragw_hal.h
+++ b/libloragw/inc/loragw_hal.h
@@ -260,7 +260,8 @@ struct lgw_pkt_tx_s {
uint8_t tx_mode; /*!> select on what event/time the TX is triggered */
uint32_t count_us; /*!> timestamp or delay in microseconds for TX trigger */
uint8_t rf_chain; /*!> through which RF chain will the packet be sent */
- float rf_power; /*!> TX power, in dBm */
+ float rf_power; /*!> TX power index */
+ int8_t dig_gain; /*!> DIG gain based on current temperature */
uint8_t modulation; /*!> modulation to use for the packet */
uint8_t bandwidth; /*!> modulation bandwidth (LoRa only) */
uint32_t datarate; /*!> TX datarate (baudrate for FSK, SF for LoRa) */
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