THX, I found it. Or something enough like it. It does indeed write off the end of the array.
I copied and pasted the snippet into a "real" C program context using an online interpreter. Changed but I feel certain not damaged to illustrate, viz:
# include <stdio.h>
// uint8_t fingerTemplate[512]; // the real template
int main()
{
printf("Hello World\n");
int uindx = 9, index = 0;
while (index < 534) {
while (index < uindx) ++index;
uindx += 256;
while (index < uindx) {
// fingerTemplate[index++] = bytesReceived[index];
printf("writing into fingerTemplate at index %d.\n", index);
index++;
}
uindx += 2;
while (index < uindx) ++index;
uindx = index + 9;
}
return 0;
}
The last line of output reads
writing into fingerTemplate at index 531.
Oops, as is said. ![]()
Sometimes errors like that do not cause immediate problems. So are not seen, but can manifest at any point and be tots unrelated to the problem(s) they cause.
a7