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.
pull/7770/head
Kimmo Vaisanen 2018-08-13 12:41:01 +03:00
parent 2a824a1ceb
commit 76d01f5c71
1 changed files with 5 additions and 0 deletions

View File

@ -1419,6 +1419,11 @@ lorawan_status_t LoRaMac::prepare_join(const lorawan_connect_t *params, bool is_
}
// Reset variable JoinRequestTrials
_params.join_request_trial_counter = 0;
reset_mac_parameters();
_params.sys_params.channel_data_rate =
_lora_phy->get_alternate_DR(_params.join_request_trial_counter + 1);
} else {
if ((params->connection_u.abp.dev_addr == 0)
|| (params->connection_u.abp.nwk_id == 0)