bitbank2 / ss_oled

Simple and small library to control 1-bpp OLED displays (Linux + Arduino)
GNU General Public License v3.0
190 stars 34 forks source link

Simple Demo updated: 1) stretched font; 2) TODO for SH1106 @ 0x3C #6

Closed vitasam closed 5 years ago

vitasam commented 5 years ago

I have replaced FONT_LARGE with FONT_STRETCHED (since _LARGE is disabled for AVR by default). Also I've found that oledSetPixel() does not work for my SH1106 @ 0x3C display, so I put it under if() for 'TODO' clarifications.

bitbank2 commented 5 years ago

I think a more useful change to the samples would be a new one written specifically for the limits of an AVR target. If you create a new sample such as that, I'll merge it.

I would like to see more info about your SH1106 pixel problem. Perhaps your display isn't really an SH1106.

vitasam commented 5 years ago

Yes, AVR-specific example sounds good.

About my display - I bought this OLED module. According to specs, it is SH1106-compatible:

...
9, compatible with 3.3V and 5V control chip I / O level (without any set, directly compatible)
10, OLED screen, internal drive chip: SH1106 (Operation and SSD1306 same)
...

I've added some traces in to ss_oled.cpp:

  // Detect the display controller (SSD1306 or SH1106)
  uint8_t u = 0;
  I2CReadRegister(oled_addr, 0x00, &u, 1); // read the status register
  *regvalue = u;
  *oledaddr = oled_addr;

Result is:

OLED address:0x3C
Register value:0x28

The simple_demo.ino sketch from /master does not show pixels, and after calling of oledSetPixel(x, y, 1, 1) loop the 0,0 coordinates seem to be shifted: oled_1-3inch_SH1106

bitbank2 commented 5 years ago

I've seen that occur when using the SetPixel function on SH1106 displays; I'll experiment and see if I can figure out what's happening.

vitasam commented 5 years ago

I've seen that occur when using the SetPixel function on SH1106 displays; I'll experiment and see if I can figure out what's happening.

Ok, thanks! Do you want me to close this pull request and move SH1106 stuff in to a new Issue?

bitbank2 commented 5 years ago

I found that I had not completed the changes of my last update and that I had accidentally disabled the SH1106 SetPixel code; it now works. I investigated the display offset error issue. For the demo sketch, it occurs when more than 2500 random pixels are drawn on the SH1106. The problem is that it's not consistent and appears to be a quirk of the controller. I cannot track down what the exact cause is. Draw fewer than 2500 random pixels and it doesn't occur. If I do a loop to individually set every pixel, it doesn't occur. It seems to be a specific sequence of pixels that causes the issue. You're still welcome to create a new example sketch specific to AVR.

vitasam commented 5 years ago

Great! Now your default demo works. In my display the offsets sometimes occurred after 2000 random pixels, with a kind of vertical "glitch" in random columns: sh1106_glitch

But it is Ok for now. I will try to make an example for avr