Skip to content
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

User-experience improvements #2

Open
CoreProduction opened this issue Jan 27, 2022 · 1 comment
Open

User-experience improvements #2

CoreProduction opened this issue Jan 27, 2022 · 1 comment
Assignees

Comments

@CoreProduction
Copy link
Collaborator

CoreProduction commented Jan 27, 2022

Presently, printing text to the OLED module requires an understanding of the (x,y) co-ordinate system to anchor the text, and requires an argument for text-colour (1=white, 0=black) eg:

display.text("Hello, World!", 0,0, 1) # print literal string at (0,0) with white colour

To remove the assumed-knowledge and make code less intimidating we can abstract to the concept of line numbers, and print in white by default. The new function could be

display.print(n, string)

where n is the line number, and string is the user-string to display.

eg. the following code would print three strings across three lines.

display.print(0, "hello world")
display.print(1, "second line")
display.print(2, "third line")

Under the hood, print() will just wrap text(), where the line number is translated into the appropriate co-ordinate (0, n*height) where n is the line number and height is the height of a letter, plus line-spacing.

There's scope for print() to auto-increment the line number, so that text flows up the screen on each successive call to print()
This is a cute stretch-goal, but probably beyond requirements.

@LiamHowell
Copy link
Contributor

Hey team!

Another suggestion for OLED User-experience improvements.
A callable rotation argument in the create_PiicoDev_SSD1306 function.

Suggestions:
create_PiicoDev_SSD1306(flipped=True)
either directly changing the registers or invoking the rotate function

def rotate(self, rotate):
self.write_cmd(_SET_COM_OUT_DIR | ((rotate & 1) << 3))
self.write_cmd(_SET_SEG_REMAP | (rotate & 1))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants