From 925d51492f24a2bc507533298de8821d92d499df Mon Sep 17 00:00:00 2001 From: Hasnain Virk Date: Fri, 21 Sep 2018 15:50:04 +0300 Subject: [PATCH] Proper handling of RX1 frequency in rx_config Previously, we weren't filling in RX1 frequecny in rx_window1_config structure. However, everything worked as in LoRaPHY::rx_config() API there was a check which filled in correct RX1 frequency. Now we are filling in RX1 freq. properly while we are computing parameters for RX1 window. --- features/lorawan/lorastack/mac/LoRaMac.cpp | 4 ++-- features/lorawan/lorastack/phy/LoRaPHY.cpp | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/features/lorawan/lorastack/mac/LoRaMac.cpp b/features/lorawan/lorastack/mac/LoRaMac.cpp index b667a0f347..fc4a100f9d 100644 --- a/features/lorawan/lorastack/mac/LoRaMac.cpp +++ b/features/lorawan/lorastack/mac/LoRaMac.cpp @@ -903,7 +903,7 @@ void LoRaMac::open_rx1_window(void) _lora_phy->rx_config(&_params.rx_window1_config); _lora_phy->handle_receive(); - tr_debug("Opening RX1 Window"); + tr_debug("RX1 slot open, Freq = %lu", _params.rx_window1_config.frequency); } void LoRaMac::open_rx2_window() @@ -932,7 +932,7 @@ void LoRaMac::open_rx2_window() _lora_phy->handle_receive(); _params.rx_slot = _params.rx_window2_config.rx_slot; - tr_debug("Opening RX2 Window, Frequency = %lu", _params.rx_window2_config.frequency); + tr_debug("RX2 slot open, Freq = %lu", _params.rx_window2_config.frequency); } void LoRaMac::on_ack_timeout_timer_event(void) diff --git a/features/lorawan/lorastack/phy/LoRaPHY.cpp b/features/lorawan/lorastack/phy/LoRaPHY.cpp index 1c2280be02..4496aa8450 100644 --- a/features/lorawan/lorastack/phy/LoRaPHY.cpp +++ b/features/lorawan/lorastack/phy/LoRaPHY.cpp @@ -806,6 +806,11 @@ void LoRaPHY::compute_rx_win_params(int8_t datarate, uint8_t min_rx_symbols, ((uint32_t *)phy_params.bandwidths.table)[rx_conf_params->datarate]); } + if (rx_conf_params->rx_slot == RX_SLOT_WIN_1) { + rx_conf_params->frequency = phy_params.channels.channel_list[rx_conf_params->channel].frequency; + } + + get_rx_window_params(t_symbol, min_rx_symbols, rx_error, RADIO_WAKEUP_TIME, &rx_conf_params->window_timeout, &rx_conf_params->window_offset); }