-
Notifications
You must be signed in to change notification settings - Fork 71
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
expose line
function
#5
Conversation
already exists in framebuf, can be used today by reaching through the oled object with `oled.framebuf.line(16,16,32,32, 1)` changed variable names to conform to conventions Removed trailing whitespace, and attempted to disable `too-many-arguments` linting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing to reduce lint clutter.
adafruit_ssd1306.py
Outdated
@@ -130,6 +130,12 @@ def text(self, string, xpos, ypos, col=1): | |||
"""Place text on display""" | |||
self.framebuf.text(string, xpos, ypos, col) | |||
|
|||
#pylint: disable-msg=too-many-arguments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you only need this disable
once if you put it in the method after the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops I meant to re-enable it after this block, I saw some other hunk of code that did that. Copy/pasted a bit too much, fixing...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved via 4bc78f8
minor fix for linting hints. re-enable `too-many-arguments` after the block in question
adafruit_ssd1306.py
Outdated
"""Draw a line from initial to final point""" | ||
self.framebuf.line(xpos0, ypos0, xpos1, ypos1, col) | ||
#pylint: enable-msg=too-many-arguments | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be much more efficient to just add self.line = self.framebuf.line
to __init__
— and same for all of the other functions.
I'm not sure we want to have to do this in every single driver, and then update those drivers when the |
Never thought about that: I agree. I'm unsure how to fully test this however: the lines between I have an open PR at the micropython-adafruit-framebuf repo for mirroring the C logic in python. Ideally I'd like that to be accepted before this gets accepted: I've tested that code as working fine. I haven't ever been able to use the python-backed framebuf: no matter what I try, the actual import is the |
@raidancampbell I think the tricky thing here is that the built in framebuf is actually implemented in C and there is a second Python implemented version that can also be converted to bytecode (known as mpy). To test, I'd recommend renaming the python version so that it doesn't conflict and then changing the import in the library. It'd be awesome to get the framebuf module reorganized in CircuitPython so that its in |
@raidancampbell Are you hoping to get back to this and test it? |
I implemented and tested, but hadn't gotten around to replying. The "cleaner" method of just mapping the functions is a breaking change: the existing wrapper functions specify a default color if none is given. The wrapped function requires the color to be given. If everyone is okay with that, I'll update with the function mapping to replace wrapping. |
# Conflicts: # adafruit_ssd1306.py
- I might have tripped myself up in git here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor thing.
@@ -35,6 +35,19 @@ class _SSD1306: | |||
"""Base class for SSD1306 display driver""" | |||
def __init__(self, framebuffer, width, height, external_vcc): | |||
self.framebuf = framebuffer | |||
# note this is a breaking change: | |||
# previously these functions were wrapped | |||
# with a default color of "1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment should go in the PR message not the code. I bet col=1 below is actually column not color too.
I'm ok with the breaking change. It seems very minor to me. Ping me on Discord is you need git help. |
closing to reopen in #9 |
already exists in framebuf, can be used today by reaching through the oled object with
oled.framebuf.line(16,16,32,32, 1)