Skip to content

Commit

Permalink
QueueDuplicates for loop fixed when checking whole queue
Browse files Browse the repository at this point in the history
  • Loading branch information
SMFSW committed Nov 6, 2019
1 parent 50bf600 commit 57fbe00
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/QueueDuplicates/QueueDuplicates.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
This example code is in the public domain.
created 3 November 2019
modified 6 November 2019
by SMFSW
*/

Expand Down Expand Up @@ -64,7 +65,7 @@ void loop() {
if (memcmp(&rec, &chk, sizeof(Rec))) { q_push(&q, &rec); }
#else // Check the whole queue
bool duplicate = false;
for (int j = max(0, (int) (q_getCount(&q) - 1)) ; j > 0 ; j--)
for (int j = (int) q_getCount(&q) - 1 ; j >= 0 ; j--)
{
Rec chk = {0xffff,0xffff};
q_peekIdx(&q, &chk, j);
Expand Down

0 comments on commit 57fbe00

Please sign in to comment.