Skip to content

Correct scroll length for left and up directions #52

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Feb 12, 2025

Previously, the calculation for the distance of leftward and upward scrolling resulted in the text bitmap not being scrolled completely off the display.

For leftward scrolling, this would be noticeable in the case where the bitmap of the last character in the string had populated pixels on the rightmost column. For upward scrolling, this would be noticeable in the case where the bitmap of any character in the string had populated pixels on the bottom row.

Demos

The incompletely scrolled pixels will not be distinguishable from the artifacts left by the unrelated bug #50, but can be seen if the fix from #51 is applied.

SCROLL_LEFT

Prior to the change proposed here, the following sketch would result in the two pixels from the rightmost column of the Font_4x6 # character bitmap would remaining on the display after scrolling:

#include <ArduinoGraphics.h>
#include <Arduino_LED_Matrix.h>

ArduinoLEDMatrix matrix;

void setup() {
  matrix.begin();
  matrix.textFont(Font_4x6);
  matrix.textScrollSpeed(200);
}

void loop() {
  matrix.beginText(matrix.width(), 1, 0xFFFFFF);
  matrix.print("#");  // The bitmap for the Font_4x6 # character has two populated pixels on the rightmost column
  matrix.endText(SCROLL_LEFT);
}

SCROLL_UP

Prior to the change proposed here, the following sketch would result in the pixel from the bottom row of the Font_4x6 ( character bitmap remaining on the display after scrolling:

#include <ArduinoGraphics.h>
#include <Arduino_LED_Matrix.h>

ArduinoLEDMatrix matrix;

void setup() {
  matrix.begin();
  matrix.textFont(Font_4x6);
  matrix.textScrollSpeed(300);
}

void loop() {
  matrix.beginText(1, matrix.height(), 0xFFFFFF);
  matrix.print("(");  // The bitmap for the Font_4x6 ( character has a populated pixel on the bottom row
  matrix.endText(SCROLL_UP);
}

Previously, the calculation for the distance of leftward and upward scrolling resulted in the text bitmap not being
scrolled completely off the display.

For leftward scrolling, this would be noticeable in the case where the bitmap of the last character in the string had
populated pixels on the rightmost column. For upward scrolling, this would be noticeable in the case where the bitmap of
any character in the string had populated pixels on the bottom row.
@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself labels Feb 12, 2025
@per1234 per1234 self-assigned this Feb 12, 2025
Copy link

Memory usage change @ e0415f1

Board flash % RAM for global variables %
arduino:samd:arduino_zero_edbg 🔺 +4 - +4 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrzero 🔺 +4 - +4 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:nano_33_iot 🔺 +4 - +4 0.0 - 0.0 0 - 0 0.0 - 0.0
Click for full report table
Board examples/ASCIIDraw
flash
% examples/ASCIIDraw
RAM for global variables
%
arduino:samd:arduino_zero_edbg 4 0.0 0 0.0
arduino:samd:mkrzero 4 0.0 0 0.0
arduino:samd:nano_33_iot 4 0.0 0 0.0
Click for full report CSV
Board,examples/ASCIIDraw<br>flash,%,examples/ASCIIDraw<br>RAM for global variables,%
arduino:samd:arduino_zero_edbg,4,0.0,0,0.0
arduino:samd:mkrzero,4,0.0,0,0.0
arduino:samd:nano_33_iot,4,0.0,0,0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant