When display has only 32 pixels high the primitives are torn apart.
The reason for this is calculation in this function:
void lcd_drawPixel(uint8_t x, uint8_t y, uint8_t color){
if( x > DISPLAY_WIDTH-1 || y > (DISPLAY_HEIGHT-1)) return; // out of Display
if( color == WHITE){
displayBuffer[(y / (DISPLAY_HEIGHT/8))][x] |= (1 << (y % (DISPLAY_HEIGHT/8)));
} else {
displayBuffer[(y / (DISPLAY_HEIGHT/8))][x] &= ~(1 << (y % (DISPLAY_HEIGHT/8)));
}
}
The y offset has nothing to do with DISPLAY_HEIGHT it has to be divided by 8, because
the memory is organized this way even in infinitely large displays of this kind.
So the correct function looks like this:
void lcd_drawPixel(uint8_t x, uint8_t y, uint8_t color){
if( x > DISPLAY_WIDTH-1 || y > (DISPLAY_HEIGHT-1)) return; // out of Display
if( color == WHITE){
displayBuffer[(y / 8)][x] |= (1 << (y % 8));
} else {
displayBuffer[(y / 8)][x] &= ~(1 << (y % 8));
}
}
When display has only 32 pixels high the primitives are torn apart. The reason for this is calculation in this function:
The y offset has nothing to do with DISPLAY_HEIGHT it has to be divided by 8, because the memory is organized this way even in infinitely large displays of this kind.
So the correct function looks like this:
// Tested with 128x32 oled display.