Skip to content

Commit

Permalink
TDoA2 #17: Fix bug where distances where not calculate if seq overflows
Browse files Browse the repository at this point in the history
  • Loading branch information
ataffanel committed Nov 29, 2017
1 parent a4c1963 commit 7b2cbc0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/uwb_tdoa_anchor2.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static void handleFailedRx(dwDevice_t *dev)
static void calculateDistance(int slot, int newId, uint32_t remoteTx, uint32_t remoteRx, uint32_t ts)
{
// Check that the 2 last packets are consecutive packets
if (ctx.packetIds[slot] == ((newId-1)%0x0ff)) {
if (ctx.packetIds[slot] == ((newId-1) & 0x0ff)) {
double tround1 = remoteRx - ctx.txTimestamps[ctx.slot];
double treply1 = ctx.txTimestamps[ctx.anchorId] - ctx.rxTimestamps[ctx.slot];
double tround2 = ts - ctx.txTimestamps[ctx.anchorId];
Expand Down

0 comments on commit 7b2cbc0

Please sign in to comment.