Datarate bug fix in rx windows configs

While configuring RX parameters for the radio, we need to feed in
rx windows 1 and 2 parameters which are computed when we do the transmission.
We are actually setting the physical value of the data rate rather than
data rate table index and the expectation was to set the data rate index.
pull/6808/head
Hasnain Virk 2018-05-08 16:22:13 +03:00
parent cc09e44cfb
commit ac6fb71c90
12 changed files with 16 additions and 23 deletions

View File

@ -872,8 +872,8 @@ void LoRaMac::open_rx1_window(void)
_lora_phy.put_radio_to_standby();
}
_lora_phy.rx_config(&_params.rx_window1_config,
(int8_t*) &_mcps_indication.rx_datarate);
_mcps_indication.rx_datarate = _params.rx_window1_config.datarate;
_lora_phy.rx_config(&_params.rx_window1_config);
_lora_phy.setup_rx_window(_params.rx_window1_config.is_rx_continuous,
_params.sys_params.max_rx_win_time);
@ -892,8 +892,9 @@ void LoRaMac::open_rx2_window()
_params.rx_window2_config.is_rx_continuous = get_device_class()==CLASS_C ? true : false;
if (_lora_phy.rx_config(&_params.rx_window2_config,
(int8_t*) &_mcps_indication.rx_datarate) == true) {
_mcps_indication.rx_datarate = _params.rx_window2_config.datarate;
if (_lora_phy.rx_config(&_params.rx_window2_config)) {
_lora_phy.setup_rx_window(_params.rx_window2_config.is_rx_continuous,
_params.sys_params.max_rx_win_time);

View File

@ -808,7 +808,7 @@ void LoRaPHY::compute_rx_win_params(int8_t datarate, uint8_t min_rx_symbols,
&rx_conf_params->window_timeout, &rx_conf_params->window_offset);
}
bool LoRaPHY::rx_config(rx_config_params_t* rx_conf, int8_t* datarate)
bool LoRaPHY::rx_config(rx_config_params_t* rx_conf)
{
radio_modems_t modem;
uint8_t dr = rx_conf->datarate;
@ -868,8 +868,6 @@ bool LoRaPHY::rx_config(rx_config_params_t* rx_conf, int8_t* datarate)
_radio->unlock();
*datarate = phy_dr;
return true;
}

View File

@ -194,11 +194,9 @@ public:
*
* @param [in] config A pointer to the RX configuration.
*
* @param [out] datarate The datarate index set.
*
* @return True, if the configuration was applied successfully.
*/
virtual bool rx_config(rx_config_params_t* config, int8_t* datarate);
virtual bool rx_config(rx_config_params_t* config);
/** Computing Receive Windows
*

View File

@ -335,7 +335,7 @@ LoRaPHYAU915::~LoRaPHYAU915()
{
}
bool LoRaPHYAU915::rx_config(rx_config_params_t* params, int8_t* datarate)
bool LoRaPHYAU915::rx_config(rx_config_params_t* params)
{
int8_t dr = params->datarate;
uint8_t max_payload = 0;
@ -374,7 +374,6 @@ bool LoRaPHYAU915::rx_config(rx_config_params_t* params, int8_t* datarate)
_radio->unlock();
*datarate = (uint8_t) dr;
return true;
}

View File

@ -56,7 +56,7 @@ public:
LoRaPHYAU915(LoRaWANTimeHandler &lora_time);
virtual ~LoRaPHYAU915();
virtual bool rx_config(rx_config_params_t* config, int8_t* datarate);
virtual bool rx_config(rx_config_params_t* config);
virtual bool tx_config(tx_config_params_t* config, int8_t* txPower,
lorawan_time_t* txTimeOnAir);

View File

@ -303,7 +303,7 @@ LoRaPHYCN470::~LoRaPHYCN470()
{
}
bool LoRaPHYCN470::rx_config(rx_config_params_t* config, int8_t* datarate)
bool LoRaPHYCN470::rx_config(rx_config_params_t* config)
{
int8_t dr = config->datarate;
uint8_t max_payload = 0;
@ -349,7 +349,6 @@ bool LoRaPHYCN470::rx_config(rx_config_params_t* config, int8_t* datarate)
_radio->set_max_payload_length(MODEM_LORA, max_payload + LORA_MAC_FRMPAYLOAD_OVERHEAD);
_radio->unlock();
*datarate = (uint8_t) dr;
return true;
}

View File

@ -56,7 +56,7 @@ public:
LoRaPHYCN470(LoRaWANTimeHandler &lora_time);
virtual ~LoRaPHYCN470();
virtual bool rx_config(rx_config_params_t* config, int8_t* datarate );
virtual bool rx_config(rx_config_params_t* config);
virtual bool tx_config(tx_config_params_t* config, int8_t* tx_power,
lorawan_time_t* tx_toa);

View File

@ -353,7 +353,7 @@ void LoRaPHYUS915::restore_default_channels()
}
}
bool LoRaPHYUS915::rx_config(rx_config_params_t* config, int8_t* datarate)
bool LoRaPHYUS915::rx_config(rx_config_params_t* config)
{
int8_t dr = config->datarate;
uint8_t max_payload = 0;
@ -409,7 +409,6 @@ bool LoRaPHYUS915::rx_config(rx_config_params_t* config, int8_t* datarate)
_radio->unlock();
*datarate = (uint8_t) dr;
return true;
}

View File

@ -56,7 +56,7 @@ public:
virtual void restore_default_channels();
virtual bool rx_config(rx_config_params_t* config, int8_t* datarate);
virtual bool rx_config(rx_config_params_t* config);
virtual bool tx_config(tx_config_params_t* config, int8_t* tx_power,
lorawan_time_t* tx_toa);

View File

@ -369,7 +369,7 @@ bool LoRaPHYUS915Hybrid::get_next_ADR(bool restore_channel_mask, int8_t& dr_out,
return adrAckReq;
}
bool LoRaPHYUS915Hybrid::rx_config(rx_config_params_t* config, int8_t* datarate)
bool LoRaPHYUS915Hybrid::rx_config(rx_config_params_t* config)
{
int8_t dr = config->datarate;
uint8_t max_payload = 0;
@ -416,7 +416,6 @@ bool LoRaPHYUS915Hybrid::rx_config(rx_config_params_t* config, int8_t* datarate)
_radio->set_max_payload_length(MODEM_LORA, max_payload + LORA_MAC_FRMPAYLOAD_OVERHEAD);
_radio->unlock();
*datarate = (uint8_t) dr;
return true;
}

View File

@ -59,7 +59,7 @@ public:
virtual bool get_next_ADR(bool restore_channel_mask, int8_t& dr_out,
int8_t& tx_power_out, uint32_t& adr_ack_cnt);
virtual bool rx_config(rx_config_params_t* rxConfig, int8_t* datarate);
virtual bool rx_config(rx_config_params_t* rxConfig);
virtual bool tx_config(tx_config_params_t* tx_config, int8_t* tx_power,
lorawan_time_t* tx_toa);

View File

@ -1005,7 +1005,7 @@ typedef struct {
*/
uint8_t channel;
/*!
* The RX datarate.
* The RX datarate index.
*/
uint8_t datarate;
/*!