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
println with "clear to end of row" #60
Comments
The call |
There are several ways to handle this problem. Since you didn't post code, I can't comment on your enhanced println(). I suspect you could call ::clearToEOL() before calling println(). This will just clear the rest of the line and position to the begining of the next line. The SixAdcFieldsWire and SixAdcFieldsSpi examples use ::clearField() to position the cursor to a field and clear it. The ProportionalFormWire and ProportionalFormSPI handles forms with proportional fonts. |
Joining party. :)
BTW, if I do this way -- screen flickers. |
Did you print the text , call clearToEol, then println() like this?
This should minimize flicker. You could remember the end column for each line and print spaces something like this:
|
Hi guys,
I am using slightly different approach:
where infoItem is an array of Structs that define my "menu". |
Sounds like clearToEol() is not the best answer if you are just printing a number in each field. Just print blanks to fill the field. oled.print(infoItem[i].info) returns the number of characters printed so use that number to calculate how many blanks to print.
You could also use oled.clearField(oled.col(), oled.row(), nClear). I use clearField() in the SixAdcFieldsWire example to clear the entire field and position the cursor and flickering is not too bad.
|
Hello, Thank you for all of the responses ...
Is this statement actually true? If so, it does not seem to be working for me. I'll give some of these other suggestions a try ... and post my results. |
clearToEOL is not called by println(). println() is in the Arduino Print class so it does not call clearToEOL(). The only call to clearToEOL() is when scrolling is enable and text is scrolled. println() can cause scrolling in the case when the cursor is on the last line. oled.write('\n') can also cause the screen to be scrolled. |
Well, sorry for this imprecision :] |
Ok, guys, results of my tests:
|
I'm looking at the best way to create an enhanced "println" that would also clear to the end of the row. I'm using the different rows to display different information, and update it every second. If the length of the string is longer, then shorter, it leaves debris at the end of the row from the prior string.
In looking at the code it seems that I could use clearToEOL, but then I need to know where the last pixels were used by the println ... and I can't quite figure that out.
Any suggestions on how to accomplish this? I'm obviously trying to avoid clearing the row before writing to it.
The text was updated successfully, but these errors were encountered: