Skip to content

Commit b83a267

Browse files
committed
QueueDuplicates for loop fixed when checking whole queue
1 parent baf8068 commit b83a267

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

examples/QueueDuplicates/QueueDuplicates.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
This example code is in the public domain.
77
88
created 3 November 2019
9+
modified 6 November 2019
910
by SMFSW
1011
*/
1112

@@ -61,7 +62,7 @@ void loop() {
6162
if (memcmp(&rec, &chk, sizeof(Rec))) { q.push(&rec); }
6263
#else // Check the whole queue
6364
bool duplicate = false;
64-
for (int j = max(0, (int) (q.getCount() - 1)) ; j > 0 ; j--)
65+
for (int j = (int) q_getCount(&q) - 1 ; j >= 0 ; j--)
6566
{
6667
Rec chk = {0xffff,0xffff};
6768
q.peekIdx(&chk, j);

0 commit comments

Comments
 (0)