drivers/display/ssd1306.py: Add support for 72x40 displays. #7411
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix for #7281
The 72x40 OLED requires selecting the internal IREF, as opposed to the default external IREF. This is an undocumented feature in the SSD1306 datasheet, but is present in the SSD1315 datasheet. It's possible this 72x40 OLED is actually using the newer SSD1315 controller. Sending the IREF select command to SSD1306 displays has no effect on them, so I've just added it to the
init_display()
instead of wrapping in anif width = 72
.I also have a 128x64 OLED using the SSD1315 controller (smaller ribbon cable) and the proposed change has no effect on the display, as the module comes with the correct current limiting resistor. You can use either internal or external IREF and it works the same.
After testing the various display sizes 128x64, 128x32, 72x40, 64x48, 64x32, I noticed all of the smaller displays use a column address offset which is exactly 1/2 of the remaining pixels. eg.
In
show()
, rather than hard coding to32
when the width is64
, I've made it calculate it based on the display width, which was tested on each of the above display dimensions.