summaryrefslogtreecommitdiff
path: root/lora_pkt_fwd
diff options
context:
space:
mode:
authorHarsh Sharma <harsh.sharma@multitech.com>2022-04-29 10:45:33 -0500
committerHarsh Sharma <harsh.sharma@multitech.com>2022-04-29 10:45:33 -0500
commit14d273376d108fe6a20c8ff27ad0fa82e6ed6731 (patch)
tree6e88c2e90e547b90cd82ff6dfb29a8406644ed1c /lora_pkt_fwd
parent8470394ec367d16599bdc7643986fb58af113ed4 (diff)
downloadpacket_forwarder_mtac_full-14d273376d108fe6a20c8ff27ad0fa82e6ed6731.tar.gz
packet_forwarder_mtac_full-14d273376d108fe6a20c8ff27ad0fa82e6ed6731.tar.bz2
packet_forwarder_mtac_full-14d273376d108fe6a20c8ff27ad0fa82e6ed6731.zip
Fixed tx power calculation with antenna gain4.0.21
Diffstat (limited to 'lora_pkt_fwd')
-rw-r--r--lora_pkt_fwd/src/lora_pkt_fwd.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/lora_pkt_fwd/src/lora_pkt_fwd.c b/lora_pkt_fwd/src/lora_pkt_fwd.c
index 145b717..eba3c48 100644
--- a/lora_pkt_fwd/src/lora_pkt_fwd.c
+++ b/lora_pkt_fwd/src/lora_pkt_fwd.c
@@ -2703,19 +2703,19 @@ void thread_down(void) {
last_beacon_gps_time.tv_sec = 0;
last_beacon_gps_time.tv_nsec = 0;
- /* beacon packet parameters */
- beacon_pkt.tx_mode = ON_GPS; /* send on PPS pulse */
- beacon_pkt.rf_chain = 0; /* antenna A */
- beacon_pkt.rf_power = beacon_power - antenna_gain;
- beacon_pkt.dig_gain = -1;
-
if (max_tx_power != -99) {
if (beacon_power > max_tx_power) {
MSG("INFO: [beacon] tx power reduced tx power: % dBm attn gain: %d dBi\n", max_tx_power, antenna_gain);
- beacon_power = max_tx_power - antenna_gain;
+ beacon_power = max_tx_power;
}
}
+ /* beacon packet parameters */
+ beacon_pkt.tx_mode = ON_GPS; /* send on PPS pulse */
+ beacon_pkt.rf_chain = 0; /* antenna A */
+ beacon_pkt.rf_power = beacon_power - antenna_gain;
+ beacon_pkt.dig_gain = -1;
+
if (temp_comp_enabled) {
float pwr = beacon_power;
/* look for power index and DIG gain for current temperature */
@@ -3195,13 +3195,14 @@ void thread_down(void) {
/* parse TX power (optional field) */
val = json_object_get_value(txpk_obj,"powe");
if (val != NULL) {
- pwr = json_value_get_number(val) - antenna_gain;
+ pwr = (int8_t)json_value_get_number(val);
if (max_tx_power != -99) {
- if (pwr > max_tx_power - antenna_gain) {
+ if (pwr > max_tx_power) {
MSG("INFO: [down] tx power reduced tx power: % dBm attn gain: %d dBi\n", max_tx_power, antenna_gain);
- pwr = max_tx_power - antenna_gain;
+ pwr = max_tx_power;
}
}
+ pwr = pwr - antenna_gain;
}
if (temp_comp_enabled) {