From ae0a684d2e239e9aee7c9b8be6f2ebbb54ce8dfa Mon Sep 17 00:00:00 2001 From: Guillaume Jenkins Date: Thu, 9 Aug 2018 10:59:47 -0400 Subject: [PATCH] Fix showString interval for single character (#1058) --- sim/state/ledmatrix.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sim/state/ledmatrix.ts b/sim/state/ledmatrix.ts index ff023d3f..577e6a9b 100644 --- a/sim/state/ledmatrix.ts +++ b/sim/state/ledmatrix.ts @@ -247,14 +247,15 @@ namespace pxsim.basic { if (s.length == 0) { clearScreen(); pause(interval * 5); + } else if (s.length > 1) { + ImageMethods.scrollImage(createImageFromString(s + " "), 1, interval); } else { - if (s.length == 1) showLeds(createImageFromString(s), 0); - else ImageMethods.scrollImage(createImageFromString(s + " "), 1, interval); + showLeds(createImageFromString(s), interval * 5); } } - export function showLeds(leds: Image, delay: number): void { - showAnimation(leds, delay); + export function showLeds(leds: Image, interval: number): void { + showAnimation(leds, interval); } export function clearScreen() { @@ -281,7 +282,7 @@ namespace pxsim.led { const state = board().ledMatrixState; brightness = Math.max(0, Math.min(0xff, brightness)); if (brightness != 0 && brightness != 0xff && state.displayMode != DisplayMode.greyscale) - state.displayMode = DisplayMode.greyscale; + state.displayMode = DisplayMode.greyscale; state.image.set(x, y, brightness); runtime.queueDisplayUpdate() }