Skip to content

Commit 76d01f5

Browse files
author
Kimmo Vaisanen
committed
LoRa: Fix MAC initialization for connection with parameters
LoRaMAC was not initialized properly if application called connect(const lorawan_connect_t &connect); This causes problems for example in case where application first disconnects and then reconnects as counter values are not initialized.
1 parent 2a824a1 commit 76d01f5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

features/lorawan/lorastack/mac/LoRaMac.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,6 +1419,11 @@ lorawan_status_t LoRaMac::prepare_join(const lorawan_connect_t *params, bool is_
14191419
}
14201420
// Reset variable JoinRequestTrials
14211421
_params.join_request_trial_counter = 0;
1422+
1423+
reset_mac_parameters();
1424+
1425+
_params.sys_params.channel_data_rate =
1426+
_lora_phy->get_alternate_DR(_params.join_request_trial_counter + 1);
14221427
} else {
14231428
if ((params->connection_u.abp.dev_addr == 0)
14241429
|| (params->connection_u.abp.nwk_id == 0)

0 commit comments

Comments
 (0)