Skip to content

Commit 9ca7bad

Browse files
authored
Merge pull request #232 from arduino/fix-226
Fix: prevent artefacts from appearing on the screen during a SCROLL_LEFT.
2 parents 9ae3d9b + 23a2447 commit 9ca7bad

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

Diff for: libraries/Arduino_LED_Matrix/examples/TextWithArduinoGraphics/TextWithArduinoGraphics.ino

+5-7
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,20 @@
55
ArduinoLEDMatrix matrix;
66

77
void setup() {
8-
Serial.begin(115200);
98
matrix.begin();
109

1110
matrix.beginDraw();
11+
1212
matrix.stroke(0xFFFFFFFF);
13-
// add some static text
14-
// will only show "UNO" (not enough space on the display)
15-
const char text[] = "UNO r4";
13+
matrix.textScrollSpeed(100);
14+
15+
const char text[] = " UNO r4 ";
1616
matrix.textFont(Font_4x6);
1717
matrix.beginText(0, 1, 0xFFFFFF);
1818
matrix.println(text);
19-
matrix.endText();
19+
matrix.endText(SCROLL_LEFT);
2020

2121
matrix.endDraw();
22-
23-
delay(2000);
2422
}
2523

2624
void loop() {

Diff for: libraries/Arduino_LED_Matrix/src/Arduino_LED_Matrix.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ class ArduinoLEDMatrix
250250

251251
#ifdef MATRIX_WITH_ARDUINOGRAPHICS
252252
virtual void set(int x, int y, uint8_t r, uint8_t g, uint8_t b) {
253-
if (y >= canvasHeight || x >= canvasWidth) {
253+
if (y >= canvasHeight || x >= canvasWidth || y < 0 || x < 0) {
254254
return;
255255
}
256256
// the r parameter is (mis)used to set the character to draw with

0 commit comments

Comments
 (0)