diff --git a/libs/core/basic.cpp b/libs/core/basic.cpp index 99a25ad2..6c7f1813 100644 --- a/libs/core/basic.cpp +++ b/libs/core/basic.cpp @@ -17,9 +17,8 @@ namespace basic { //% async //% parts="ledmatrix" void showNumber(int value, int interval = 150) { - if (interval < 0) - return; - + if (interval <= 0) + interval = 1; ManagedString t(value); if (value < 0 || value >= 10) { uBit.display.scroll(t, interval); @@ -55,8 +54,8 @@ namespace basic { //% blockId=device_print_message //% parts="ledmatrix" void showString(StringData *text, int interval = 150) { - if (interval < 0) - return; + if (interval <= 0) + interval = 1; ManagedString s(text); int l = s.length(); if (l == 0) { diff --git a/sim/state/ledmatrix.ts b/sim/state/ledmatrix.ts index 7cb3dae3..1b3d74f3 100644 --- a/sim/state/ledmatrix.ts +++ b/sim/state/ledmatrix.ts @@ -234,15 +234,16 @@ namespace pxsim.ImageMethods { namespace pxsim.basic { export function showNumber(x: number, interval: number) { - if (interval < 0) return; - + if (interval <= 0) + interval = 1; let leds = createImageFromString(x.toString()); if (x < 0 || x >= 10) ImageMethods.scrollImage(leds, 1, interval); else showLeds(leds, interval * 5); } export function showString(s: string, interval: number) { - if (interval < 0) return; + if (interval <= 0) + interval = 1; if (s.length == 0) { clearScreen(); pause(interval * 5);