Skip to content

Commit c7f3585

Browse files
author
Hasnain Virk
committed
Clear distinction b/w class A & C data paths
1 parent d76f6c0 commit c7f3585

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

features/lorawan/LoRaWANStack.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -603,17 +603,14 @@ void LoRaWANStack::process_transmission(void)
603603
_ctrl_flags &= ~TX_DONE_FLAG;
604604
tr_debug("Awaiting ACK");
605605
_device_current_state = DEVICE_STATE_AWAITING_ACK;
606-
return;
607-
}
608-
609-
// Class A unconfirmed message sent, TX_DONE event will be sent to
610-
// application when RX2 windows is elapsed, i.e., in process_reception_timeout()
611-
_ctrl_flags &= ~TX_ONGOING_FLAG;
612-
_ctrl_flags |= TX_DONE_FLAG;
613-
614-
// In Class C, reception timeout never happens, so we handle the state
615-
// progression for TX_DONE in UNCONFIRMED case here
616-
if (_loramac.get_device_class() == CLASS_C) {
606+
} else if (_loramac.get_device_class() == CLASS_A) {
607+
// Class A unconfirmed message sent, TX_DONE event will be sent to
608+
// application when RX2 windows is elapsed, i.e., in process_reception_timeout()
609+
_ctrl_flags &= ~TX_ONGOING_FLAG;
610+
_ctrl_flags |= TX_DONE_FLAG;
611+
} else if (_loramac.get_device_class() == CLASS_C) {
612+
// In Class C, reception timeout never happens, so we handle the state
613+
// progression for TX_DONE in UNCONFIRMED case here
617614
_loramac.post_process_mcps_req();
618615
state_controller(DEVICE_STATE_STATUS_CHECK);
619616
state_machine_run_to_completion();
@@ -669,9 +666,10 @@ void LoRaWANStack::process_reception(const uint8_t *const payload, uint16_t size
669666
state_controller(DEVICE_STATE_STATUS_CHECK);
670667
}
671668
}
672-
} else {
669+
} else if (_loramac.get_device_class() == CLASS_A) {
673670
// handle UNCONFIRMED case here, RX slots were turned off due to
674-
// valid packet reception
671+
// valid packet reception. For Class C, an outgoing UNCONFIRMED message
672+
// gets its handling in process_transmission.
675673
_loramac.post_process_mcps_req();
676674
_ctrl_flags |= TX_DONE_FLAG;
677675
state_controller(DEVICE_STATE_STATUS_CHECK);

features/lorawan/lorastack/mac/LoRaMac.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ void LoRaMac::on_radio_rx_done(const uint8_t *const payload, uint16_t size,
673673
{
674674
if (_device_class == CLASS_C && !_continuous_rx2_window_open) {
675675
open_rx2_window();
676-
} else {
676+
} else if (_device_class != CLASS_C){
677677
_lora_time.stop(_params.timers.rx_window1_timer);
678678
_lora_phy->put_radio_to_sleep();
679679
}

0 commit comments

Comments
 (0)