diff --git a/lora_pkt_fwd/src/lora_pkt_fwd.c b/lora_pkt_fwd/src/lora_pkt_fwd.c index 801f28d..2772a8e 100644 --- a/lora_pkt_fwd/src/lora_pkt_fwd.c +++ b/lora_pkt_fwd/src/lora_pkt_fwd.c @@ -233,6 +233,8 @@ static struct lgw_tx_gain_lut_s txlut; /* TX gain table */ static uint32_t tx_freq_min[LGW_RF_CHAIN_NB]; /* lowest frequency supported by TX chain */ static uint32_t tx_freq_max[LGW_RF_CHAIN_NB]; /* highest frequency supported by TX chain */ +static uint32_t rx_rf_freq[LGW_RF_CHAIN_NB]; /* center frequency of the radio in Hz */ + /* -------------------------------------------------------------------------- */ /* --- PRIVATE FUNCTIONS DECLARATION ---------------------------------------- */ @@ -494,7 +496,7 @@ static int parse_SX1301_configuration(const char * conf_file) { MSG("INFO: radio %i disabled\n", i); } else { /* radio enabled, will parse the other parameters */ snprintf(param_name, sizeof param_name, "radio_%i.freq", i); - rfconf.freq_hz = (uint32_t)json_object_dotget_number(conf_obj, param_name); + rfconf.freq_hz = rx_rf_freq[i] = (uint32_t)json_object_dotget_number(conf_obj, param_name); snprintf(param_name, sizeof param_name, "radio_%i.rssi_offset", i); rfconf.rssi_offset = (float)json_object_dotget_number(conf_obj, param_name); snprintf(param_name, sizeof param_name, "radio_%i.type", i); @@ -1995,8 +1997,15 @@ void thread_down(void) { break; case 12: beacon_pkt.datarate = DR_LORA_SF12; - beacon_RFU1_size = 5; - beacon_RFU2_size = 3; + + /* Check radio 0 center frequency to determine if US or AU region */ + if (rx_rf_freq[0] > 914900000U ) { + beacon_RFU1_size = 3; + beacon_RFU2_size = 1; + } else { + beacon_RFU1_size = 5; + beacon_RFU2_size = 3; + } break; default: /* should not happen */