-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
ssd1306.py: Change the init values for a 64x32 display #5837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I used this driver only on a 128x32 display, so couldn't say either way about this issue. Reading the docs for the SSD1306 it says there are 6 combinations for display configurations (for a size of 128x64 pixels) for this option, so it may be that it's hardware dependent what value to use here. How do other drivers (Arduino etc) configure this value? |
Actually after studying the data sheet w/o getting better clues I tried another driver, which worked, and compared the difference. The setting for SET_COM_PIN_CFG was the only one, and implement that made the driver work. But, as I noted, I tested just that device. Other 64x32 units may behave differently. The 128x32 you used should not be affected by the change. |
I did a brief search for SSD1306 tutorials and all seem to rely on Adafruit's driver https://github.com/adafruit/Adafruit_SSD1306/blob/master/Adafruit_SSD1306.cpp. For this setting (grep for So, maybe it's best here to change the code to |
Whatever works. As said, I have not much confidence that the suggested change will work for all devices. |
There's only two I know if that use 0x02. Use "sequential" (bit 4 = 0) when there are two sub panels - a panel at the top and one at the bottom. Use "alternating" (bit 4 = 1) when it's a large panel and each com pin maps to even rows, then odd rows, like interlacing. 0xDA, 0x02:
0xDA, 0x12:
|
Thanks @mcauser for the data. I have a 128x64 SPI based SSD1306 display and I tested it and it does need 0x12. It looks like a value of 0x02 is used only when the aspect ratio is greater than 2. So that means the formula could be: 0x02 if self.width > 2 * self.height else 0x12 That would lead to smaller and faster bytecode than checking a set of specific w/h values. |
Making it more specific to use 0x02 for display with an aspect ratio > 2 and 0x12 for all othe sizes as recommended by @mcauser. Tested with a 64x32 display which did not work before.
Changed accordingly. Thanks for testing. Besides that one, I have only displays with other controllers at hand. |
Thanks for updating, merged in 8680a74 |
The parameter for the SET_COM_PIN_CFG setting was wrong for that size,
at least for the display I have here for testing. I am not sure whether
other displays of that size behave different.