Skip to content

Commit ffb0698

Browse files
author
Hasnain Virk
committed
Adding port in trace & streamlining continuous RX2
1 parent eab2bad commit ffb0698

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

features/lorawan/LoRaWANStack.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -962,8 +962,9 @@ void LoRaWANStack::mcps_indication_handler()
962962
_rx_msg.msg.mcps_indication.type = mcps_indication->type;
963963

964964
// Notify application about received frame..
965-
tr_debug("Packet Received %d bytes",
966-
_rx_msg.msg.mcps_indication.buffer_size);
965+
tr_debug("Packet Received %d bytes, Port=%d",
966+
_rx_msg.msg.mcps_indication.buffer_size,
967+
mcps_indication->port);
967968
_rx_msg.receive_ready = true;
968969
send_event_to_application(RX_DONE);
969970
}

features/lorawan/lorastack/mac/LoRaMac.cpp

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -669,23 +669,13 @@ void LoRaMac::on_radio_tx_done(lorawan_time_t timestamp)
669669
void LoRaMac::on_radio_rx_done(const uint8_t* const payload, uint16_t size,
670670
int16_t rssi, int8_t snr)
671671
{
672-
// stop the RX1 timer here if its the first RX slot.
673-
// If the MIC will pass we will stop RX2 timer as well later.
674-
// If its RX2, stop RX2 timer.
675-
if (_params.rx_slot == RX_SLOT_WIN_1) {
672+
if (_device_class == CLASS_C && !_continuous_rx2_window_open) {
673+
open_rx2_window();
674+
} else {
676675
_lora_time.stop(_params.timers.rx_window1_timer);
677-
} else if (_params.rx_slot == RX_SLOT_WIN_2) {
678-
_lora_time.stop(_params.timers.rx_window2_timer);
676+
_lora_phy.put_radio_to_sleep();
679677
}
680678

681-
if (_device_class == CLASS_C) {
682-
if (!_continuous_rx2_window_open) {
683-
open_rx2_window();
684-
}
685-
} else {
686-
_lora_phy.put_radio_to_sleep();
687-
}
688-
689679
loramac_mhdr_t mac_hdr;
690680
uint8_t pos = 0;
691681
mac_hdr.value = payload[pos++];

0 commit comments

Comments
 (0)