This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Possible fault in stack: broadcast.c, method time_required_to_send_us, packet_length_in_bytes calculation?

Hi guys,

Going through mesh packet format today and I'm stumbling upon the time_required_to_send_us method in broadcast.c which is used to calculate and indicate how long a BLE advertisement transmission will take. But there is something strange with the line:

 uint32_t packet_length_in_bytes = BLE_PACKET_OVERHEAD(RADIO_MODE_BLE_1MBIT) + BLE_ADV_PACKET_HEADER_LENGTH + p_packet->header.length;

When I look at BLE_PACKET_OVERHEAD(RADIO_MODE_BLE_1MBIT), I see that BLE_ADV_PACKET_HEADER_LENGTH is already been used for the sum there. But the line above still again adds the BLE_ADV_PACKET_HEADER_LENGTH  to the total packet length. Doesn't that give 2 bytes too much compared to the real length?

Thanks!

Kind regards,

Mathias

Related