@@ -223,15 +223,6 @@ void LoRaMac::on_radio_tx_done(void)
223
223
_params.timers .aggregated_last_tx_time = cur_time;
224
224
}
225
225
226
- void LoRaMac::abort_rx (void )
227
- {
228
- if (_params.is_node_ack_requested ) {
229
- const int ret = _ev_queue->call (this , &LoRaMac::on_ack_timeout_timer_event);
230
- MBED_ASSERT (ret != 0 );
231
- (void )ret;
232
- }
233
- }
234
-
235
226
/* *
236
227
* This part handles incoming frames in response to Radio RX Interrupt
237
228
*/
@@ -526,7 +517,6 @@ void LoRaMac::handle_data_frame(const uint8_t* const payload,
526
517
if (!is_multicast) {
527
518
// We are not the destination of this frame.
528
519
_mcps_indication.status = LORAMAC_EVENT_INFO_STATUS_ADDRESS_FAIL;
529
- abort_rx ();
530
520
return ;
531
521
}
532
522
} else {
@@ -543,13 +533,14 @@ void LoRaMac::handle_data_frame(const uint8_t* const payload,
543
533
if (!message_integrity_check (payload, size, &ptr_pos, address,
544
534
&downlink_counter, nwk_skey)) {
545
535
tr_error (" MIC failed" );
546
- abort_rx ();
547
536
return ;
548
537
}
549
538
550
539
// message is intended for us and MIC have passed, stop RX2 Window
551
540
// Spec: 3.3.4 Receiver Activity during the receive windows
552
- _lora_time.stop (_params.timers .rx_window2_timer );
541
+ if (_params.rx_slot == RX_SLOT_WIN_2) {
542
+ _lora_time.stop (_params.timers .rx_window2_timer );
543
+ }
553
544
554
545
_mcps_confirmation.ack_received = false ;
555
546
_mcps_indication.is_ack_recvd = false ;
@@ -578,7 +569,6 @@ void LoRaMac::handle_data_frame(const uint8_t* const payload,
578
569
_mcps_indication.status = LORAMAC_EVENT_INFO_STATUS_DOWNLINK_REPEATED;
579
570
_mcps_indication.dl_frame_counter = downlink_counter;
580
571
_mcps_indication.pending = false ;
581
- abort_rx ();
582
572
583
573
return ;
584
574
}
@@ -610,7 +600,7 @@ void LoRaMac::handle_data_frame(const uint8_t* const payload,
610
600
tr_debug (" Discarding duplicate frame" );
611
601
_mcps_indication.pending = false ;
612
602
_mcps_indication.status = LORAMAC_EVENT_INFO_STATUS_DOWNLINK_REPEATED;
613
- abort_rx ();
603
+
614
604
return ;
615
605
}
616
606
}
@@ -663,8 +653,14 @@ void LoRaMac::set_batterylevel_callback(mbed::Callback<uint8_t(void)> battery_le
663
653
void LoRaMac::on_radio_rx_done (const uint8_t * const payload, uint16_t size,
664
654
int16_t rssi, int8_t snr)
665
655
{
666
- // on reception turn off queued timers
667
- _lora_time.stop (_params.timers .rx_window1_timer );
656
+ // stop the RX1 timer here if its the first RX slot.
657
+ // If the MIC will pass we will stop RX2 timer as well later.
658
+ // If its RX2, stop RX2 timer.
659
+ if (_params.rx_slot == RX_SLOT_WIN_1) {
660
+ _lora_time.stop (_params.timers .rx_window1_timer );
661
+ } else if (_params.rx_slot == RX_SLOT_WIN_2) {
662
+ _lora_time.stop (_params.timers .rx_window2_timer );
663
+ }
668
664
669
665
if (_device_class == CLASS_C) {
670
666
open_rx2_window ();
@@ -681,7 +677,6 @@ void LoRaMac::on_radio_rx_done(const uint8_t* const payload, uint16_t size,
681
677
case FRAME_TYPE_JOIN_ACCEPT:
682
678
683
679
if (nwk_joined ()) {
684
- abort_rx ();
685
680
_mlme_confirmation.pending = false ;
686
681
return ;
687
682
} else {
0 commit comments