arduino / ArduinoCore-renesas

MIT License
111 stars 77 forks source link

matrix.clear() does not clear the matrix buffer #352

Closed ralf-krause closed 3 months ago

ralf-krause commented 3 months ago

In the "get started" software for the new "Arduino Plug and Make Kit" the UNO R4 matrix shows a scrolling text "Resetting!" with forgotten pixels in the top line. I try to use the command matrix.clear() to clear everything but it does not work.

Please see my example code. In the first step the sketch draws a line on the top of the matrix. Then in a second step I try to clear .... yes, the line goes away. But in the third step the line comes back while the scrolling text does not use the top line of the matrix.

/*
  Test scrolling text and matrix.clear()
*/

// To use ArduinoGraphics APIs
// Please include BEFORE Arduino_LED_Matrix
#include "ArduinoGraphics.h"
#include "Arduino_LED_Matrix.h"

ArduinoLEDMatrix matrix;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  // use matrix
  matrix.begin();

  matrix.beginDraw();
  matrix.stroke(0xFFFFFFFF);
  matrix.line(0,0,11,0);
  matrix.endDraw();
  delay(1000);

  matrix.clear();
  delay(1000);

  matrix.beginDraw();
  matrix.textScrollSpeed(80);
  const char text[] = "  Hello World!  ";
  matrix.textFont(Font_5x7);
  matrix.beginText(0, 1, 0xFFFFFF);
  matrix.println(text);
  matrix.endText(SCROLL_LEFT);
  matrix.endDraw();

}

void loop() {
  // put your main code here, to run repeatedly:

}
per1234 commented 3 months ago

Hi @ralf-krause. Thanks for taking the time to submit an issue.

This bug was previously reported at https://github.com/arduino/ArduinoCore-renesas/issues/336 and already fixed by https://github.com/arduino/ArduinoCore-renesas/pull/335.

There hasn't been a new release of the platform since the time of the fix so this is why you still encounter the bug. If you like, you can manually apply the patch to the Arduino_LED_Matrix.h file in your local installation of the platform:

https://github.com/arduino/ArduinoCore-renesas/pull/335/files

If you want instructions for applying the patch, post over on Arduino Forum and we'll provide assistance over there:

https://forum.arduino.cc/c/hardware/uno-r4/uno-r4-wifi/189