Skip to content

Commit d270105

Browse files
author
Hasnain Virk
committed
LoRaWAN: Wrong type of message check
In the reception data path, we needed to check the MCPS CONFIRMATION type not the MCPS INDICATION type. Indication message type is for downlink message type which can be UNCONFIRMED even if we have sent a CONFIRMED one, e.g., an ACK.
1 parent 2104d8a commit d270105

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

features/lorawan/LoRaWANStack.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ void LoRaWANStack::process_reception(const uint8_t* const payload, uint16_t size
521521
}
522522

523523
if (_loramac.nwk_joined()) {
524-
if (_loramac.get_mcps_indication()->type == MCPS_CONFIRMED) {
524+
if (_loramac.get_mcps_confirmation()->req_type == MCPS_CONFIRMED) {
525525
// if ack was not received, we will try retransmission after
526526
// ACK_TIMEOUT. handle_data_frame() already disables ACK_TIMEOUT timer
527527
// if ack was received

features/lorawan/lorastack/mac/LoRaMac.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ void LoRaMac::post_process_mcps_req()
166166
{
167167
_params.is_last_tx_join_request = false;
168168
_mcps_confirmation.status = LORAMAC_EVENT_INFO_STATUS_OK;
169-
if (_mcps_indication.type == MCPS_CONFIRMED) {
169+
if (_mcps_confirmation.req_type == MCPS_CONFIRMED) {
170170
// An MCPS request for a CONFIRMED message has received an ack
171171
// in the downlink message
172172
if (_mcps_confirmation.ack_received) {
@@ -547,8 +547,6 @@ void LoRaMac::handle_data_frame(const uint8_t* const payload,
547547
fctrl.value = payload[ptr_pos++];
548548
app_payload_start_index = 8 + fctrl.bits.fopts_len;
549549

550-
tr_debug("RX at port %d", payload[app_payload_start_index]);
551-
552550
//perform MIC check
553551
if (!message_integrity_check(payload, size, &ptr_pos, address,
554552
&downlink_counter, nwk_skey)) {
@@ -1612,9 +1610,6 @@ lorawan_status_t LoRaMac::send_frame_on_channel(uint8_t channel)
16121610
_mcps_confirmation.tx_toa = _params.timers.tx_toa;
16131611
_mlme_confirmation.tx_toa = _params.timers.tx_toa;
16141612

1615-
// _lora_time.start(_params.timers.mac_state_check_timer,
1616-
// MAC_STATE_CHECK_TIMEOUT);
1617-
16181613
if (!_is_nwk_joined) {
16191614
_params.join_request_trial_counter++;
16201615
}

0 commit comments

Comments
 (0)