From ffb0698ce74d6b81cfa13bd541edb8375eb3fe8d Mon Sep 17 00:00:00 2001 From: Hasnain Virk Date: Mon, 11 Jun 2018 15:42:45 +0300 Subject: [PATCH] Adding port in trace & streamlining continuous RX2 --- features/lorawan/LoRaWANStack.cpp | 5 +++-- features/lorawan/lorastack/mac/LoRaMac.cpp | 18 ++++-------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/features/lorawan/LoRaWANStack.cpp b/features/lorawan/LoRaWANStack.cpp index 1143b018a5..2580aad001 100644 --- a/features/lorawan/LoRaWANStack.cpp +++ b/features/lorawan/LoRaWANStack.cpp @@ -962,8 +962,9 @@ void LoRaWANStack::mcps_indication_handler() _rx_msg.msg.mcps_indication.type = mcps_indication->type; // Notify application about received frame.. - tr_debug("Packet Received %d bytes", - _rx_msg.msg.mcps_indication.buffer_size); + tr_debug("Packet Received %d bytes, Port=%d", + _rx_msg.msg.mcps_indication.buffer_size, + mcps_indication->port); _rx_msg.receive_ready = true; send_event_to_application(RX_DONE); } diff --git a/features/lorawan/lorastack/mac/LoRaMac.cpp b/features/lorawan/lorastack/mac/LoRaMac.cpp index bcd8226e90..26186b3377 100644 --- a/features/lorawan/lorastack/mac/LoRaMac.cpp +++ b/features/lorawan/lorastack/mac/LoRaMac.cpp @@ -669,23 +669,13 @@ void LoRaMac::on_radio_tx_done(lorawan_time_t timestamp) void LoRaMac::on_radio_rx_done(const uint8_t* const payload, uint16_t size, int16_t rssi, int8_t snr) { - // stop the RX1 timer here if its the first RX slot. - // If the MIC will pass we will stop RX2 timer as well later. - // If its RX2, stop RX2 timer. - if (_params.rx_slot == RX_SLOT_WIN_1) { + if (_device_class == CLASS_C && !_continuous_rx2_window_open) { + open_rx2_window(); + } else { _lora_time.stop(_params.timers.rx_window1_timer); - } else if (_params.rx_slot == RX_SLOT_WIN_2) { - _lora_time.stop(_params.timers.rx_window2_timer); + _lora_phy.put_radio_to_sleep(); } - if (_device_class == CLASS_C) { - if (!_continuous_rx2_window_open) { - open_rx2_window(); - } - } else { - _lora_phy.put_radio_to_sleep(); - } - loramac_mhdr_t mac_hdr; uint8_t pos = 0; mac_hdr.value = payload[pos++];