endText: SCROLL_RIGHT and SCROLL_DOWN "traces"
matteoguglielmi opened this issue · 6 comments
Hello,
I'm using this library to drive an Arduino RGB Shield (5x12 LED Matrix).
With the following piece of code:
MATRIX.beginText(MATRIX.width(), 0, 80, 80, 80);
MATRIX.print("H");
MATRIX.endText(SCROLL_RIGHT);
I get this behavior (5th frame):
ooooo o....
ooooo o....
oooooooo....
ooooo o....
............
insted of this one (5th frame):
....o o....
....o o....
....oooo....
....o o....
............
As you can see, pixels are not turned off properly, resulting in a character trace.
Character traces also occurs when using SCROLL_DOWN but not with SCROLL_LEFT or SCROLL_UP.
Any suggestion on how to remove such traces?
Thank you.
EDIT
Just noticed that:
- traces are not present when using the letter "i" (either capitalized or not) and SCROLL_RIGHT
- traces are present when using the letter "i" (either capitalized or not) and SCROLL_DOWN
Your issue is caused by Arduino_Graphics providing negative numbers within set. A similar issue (arduino/ArduinoCore-renesas#226) occured for the Uno R4 WiFi, with this fix: arduino/ArduinoCore-renesas@e191781 .
The Arduino_MKRRGB library already has code for correctly handling negative coordinates:
void RGBMatrixClass::set(int x, int y, uint8_t r, uint8_t g, uint8_t b)
{
if (x < 0 || x >= RGB_MATRIX_WIDTH || y < 0 || y >= RGB_MATRIX_HEIGHT) {
return;
}so that is not the cause of the bug.
The cause is that the ArduinoGraphics library simply doesn't have any code for clearing the graphic at the previous position when scrolling text:
ArduinoGraphics/src/ArduinoGraphics.cpp
Lines 444 to 453 in 33e287d
In cases like i, the clearing is done purely by chance due to the left column of the graphic being empty:
ArduinoGraphics/src/Font_5x7.c
Lines 797 to 806 in 33e287d
Thank you @per1234 for reporting this in detail 🙇 . Though it seems to me that fixing this in the library may have been less work. I'll be ordering myself an Arduino MKR RGB Shield which - surprisingly - isn't in my collection yet. Then let's fix this once and for all.
@aentinger the bug can also be reproduced with the UNO R4 WiFi. Here is a demonstration sketch:
#include <ArduinoGraphics.h>
#include <Arduino_LED_Matrix.h>
ArduinoLEDMatrix matrix;
void setup() {
matrix.begin();
matrix.textScrollSpeed(50);
matrix.textFont(Font_5x7);
matrix.beginText(matrix.width(), 1, 80, 80, 80);
matrix.print("H");
matrix.endText(SCROLL_RIGHT);
}
void loop() {}That I have 🚀 . Let's fix it 🪛
Hello,
Was it fixed in the latest 1.1.2 release of the ArduinoGraphics library?
I'm asking because I still get the same artifacts with an Arduino MKR WIFI 1010 + Arduino RGB LED Shield when, for instance, scrolling down the three letters 'EEE,' but only on the second and third 'E.'
Thank you.