Decawave / mynewt-dw1000-core

[DEPRECATED] Use https://github.com/Decawave/uwb-core for new designs.
Apache License 2.0
57 stars 34 forks source link

risk overflow associated with uint32_t type of repeat_dly #16

Closed flacordaire closed 5 years ago

flacordaire commented 5 years ago

Hi, in rtdoa_node.c line 365 risk overflow associated with uint32_t type of repeat_dly Instead of (repeat_dly << 16)(1.0l - wcs->skew) Shouldn't it be sth like : frame->rpt_count((uint64_t)rtdoa->config.tx_holdoff_dly<<16)*(1.0l - wcs->skew) as further below when computing tx_timestamp (line 374)?

ncasaril commented 5 years ago

Hi,

Thanks for your suggestion. In theory you're absolutely correct. In practice though the relay would have to be over 65ms (65536us) delayed before the field would overflow. The relay of rtdoa_node is in reality not tested yet and this also highlighted that the rx_timestamp compensation by just adding up the holdoffs isn't correct.

Thanks, N