i've added new function code , integer used gets affected sort of memory overrun. (note concerning .ino sketch arduino uno)
instead of decrementing 1 xpos--;
decrements 256 (if remove printtext function overrun doesn't happen).
the integer xpos , char buffer defined with
int xpos = 0; char buffer[26];
just under includes. u8g.drawstr function draws string on display , takes 2 ints x , y , char* string arguments.
void printtext(const char* inputtext) { int y = ypos; (int = strlen(inputtext); > 0; -= 25) { strncpy(buffer, &inputtext[strlen(inputtext) - i], >= 25 ? 25 : i); buffer[26] = '\0'; u8g.drawstr(0, y, buffer); y += 8; } }
any council appreciated :)
your buffer has 26 slots:
char buffer[26];
yet try write 27th slot:
buffer[26] = '\0';
that's not going work. (zero first slot, 1 second slot, , on. 26 27th slot.)
Comments
Post a Comment