Bug fix in RX timeout and RX error handling for class c nodes.

1. Do not stop the 2nd window timer, as it is not running.
2. Wait for the OnAckTimeout event, before setting MacDone
3. Process for class c also the 2nd window timeout part, as we do
   not have a 2nd window timer.
pull/6411/head
Kimmo Vaisanen 2018-02-19 08:42:43 +02:00 committed by Antti Kauppila
parent 591bc7da1f
commit a9e1076572
1 changed files with 20 additions and 9 deletions

View File

@ -733,12 +733,17 @@ void LoRaMac::on_radio_rx_error( void )
mlme.get_confirmation().status = LORAMAC_EVENT_INFO_STATUS_RX1_ERROR;
if (_lora_time.get_elapsed_time(_params.timers.aggregated_last_tx_time) >= _params.rx_window2_delay) {
_lora_time.stop(_params.timers.rx_window2_timer);
_params.flags.bits.mac_done = 1;
if (_params.dev_class != CLASS_C) {
if (_lora_time.get_elapsed_time(_params.timers.aggregated_last_tx_time) >= _params.rx_window2_delay) {
_lora_time.stop(_params.timers.rx_window2_timer);
_params.flags.bits.mac_done = 1;
}
}
} else {
}
if ((rx_slot == RX_SLOT_WIN_2) || (_params.dev_class == CLASS_C)) {
// We need to process this case if the MAC is in class A or B for the 2nd RX window timeout.
// If the MAC is in class C, we need to process this part also for the 1st RX window timeout,
// as the 2nd window timer is not running.
if (_params.is_node_ack_requested == true) {
mcps.get_confirmation().status = LORAMAC_EVENT_INFO_STATUS_RX2_ERROR;
@ -768,12 +773,18 @@ void LoRaMac::on_radio_rx_timeout(void)
}
mlme.get_confirmation().status = LORAMAC_EVENT_INFO_STATUS_RX1_TIMEOUT;
if (_lora_time.get_elapsed_time(_params.timers.aggregated_last_tx_time ) >= _params.rx_window2_delay) {
_lora_time.stop(_params.timers.rx_window2_timer);
_params.flags.bits.mac_done = 1;
if (_params.dev_class != CLASS_C) {
if (_lora_time.get_elapsed_time(_params.timers.aggregated_last_tx_time ) >= _params.rx_window2_delay) {
_lora_time.stop(_params.timers.rx_window2_timer);
_params.flags.bits.mac_done = 1;
}
}
}
} else {
if ((rx_slot == RX_SLOT_WIN_2) || (_params.dev_class == CLASS_C)) {
// We need to process this case if the MAC is in class A or B for the 2nd RX window timeout.
// If the MAC is in class C, we need to process this part also for the 1st RX window timeout,
// as the 2nd window timer is not running.
if (_params.is_node_ack_requested == true) {
mcps.get_confirmation().status = LORAMAC_EVENT_INFO_STATUS_RX2_TIMEOUT;