From 72acdfc2acc57dd790a5a36722c126b9ab20d0eb Mon Sep 17 00:00:00 2001 From: Harsh Sharma Date: Tue, 29 Oct 2019 14:43:16 -0500 Subject: Added support for setting max tx power if the FPGA supports it --- lora_pkt_fwd/src/lora_pkt_fwd.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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) */ -- cgit v1.2.3