summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Reiss <jreiss@multitech.com>2021-04-14 16:58:27 -0500
committerJason Reiss <jreiss@multitech.com>2021-04-14 16:58:27 -0500
commit5a5ee4c62a8d46e8399c518ef0365abeaddbda3b (patch)
treeb407f1086ce449d492966f50545c120d428583ca
parent2127cf20cbc9c28e5efe81cf034a716892bfc8e5 (diff)
downloadpacket_forwarder_mtac_full-5a5ee4c62a8d46e8399c518ef0365abeaddbda3b.tar.gz
packet_forwarder_mtac_full-5a5ee4c62a8d46e8399c518ef0365abeaddbda3b.tar.bz2
packet_forwarder_mtac_full-5a5ee4c62a8d46e8399c518ef0365abeaddbda3b.zip
check size of temp tables loaded
-rw-r--r--lora_pkt_fwd/src/lora_pkt_fwd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lora_pkt_fwd/src/lora_pkt_fwd.c b/lora_pkt_fwd/src/lora_pkt_fwd.c
index 80bd66a..25c0d78 100644
--- a/lora_pkt_fwd/src/lora_pkt_fwd.c
+++ b/lora_pkt_fwd/src/lora_pkt_fwd.c
@@ -372,9 +372,9 @@ struct lgw_tx_temp_lut_s tx_temp_lut;
void lookup_power_settings(float tx_pwr, int8_t* rf_power, int8_t* dig_gain) {
float min_diff = 99;
- for (int i = 0; i < TEMP_LUT_SIZE_MAX; i++) {
+ for (int i = 0; i < tx_temp_lut.size; i++) {
// If the current temp is lower than the first temp or we reach the end of the table
- if ((tx_temp_lut.lut[0].temp > temp_comp_value || i == TEMP_LUT_SIZE_MAX-1) ||
+ if ((tx_temp_lut.lut[0].temp > temp_comp_value || i == tx_temp_lut.size-1) ||
(tx_temp_lut.lut[i].temp <= temp_comp_value && tx_temp_lut.lut[i+1].temp > temp_comp_value)) {
for (int j = 0; j < TX_GAIN_LUT_SIZE_MAX; j++) {
for (int h = 0; h < 4; h++) {