adafruit / Adafruit_CircuitPython_DisplayIO_SSD1306

DisplayIO driver for SSD1306 monochrome OLED displays
MIT License
57 stars 24 forks source link

0.49" 64 x 32 pixel module output error #20

Closed wildestpixel closed 1 year ago

wildestpixel commented 3 years ago

Using a cheap 0.49" OLED with 64 x 32px - modified simple test.py to accommodate width and height, output shows as follows - seems not to like the tiny screen size.

Running on CP 6.2 Stable Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Feather RP2040 with rp2040 rather than own build CP, all libraries updated from bundle automatically using the joedevivo VSCode plugins IMG_1035

Need something to get the geometry corrected for the tiny OLEDs

ladyada commented 3 years ago

not surpring - it could be a different chipset or have different offsets. if you figure it out plesae submit a PR! :)

wildestpixel commented 3 years ago

okay - for these displays, when the displayio_ssd1306_simpletest.py has parameters of :

WIDTH = 96 HEIGHT = 64

The offset is 32 pixels in from x and y meaning text is displayed correctly when :

text = "Hello !!!" text_area = label.Label( terminalio.FONT, text=text, color=0xFFFFFF, x=32, y=36 )

Allowing for the half glyph height of terminalio scale 1 font at 4px.

How to get this into a PR I can't imagine, but handle-able as a manual process in using the display. They seem to be becoming more widely available for about $2 or $3. It definitely is SSD1306 based - doesn't seem to like to be spoken to as SH1106 or SH1107 IMG_1066 .

jposada202020 commented 3 years ago

@wildestpixel maybe something like this https://github.com/adafruit/Adafruit_CircuitPython_SSD1306/blob/3b350ba2654943f66a8c231c6795891ca39b535f/adafruit_ssd1306.py#L180

wildestpixel commented 3 years ago

This tests perfectly and framebuf's text class with size=2 is good.

Probably for a display this size using framebuf is perfectly adequate to display a single sensor string rather than using displayio. Would close as a consequence ?

adamcandy commented 3 years ago

@wildestpixel I have been through all this adapting the adafruit/Adafruit_CircuitPython_SSD1306 library to work with a wider range of displays -- and specifically this 0.49" 64x32 OLED display. It is a great little screen!

Two main issues came up:

  1. Extending the logic to correct the display clock div and com pin values.
  2. Adding Page Addressing Mode, since I found some of these 0.49" displays were SH1106 based (a different chipset as @ladyada suggested above), which has a reduced instruction set (that does not include the Horizontal Addressing Mode of the SSD1306). I have both SH1106 and SSD1306 based 0.49" 64x32 OLEDs and cannot differentiate the two from their appearance -- so watch out! Even suppliers do not know which is which.

This means that some 0.49" 64x32 screens may just need the fix to 1 above and some need a fix to both 1 and 2! Both SH1106 and SSD1306 chipsets work with Page Addressing Mode if you want one codebase that works with all.

Please see the corresponding issues 52 and 56 for the adafruit/Adafruit_CircuitPython_SSD1306 project: adafruit/Adafruit_CircuitPython_SSD1306/issues/52 and adafruit/Adafruit_CircuitPython_SSD1306/issues/56 which solved 1 and 2 above, respectively.

I was just writing in an issue over there that support could be improved here (see https://github.com/adafruit/Adafruit_CircuitPython_SSD1306/issues/40#issuecomment-825850964) and saw this issue! The logic here in this displayio library could definitely be extended to include the changes made over there to increase coverage.

wildestpixel commented 3 years ago

wow ! Thats superb Adam, I had resigned myself to seeing the great work done in the other library and thought it might not be PR'd into displayio due to the possible complexity - certainly out of the reach of my much more basic PR's.

Thanks indeed for your efforts - they are indeed a wonderful screen as you state.

jposada202020 commented 3 years ago

@adamcandy Thanks a lot for all the explanations, and sorry @wildestpixel =when I was answering I as referring to your comment How to get this into a PR I can't imagine. So I was showing an example. sorry about that. :) I will answer in the other library, however I do not have any of these display so if you could do a PR would be great. Thanks again adamcandy, your explanation and work on this and in the other library are greatly appreciated

adamcandy commented 3 years ago

Happy my comments have helped make this a bit clearer @wildestpixel and @jposada202020. This was just the result of interpreting manual descriptions and some good old experimentation! With displays not well marked it can be a bit tricky and we should make sure the library works well and efficiently for the standardised Adafruit displays at least, with generality to others a bonus!

Please have a go at extending the logic, mirroring from the development in adafruit/Adafruit_CircuitPython_SSD1306. I will try and help when I can :)

stewe93 commented 1 year ago

Hy Guys!

I'm trying to use a (probably) SSD1306 based 72x40 screen, experiencing similar issues. I found these related to our problem: https://github.com/micropython/micropython/issues/7281 https://github.com/micropython/micropython/pull/7411 https://github.com/micropython/micropython/commit/bc7822d8e95c40a9d5e403fd22c82b1bbad53b8b

Is there any update in this case?

ladyada commented 1 year ago

we're still waiting for someone with a screen to submit a PR - anyone is welcome to send one over, we do not own a screen of this resolution to test or develop with :)

stewe93 commented 1 year ago

Unfortunately, I'm not that familiar with this low-level hardware related software development, but I'm here to test any implementation given in case anyone could figure this out. Until then I will try and probably fail :"D

dglaude commented 1 year ago

I made a PR that work for me on my 0.49'' 64x32 I2C from LOLIN. I also tested it a 128x32 screen build on a LOLIN S2 PICO v1.0.0. But we would need someone to juge the style/logic in the code, then once that is OK, it need to be tested on as many screen as possible without the work by @adamcandy and other testing with those tiny screen.

PXL_20221212_131050719 NIGHT

dglaude commented 1 year ago

It would be great if owner of one or multiple screen of various resolution try Pull Request #31 and put a comment to help have it accepted. Beeping @stewe93 @adamcandy @jposada202020 @wildestpixel Thanks in advance.

jposada202020 commented 1 year ago

Sorry for the late delay...I was in deep sleep mode. I will test the PR this week :) @dglaude

jposada202020 commented 1 year ago

Closed by #31