mirror of https://github.com/ARMmbed/mbed-os.git
Update handling for functions OnRadioRxError and OnRadioRxTimout.
This is especially important for class c devices.pull/6411/head
parent
6c165e0f19
commit
e1fff2e738
|
@ -718,15 +718,11 @@ void LoRaMac::on_radio_tx_timeout( void )
|
||||||
|
|
||||||
void LoRaMac::on_radio_rx_error( void )
|
void LoRaMac::on_radio_rx_error( void )
|
||||||
{
|
{
|
||||||
const rx_slot_t rx_slot = _params.rx_slot;
|
|
||||||
|
|
||||||
if (_params.dev_class != CLASS_C) {
|
if (_params.dev_class != CLASS_C) {
|
||||||
lora_phy->put_radio_to_sleep();
|
lora_phy->put_radio_to_sleep();
|
||||||
} else {
|
|
||||||
open_continuous_rx2_window();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rx_slot == RX_SLOT_WIN_1) {
|
if (_params.rx_slot == RX_SLOT_WIN_1) {
|
||||||
if (_params.is_node_ack_requested == true) {
|
if (_params.is_node_ack_requested == true) {
|
||||||
mcps.get_confirmation().status = LORAMAC_EVENT_INFO_STATUS_RX1_ERROR;
|
mcps.get_confirmation().status = LORAMAC_EVENT_INFO_STATUS_RX1_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -739,12 +735,7 @@ void LoRaMac::on_radio_rx_error( void )
|
||||||
_params.flags.bits.mac_done = 1;
|
_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) {
|
if (_params.is_node_ack_requested == true) {
|
||||||
mcps.get_confirmation().status = LORAMAC_EVENT_INFO_STATUS_RX2_ERROR;
|
mcps.get_confirmation().status = LORAMAC_EVENT_INFO_STATUS_RX2_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -755,19 +746,19 @@ void LoRaMac::on_radio_rx_error( void )
|
||||||
_params.flags.bits.mac_done = 1;
|
_params.flags.bits.mac_done = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_params.dev_class == CLASS_C) {
|
||||||
|
open_continuous_rx2_window();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoRaMac::on_radio_rx_timeout(void)
|
void LoRaMac::on_radio_rx_timeout(void)
|
||||||
{
|
{
|
||||||
const rx_slot_t rx_slot = _params.rx_slot;
|
|
||||||
|
|
||||||
if (_params.dev_class != CLASS_C) {
|
if (_params.dev_class != CLASS_C) {
|
||||||
lora_phy->put_radio_to_sleep();
|
lora_phy->put_radio_to_sleep();
|
||||||
} else {
|
|
||||||
open_continuous_rx2_window();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rx_slot == RX_SLOT_WIN_1) {
|
if (_params.rx_slot == RX_SLOT_WIN_1) {
|
||||||
if (_params.is_node_ack_requested == true) {
|
if (_params.is_node_ack_requested == true) {
|
||||||
mcps.get_confirmation().status = LORAMAC_EVENT_INFO_STATUS_RX1_TIMEOUT;
|
mcps.get_confirmation().status = LORAMAC_EVENT_INFO_STATUS_RX1_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
@ -779,13 +770,7 @@ void LoRaMac::on_radio_rx_timeout(void)
|
||||||
_params.flags.bits.mac_done = 1;
|
_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) {
|
if (_params.is_node_ack_requested == true) {
|
||||||
mcps.get_confirmation().status = LORAMAC_EVENT_INFO_STATUS_RX2_TIMEOUT;
|
mcps.get_confirmation().status = LORAMAC_EVENT_INFO_STATUS_RX2_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
@ -796,6 +781,10 @@ void LoRaMac::on_radio_rx_timeout(void)
|
||||||
_params.flags.bits.mac_done = 1;
|
_params.flags.bits.mac_done = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_params.dev_class == CLASS_C) {
|
||||||
|
open_continuous_rx2_window();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
|
Loading…
Reference in New Issue