summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarsh Sharma <harsh.sharma@multitech.com>2019-10-29 14:43:16 -0500
committerHarsh Sharma <harsh.sharma@multitech.com>2019-10-29 14:43:16 -0500
commit72acdfc2acc57dd790a5a36722c126b9ab20d0eb (patch)
treed676b25c9d8886c1e1a7a4e269f916369300d42e
parentfcfec5c972253795de33e5243fe3294d20588d59 (diff)
downloadpacket_forwarder_mtac_full-72acdfc2acc57dd790a5a36722c126b9ab20d0eb.tar.gz
packet_forwarder_mtac_full-72acdfc2acc57dd790a5a36722c126b9ab20d0eb.tar.bz2
packet_forwarder_mtac_full-72acdfc2acc57dd790a5a36722c126b9ab20d0eb.zip
Added support for setting max tx power if the FPGA supports it
-rw-r--r--lora_pkt_fwd/src/lora_pkt_fwd.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lora_pkt_fwd/src/lora_pkt_fwd.c b/lora_pkt_fwd/src/lora_pkt_fwd.c
index 8fbbd7b..5cfd28a 100644
--- a/lora_pkt_fwd/src/lora_pkt_fwd.c
+++ b/lora_pkt_fwd/src/lora_pkt_fwd.c
@@ -513,6 +513,14 @@ static int parse_SX1301_configuration(const char * conf_file) {
return -1;
}
+ val = json_object_get_value(conf_obj, "max_tx_power"); /* fetch value (if possible) */
+ if (json_value_get_type(val) == JSONNumber && (uint8_t)json_value_get_number(val) <= 32) {
+ boardconf.max_tx_power = (uint8_t)json_value_get_number(val);
+ } else {
+ MSG("WARNING: Data for max_tx_power is invalid, must be an integer (0-32)\n");
+ boardconf.max_tx_power = 32;
+ }
+
/* set LBT configuration */
memset(&lbtconf, 0, sizeof lbtconf); /* initialize configuration structure */
conf_lbt_obj = json_object_get_object(conf_obj, "lbt_cfg"); /* fetch value (if possible) */