Move forever and runinbackground after onstart (#555)
This commit is contained in:
parent
3ec0534064
commit
b67ff733ab
@ -16,7 +16,7 @@ namespace basic {
|
|||||||
//% blockId=device_show_number block="show|number %number" blockGap=8
|
//% blockId=device_show_number block="show|number %number" blockGap=8
|
||||||
//% async
|
//% async
|
||||||
//% parts="ledmatrix"
|
//% parts="ledmatrix"
|
||||||
void showNumber(int value, int interval = 150) {
|
void showNumber(int value, int interval = 150) {
|
||||||
if (interval <= 0)
|
if (interval <= 0)
|
||||||
interval = 1;
|
interval = 1;
|
||||||
ManagedString t(value);
|
ManagedString t(value);
|
||||||
@ -32,7 +32,7 @@ namespace basic {
|
|||||||
* @param leds the pattern of LED to turn on/off
|
* @param leds the pattern of LED to turn on/off
|
||||||
* @param interval time in milliseconds to pause after drawing
|
* @param interval time in milliseconds to pause after drawing
|
||||||
*/
|
*/
|
||||||
//% help=basic/show-leds
|
//% help=basic/show-leds
|
||||||
//% weight=95 blockGap=8
|
//% weight=95 blockGap=8
|
||||||
//% imageLiteral=1 async
|
//% imageLiteral=1 async
|
||||||
//% blockId=device_show_leds
|
//% blockId=device_show_leds
|
||||||
@ -47,9 +47,9 @@ namespace basic {
|
|||||||
* @param text the text to scroll on the screen, eg: "Hello!"
|
* @param text the text to scroll on the screen, eg: "Hello!"
|
||||||
* @param interval how fast to shift characters; eg: 150, 100, 200, -100
|
* @param interval how fast to shift characters; eg: 150, 100, 200, -100
|
||||||
*/
|
*/
|
||||||
//% help=basic/show-string
|
//% help=basic/show-string
|
||||||
//% weight=87 blockGap=8
|
//% weight=87 blockGap=8
|
||||||
//% block="show|string %text"
|
//% block="show|string %text"
|
||||||
//% async
|
//% async
|
||||||
//% blockId=device_print_message
|
//% blockId=device_print_message
|
||||||
//% parts="ledmatrix"
|
//% parts="ledmatrix"
|
||||||
@ -112,7 +112,7 @@ namespace basic {
|
|||||||
* Repeats the code forever in the background. On each iteration, allows other codes to run.
|
* Repeats the code forever in the background. On each iteration, allows other codes to run.
|
||||||
* @param body code to execute
|
* @param body code to execute
|
||||||
*/
|
*/
|
||||||
//% help=basic/forever weight=55 blockGap=8 blockAllowMultiple=1
|
//% help=basic/forever weight=55 blockGap=8 blockAllowMultiple=1 afterOnStart=true
|
||||||
//% blockId=device_forever block="forever" icon="\uf01e"
|
//% blockId=device_forever block="forever" icon="\uf01e"
|
||||||
void forever(Action a) {
|
void forever(Action a) {
|
||||||
if (a != 0) {
|
if (a != 0) {
|
||||||
|
@ -217,7 +217,7 @@ namespace control {
|
|||||||
/**
|
/**
|
||||||
* Schedules code that run in the background.
|
* Schedules code that run in the background.
|
||||||
*/
|
*/
|
||||||
//% help=control/in-background blockAllowMultiple=1
|
//% help=control/in-background blockAllowMultiple=1 afterOnStart=true
|
||||||
//% blockId="control_in_background" block="run in background" blockGap=8
|
//% blockId="control_in_background" block="run in background" blockGap=8
|
||||||
void inBackground(Action a) {
|
void inBackground(Action a) {
|
||||||
runInBackground(a);
|
runInBackground(a);
|
||||||
|
10
libs/core/shims.d.ts
vendored
10
libs/core/shims.d.ts
vendored
@ -145,7 +145,7 @@ declare namespace basic {
|
|||||||
* @param leds the pattern of LED to turn on/off
|
* @param leds the pattern of LED to turn on/off
|
||||||
* @param interval time in milliseconds to pause after drawing
|
* @param interval time in milliseconds to pause after drawing
|
||||||
*/
|
*/
|
||||||
//% help=basic/show-leds
|
//% help=basic/show-leds
|
||||||
//% weight=95 blockGap=8
|
//% weight=95 blockGap=8
|
||||||
//% imageLiteral=1 async
|
//% imageLiteral=1 async
|
||||||
//% blockId=device_show_leds
|
//% blockId=device_show_leds
|
||||||
@ -158,9 +158,9 @@ declare namespace basic {
|
|||||||
* @param text the text to scroll on the screen, eg: "Hello!"
|
* @param text the text to scroll on the screen, eg: "Hello!"
|
||||||
* @param interval how fast to shift characters; eg: 150, 100, 200, -100
|
* @param interval how fast to shift characters; eg: 150, 100, 200, -100
|
||||||
*/
|
*/
|
||||||
//% help=basic/show-string
|
//% help=basic/show-string
|
||||||
//% weight=87 blockGap=8
|
//% weight=87 blockGap=8
|
||||||
//% block="show|string %text"
|
//% block="show|string %text"
|
||||||
//% async
|
//% async
|
||||||
//% blockId=device_print_message
|
//% blockId=device_print_message
|
||||||
//% parts="ledmatrix" interval.defl=150 shim=basic::showString
|
//% parts="ledmatrix" interval.defl=150 shim=basic::showString
|
||||||
@ -196,7 +196,7 @@ declare namespace basic {
|
|||||||
* Repeats the code forever in the background. On each iteration, allows other codes to run.
|
* Repeats the code forever in the background. On each iteration, allows other codes to run.
|
||||||
* @param body code to execute
|
* @param body code to execute
|
||||||
*/
|
*/
|
||||||
//% help=basic/forever weight=55 blockGap=8 blockAllowMultiple=1
|
//% help=basic/forever weight=55 blockGap=8 blockAllowMultiple=1 afterOnStart=true
|
||||||
//% blockId=device_forever block="forever" icon="\uf01e" shim=basic::forever
|
//% blockId=device_forever block="forever" icon="\uf01e" shim=basic::forever
|
||||||
function forever(a: () => void): void;
|
function forever(a: () => void): void;
|
||||||
|
|
||||||
@ -373,7 +373,7 @@ declare namespace control {
|
|||||||
/**
|
/**
|
||||||
* Schedules code that run in the background.
|
* Schedules code that run in the background.
|
||||||
*/
|
*/
|
||||||
//% help=control/in-background blockAllowMultiple=1
|
//% help=control/in-background blockAllowMultiple=1 afterOnStart=true
|
||||||
//% blockId="control_in_background" block="run in background" blockGap=8 shim=control::inBackground
|
//% blockId="control_in_background" block="run in background" blockGap=8 shim=control::inBackground
|
||||||
function inBackground(a: () => void): void;
|
function inBackground(a: () => void): void;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user