Skip to content

Commit ac6fb71

Browse files
author
Hasnain Virk
committed
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.
1 parent cc09e44 commit ac6fb71

File tree

12 files changed

+16
-23
lines changed

12 files changed

+16
-23
lines changed

features/lorawan/lorastack/mac/LoRaMac.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -872,8 +872,8 @@ void LoRaMac::open_rx1_window(void)
872872
_lora_phy.put_radio_to_standby();
873873
}
874874

875-
_lora_phy.rx_config(&_params.rx_window1_config,
876-
(int8_t*) &_mcps_indication.rx_datarate);
875+
_mcps_indication.rx_datarate = _params.rx_window1_config.datarate;
876+
_lora_phy.rx_config(&_params.rx_window1_config);
877877

878878
_lora_phy.setup_rx_window(_params.rx_window1_config.is_rx_continuous,
879879
_params.sys_params.max_rx_win_time);
@@ -892,8 +892,9 @@ void LoRaMac::open_rx2_window()
892892

893893
_params.rx_window2_config.is_rx_continuous = get_device_class()==CLASS_C ? true : false;
894894

895-
if (_lora_phy.rx_config(&_params.rx_window2_config,
896-
(int8_t*) &_mcps_indication.rx_datarate) == true) {
895+
_mcps_indication.rx_datarate = _params.rx_window2_config.datarate;
896+
897+
if (_lora_phy.rx_config(&_params.rx_window2_config)) {
897898

898899
_lora_phy.setup_rx_window(_params.rx_window2_config.is_rx_continuous,
899900
_params.sys_params.max_rx_win_time);

features/lorawan/lorastack/phy/LoRaPHY.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ void LoRaPHY::compute_rx_win_params(int8_t datarate, uint8_t min_rx_symbols,
808808
&rx_conf_params->window_timeout, &rx_conf_params->window_offset);
809809
}
810810

811-
bool LoRaPHY::rx_config(rx_config_params_t* rx_conf, int8_t* datarate)
811+
bool LoRaPHY::rx_config(rx_config_params_t* rx_conf)
812812
{
813813
radio_modems_t modem;
814814
uint8_t dr = rx_conf->datarate;
@@ -868,8 +868,6 @@ bool LoRaPHY::rx_config(rx_config_params_t* rx_conf, int8_t* datarate)
868868

869869
_radio->unlock();
870870

871-
*datarate = phy_dr;
872-
873871
return true;
874872
}
875873

features/lorawan/lorastack/phy/LoRaPHY.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,9 @@ class LoRaPHY : private mbed::NonCopyable<LoRaPHY> {
194194
*
195195
* @param [in] config A pointer to the RX configuration.
196196
*
197-
* @param [out] datarate The datarate index set.
198-
*
199197
* @return True, if the configuration was applied successfully.
200198
*/
201-
virtual bool rx_config(rx_config_params_t* config, int8_t* datarate);
199+
virtual bool rx_config(rx_config_params_t* config);
202200

203201
/** Computing Receive Windows
204202
*

features/lorawan/lorastack/phy/LoRaPHYAU915.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ LoRaPHYAU915::~LoRaPHYAU915()
335335
{
336336
}
337337

338-
bool LoRaPHYAU915::rx_config(rx_config_params_t* params, int8_t* datarate)
338+
bool LoRaPHYAU915::rx_config(rx_config_params_t* params)
339339
{
340340
int8_t dr = params->datarate;
341341
uint8_t max_payload = 0;
@@ -374,7 +374,6 @@ bool LoRaPHYAU915::rx_config(rx_config_params_t* params, int8_t* datarate)
374374

375375
_radio->unlock();
376376

377-
*datarate = (uint8_t) dr;
378377
return true;
379378
}
380379

features/lorawan/lorastack/phy/LoRaPHYAU915.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class LoRaPHYAU915 : public LoRaPHY{
5656
LoRaPHYAU915(LoRaWANTimeHandler &lora_time);
5757
virtual ~LoRaPHYAU915();
5858

59-
virtual bool rx_config(rx_config_params_t* config, int8_t* datarate);
59+
virtual bool rx_config(rx_config_params_t* config);
6060

6161
virtual bool tx_config(tx_config_params_t* config, int8_t* txPower,
6262
lorawan_time_t* txTimeOnAir);

features/lorawan/lorastack/phy/LoRaPHYCN470.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ LoRaPHYCN470::~LoRaPHYCN470()
303303
{
304304
}
305305

306-
bool LoRaPHYCN470::rx_config(rx_config_params_t* config, int8_t* datarate)
306+
bool LoRaPHYCN470::rx_config(rx_config_params_t* config)
307307
{
308308
int8_t dr = config->datarate;
309309
uint8_t max_payload = 0;
@@ -349,7 +349,6 @@ bool LoRaPHYCN470::rx_config(rx_config_params_t* config, int8_t* datarate)
349349
_radio->set_max_payload_length(MODEM_LORA, max_payload + LORA_MAC_FRMPAYLOAD_OVERHEAD);
350350
_radio->unlock();
351351

352-
*datarate = (uint8_t) dr;
353352
return true;
354353
}
355354

features/lorawan/lorastack/phy/LoRaPHYCN470.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class LoRaPHYCN470 : public LoRaPHY {
5656
LoRaPHYCN470(LoRaWANTimeHandler &lora_time);
5757
virtual ~LoRaPHYCN470();
5858

59-
virtual bool rx_config(rx_config_params_t* config, int8_t* datarate );
59+
virtual bool rx_config(rx_config_params_t* config);
6060

6161
virtual bool tx_config(tx_config_params_t* config, int8_t* tx_power,
6262
lorawan_time_t* tx_toa);

features/lorawan/lorastack/phy/LoRaPHYUS915.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ void LoRaPHYUS915::restore_default_channels()
353353
}
354354
}
355355

356-
bool LoRaPHYUS915::rx_config(rx_config_params_t* config, int8_t* datarate)
356+
bool LoRaPHYUS915::rx_config(rx_config_params_t* config)
357357
{
358358
int8_t dr = config->datarate;
359359
uint8_t max_payload = 0;
@@ -409,7 +409,6 @@ bool LoRaPHYUS915::rx_config(rx_config_params_t* config, int8_t* datarate)
409409

410410
_radio->unlock();
411411

412-
*datarate = (uint8_t) dr;
413412
return true;
414413
}
415414

features/lorawan/lorastack/phy/LoRaPHYUS915.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class LoRaPHYUS915 : public LoRaPHY {
5656

5757
virtual void restore_default_channels();
5858

59-
virtual bool rx_config(rx_config_params_t* config, int8_t* datarate);
59+
virtual bool rx_config(rx_config_params_t* config);
6060

6161
virtual bool tx_config(tx_config_params_t* config, int8_t* tx_power,
6262
lorawan_time_t* tx_toa);

features/lorawan/lorastack/phy/LoRaPHYUS915Hybrid.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ bool LoRaPHYUS915Hybrid::get_next_ADR(bool restore_channel_mask, int8_t& dr_out,
369369
return adrAckReq;
370370
}
371371

372-
bool LoRaPHYUS915Hybrid::rx_config(rx_config_params_t* config, int8_t* datarate)
372+
bool LoRaPHYUS915Hybrid::rx_config(rx_config_params_t* config)
373373
{
374374
int8_t dr = config->datarate;
375375
uint8_t max_payload = 0;
@@ -416,7 +416,6 @@ bool LoRaPHYUS915Hybrid::rx_config(rx_config_params_t* config, int8_t* datarate)
416416
_radio->set_max_payload_length(MODEM_LORA, max_payload + LORA_MAC_FRMPAYLOAD_OVERHEAD);
417417
_radio->unlock();
418418

419-
*datarate = (uint8_t) dr;
420419
return true;
421420
}
422421

features/lorawan/lorastack/phy/LoRaPHYUS915Hybrid.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class LoRaPHYUS915Hybrid : public LoRaPHY {
5959
virtual bool get_next_ADR(bool restore_channel_mask, int8_t& dr_out,
6060
int8_t& tx_power_out, uint32_t& adr_ack_cnt);
6161

62-
virtual bool rx_config(rx_config_params_t* rxConfig, int8_t* datarate);
62+
virtual bool rx_config(rx_config_params_t* rxConfig);
6363

6464
virtual bool tx_config(tx_config_params_t* tx_config, int8_t* tx_power,
6565
lorawan_time_t* tx_toa);

features/lorawan/system/lorawan_data_structures.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ typedef struct {
10051005
*/
10061006
uint8_t channel;
10071007
/*!
1008-
* The RX datarate.
1008+
* The RX datarate index.
10091009
*/
10101010
uint8_t datarate;
10111011
/*!

0 commit comments

Comments
 (0)