lexus2k / ssd1306

Driver for SSD1306, SSD1331, SSD1351, IL9163, ILI9341, ST7735, PCD8544, Nokia 5110 displays running on Arduino/ESP32/Linux (Rasperry) platforms
MIT License
664 stars 127 forks source link

drawLinesDemo Bug #70

Closed AndreiCo14 closed 5 years ago

AndreiCo14 commented 5 years ago

Describe the bug See screenshots. Lines is broken.

To Reproduce Steps to reproduce the behavior:

  1. Upload ssd1306_demo.ino
  2. the result of the "draw lines" menu

Expected behavior Draw lines.

Screenshots photo_2019-03-16_21-36-32

Please complete the following information:

Additional context

lexus2k commented 5 years ago

Hello,

Actually, this is not a bug, but expected behavior on these types of displays (based on ssd1306 controllers). This happens, because oled display doesn't allow to address single pixel. Each byte in ssd1306 controller represents 8 vertical pixels. So, for example, if it is required to draw horizontal line 4 pixels length at [0,2], library sends four bytes to ssd1306 (0x04,0x04,0x04,0x04). And then you need another horizontal line at [0,4], so the library needs to send another four bytes (0x10,0x10,0x10,0x10), and new bytes completely overwrite previous ones. So, you will see only one line, but not two. Unfortunately there is no way to read old bytes from oled display of this type. So, the only way out for you here is to use double buffering, what is supported by ssd1306 library. Please, refer to examples.

lexus2k commented 5 years ago

If you have any ideas how to solve your problem, let me know

AndreiCo14 commented 5 years ago

I understood. Thanks!