[go: up one dir, main page]

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

Characters Merged Instead of Overwritten When Updated #11

Open
martyphelan opened this issue Feb 27, 2022 · 1 comment
Open

Characters Merged Instead of Overwritten When Updated #11

martyphelan opened this issue Feb 27, 2022 · 1 comment

Comments

@martyphelan
Copy link

I have an application where I display a screen with multiple values and their titles.
When I first display the screen everything is fine.
But when I update just one changed value (not clearing the screen), the updated value is merged on top of the old value.
It appears that the characters being printed are OR'd on top of current pixels, rather than replacing.
I am using the display.printf(0, 10, "Title: %-15s", mytitle); function. Works fine when I first clear the display.
Does not work on second update call (without clearing display) with a new title value. Result is illegible.
I only want to update the value that changed without re-printing the entire screen.

Thanks,
Marty

@moelfus
Copy link
moelfus commented Jul 22, 2024

Hi @martyphelan,
I stumbled upon the same problem. Two years later this might not be helpful for you, but maybe for others. I kind of solved it by using this hacky solution. In the oled.h I moved the functions ToRow, ToCol, ToX, ToY in the public section and added a function in my code, that draws a black rectangular before printing the line:

void clear_line(int line){
    Display.draw_rectangle(Display.ToX(0),Display.ToY(line),Display.ToX(22),Display.ToY(line +1),OLED::SOLID,OLED::BLACK);
    Display.display();
}

Note: this is a hacky solution. I'm using a SH1106 display with a line length of 22 columns. @durydevelop a similar function to clear a line would be quite useful. Otherwise thanks for the lib!

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

2 participants