mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #10196 from hasnainvirk/premature_rx2_fix
LoRaWAN: Fixing premature RX2 closurepull/9904/head
commit
a0a265ad84
|
|
@ -173,7 +173,8 @@ uint8_t LoRaPHY::verify_link_ADR_req(verify_adr_params_t *verify_params,
|
||||||
|
|
||||||
void LoRaPHY::get_rx_window_params(float t_symbol, uint8_t min_rx_symbols,
|
void LoRaPHY::get_rx_window_params(float t_symbol, uint8_t min_rx_symbols,
|
||||||
float rx_error, float wakeup_time,
|
float rx_error, float wakeup_time,
|
||||||
uint32_t *window_length, int32_t *window_offset,
|
uint32_t *window_length, uint32_t *window_length_ms,
|
||||||
|
int32_t *window_offset,
|
||||||
uint8_t phy_dr)
|
uint8_t phy_dr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -664,13 +664,14 @@ void LoRaMac::on_radio_tx_done(lorawan_time_t timestamp)
|
||||||
if (get_device_class() == CLASS_C) {
|
if (get_device_class() == CLASS_C) {
|
||||||
_lora_time.start(_rx2_closure_timer_for_class_c,
|
_lora_time.start(_rx2_closure_timer_for_class_c,
|
||||||
(_params.rx_window2_delay - time_diff) +
|
(_params.rx_window2_delay - time_diff) +
|
||||||
_params.rx_window2_config.window_timeout);
|
_params.rx_window2_config.window_timeout_ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
// start timer after which ack wait will timeout (for Confirmed messages)
|
// start timer after which ack wait will timeout (for Confirmed messages)
|
||||||
if (_params.is_node_ack_requested) {
|
if (_params.is_node_ack_requested) {
|
||||||
_lora_time.start(_params.timers.ack_timeout_timer,
|
_lora_time.start(_params.timers.ack_timeout_timer,
|
||||||
(_params.rx_window2_delay - time_diff) +
|
(_params.rx_window2_delay - time_diff) +
|
||||||
|
_params.rx_window2_config.window_timeout_ms +
|
||||||
_lora_phy->get_ack_timeout());
|
_lora_phy->get_ack_timeout());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1094,6 +1095,8 @@ lorawan_status_t LoRaMac::schedule_tx()
|
||||||
{
|
{
|
||||||
channel_selection_params_t next_channel;
|
channel_selection_params_t next_channel;
|
||||||
lorawan_time_t backoff_time = 0;
|
lorawan_time_t backoff_time = 0;
|
||||||
|
lorawan_time_t aggregated_timeoff = 0;
|
||||||
|
uint8_t channel = 0;
|
||||||
uint8_t fopts_len = 0;
|
uint8_t fopts_len = 0;
|
||||||
|
|
||||||
if (_params.sys_params.max_duty_cycle == 255) {
|
if (_params.sys_params.max_duty_cycle == 255) {
|
||||||
|
|
@ -1119,9 +1122,12 @@ lorawan_status_t LoRaMac::schedule_tx()
|
||||||
next_channel.last_aggregate_tx_time = _params.timers.aggregated_last_tx_time;
|
next_channel.last_aggregate_tx_time = _params.timers.aggregated_last_tx_time;
|
||||||
|
|
||||||
lorawan_status_t status = _lora_phy->set_next_channel(&next_channel,
|
lorawan_status_t status = _lora_phy->set_next_channel(&next_channel,
|
||||||
&_params.channel,
|
&channel,
|
||||||
&backoff_time,
|
&backoff_time,
|
||||||
&_params.timers.aggregated_timeoff);
|
&aggregated_timeoff);
|
||||||
|
|
||||||
|
_params.channel = channel;
|
||||||
|
_params.timers.aggregated_timeoff = aggregated_timeoff;
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case LORAWAN_STATUS_NO_CHANNEL_FOUND:
|
case LORAWAN_STATUS_NO_CHANNEL_FOUND:
|
||||||
|
|
|
||||||
|
|
@ -406,7 +406,8 @@ float LoRaPHY::compute_symb_timeout_fsk(uint8_t phy_dr)
|
||||||
|
|
||||||
void LoRaPHY::get_rx_window_params(float t_symb, uint8_t min_rx_symb,
|
void LoRaPHY::get_rx_window_params(float t_symb, uint8_t min_rx_symb,
|
||||||
float error_fudge, float wakeup_time,
|
float error_fudge, float wakeup_time,
|
||||||
uint32_t *window_length, int32_t *window_offset,
|
uint32_t *window_length, uint32_t *window_length_ms,
|
||||||
|
int32_t *window_offset,
|
||||||
uint8_t phy_dr)
|
uint8_t phy_dr)
|
||||||
{
|
{
|
||||||
float target_rx_window_offset;
|
float target_rx_window_offset;
|
||||||
|
|
@ -442,6 +443,7 @@ void LoRaPHY::get_rx_window_params(float t_symb, uint8_t min_rx_symb,
|
||||||
// Setting the window_length in terms of 'symbols' for LoRa modulation or
|
// Setting the window_length in terms of 'symbols' for LoRa modulation or
|
||||||
// in terms of 'bytes' for FSK
|
// in terms of 'bytes' for FSK
|
||||||
*window_length = (uint32_t) ceil(window_len_in_ms / t_symb);
|
*window_length = (uint32_t) ceil(window_len_in_ms / t_symb);
|
||||||
|
*window_length_ms = window_len_in_ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t LoRaPHY::compute_tx_power(int8_t tx_power_idx, float max_eirp,
|
int8_t LoRaPHY::compute_tx_power(int8_t tx_power_idx, float max_eirp,
|
||||||
|
|
@ -628,8 +630,7 @@ uint16_t LoRaPHY::get_maximum_frame_counter_gap()
|
||||||
uint32_t LoRaPHY::get_ack_timeout()
|
uint32_t LoRaPHY::get_ack_timeout()
|
||||||
{
|
{
|
||||||
uint16_t ack_timeout_rnd = phy_params.ack_timeout_rnd;
|
uint16_t ack_timeout_rnd = phy_params.ack_timeout_rnd;
|
||||||
return (phy_params.ack_timeout
|
return (phy_params.ack_timeout + get_random(0, ack_timeout_rnd));
|
||||||
+ get_random(-ack_timeout_rnd, ack_timeout_rnd));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t LoRaPHY::get_default_rx2_frequency()
|
uint32_t LoRaPHY::get_default_rx2_frequency()
|
||||||
|
|
@ -849,7 +850,8 @@ void LoRaPHY::compute_rx_win_params(int8_t datarate, uint8_t min_rx_symbols,
|
||||||
}
|
}
|
||||||
|
|
||||||
get_rx_window_params(t_symbol, min_rx_symbols, (float) rx_error, MBED_CONF_LORA_WAKEUP_TIME,
|
get_rx_window_params(t_symbol, min_rx_symbols, (float) rx_error, MBED_CONF_LORA_WAKEUP_TIME,
|
||||||
&rx_conf_params->window_timeout, &rx_conf_params->window_offset,
|
&rx_conf_params->window_timeout, &rx_conf_params->window_timeout_ms,
|
||||||
|
&rx_conf_params->window_offset,
|
||||||
rx_conf_params->datarate);
|
rx_conf_params->datarate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -626,7 +626,8 @@ protected:
|
||||||
*/
|
*/
|
||||||
void get_rx_window_params(float t_symbol, uint8_t min_rx_symbols,
|
void get_rx_window_params(float t_symbol, uint8_t min_rx_symbols,
|
||||||
float rx_error, float wakeup_time,
|
float rx_error, float wakeup_time,
|
||||||
uint32_t *window_length, int32_t *window_offset,
|
uint32_t *window_length, uint32_t *window_length_ms,
|
||||||
|
int32_t *window_offset,
|
||||||
uint8_t phy_dr);
|
uint8_t phy_dr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1007,9 +1007,13 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
uint32_t frequency;
|
uint32_t frequency;
|
||||||
/*!
|
/*!
|
||||||
* The RX window timeout
|
* The RX window timeout - Symbols
|
||||||
*/
|
*/
|
||||||
uint32_t window_timeout;
|
uint32_t window_timeout;
|
||||||
|
/*!
|
||||||
|
* The RX window timeout - Milliseconds
|
||||||
|
*/
|
||||||
|
uint32_t window_timeout_ms;
|
||||||
/*!
|
/*!
|
||||||
* The RX window offset
|
* The RX window offset
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue