-
Notifications
You must be signed in to change notification settings - Fork 19
remove reference to temp, Display on a correct line #7
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
Conversation
I unfortunately wasted 1H trying to use the oled due to this example. Display lines need to be 9, 18, 27, 36, 45, 54 Using 33 is not good, it's an incorrect value that ends up in the wrong place, and gives the impression that you can give any Y coordinate, when in fact you cannot. If you don't, text gets overlayed on top of other text, even though it shouldn't according to Y See arduino-libraries#6 for an example.
Wait, are you sure? I might be missing something, but looks like using anything larger than (0,7) just loops the screen over. This is using the normal sized fonts from the u8x8 font list (https://github.com/olikraus/u8g2/wiki/fntlist8x8). Using larger (1x2) moves characters over others. My example code: #include "Arduino_SensorKit.h"
void setup() {
Oled.begin();
Oled.setFlipMode(true);
}
void loop() {
Oled.setFont(u8x8_font_chroma48medium8_r);
for (int i = 0; i <= 8; i++) {
Oled.setCursor(0, i);
if (i < 8) {
Oled.print(i);
}
else {
Oled.print("... goes over");
}
}
delay(1000);
} |
I noticed that with U8x8 line 33 did not print at line 33 (although it does with U8g2) |
I think u8x8 setCursor works not as pixel rows, but rows of 8x8 squares: "Arguments: x, y: Column/row position for the cursor of the So printing anything over row num 7 is futile. That's why I'd use Try this example to see what I mean: #include "Arduino_SensorKit.h"
void setup() {
Serial.begin(9600);
Oled.begin();
Oled.setFlipMode(true);
}
void loop() {
// Works with any standard size u8x8 font
Oled.setFont(u8x8_font_chroma48medium8_r);
Serial.println(Oled.getRows());
// Populate rows with numbers 0 to 7
for (int i = 0; i <= 8; i++) {
Oled.setCursor(0, i);
if (i < 8) {
Oled.print(i);
}
}
// Move the looped values a bit on the x axis to see result
Oled.setCursor(3, 9); // This is line num 1
Oled.print(9);
Oled.setCursor(3, 18);
Oled.print(18);
Oled.setCursor(3, 27);
Oled.print(27);
Oled.setCursor(3, 36);
Oled.print(36);
Oled.setCursor(3, 45); // This is line num 5
Oled.print(45);
delay(1000);
} |
I'm guessing U8g2 works on pixel coordinate basis and U8x8 on 8 by 8 pixel grid basis. And that's confusing this for everybody? In U8x8 printing on row 33 == 9 == 1. If larger font like 2x2 (e.g. u8x8_font_px437wyse700a_2x2_f) is used, single character uses two rows, not 16. Although it's possible the parameters on how the rows are calculated might have changed with different versions, but based on U8x8 reference it seems unlikely. |
@noppatoppa actually what you're saying is very possible, yes. |
@marcmerlin what I'm trying to say is
But my point is, that you can and it produces expected results.
Really sorry about the potato quality of the photo, but the top right row is 33 and row number 3 is 27. But if you print on row 28 (that is, row 4) it prints correctly without overlap. I'm just a user, but banged my head against the same wall. It is also very likely it would be wise to use multiples of 8 as row numbers, but I just can't see it right now. It would mess up for example iterating the rows with getRows. One final bit of documentation (I promise):
|
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.
Suggested changes based on comments I made. Again, I'm just a user and not at all responsible for the library.
// will end up in an incorrect place. | ||
Oled.setCursor(0, 27); | ||
Oled.print("Value: "); | ||
Oled.print(random_value) | ||
Oled.refreshDisplay(); |
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.
Not needed with U8x8.
Oled.refreshDisplay(); |
Writes directly to the display. No buffer in the microcontroller required.
(https://github.com/olikraus/u8g2/wiki)
Description: Transfer the content of the display RAM to the display itself. This is only required for e-Paper/e-Ink devices.
(https://github.com/olikraus/u8g2/wiki/u8x8reference#refreshdisplay)
Oled.print("C"); | ||
// Y needs to be a multiple of 9 for a font of 8 or the display | ||
// will end up in an incorrect place. | ||
Oled.setCursor(0, 27); |
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 could be
Oled.setCursor(0, 27); | |
Oled.setCursor(0, 3); | |
Or
Oled.setCursor(0, 27); | |
Oled.home(); | |
Thanks for the info, you are correct on the cursor value, I fixed it. |
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.
Thanks! 👌
@noppatoppa @marcmerlin |
I unfortunately wasted 1H trying to use the oled due to this example.
Display lines need to be 9, 18, 27, 36, 45, 54
Using 33 is not good, it's an incorrect value that ends up in the wrong place, and gives the
impression that you can give any Y coordinate, when in fact you cannot.
If you don't, text gets overlayed on top of other text, even though it shouldn't according to Y
See #6 for an example.