Skip to content

Commit

Permalink
add print to make sure we don't do too many iterations
Browse files Browse the repository at this point in the history
  • Loading branch information
wiedehopf committed Jan 4, 2025
1 parent 7211f3f commit 2f7a72e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions track.c
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,9 @@ static void setPosition(struct aircraft *a, struct modesMessage *mm, int64_t now
a->receiverIdsNext = (a->receiverIdsNext + 1) % RECEIVERIDBUFFER;
a->receiverIds[a->receiverIdsNext] = simpleHash(mm->receiverId);
int64_t advance = imin(RECEIVERIDBUFFER * 500, elapsed_pos);
int iterations = 0;
while (advance > 750) {
iterations++;
// ADS-B positions nominally come in every 500 ms receiver id
// buffer has 12 positions, if the positions don't come in
// often enough we zero them so it's only roughly the receiver
Expand All @@ -1096,6 +1098,9 @@ static void setPosition(struct aircraft *a, struct modesMessage *mm, int64_t now
a->receiverIdsNext = (a->receiverIdsNext + 1) % RECEIVERIDBUFFER;
a->receiverIds[a->receiverIdsNext] = 0;
}
if (iterations > 20) {
fprintf(stderr, "%06x\n", a->addr);
}
if (0 && a->addr == Modes.cpr_focus) {
fprintf(stderr, "%u\n", simpleHash(mm->receiverId));
}
Expand Down

0 comments on commit 2f7a72e

Please sign in to comment.