Merge pull request #397 from Microsoft/showFix

fix problem with showNumber and showString on negative interval
This commit is contained in:
Tom Ball 2017-05-12 14:20:07 -07:00 committed by GitHub
commit 4fec614b50
2 changed files with 8 additions and 8 deletions

View File

@ -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) {

View File

@ -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);