Ow yeah.
in "transfer", i changed loop_1's range from 1024 (=8x128) to 816 (=8x102).
set the break at the bottom to happen at index 816 as well.
hey presto. all good.
might be better if this range is dependent on the 'SSD1306_LCDWIDTH' (aka 8*LCDWIDTH), no?
something like
void transfer()
{
short loop_1 = 0, loop_2 = 0;
short index = 0x00;
for (loop_1 = 0; loop_1 < SSD1306_LCDWIDTH*8; loop_1++)
{
chunk[0] = 0x40;
for(loop_2 = 1; loop_2 < 17; loop_2++)
chunk[loop_2] = screen[index++];
if(i2c_multiple_writes(I2C_DEV_1.fd_i2c, 17, chunk) == 17)
{
#ifdef SSD1306_DBG
printf("Chunk written to RAM - Completed\r\n");
#endif
}
else
{
#ifdef SSD1306_DBG
printf("Chunk written to RAM - Failed\r\n");
#endif
exit(1);
}
memset(chunk,0x00,17);
if(index == SSD1306_LCDWIDTH*8)
break;
}
}
that works for me.
although i can imagine that there's still some possible conflict for non-64line displays in there, maybe.
but this should make it a little more universal at least.