lexus2k / lcdgfx

Driver for LCD displays running on Arduino/Avr/ESP32/Linux (including Rasperry) platforms
MIT License
377 stars 52 forks source link

putPixel deletes Pixels #24

Closed ACDCLabs closed 4 years ago

ACDCLabs commented 4 years ago

the putPixel method of the NanoDisplayOps4 class does not allow to draw directly neighboring pixels. A full line appears as dotted line. (See code below)

drawLine(30,60,60,60) has the same issue, drawing a dotted line.

drawHLine(40,70,8) works as expected, drawing a solid line

Thanks Norbert

`#include "lcdgfx.h"

DisplaySSD1327_128x128_SPI display(3, { -1, 4, 5, 0, -1, -1}); // Use this line for Atmega328p (3=RST, 4=CE, 5=D/C)

void setup() { display.begin(); display.fill(0x00);

}

void loop() {

for (int i = 0; i < 8; i++) { display.putPixel(64 + i, 61); delay(500); } }`

lexus2k commented 4 years ago

Well, actually that is not a bug.

Here you're using direct API. This API doesn't use any memory buffer, and sends all data directly to ssd1327 controller. The minimum packet size is 1 byte (8 bits). Serial interfaces: i2c, spi - do not allow to read data back from display. Each pixel for ssd1327 controller is 4 bits. So, cpu can send 2 pixels at once. Usually, the problem is solved by reading byte from memory, modifying it and saving back to memory, but this cannot be done for serial interfaces.

So, to workaround the problem, you described, you need to use either drawLine or canvas.

ACDCLabs commented 4 years ago

Thanks for the answer. I will go for the Canvas. Thanks. N.