Skip to content

Commit 68ebbb0

Browse files
author
Cruz Monrreal
authored
Merge pull request #6569 from kivaisan/LORAWAN_FEATURE_BRANCH
Lora: small fixes
2 parents 641e814 + 01fd880 commit 68ebbb0

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

features/lorawan/LoRaWANStack.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ void LoRaWANStack::mcps_indication_handler(loramac_mcps_indication_t *mcps_indic
577577
{
578578
if (mcps_indication->status != LORAMAC_EVENT_INFO_STATUS_OK) {
579579
if (_callbacks.events) {
580+
tr_error("RX_ERROR: mcps_indication status = %d", mcps_indication->status);
580581
const int ret = _queue->call(_callbacks.events, RX_ERROR);
581582
MBED_ASSERT(ret != 0);
582583
(void)ret;
@@ -658,6 +659,7 @@ void LoRaWANStack::mcps_indication_handler(loramac_mcps_indication_t *mcps_indic
658659
// that we could retry a certain number of times if the uplink
659660
// failed for some reason
660661
if (_loramac.get_device_class() != CLASS_C && mcps_indication->fpending_status) {
662+
tr_debug("Pending bit set. Sending empty message to receive pending data...");
661663
handle_tx(mcps_indication->port, NULL, 0, MSG_CONFIRMED_FLAG, true);
662664
}
663665

@@ -667,6 +669,7 @@ void LoRaWANStack::mcps_indication_handler(loramac_mcps_indication_t *mcps_indic
667669
// but version 1.1.0 says that network SHALL not send any new
668670
// confirmed messages until ack has been sent
669671
if (_loramac.get_device_class() == CLASS_C && mcps_indication->type == MCPS_CONFIRMED) {
672+
tr_debug("Acknowledging confirmed message (class C)...");
670673
handle_tx(mcps_indication->port, NULL, 0, MSG_CONFIRMED_FLAG, true);
671674
}
672675
} else {

features/lorawan/lorastack/mac/LoRaMac.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ void LoRaMac::on_radio_rx_done(uint8_t *payload, uint16_t size, int16_t rssi,
293293
_mcps_indication.is_ack_recvd = false;
294294
_mcps_indication.dl_frame_counter = 0;
295295
_mcps_indication.type = MCPS_UNCONFIRMED;
296+
_mcps_indication.status = LORAMAC_EVENT_INFO_STATUS_OK;
296297

297298
if (_device_class != CLASS_C) {
298299
_lora_phy.put_radio_to_sleep();
@@ -1102,7 +1103,6 @@ lorawan_status_t LoRaMac::schedule_tx(void)
11021103
{
11031104
lorawan_time_t dutyCycleTimeOff = 0;
11041105
channel_selection_params_t nextChan;
1105-
lorawan_status_t status = LORAWAN_STATUS_PARAMETER_INVALID;
11061106

11071107
if (_params.sys_params.max_duty_cycle == 255) {
11081108
return LORAWAN_STATUS_DEVICE_OFF;
@@ -1121,9 +1121,10 @@ lorawan_status_t LoRaMac::schedule_tx(void)
11211121
nextChan.joined = _is_nwk_joined;
11221122
nextChan.last_aggregate_tx_time = _params.timers.aggregated_last_tx_time;
11231123

1124-
status = _lora_phy.set_next_channel(&nextChan, &_params.channel,
1125-
&dutyCycleTimeOff,
1126-
&_params.timers.aggregated_timeoff);
1124+
lorawan_status_t status = _lora_phy.set_next_channel(&nextChan,
1125+
&_params.channel,
1126+
&dutyCycleTimeOff,
1127+
&_params.timers.aggregated_timeoff);
11271128
switch (status) {
11281129
case LORAWAN_STATUS_NO_CHANNEL_FOUND:
11291130
case LORAWAN_STATUS_NO_FREE_CHANNEL_FOUND:

0 commit comments

Comments
 (0)