@@ -163,6 +163,7 @@ void LoRaMac::post_process_mcps_req()
163
163
_mcps_indication.is_ack_recvd = false ;
164
164
if (_params.is_ul_frame_counter_fixed == false ) {
165
165
_params.ul_frame_counter ++;
166
+ _params.adr_ack_counter ++;
166
167
}
167
168
} else {
168
169
_mcps_confirmation.status = LORAMAC_EVENT_INFO_STATUS_ERROR;
@@ -171,6 +172,7 @@ void LoRaMac::post_process_mcps_req()
171
172
// UNCONFIRMED or PROPRIETARY
172
173
if (_params.is_ul_frame_counter_fixed == false ) {
173
174
_params.ul_frame_counter ++;
175
+ _params.adr_ack_counter ++;
174
176
}
175
177
}
176
178
}
@@ -269,6 +271,7 @@ void LoRaMac::handle_join_accept_frame(const uint8_t *payload, uint16_t size)
269
271
// Node joined successfully
270
272
_params.ul_frame_counter = 0 ;
271
273
_params.ul_nb_rep_counter = 0 ;
274
+ _params.adr_ack_counter = 0 ;
272
275
273
276
} else {
274
277
_mlme_confirmation.status = LORAMAC_EVENT_INFO_STATUS_JOIN_FAIL;
@@ -779,7 +782,6 @@ bool LoRaMac::continue_sending_process()
779
782
{
780
783
if (_params.ack_timeout_retry_counter > _params.max_ack_timeout_retries ) {
781
784
_mac_commands.clear_command_buffer ();
782
- _params.adr_ack_counter ++;
783
785
_lora_time.stop (_params.timers .ack_timeout_timer );
784
786
return false ;
785
787
}
@@ -1821,13 +1823,17 @@ uint8_t LoRaMac::get_max_possible_tx_size(uint8_t fopts_len)
1821
1823
uint8_t max_possible_payload_size = 0 ;
1822
1824
uint8_t allowed_frm_payload_size = 0 ;
1823
1825
1826
+ int8_t datarate = _params.sys_params .channel_data_rate ;
1827
+ int8_t tx_power = _params.sys_params .channel_tx_power ;
1828
+ uint32_t adr_ack_counter = _params.adr_ack_counter ;
1829
+
1824
1830
if (_params.sys_params .adr_on ) {
1825
- _lora_phy-> get_next_ADR ( false , _params. sys_params . channel_data_rate ,
1826
- _params. sys_params . channel_tx_power ,
1827
- _params. adr_ack_counter );
1831
+ // Just query the information. We do not want to apply them into use
1832
+ // at this point.
1833
+ _lora_phy-> get_next_ADR ( false , datarate, tx_power, adr_ack_counter);
1828
1834
}
1829
1835
1830
- allowed_frm_payload_size = _lora_phy->get_max_payload (_params. sys_params . channel_data_rate ,
1836
+ allowed_frm_payload_size = _lora_phy->get_max_payload (datarate ,
1831
1837
_params.is_repeater_supported );
1832
1838
1833
1839
if (allowed_frm_payload_size >= fopts_len) {
0 commit comments