Skip to content

Commit

Permalink
Display scroll an empty char if the requested char is out-of-range. (#…
Browse files Browse the repository at this point in the history
…168)

Currently it was scrolling a NULL pointer:
lancaster-university/codal-microbit-v2#423

This matches the V1 and MakeCode sim behaviour.
  • Loading branch information
microbit-carlos authored Apr 16, 2024
1 parent d667216 commit df05db9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions source/drivers/AnimatedDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ void AnimatedDisplay::updateScrollText()
if (scrollingPosition < BITMAP_FONT_WIDTH && scrollingChar < scrollingText.length())
{
const uint8_t *v = font.get(scrollingText.charAt(scrollingChar));
if (v == NULL) {
v = font.get(' ');
}
uint8_t mask = 1 << (BITMAP_FONT_WIDTH - scrollingPosition - 1);
uint8_t x = display.getWidth()-1;

Expand Down

0 comments on commit df05db9

Please sign in to comment.