OLED Library Writer, Clear to end of line

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Online
User avatar
pythoncoder
Posts: 4030
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: OLED Library Writer, Clear to end of line

Post by pythoncoder » Mon Mar 02, 2020 10:52 am

Well done :D

Without seeing code or docs for the display driver it's hard to comment, but one that doesn't support drawing a filled rectangle strikes me as extraordinarily limited. However given that you can evidently blit glyphs, you could presumably blit a framebuf crafted to correspond to the dimensions of the field. That might enable you to implement my solution. But yours works, so there's not really any need.
Peter Hinch

stanely
Posts: 40
Joined: Fri Jan 17, 2020 5:19 am
Location: Ohio, USA

Re: OLED Library Writer, Clear to end of line

Post by stanely » Mon Mar 02, 2020 1:42 pm

The displays I'm using are the Nokia 5110, the SSD1306 0.96" OLED, and the MX1230. I don't expect to be doing much GUI with these; It's all text.

My approach is in the style of the Python 'curses' package which provides for an addressable cursor on a VT100-style display. That's kind of what Writer is doing, except it adds a lot of font flexibility. So in 'curses' there's this:
window.clrtoeol()
Erase from cursor to the end of the line.
It's very efficient and does what's needed. Best thing about my solution is that I only had to write 2 lines of code and copy the other 8. :)

Post Reply