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?
short loop_1 = 0, loop_2 = 0;
short index = 0x00;
for (loop_1 = 0; loop_1 < SSD1306_LCDWIDTH*8; loop_1++)
chunk = 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)
printf("Chunk written to RAM - Completed\r\n");
printf("Chunk written to RAM - Failed\r\n");
if(index == SSD1306_LCDWIDTH*8)
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.