From 4b2ed73382715abe016176dc8e51b810c4dc8670 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Thu, 11 Oct 2018 14:08:46 -0700 Subject: [PATCH] fix brightness (#1386) --- libs/core/_locales/core-strings.json | 1 + libs/core/game.ts | 3 --- libs/core/led.cpp | 3 ++- libs/core/shims.d.ts | 3 ++- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libs/core/_locales/core-strings.json b/libs/core/_locales/core-strings.json index 1908d4bc..e3b818b5 100644 --- a/libs/core/_locales/core-strings.json +++ b/libs/core/_locales/core-strings.json @@ -300,6 +300,7 @@ "led.plot|block": "plot|x %x|y %y", "led.point|block": "point|x %x|y %y", "led.setBrightness|block": "set brightness %value", + "led.setDisplayMode|block": "set display mode $mode", "led.stopAnimation|block": "stop animation", "led.toggle|block": "toggle|x %x|y %y", "led.unplot|block": "unplot|x %x|y %y", diff --git a/libs/core/game.ts b/libs/core/game.ts index e39b50a0..3c47947e 100644 --- a/libs/core/game.ts +++ b/libs/core/game.ts @@ -774,9 +774,6 @@ namespace game { _sprites[i]._plot(now); } _img.plotImage(0); - // restore previous display mode - if (dm != DisplayMode.Greyscale) - led.setDisplayMode(dm); } /** diff --git a/libs/core/led.cpp b/libs/core/led.cpp index 5a5b9621..328adfee 100644 --- a/libs/core/led.cpp +++ b/libs/core/led.cpp @@ -110,7 +110,8 @@ namespace led { * @param mode mode the display mode in which the screen operates */ //% weight=1 help=led/set-display-mode - //% parts="ledmatrix" advanced=true + //% parts="ledmatrix" advanced=true weight=1 + //% blockId="led_set_display_mode" block="set display mode $mode" void setDisplayMode(DisplayMode_ mode) { uBit.display.setDisplayMode((DisplayMode)mode); } diff --git a/libs/core/shims.d.ts b/libs/core/shims.d.ts index 2a12ba0c..1faa4072 100644 --- a/libs/core/shims.d.ts +++ b/libs/core/shims.d.ts @@ -526,7 +526,8 @@ declare namespace led { * @param mode mode the display mode in which the screen operates */ //% weight=1 help=led/set-display-mode - //% parts="ledmatrix" advanced=true shim=led::setDisplayMode + //% parts="ledmatrix" advanced=true weight=1 + //% blockId="led_set_display_mode" block="set display mode $mode" shim=led::setDisplayMode function setDisplayMode(mode: DisplayMode): void; /**