Skip to content

Commit be04a57

Browse files
author
Hasnain Virk
committed
Removing abort from rx in case of FL discrepency
If the frame length is not what we are expecting, it is found to be a good practise to actually continue with what we have received rather than aborting. As we have already demodulated the packet and RX slots are used up, ther is not so much benefit in dropping that packet.
1 parent ac6fb71 commit be04a57

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

features/lorawan/lorastack/mac/LoRaMac.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -321,20 +321,15 @@ void LoRaMac::handle_join_accept_frame(const uint8_t *payload,
321321
}
322322
}
323323

324-
bool LoRaMac::is_frame_size_valid(const uint16_t size)
324+
void LoRaMac::check_frame_size(uint16_t size)
325325
{
326326
uint8_t value = _lora_phy.get_max_payload(_mcps_indication.rx_datarate,
327327
_params.is_repeater_supported);
328328

329329
if (MAX(0, (int16_t) ((int16_t)size - (int16_t)LORA_MAC_FRMPAYLOAD_OVERHEAD))
330330
> (int32_t) value) {
331331
tr_error("Invalid frame size");
332-
_mcps_indication.status = LORAMAC_EVENT_INFO_STATUS_ERROR;
333-
abort_rx();
334-
return false;
335332
}
336-
337-
return true;
338333
}
339334

340335
bool LoRaMac::message_integrity_check(const uint8_t * const payload,
@@ -504,9 +499,7 @@ void LoRaMac::handle_data_frame(const uint8_t* const payload,
504499
int16_t rssi,
505500
int8_t snr)
506501
{
507-
if (!is_frame_size_valid(size)) {
508-
return;
509-
}
502+
check_frame_size(size);
510503

511504
bool is_multicast = false;
512505
loramac_frame_ctrl_t fctrl;

features/lorawan/lorastack/mac/LoRaMac.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ class LoRaMac {
484484
/**
485485
* Checks if the frame is valid
486486
*/
487-
bool is_frame_size_valid(const uint16_t size);
487+
void check_frame_size(uint16_t size);
488488

489489
/**
490490
* Performs MIC

0 commit comments

Comments
 (0)