Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces support for the SSD1305 OLED display controller, expanding the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds support for the SSD1305 OLED controller, including the driver class, documentation, and a full test suite. The implementation is well-tested and follows the existing structure. My main feedback concerns code duplication in the new ssd1305 class's __init__ method, which is a near-copy of the parent ssd1306's __init__. I've suggested a small change to improve clarity and noted that a larger refactoring of ssd1306 would be beneficial for long-term maintainability.
| """ | ||
|
|
||
| def __init__(self, serial_interface=None, width=128, height=32, rotate=0, **kwargs): | ||
| super(ssd1306, self).__init__(luma.oled.const.ssd1306, serial_interface) |
There was a problem hiding this comment.
The call super(ssd1306, self).__init__(...) is confusing. It's being used to intentionally skip the parent ssd1306.__init__ and call the grandparent device.__init__. While this works, it's un-idiomatic and hard to follow. For improved clarity, consider calling the grandparent's __init__ method directly.
This is also related to the larger issue of this __init__ method being almost a complete copy of ssd1306.__init__. A future refactor of ssd1306 to make it more extensible would be the ideal solution to avoid this code duplication.
| super(ssd1306, self).__init__(luma.oled.const.ssd1306, serial_interface) | |
| device.__init__(self, luma.oled.const.ssd1306, serial_interface) |
There was a problem hiding this comment.
I have used the patterns of other drivers, such as 1309 and 1316, and doing the suggested change would break the consistency.
As for the larger question of code duplication and refactoring, I think that is a question for the maintainers and out of scope for this PR.
luma/oled/device/__init__.py
Outdated
| represents 270° rotation. | ||
| :type rotate: int | ||
|
|
||
| .. versionadded:: 3.x.0 |
There was a problem hiding this comment.
Thanks, fixed now!
I had also forgotten to add ssd1305 to the all list.
524479a to
9356ca1
Compare
Adds support for the SSD1305 OLED controller, tested on a Waveshare 2.23inch OLED HAT (128x32, SPI). Key differences from SSD1306: - No internal charge pump (CHARGEPUMP set to 0x10) - Column offset of 4 for 128x32 mode - COM pins config 0x12 for 128x32 mode - Supports 128x32 (default) and 128x64 resolutions Includes datasheet, documentation updates, and test suite. Hardware-verified on Raspberry Pi with Waveshare 2.23inch OLED HAT. Ref rm-hull#309, ref rm-hull#412
9356ca1 to
4e57cda
Compare
Adds support for the SSD1305 OLED controller.
Changes
ssd1305device class inluma/oled/device/__init__.pydoc/tech-spec/Hardware verification
Tested on a Waveshare 2.23inch OLED HAT (128x32, SPI) connected to a Raspberry Pi.
Proof of concept repo: https://github.com/Kihltech/waveshare-2.23inch-oled-hat
Key differences from SSD1306
Ref #309, ref #412