mirror of https://github.com/ARMmbed/mbed-os.git
Fix Beacon Time On Air Computation
Beacon time on air computation bandwidth param was hard coded to 500 KHz. Now it is read from the phy bandwidths table.feature-lorawan-1-1
parent
00dc81114d
commit
65e1e9c222
|
@ -44,7 +44,6 @@ SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
#define BEACON_PREAMBLE_LENGTH 10.0f
|
#define BEACON_PREAMBLE_LENGTH 10.0f
|
||||||
#define BEACON_COMMON_FRAME_SIZE 15
|
#define BEACON_COMMON_FRAME_SIZE 15
|
||||||
#define BEACON_BANDWIDTH 500000
|
|
||||||
#define BEACON_CODING_RATE 1
|
#define BEACON_CODING_RATE 1
|
||||||
#define BEACON_CRC_ON false
|
#define BEACON_CRC_ON false
|
||||||
#define BEACON_FIXED_LEN true
|
#define BEACON_FIXED_LEN true
|
||||||
|
@ -1637,18 +1636,21 @@ uint32_t LoRaPHY::compute_beacon_time_on_air()
|
||||||
{
|
{
|
||||||
uint8_t beacon_length;
|
uint8_t beacon_length;
|
||||||
uint8_t phy_dr;
|
uint8_t phy_dr;
|
||||||
|
uint32_t bw;
|
||||||
|
|
||||||
beacon_length = BEACON_COMMON_FRAME_SIZE + phy_params.beacon.rfu1_size +
|
beacon_length = BEACON_COMMON_FRAME_SIZE + phy_params.beacon.rfu1_size +
|
||||||
phy_params.beacon.rfu2_size;
|
phy_params.beacon.rfu2_size;
|
||||||
|
|
||||||
// Read the physical datarate from the datarates table
|
// Read the physical datarate from the datarates table
|
||||||
phy_dr = ((uint8_t *)phy_params.datarates.table)[phy_params.beacon.datarate];
|
phy_dr = ((uint8_t *)phy_params.datarates.table)[phy_params.beacon.datarate];
|
||||||
|
// Read beacon datarate bandwidth from the bandwidths table
|
||||||
|
bw = ((uint32_t *)phy_params.bandwidths.table)[phy_params.beacon.datarate];
|
||||||
|
|
||||||
return _radio->lora_time_on_air(BEACON_PREAMBLE_LENGTH,
|
return _radio->lora_time_on_air(BEACON_PREAMBLE_LENGTH,
|
||||||
phy_dr,
|
phy_dr,
|
||||||
BEACON_BANDWIDTH,
|
bw,
|
||||||
BEACON_CODING_RATE,
|
BEACON_CODING_RATE,
|
||||||
BEACON_CRC_ON,
|
BEACON_CRC_ON,
|
||||||
BEACON_FIXED_LEN,
|
BEACON_FIXED_LEN,
|
||||||
beacon_length);
|
beacon_length);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue