diff --git a/libs/audio-recording/_locales/audio-recording-strings.json b/libs/audio-recording/_locales/audio-recording-strings.json index d910bff0c9b..c9399ad475b 100644 --- a/libs/audio-recording/_locales/audio-recording-strings.json +++ b/libs/audio-recording/_locales/audio-recording-strings.json @@ -22,6 +22,7 @@ "record.playAudio|block": "play audio clip $mode", "record.setMicGain|block": "set microphone sensitivity to $gain", "record.setSampleRate|block": "set sample rate to $hz || for $scope", + "record.setSampleRate|param|hz|label": "sample rate", "record.startRecording|block": "record audio clip $mode", "record|block": "Record", "{id:category}Record": "Record" diff --git a/libs/audio-recording/recording.ts b/libs/audio-recording/recording.ts index d96d4820ff2..7426d655f59 100644 --- a/libs/audio-recording/recording.ts +++ b/libs/audio-recording/recording.ts @@ -186,6 +186,7 @@ namespace record { * @param hz The sample frequency, in Hz */ //% block="set sample rate to $hz || for $scope" + //% hz.label="sample rate" //% blockId="record_setSampleRate" //% hz.min=1000 hz.max=22000 hz.defl=11000 //% expandableArgumentMode="enabled" diff --git a/libs/bluetooth/_locales/bluetooth-strings.json b/libs/bluetooth/_locales/bluetooth-strings.json index e63707af103..070d04e579f 100644 --- a/libs/bluetooth/_locales/bluetooth-strings.json +++ b/libs/bluetooth/_locales/bluetooth-strings.json @@ -1,10 +1,20 @@ { "bluetooth.advertiseUid|block": "bluetooth advertise UID|namespace (bytes 6-9)%ns|instance (bytes 2-6)%instance|with power %power|connectable %connectable", + "bluetooth.advertiseUid|param|connectable|label": "connectable", + "bluetooth.advertiseUid|param|instance|label": "instance", + "bluetooth.advertiseUid|param|ns|label": "namespace", + "bluetooth.advertiseUid|param|power|label": "power", "bluetooth.advertiseUrl|block": "bluetooth advertise url %url|with power %power|connectable %connectable", + "bluetooth.advertiseUrl|param|connectable|label": "connectable", + "bluetooth.advertiseUrl|param|power|label": "power", + "bluetooth.advertiseUrl|param|url|defl": "https://makecode.com", + "bluetooth.advertiseUrl|param|url|label": "url", "bluetooth.onBluetoothConnected|block": "on bluetooth connected", "bluetooth.onBluetoothDisconnected|block": "on bluetooth disconnected", "bluetooth.onUartDataReceived|block": "bluetooth|on data received %delimiters=serial_delimiter_conv", + "bluetooth.onUartDataReceived|param|delimiters|label": "delimiter", "bluetooth.setTransmitPower|block": "bluetooth set transmit power %power", + "bluetooth.setTransmitPower|param|power|label": "value", "bluetooth.startAccelerometerService|block": "bluetooth accelerometer service", "bluetooth.startButtonService|block": "bluetooth button service", "bluetooth.startIOPinService|block": "bluetooth io pin service", @@ -14,10 +24,17 @@ "bluetooth.startUartService|block": "bluetooth uart service", "bluetooth.stopAdvertising|block": "bluetooth stop advertising", "bluetooth.uartReadUntil|block": "bluetooth uart|read until %del=serial_delimiter_conv", + "bluetooth.uartReadUntil|param|del|label": "delimiter", "bluetooth.uartWriteLine|block": "bluetooth uart|write line %data", + "bluetooth.uartWriteLine|param|data|label": "value", "bluetooth.uartWriteNumber|block": "bluetooth uart|write number %value", + "bluetooth.uartWriteNumber|param|value|label": "value", "bluetooth.uartWriteString|block": "bluetooth uart|write string %data", + "bluetooth.uartWriteString|param|data|label": "value", "bluetooth.uartWriteValue|block": "bluetooth uart|write value %name|= %value", + "bluetooth.uartWriteValue|param|name|defl": "x", + "bluetooth.uartWriteValue|param|name|label": "name", + "bluetooth.uartWriteValue|param|value|label": "value", "bluetooth|block": "bluetooth", "{id:category}Bluetooth": "Bluetooth" } \ No newline at end of file diff --git a/libs/bluetooth/bluetooth.cpp b/libs/bluetooth/bluetooth.cpp index 155bfcc359e..2ba454e530a 100644 --- a/libs/bluetooth/bluetooth.cpp +++ b/libs/bluetooth/bluetooth.cpp @@ -145,6 +145,7 @@ namespace bluetooth { */ //% help=bluetooth/on-uart-data-received //% weight=18 blockId=bluetooth_on_data_received block="bluetooth|on data received %delimiters=serial_delimiter_conv" + //% delimiters.label="delimiter" void onUartDataReceived(String delimiters, Action body) { startUartService(); uart->eventOn(MSTR(delimiters)); @@ -181,6 +182,7 @@ namespace bluetooth { * @param connectable true to keep bluetooth connectable for other services, false otherwise. */ //% blockId=eddystone_advertise_url block="bluetooth advertise url %url|with power %power|connectable %connectable" + //% url.label="url" power.label="power" connectable.label="connectable" //% parts=bluetooth weight=11 blockGap=8 //% help=bluetooth/advertise-url blockExternalInputs=1 //% hidden=1 deprecated=1 @@ -217,6 +219,7 @@ namespace bluetooth { */ //% parts=bluetooth weight=5 help=bluetooth/set-transmit-power advanced=true //% blockId=bluetooth_settransmitpower block="bluetooth set transmit power %power" + //% power.label="value" void setTransmitPower(int power) { uBit.bleManager.setTransmitPower(min(MICROBIT_BLE_POWER_LEVELS-1, max(0, power))); } diff --git a/libs/bluetooth/bluetooth.ts b/libs/bluetooth/bluetooth.ts index 7f537209530..f922613b494 100644 --- a/libs/bluetooth/bluetooth.ts +++ b/libs/bluetooth/bluetooth.ts @@ -20,6 +20,7 @@ namespace bluetooth { */ //% help=bluetooth/uart-write-string weight=80 //% blockId=bluetooth_uart_write block="bluetooth uart|write string %data" blockGap=8 + //% data.label="value" //% parts="bluetooth" shim=bluetooth::uartWriteString advanced=true export function uartWriteString(data: string): void { console.log(data) @@ -30,6 +31,7 @@ namespace bluetooth { */ //% help=bluetooth/uart-write-line weight=79 //% blockId=bluetooth_uart_line block="bluetooth uart|write line %data" blockGap=8 + //% data.label="value" //% parts="bluetooth" advanced=true export function uartWriteLine(data: string): void { uartWriteString(data + serial.NEW_LINE); @@ -41,6 +43,7 @@ namespace bluetooth { //% help=bluetooth/uart-write-number weight=79 //% weight=89 blockGap=8 advanced=true //% blockId=bluetooth_uart_writenumber block="bluetooth uart|write number %value" + //% value.label="value" export function uartWriteNumber(value: number): void { uartWriteString(value.toString()); } @@ -53,6 +56,7 @@ namespace bluetooth { //% weight=88 weight=78 //% help=bluetooth/uart-write-value advanced=true //% blockId=bluetooth_uart_writevalue block="bluetooth uart|write value %name|= %value" + //% name.label="name" value.label="value" export function uartWriteValue(name: string, value: number): void { uartWriteString((name ? name + ":" : "") + value + NEW_LINE); } @@ -62,6 +66,7 @@ namespace bluetooth { */ //% help=bluetooth/uart-read-until weight=75 //% blockId=bluetooth_uart_read block="bluetooth uart|read until %del=serial_delimiter_conv" + //% del.label="delimiter" //% parts="bluetooth" shim=bluetooth::uartReadUntil advanced=true export function uartReadUntil(del: string): string { // dummy implementation for simulator @@ -76,6 +81,7 @@ namespace bluetooth { * @param connectable true to keep bluetooth connectable for other services, false otherwise. */ //% blockId=eddystone_advertise_uid block="bluetooth advertise UID|namespace (bytes 6-9)%ns|instance (bytes 2-6)%instance|with power %power|connectable %connectable" + //% ns.label="namespace" instance.label="instance" power.label="power" connectable.label="connectable" //% parts=bluetooth weight=12 blockGap=8 //% help=bluetooth/advertise-uid blockExternalInputs=1 //% hidden=1 deprecated=1 diff --git a/libs/bluetooth/shims.d.ts b/libs/bluetooth/shims.d.ts index 4e2b6e693d8..e4d363f40c9 100644 --- a/libs/bluetooth/shims.d.ts +++ b/libs/bluetooth/shims.d.ts @@ -80,7 +80,8 @@ declare namespace bluetooth { * @param delimiters the characters to match received characters against. */ //% help=bluetooth/on-uart-data-received - //% weight=18 blockId=bluetooth_on_data_received block="bluetooth|on data received %delimiters=serial_delimiter_conv" shim=bluetooth::onUartDataReceived + //% weight=18 blockId=bluetooth_on_data_received block="bluetooth|on data received %delimiters=serial_delimiter_conv" + //% delimiters.label="delimiter" shim=bluetooth::onUartDataReceived function onUartDataReceived(delimiters: string, body: () => void): void; /** @@ -108,6 +109,7 @@ declare namespace bluetooth { * @param connectable true to keep bluetooth connectable for other services, false otherwise. */ //% blockId=eddystone_advertise_url block="bluetooth advertise url %url|with power %power|connectable %connectable" + //% url.label="url" power.label="power" connectable.label="connectable" //% parts=bluetooth weight=11 blockGap=8 //% help=bluetooth/advertise-url blockExternalInputs=1 //% hidden=1 deprecated=1 shim=bluetooth::advertiseUrl @@ -127,7 +129,8 @@ declare namespace bluetooth { * @param power power level between 0 (minimal) and 7 (maximum), eg: 7. */ //% parts=bluetooth weight=5 help=bluetooth/set-transmit-power advanced=true - //% blockId=bluetooth_settransmitpower block="bluetooth set transmit power %power" shim=bluetooth::setTransmitPower + //% blockId=bluetooth_settransmitpower block="bluetooth set transmit power %power" + //% power.label="value" shim=bluetooth::setTransmitPower function setTransmitPower(power: int32): void; /** diff --git a/libs/color/_locales/color-strings.json b/libs/color/_locales/color-strings.json index 59d4fe53d43..e5310ac8325 100644 --- a/libs/color/_locales/color-strings.json +++ b/libs/color/_locales/color-strings.json @@ -22,8 +22,16 @@ "color.ColorBufferLayout.ARGB": "32bit RGB color with alpha", "color.ColorBufferLayout.RGB": "24bit RGB color", "color.fade|block": "fade %color=neopixel_colors|by %brightness", + "color.fade|param|brightness|label": "brightness", + "color.fade|param|color|label": "color", "color.hsv|block": "hue %hue|sat %sat|val %val", + "color.hsv|param|hue|label": "hue", + "color.hsv|param|sat|label": "saturation", + "color.hsv|param|val|label": "brightness", "color.rgb|block": "red %red|green %green|blue %blue", + "color.rgb|param|blue|label": "blue", + "color.rgb|param|green|label": "green", + "color.rgb|param|red|label": "red", "color.wellKnown|block": "%color", "color|block": "color", "{id:category}Color": "Color", diff --git a/libs/core/_locales/core-jsdoc-strings.json b/libs/core/_locales/core-jsdoc-strings.json index 9b296a2d54b..4d7055343ed 100644 --- a/libs/core/_locales/core-jsdoc-strings.json +++ b/libs/core/_locales/core-jsdoc-strings.json @@ -151,6 +151,9 @@ "Math.ceil": "Returns the smallest number greater than or equal to its numeric argument.", "Math.ceil|param|x": "A numeric expression.", "Math.constrain": "Constrains a number to be within a range", + "Math.convert": "Converts a value from one unit to another. For example, degrees to radians, fahrenheit to celsius, etc.", + "Math.convert|param|type": "The type of conversion to perform.", + "Math.convert|param|value": "The value to convert.", "Math.cos": "Returns the cosine of a number.", "Math.cos|param|x": "An angle in radians", "Math.exp": "Returns returns ``e^x``.", @@ -275,6 +278,25 @@ "basic.showString": "Display text on the display, one character at a time. If the string fits on the screen (i.e. is one letter), does not scroll.", "basic.showString|param|interval": "how fast to shift characters; eg: 150, 100, 200, -100", "basic.showString|param|text": "the text to scroll on the screen, eg: \"Hello!\"", + "colorHelpers.cmyk": "Converts a CMYK color into a single color number.\n*\n\n\n\n\n@returns The combined color as a single number", + "colorHelpers.cmyk|param|black": "The black component of the color, between 0 and 100", + "colorHelpers.cmyk|param|cyan": "The cyan component of the color, between 0 and 100", + "colorHelpers.cmyk|param|magenta": "The magenta component of the color, between 0 and 100", + "colorHelpers.cmyk|param|yellow": "The yellow component of the color, between 0 and 100", + "colorHelpers.hex": "Converts a hexadecimal color string into a single color number. The hexadecimal string can be in the short\n3-digit form (\"#f0a\") or the full 6-digit form (\"#ff00aa\").\n*\n\n@returns The combined color as a single number", + "colorHelpers.hex|param|hex": "A hexadecimal color string, optionally starting with \"#\" and either in 3-digit or 6-digit format", + "colorHelpers.hsl": "Converts a hue, saturation, and lightness (HSL) color into a single color number.\n*\n\n\n\n@returns The combined color as a single number", + "colorHelpers.hsl|param|hue": "The hue component of the color, between 0 and 360", + "colorHelpers.hsl|param|lightness": "The lightness component of the color, between 0 and 100", + "colorHelpers.hsl|param|saturation": "The saturation component of the color, between 0 and 100", + "colorHelpers.hsv": "Converts a hue, saturation, and value (HSV) color into a single color number.\n*\n\n\n\n@returns The combined color as a single number", + "colorHelpers.hsv|param|hue": "The hue component of the color, between 0 and 360", + "colorHelpers.hsv|param|saturation": "The saturation component of the color, between 0 and 100", + "colorHelpers.hsv|param|value": "The value component of the color, between 0 and 100", + "colorHelpers.rgb": "Converts a red, green, and blue color value into a single color number.\n*\n\n\n\n@returns The combined color as a single number", + "colorHelpers.rgb|param|blue": "The blue component of the color, between 0 and 255", + "colorHelpers.rgb|param|green": "The green component of the color, between 0 and 255", + "colorHelpers.rgb|param|red": "The red component of the color, between 0 and 255", "console": "Reading and writing data to the console output.", "console.addListener": "Adds a listener for the log messages", "console.inspect": "Convert any object or value to a string representation", diff --git a/libs/core/_locales/core-strings.json b/libs/core/_locales/core-strings.json index be22fb1780d..548b82d5bce 100644 --- a/libs/core/_locales/core-strings.json +++ b/libs/core/_locales/core-strings.json @@ -8,19 +8,40 @@ "AcceleratorRange.TwoG": "The accelerator measures forces up to 2 gravity", "AcceleratorRange.TwoG|block": "2g", "Array._pickRandom|block": "get random value from %list", + "Array._pickRandom|param|this|label": "list to check", "Array._popStatement|block": "remove last value from %list", + "Array._popStatement|param|this|label": "list to change", "Array._removeAtStatement|block": "%list| remove value at %index", + "Array._removeAtStatement|param|index|label": "position within list", + "Array._removeAtStatement|param|this|label": "list to change", "Array._shiftStatement|block": "remove first value from %list", + "Array._shiftStatement|param|this|label": "list to change", "Array._unshiftStatement|block": "%list| insert %value| at beginning", + "Array._unshiftStatement|param|this|label": "list to change", + "Array._unshiftStatement|param|value|label": "value to add", "Array.indexOf|block": "%list| find index of %value", + "Array.indexOf|param|item|label": "value to find", + "Array.indexOf|param|this|label": "list to check", "Array.insertAt|block": "%list| insert at %index| value %value", + "Array.insertAt|param|index|label": "position within list", + "Array.insertAt|param|this|label": "list to change", + "Array.insertAt|param|value|label": "value to add", "Array.length|block": "length of %VALUE", "Array.pop|block": "get and remove last value from %list", + "Array.pop|param|this|label": "list to change", "Array.push|block": "%list| add value %value| to end", + "Array.push|param|item|label": "value to add", + "Array.push|param|this|label": "list to change", "Array.removeAt|block": "%list| get and remove value at %index", + "Array.removeAt|param|index|label": "position within list", + "Array.removeAt|param|this|label": "list to change", "Array.reverse|block": "reverse %list", + "Array.reverse|param|this|label": "list to change", "Array.shift|block": "get and remove first value from %list", + "Array.shift|param|this|label": "list to change", "Array.unshift|block": "%list| insert %value| at beginning", + "Array.unshift|param|this|label": "list to change", + "Array.unshift|param|value|label": "value to add", "Array|block": "Array", "ArrowNames.East|block": "East", "ArrowNames.NorthEast|block": "North East", @@ -135,7 +156,12 @@ "IconNames.Umbrella|block": "umbrella", "IconNames.Yes|block": "yes", "Image.scrollImage|block": "scroll image %sprite(myImage)|with offset %frameoffset|and interval (ms) %delay", + "Image.scrollImage|param|frameOffset|label": "offset", + "Image.scrollImage|param|interval|label": "interval", "Image.showImage|block": "show image %sprite(myImage)|at offset %offset ||and interval (ms) %interval", + "Image.showImage|param|interval|label": "interval", + "Image.showImage|param|this|label": "image", + "Image.showImage|param|xOffset|label": "offset", "InterpolationCurve.Curve|block": "curve", "InterpolationCurve.Linear|block": "linear", "InterpolationCurve.Logarithmic|block": "logarithmic", @@ -155,9 +181,21 @@ "Math.SQRT2|block": "√2", "Math._constant|block": "$MEMBER", "Math.constrain|block": "constrain %value|between %low|and %high", + "Math.constrain|param|high|label": "maximum", + "Math.constrain|param|low|label": "minimum", + "Math.constrain|param|value|label": "value", + "Math.convert|block": "convert $value|from $type", + "Math.convert|param|value|label": "value", "Math.map|block": "map %value|from low %fromLow|high %fromHigh|to low %toLow|high %toHigh", + "Math.map|param|fromHigh|label": "from high", + "Math.map|param|fromLow|label": "from low", + "Math.map|param|toHigh|label": "to high", + "Math.map|param|toLow|label": "to low", + "Math.map|param|value|label": "value", "Math.randomBoolean|block": "pick random true or false", "Math.randomRange|block": "pick random %min|to %limit", + "Math.randomRange|param|max|label": "maximum", + "Math.randomRange|param|min|label": "minimum", "Math|block": "Math", "Melodies.BaDing|block": "ba ding", "Melodies.Baddy|block": "baddy", @@ -242,7 +280,9 @@ "Rotation.Pitch|block": "pitch", "Rotation.Roll|block": "roll", "SoundExpression.playUntilDone|block": "play sound $this until done", + "SoundExpression.playUntilDone|param|this|label": "sound", "SoundExpression.play|block": "play sound $this", + "SoundExpression.play|param|this|label": "sound", "SoundExpressionEffect.None|block": "none", "SoundExpressionEffect.Tremolo|block": "tremolo", "SoundExpressionEffect.Vibrato|block": "vibrato", @@ -250,15 +290,32 @@ "SoundExpressionPlayMode.InBackground|block": "in background", "SoundExpressionPlayMode.UntilDone|block": "until done", "String.charAt|block": "char from %this=text|at %pos", + "String.charAt|param|index|label": "position within text", + "String.charAt|param|this|label": "value", "String.charCodeAt|block": "char code from $this=text|at $index", + "String.charCodeAt|param|index|label": "position within text", + "String.charCodeAt|param|this|label": "value", "String.compare|block": "compare %this=text| to %that", + "String.compare|param|that|label": "other value", + "String.compare|param|this|label": "value", "String.fromCharCode|block": "text from char code %code", + "String.fromCharCode|param|code|label": "value", "String.includes|block": "%this=text|includes %searchValue", + "String.includes|param|searchValue|label": "text to find", + "String.includes|param|this|label": "value", "String.indexOf|block": "%this=text|find index of %searchValue", + "String.indexOf|param|searchValue|label": "text to find", + "String.indexOf|param|this|label": "value", "String.isEmpty|block": "%this=text| is empty", + "String.isEmpty|param|this|label": "value", "String.length|block": "length of %VALUE", "String.split|block": "split %this=text|at %separator", + "String.split|param|separator|label": "separator", + "String.split|param|this|label": "value", "String.substr|block": "substring of $this|from $start||of length $length", + "String.substr|param|length|label": "length", + "String.substr|param|start|label": "start position", + "String.substr|param|this|label": "value", "String|block": "String", "TouchButtonEvent.LongPressed|block": "long pressed", "TouchButtonEvent.Pressed|block": "pressed", @@ -270,6 +327,10 @@ "TouchTarget.P2|block": "P2", "TouchTargetMode.Capacitive|block": "capacitive", "TouchTargetMode.Resistive|block": "resistive", + "UnitConversion.CelsiusToFahrenheit|block": "celsius to fahrenheit", + "UnitConversion.DegreesToRadians|block": "degrees to radians", + "UnitConversion.FahrenheitToCelsius|block": "fahrenheit to celsius", + "UnitConversion.RadiansToDegrees|block": "radians to degrees", "WaveShape.Noise|block": "noise", "WaveShape.Sawtooth|block": "sawtooth", "WaveShape.Sine|block": "sine", @@ -279,12 +340,18 @@ "basic.clearScreen|block": "clear screen", "basic.forever|block": "forever", "basic.pause|block": "pause (ms) %pause", + "basic.pause|param|ms|label": "value", "basic.showArrow|block": "show arrow %i=device_arrow", + "basic.showArrow|param|direction|label": "arrow", "basic.showIcon|block": "show icon %i", "basic.showLeds|block": "show leds", "basic.showNumber|block": "show|number %number", + "basic.showNumber|param|value|label": "value", "basic.showString|block": "show|string %text", + "basic.showString|param|text|defl": "Hello!", + "basic.showString|param|text|label": "value", "basic|block": "basic", + "colorHelpers|block": "colorHelpers", "console|block": "console", "control.deviceName|block": "device name", "control.deviceSerialNumber|block": "device serial number", @@ -295,36 +362,67 @@ "control.inBackground|block": "run in background", "control.millis|block": "millis (ms)", "control.onEvent|block": "on event|from %src=control_event_source_id|with value %value=control_event_value_id", + "control.onEvent|param|src|label": "source", + "control.onEvent|param|value|label": "value", "control.raiseEvent|block": "raise event|from source %src=control_event_source_id|with value %value=control_event_value_id", + "control.raiseEvent|param|src|label": "source", + "control.raiseEvent|param|value|label": "value", "control.reset|block": "reset", "control.waitForEvent|block": "wait for event|from %src|with value %value", + "control.waitForEvent|param|src|label": "source", + "control.waitForEvent|param|value|label": "value", "control.waitMicros|block": "wait (µs)%micros", + "control.waitMicros|param|micros|label": "microseconds", "control|block": "control", "convertToText|block": "convert $value=math_number to text", + "convertToText|param|value|label": "value", "game.LedSprite.change|block": "%sprite|change %property|by %value", + "game.LedSprite.change|param|this|label": "sprite", + "game.LedSprite.change|param|value|label": "value", "game.LedSprite.delete|block": "delete %this(sprite)", + "game.LedSprite.delete|param|this|label": "sprite", "game.LedSprite.get|block": "%sprite|%property", + "game.LedSprite.get|param|this|label": "sprite", "game.LedSprite.ifOnEdgeBounce|block": "%sprite|if on edge, bounce", + "game.LedSprite.ifOnEdgeBounce|param|this|label": "sprite", "game.LedSprite.isDeleted|block": "is %sprite|deleted", + "game.LedSprite.isDeleted|param|this|label": "sprite", "game.LedSprite.isTouchingEdge|block": "is %sprite|touching edge", + "game.LedSprite.isTouchingEdge|param|this|label": "sprite", "game.LedSprite.isTouching|block": "is %sprite|touching %other", + "game.LedSprite.isTouching|param|other|label": "other sprite", + "game.LedSprite.isTouching|param|this|label": "sprite", "game.LedSprite.move|block": "%sprite|move by %leds", + "game.LedSprite.move|param|leds|label": "LEDs", + "game.LedSprite.move|param|this|label": "sprite", "game.LedSprite.set|block": "%sprite|set %property|to %value", + "game.LedSprite.set|param|this|label": "sprite", + "game.LedSprite.set|param|value|label": "value", "game.LedSprite.turn|block": "%sprite|turn %direction|by (°) %degrees", + "game.LedSprite.turn|param|degrees|label": "degrees", + "game.LedSprite.turn|param|this|label": "sprite", "game.addLife|block": "add life %lives", + "game.addLife|param|lives|label": "value", "game.addScore|block": "change score by|%points", + "game.addScore|param|points|label": "value", "game.createSprite|block": "create sprite at|x: %x|y: %y", + "game.createSprite|param|x|label": "x", + "game.createSprite|param|y|label": "y", "game.gameOver|block": "game over", "game.isGameOver|block": "is game over", "game.isPaused|block": "is paused", "game.isRunning|block": "is running", "game.pause|block": "pause", "game.removeLife|block": "remove life %life", + "game.removeLife|param|life|label": "value", "game.resume|block": "resume", "game.score|block": "score", "game.setLife|block": "set life %value", + "game.setLife|param|value|label": "value", "game.setScore|block": "set score %points", + "game.setScore|param|value|label": "value", "game.startCountdown|block": "start countdown|(ms) %duration", + "game.startCountdown|param|ms|label": "value", "game|block": "game", "images.arrowImage|block": "arrow image %i", "images.arrowNumber|block": "%arrow", @@ -354,56 +452,107 @@ "input|block": "input", "led.brightness|block": "brightness", "led.enable|block": "led enable %on", + "led.enable|param|on|label": "value", "led.plotBarGraph|block": "plot bar graph of $value up to $high|| serial write $valueToConsole", + "led.plotBarGraph|param|high|label": "maximum", + "led.plotBarGraph|param|valueToConsole|label": "serial write", + "led.plotBarGraph|param|value|label": "value", "led.plotBrightness|block": "plot|x %x|y %y|brightness %brightness", + "led.plotBrightness|param|brightness|label": "brightness", + "led.plotBrightness|param|x|label": "x", + "led.plotBrightness|param|y|label": "y", "led.plot|block": "plot|x %x|y %y", + "led.plot|param|x|label": "x", + "led.plot|param|y|label": "y", "led.pointBrightness|block": "point|x %x|y %y brightness", + "led.pointBrightness|param|x|label": "x", + "led.pointBrightness|param|y|label": "y", "led.point|block": "point|x %x|y %y", + "led.point|param|x|label": "x", + "led.point|param|y|label": "y", "led.setBrightness|block": "set brightness %value", + "led.setBrightness|param|value|label": "value", "led.setDisplayMode|block": "set display mode $mode", "led.stopAnimation|block": "stop animation", "led.toggle|block": "toggle|x %x|y %y", + "led.toggle|param|x|label": "x", + "led.toggle|param|y|label": "y", "led.unplot|block": "unplot|x %x|y %y", - "led|block": "led", + "led.unplot|param|x|label": "x", + "led.unplot|param|y|label": "y", + "led|block": "LED", "light|block": "light", "loops.everyInterval|block": "every $interval ms", + "loops.everyInterval|param|interval|label": "value", "loops|block": "loops", "msgpack|block": "msgpack", "music.PlaybackMode.InBackground|block": "in background", "music.PlaybackMode.LoopingInBackground|block": "looping in background", "music.PlaybackMode.UntilDone|block": "until done", "music._playDefaultBackground|block": "play $toPlay $playbackMode", + "music._playDefaultBackground|param|toPlay|label": "sound", "music.beat|block": "%fraction|beat", "music.builtInMelody|block": "%melody", "music.builtInPlayableMelody|block": "melody|$melody", "music.builtinPlayableSoundEffect|block": "$soundExpression", "music.builtinSoundEffect|block": "$soundExpression", "music.changeTempoBy|block": "change tempo by (bpm)|%value", + "music.changeTempoBy|param|bpm|label": "value", "music.createSoundEffect|block": "$waveShape|| start frequency $startFrequency end frequency $endFrequency duration $duration start volume $startVolume end volume $endVolume effect $effect interpolation $interpolation", + "music.createSoundEffect|param|duration|label": "duration", + "music.createSoundEffect|param|endFrequency|label": "end frequency", + "music.createSoundEffect|param|endVolume|label": "end volume", + "music.createSoundEffect|param|startFrequency|label": "start frequency", + "music.createSoundEffect|param|startVolume|label": "start volume", "music.createSoundExpression|block": "$waveShape|| start frequency $startFrequency end frequency $endFrequency duration $duration start volume $startVolume end volume $endVolume effect $effect interpolation $interpolation", + "music.createSoundExpression|param|duration|label": "duration", + "music.createSoundExpression|param|endFrequency|label": "end frequency", + "music.createSoundExpression|param|endVolume|label": "end volume", + "music.createSoundExpression|param|startFrequency|label": "start frequency", + "music.createSoundExpression|param|startVolume|label": "start volume", "music.isSoundPlaying|block": "sound is playing", "music.melodyEditor|block": "$melody", "music.noteFrequency|block": "%name", "music.onEvent|block": "music on %value", "music.playMelody|block": "play melody $melody at tempo $tempo|(bpm)", + "music.playMelody|param|melody|label": "melody", + "music.playMelody|param|tempo|label": "tempo", "music.playSoundEffect|block": "play sound $sound $mode", + "music.playSoundEffect|param|sound|label": "sound", "music.playTone|block": "play|tone %note=device_note|for %duration=device_beat", + "music.playTone|param|frequency|label": "note", + "music.playTone|param|ms|label": "duration", "music.play|block": "play $toPlay $playbackMode", + "music.play|param|toPlay|label": "sound", "music.rest|block": "rest for |%duration=device_beat", + "music.rest|param|ms|label": "value", "music.ringTone|block": "ring tone (Hz)|%note=device_note", + "music.ringTone|param|frequency|label": "note", "music.setBuiltInSpeakerEnabled|block": "set built-in speaker $enabled", + "music.setBuiltInSpeakerEnabled|param|enabled|label": "value", "music.setTempo|block": "set tempo to (bpm)|%value", + "music.setTempo|param|bpm|label": "value", "music.setVolume|block": "set volume %volume", + "music.setVolume|param|volume|label": "value", "music.startMelody|block": "start melody %melody=device_builtin_melody| repeating %options", + "music.startMelody|param|melodyArray|label": "melody", "music.stopAllSounds|block": "stop all sounds", "music.stopMelody|block": "stop melody $options", "music.stringPlayable|block": "melody $melody at tempo $bpm|(bpm)", + "music.stringPlayable|param|bpm|label": "tempo", + "music.stringPlayable|param|melody|label": "melody", "music.tempo|block": "tempo (bpm)", "music.tonePlayable|block": "tone $note for $duration", + "music.tonePlayable|param|duration|label": "duration", + "music.tonePlayable|param|note|label": "note", "music.volume|block": "volume", "music|block": "music", "parseFloat|block": "parse to number %text", + "parseFloat|param|text|defl": "123", + "parseFloat|param|text|label": "value", "parseInt|block": "parse to integer %text", + "parseInt|param|text|defl": "123", + "parseInt|param|text|label": "value", "pins._analogPinShadow|block": "$pin", "pins._analogPin|block": "analog pin $pin", "pins._analogReadWritePinShadow|block": "$pin", @@ -411,51 +560,107 @@ "pins._digitalPin|block": "digital pin $pin", "pins.analogPitchVolume|block": "analog pitch volume", "pins.analogPitch|block": "analog pitch %frequency|for (ms) %ms", + "pins.analogPitch|param|frequency|label": "frequency", + "pins.analogPitch|param|ms|label": "duration", "pins.analogReadPin|block": "analog read|pin %name", + "pins.analogReadPin|param|name|label": "value", "pins.analogSetPeriod|block": "analog set period|pin %pin|to (µs)%micros", + "pins.analogSetPeriod|param|micros|label": "microseconds", + "pins.analogSetPeriod|param|name|label": "pin", "pins.analogSetPitchPin|block": "analog set pitch pin %name", + "pins.analogSetPitchPin|param|name|label": "value", "pins.analogSetPitchVolume|block": "analog set pitch volume $volume", + "pins.analogSetPitchVolume|param|volume|label": "value", "pins.analogWritePin|block": "analog write|pin %name|to %value", + "pins.analogWritePin|param|name|label": "pin", + "pins.analogWritePin|param|value|label": "value", "pins.digitalReadPin|block": "digital read|pin %name", + "pins.digitalReadPin|param|name|label": "value", "pins.digitalWritePin|block": "digital write|pin %name|to %value", + "pins.digitalWritePin|param|name|label": "pin", + "pins.digitalWritePin|param|value|label": "value", "pins.i2cReadNumber|block": "i2c read number|at address %address|of format %format|repeated %repeat", + "pins.i2cReadNumber|param|address|label": "address", + "pins.i2cReadNumber|param|repeated|label": "repeated", "pins.i2cWriteNumber|block": "i2c write number|at address %address|with value %value|of format %format|repeated %repeat", + "pins.i2cWriteNumber|param|address|label": "address", + "pins.i2cWriteNumber|param|repeated|label": "repeated", + "pins.i2cWriteNumber|param|value|label": "value", "pins.map|block": "map %value|from low %fromLow|from high %fromHigh|to low %toLow|to high %toHigh", + "pins.map|param|fromHigh|label": "from high", + "pins.map|param|fromLow|label": "from low", + "pins.map|param|toHigh|label": "to high", + "pins.map|param|toLow|label": "to low", + "pins.map|param|value|label": "value", "pins.onPulsed|block": "on|pin %pin|pulsed %pulse", "pins.pulseDuration|block": "pulse duration (µs)", "pins.pulseIn|block": "pulse in (µs)|pin %name|pulsed %value", + "pins.pulseIn|param|name|label": "pin", "pins.servoSetPulse|block": "servo set pulse|pin %value|to (µs) %micros", + "pins.servoSetPulse|param|micros|label": "microseconds", + "pins.servoSetPulse|param|name|label": "pin", "pins.servoWritePin|block": "servo write|pin %name|to %value", + "pins.servoWritePin|param|name|label": "pin", + "pins.servoWritePin|param|value|label": "angle", "pins.setAudioPinEnabled|block": "set audio pin enabled $enabled", + "pins.setAudioPinEnabled|param|enabled|label": "value", "pins.setAudioPin|block": "set audio pin $name", + "pins.setAudioPin|param|name|label": "value", "pins.setEvents|block": "set pin %pin|to emit %type|events", + "pins.setEvents|param|name|label": "pin", "pins.setMatrixWidth|block": "neopixel matrix width|pin %pin %width", + "pins.setMatrixWidth|param|pin|label": "pin", + "pins.setMatrixWidth|param|width|label": "width", "pins.setPull|block": "set pull|pin %pin|to %pull", + "pins.setPull|param|name|label": "pin", "pins.spiFormat|block": "spi format|bits %bits|mode %mode", + "pins.spiFormat|param|bits|label": "bits", + "pins.spiFormat|param|mode|label": "mode", "pins.spiFrequency|block": "spi frequency %frequency", + "pins.spiFrequency|param|frequency|label": "value", "pins.spiPins|block": "spi set pins|MOSI %mosi|MISO %miso|SCK %sck", + "pins.spiPins|param|miso|label": "MISO pin", + "pins.spiPins|param|mosi|label": "MOSI pin", + "pins.spiPins|param|sck|label": "SCK pin", "pins.spiWrite|block": "spi write %value", + "pins.spiWrite|param|value|label": "value", "pins.touchSetMode|block": "set %name to touch mode %mode", "pins|block": "pins", "randint|block": "pick random %min|to %limit", + "randint|param|max|label": "maximum", + "randint|param|min|label": "minimum", "serial.delimiters|block": "%del", "serial.onDataReceived|block": "serial|on data received %delimiters=serial_delimiter_conv", + "serial.onDataReceived|param|delimiters|label": "delimiter", "serial.readBuffer|block": "serial|read buffer %length", + "serial.readBuffer|param|length|label": "value", "serial.readLine|block": "serial|read line", "serial.readString|block": "serial|read string", "serial.readUntil|block": "serial|read until %delimiter=serial_delimiter_conv", + "serial.readUntil|param|delimiter|label": "delimiter", "serial.redirectToUSB|block": "serial|redirect to USB", "serial.redirect|block": "serial|redirect to|TX %tx|RX %rx|at baud rate %rate", "serial.setBaudRate|block": "serial|set baud rate %rate", "serial.setRxBufferSize|block": "serial set rx buffer size to $size", + "serial.setRxBufferSize|param|size|label": "value", "serial.setTxBufferSize|block": "serial set tx buffer size to $size", + "serial.setTxBufferSize|param|size|label": "value", "serial.setWriteLinePadding|block": "serial set write line padding to $length", + "serial.setWriteLinePadding|param|length|label": "value", "serial.writeBuffer|block": "serial|write buffer %buffer=serial_readbuffer", + "serial.writeBuffer|param|buffer|label": "value", "serial.writeLine|block": "serial|write line %text", + "serial.writeLine|param|text|label": "value", "serial.writeNumbers|block": "serial|write numbers %values", + "serial.writeNumbers|param|values|label": "value", "serial.writeNumber|block": "serial|write number %value", + "serial.writeNumber|param|value|label": "value", "serial.writeString|block": "serial|write string %text", + "serial.writeString|param|text|label": "value", "serial.writeValue|block": "serial|write value %name|= %value", + "serial.writeValue|param|name|defl": "x", + "serial.writeValue|param|name|label": "name", + "serial.writeValue|param|value|label": "value", "serial|block": "serial", "soundExpression.giggle|block": "{id:soundexpression}giggle", "soundExpression.happy|block": "{id:soundexpression}happy", @@ -474,6 +679,7 @@ "{id:category}Basic": "Basic", "{id:category}Boolean": "Boolean", "{id:category}Buffer": "Buffer", + "{id:category}ColorHelpers": "ColorHelpers", "{id:category}Console": "Console", "{id:category}Control": "Control", "{id:category}DigitalInOutPin": "DigitalInOutPin", diff --git a/libs/core/basic.cpp b/libs/core/basic.cpp index 0a57586bd3d..4426305952d 100644 --- a/libs/core/basic.cpp +++ b/libs/core/basic.cpp @@ -29,6 +29,7 @@ namespace basic { //% help=basic/show-string //% weight=87 blockGap=16 //% block="show|string %text" + //% text.label="value" //% async //% blockId=device_print_message //% parts="ledmatrix" @@ -95,6 +96,7 @@ namespace basic { */ //% help=basic/pause weight=54 //% async block="pause (ms) %pause" blockGap=16 + //% ms.label="value" //% blockId=device_pause icon="\uf110" //% pause.shadow=timePicker void pause(int ms) { diff --git a/libs/core/basic.ts b/libs/core/basic.ts index f97204114f0..51395c34e2e 100644 --- a/libs/core/basic.ts +++ b/libs/core/basic.ts @@ -7,6 +7,7 @@ namespace basic { //% help=basic/show-number //% weight=96 //% blockId=device_show_number block="show|number %number" blockGap=8 + //% value.label="value" //% async //% parts="ledmatrix" interval.defl=150 export function showNumber(value: number, interval?: number) { diff --git a/libs/core/control.cpp b/libs/core/control.cpp index 031c37e7b92..36c078f1686 100644 --- a/libs/core/control.cpp +++ b/libs/core/control.cpp @@ -258,6 +258,7 @@ namespace control { */ //% help=control/wait-for-event async //% blockId=control_wait_for_event block="wait for event|from %src|with value %value" + //% src.label="source" value.label="value" void waitForEvent(int src, int value) { pxt::waitForEvent(src, value); } @@ -283,6 +284,7 @@ namespace control { */ //% help=control/wait-micros weight=29 async //% blockId="control_wait_us" block="wait (µs)%micros" + //% micros.label="microseconds" //% micros.min=0 micros.max=6000 void waitMicros(int micros) { sleep_us(micros); @@ -295,6 +297,7 @@ namespace control { * @param mode optional definition of how the event should be processed after construction (default is CREATE_AND_FIRE). */ //% weight=21 blockGap=12 blockId="control_raise_event" block="raise event|from source %src=control_event_source_id|with value %value=control_event_value_id" blockExternalInputs=1 + //% src.label="source" value.label="value" //% help=control/raise-event //% mode.defl=CREATE_AND_FIRE void raiseEvent(int src, int value, EventCreationMode mode) { @@ -305,6 +308,7 @@ namespace control { * Registers an event handler. */ //% weight=20 blockGap=8 blockId="control_on_event" block="on event|from %src=control_event_source_id|with value %value=control_event_value_id" + //% src.label="source" value.label="value" //% help=control/on-event //% blockExternalInputs=1 void onEvent(int src, int value, Action handler, int flags = 0) { diff --git a/libs/core/control.ts b/libs/core/control.ts index 57d6f7a1c22..c85f8c771d5 100644 --- a/libs/core/control.ts +++ b/libs/core/control.ts @@ -201,6 +201,7 @@ namespace control { */ //% help=text/convert-to-text weight=1 //% block="convert $value=math_number to text" +//% value.label="value" //% blockId=variable_to_text blockNamespace="text" function convertToText(value: any): string { return "" + value; diff --git a/libs/core/game.ts b/libs/core/game.ts index 0c2a454fe45..932135d1d09 100644 --- a/libs/core/game.ts +++ b/libs/core/game.ts @@ -44,6 +44,7 @@ namespace game { */ //% weight=60 blockGap=8 help=game/create-sprite //% blockId=game_create_sprite block="create sprite at|x: %x|y: %y" + //% x.label="x" y.label="y" //% parts="ledmatrix" export function createSprite(x: number, y: number): LedSprite { init(); @@ -66,6 +67,7 @@ namespace game { */ //% weight=10 help=game/add-score //% blockId=game_add_score block="change score by|%points" blockGap=8 + //% points.label="value" //% parts="ledmatrix" export function addScore(points: number): void { setScore(_score + points); @@ -89,6 +91,7 @@ namespace game { */ //% weight=9 help=game/start-countdown //% blockId=game_start_countdown block="start countdown|(ms) %duration" blockGap=8 + //% ms.label="value" //% parts="ledmatrix" export function startCountdown(ms: number): void { if (checkStart()) { @@ -153,6 +156,7 @@ namespace game { * @param value new score value. */ //% blockId=game_set_score block="set score %points" blockGap=8 + //% value.label="value" //% weight=10 help=game/set-score export function setScore(value: number): void { _score = Math.max(0, value); @@ -172,6 +176,7 @@ namespace game { */ //% weight=10 help=game/set-life //% blockId=game_set_life block="set life %value" blockGap=8 + //% value.label="value" export function setLife(value: number): void { _life = Math.max(0, value); if (_life <= 0) { @@ -185,6 +190,7 @@ namespace game { */ //% weight=10 help=game/add-life //% blockId=game_add_life block="add life %lives" blockGap=8 + //% lives.label="value" export function addLife(lives: number): void { setLife(_life + lives); } @@ -208,6 +214,7 @@ namespace game { //% weight=10 help=game/remove-life //% parts="ledmatrix" //% blockId=game_remove_life block="remove life %life" blockGap=8 + //% life.label="value" export function removeLife(life: number): void { setLife(_life - life); if (!_paused && !_backgroundAnimation) { @@ -360,6 +367,7 @@ namespace game { */ //% weight=50 help=game/move //% blockId=game_move_sprite block="%sprite|move by %leds" blockGap=8 + //% sprite.label="sprite" leds.label="LEDs" //% parts="ledmatrix" public move(leds: number): void { if (this._dir == 0) { @@ -409,6 +417,7 @@ namespace game { */ //% weight=18 help=game/if-on-edge-bounce //% blockId=game_sprite_bounce block="%sprite|if on edge, bounce" + //% sprite.label="sprite" //% parts="ledmatrix" public ifOnEdgeBounce(): void { if (this._dir == 0 && this._y == 0) { @@ -463,6 +472,7 @@ namespace game { */ //% weight=49 help=game/turn //% blockId=game_turn_sprite block="%sprite|turn %direction|by (°) %degrees" + //% sprite.label="sprite" degrees.label="degrees" public turn(direction: Direction, degrees: number) { if (direction == Direction.Right) this.setDirection(this._dir + degrees); @@ -495,6 +505,7 @@ namespace game { */ //% weight=29 help=game/set //% blockId=game_sprite_set_property block="%sprite|set %property|to %value" blockGap=8 + //% sprite.label="sprite" value.label="value" public set(property: LedSpriteProperty, value: number) { switch (property) { case LedSpriteProperty.X: this.setX(value); break; @@ -512,6 +523,7 @@ namespace game { */ //% weight=30 help=game/change //% blockId=game_sprite_change_xy block="%sprite|change %property|by %value" blockGap=8 + //% sprite.label="sprite" value.label="value" public change(property: LedSpriteProperty, value: number) { switch (property) { case LedSpriteProperty.X: this.changeXBy(value); break; @@ -528,6 +540,7 @@ namespace game { */ //% weight=28 help=game/get //% blockId=game_sprite_property block="%sprite|%property" + //% sprite.label="sprite" public get(property: LedSpriteProperty) { switch (property) { case LedSpriteProperty.X: return this.x(); @@ -622,6 +635,7 @@ namespace game { */ //% weight=20 help=game/is-touching //% blockId=game_sprite_touching_sprite block="is %sprite|touching %other" blockGap=8 + //% sprite.label="sprite" other.label="other sprite" public isTouching(other: LedSprite): boolean { return this._enabled && other._enabled && this._x == other._x && this._y == other._y; } @@ -632,6 +646,7 @@ namespace game { */ //% weight=19 help=game/is-touching-edge //% blockId=game_sprite_touching_edge block="is %sprite|touching edge" blockGap=8 + //% sprite.label="sprite" public isTouchingEdge(): boolean { return this._enabled && (this._x == 0 || this._x == 4 || this._y == 0 || this._y == 4); } @@ -697,6 +712,7 @@ namespace game { */ //% weight=59 blockGap=8 help=game/delete //% blockId="game_delete_sprite" block="delete %this(sprite)" + //% this.label="sprite" public delete(): void { this._enabled = false; if (_sprites.removeElement(this)) @@ -708,6 +724,7 @@ namespace game { */ //% weight=58 help=game/is-deleted //% blockId="game_sprite_is_deleted" block="is %sprite|deleted" + //% sprite.label="sprite" public isDeleted(): boolean { return !this._enabled; } diff --git a/libs/core/helpers.ts b/libs/core/helpers.ts index e0ccbdce60b..3f000efda6c 100644 --- a/libs/core/helpers.ts +++ b/libs/core/helpers.ts @@ -26,6 +26,7 @@ namespace Math { */ //% blockId=math_convert_unit //% block="convert $value|from $type" + //% value.label="value" //% help=math/convert-unit //% weight=0 export function convert(value: number, type: UnitConversion): number { diff --git a/libs/core/icons.ts b/libs/core/icons.ts index 39022bce515..759c9665c6c 100644 --- a/libs/core/icons.ts +++ b/libs/core/icons.ts @@ -200,6 +200,7 @@ namespace basic { //% weight=50 blockGap=8 //% blockId=basic_show_arrow //% block="show arrow %i=device_arrow" + //% direction.label="arrow" //% parts="ledmatrix" //% help=basic/show-arrow export function showArrow(direction: number, interval = 600) { diff --git a/libs/core/images.cpp b/libs/core/images.cpp index f3921a32efd..d548853ba6b 100644 --- a/libs/core/images.cpp +++ b/libs/core/images.cpp @@ -87,6 +87,7 @@ void plotImage(Image i, int xOffset = 0) { */ //% help=images/show-image weight=80 blockNamespace=images //% blockId=device_show_image_offset block="show image %sprite(myImage)|at offset %offset ||and interval (ms) %interval" +//% sprite.label="image" xOffset.label="offset" interval.label="interval" //% interval.defl=400 //% blockGap=8 parts="ledmatrix" async void showImage(Image sprite, int xOffset, int interval = 400) { @@ -112,6 +113,7 @@ void plotFrame(Image i, int xOffset) { //% help=images/scroll-image weight=79 async blockNamespace=images //% blockId=device_scroll_image //% block="scroll image %sprite(myImage)|with offset %frameoffset|and interval (ms) %delay" +//% id.label="image" frameOffset.label="offset" interval.label="interval" //% blockGap=8 parts="ledmatrix" void scrollImage(Image id, int frameOffset, int interval) { MicroBitImage i(id->img); diff --git a/libs/core/led.cpp b/libs/core/led.cpp index 1815c05d7cb..4d8d4ba5455 100644 --- a/libs/core/led.cpp +++ b/libs/core/led.cpp @@ -20,6 +20,7 @@ namespace led { */ //% help=led/plot weight=78 //% blockId=device_plot block="plot|x %x|y %y" blockGap=8 + //% x.label="x" y.label="y" //% parts="ledmatrix" //% x.min=0 x.max=4 y.min=0 y.max=4 //% x.fieldOptions.precision=1 y.fieldOptions.precision=1 @@ -35,6 +36,7 @@ namespace led { */ //% help=led/plot-brightness weight=78 //% blockId=device_plot_brightness block="plot|x %x|y %y|brightness %brightness" blockGap=8 + //% x.label="x" y.label="y" brightness.label="brightness" //% parts="ledmatrix" //% x.min=0 x.max=4 y.min=0 y.max=4 brightness.min=0 brightness.max=255 //% x.fieldOptions.precision=1 y.fieldOptions.precision=1 @@ -54,6 +56,7 @@ namespace led { */ //% help=led/unplot weight=77 //% blockId=device_unplot block="unplot|x %x|y %y" blockGap=8 + //% x.label="x" y.label="y" //% parts="ledmatrix" //% x.min=0 x.max=4 y.min=0 y.max=4 //% x.fieldOptions.precision=1 y.fieldOptions.precision=1 @@ -68,6 +71,7 @@ namespace led { */ //% help=led/point-brightness weight=76 //% blockId=device_point_brightness block="point|x %x|y %y brightness" + //% x.label="x" y.label="y" //% parts="ledmatrix" //% x.min=0 x.max=4 y.min=0 y.max=4 //% x.fieldOptions.precision=1 y.fieldOptions.precision=1 @@ -93,6 +97,7 @@ namespace led { */ //% help=led/set-brightness weight=59 //% blockId=device_set_brightness block="set brightness %value" + //% value.label="value" //% parts="ledmatrix" //% advanced=true //% value.min=0 value.max=255 @@ -134,6 +139,7 @@ namespace led { * Turns on or off the display */ //% help=led/enable blockId=device_led_enable block="led enable %on" + //% on.label="value" //% advanced=true parts="ledmatrix" void enable(bool on) { if (on) uBit.display.enable(); diff --git a/libs/core/led.ts b/libs/core/led.ts index bac47073853..bd32cece9b2 100644 --- a/libs/core/led.ts +++ b/libs/core/led.ts @@ -10,6 +10,7 @@ namespace led { */ //% help=led/point weight=76 //% blockId=device_point block="point|x %x|y %y" + //% x.label="x" y.label="y" //% parts="ledmatrix" //% x.min=0 x.max=4 y.min=0 y.max=4 //% x.fieldOptions.precision=1 y.fieldOptions.precision=1 @@ -36,6 +37,7 @@ namespace led { */ //% help=led/plot-bar-graph weight=20 //% blockId=device_plot_bar_graph block="plot bar graph of $value up to $high|| serial write $valueToConsole" icon="\uf080" blockExternalInputs=true + //% value.label="value" high.label="maximum" valueToConsole.label="serial write" //% parts="ledmatrix" //% valueToConsole.shadow=toggleOnOff //% valueToConsole.defl=true @@ -89,6 +91,7 @@ namespace led { */ //% help=led/toggle weight=77 //% blockId=device_led_toggle block="toggle|x %x|y %y" icon="\uf204" blockGap=8 + //% x.label="x" y.label="y" //% parts="ledmatrix" //% x.min=0 x.max=4 y.min=0 y.max=4 //% x.fieldOptions.precision=1 y.fieldOptions.precision=1 diff --git a/libs/core/loops.ts b/libs/core/loops.ts index efc3f51a0f2..5691eeea57a 100644 --- a/libs/core/loops.ts +++ b/libs/core/loops.ts @@ -10,6 +10,7 @@ namespace loops { //% interval.shadow=longTimePicker //% afterOnStart=true help=loops/every-interval //% blockId=every_interval block="every $interval ms" + //% interval.label="value" export function everyInterval(interval: number, a: () => void): void { control.runInParallel(() => { let start = 0; diff --git a/libs/core/music.cpp b/libs/core/music.cpp index 78d381908c1..86b367817c6 100644 --- a/libs/core/music.cpp +++ b/libs/core/music.cpp @@ -11,6 +11,7 @@ namespace music { * @param volume the volume 0...255 */ //% blockId=synth_set_volume block="set volume %volume" +//% volume.label="value" //% volume.min=0 volume.max=255 //% volume.defl=127 //% help=music/set-volume @@ -47,6 +48,7 @@ int volume() { * @param enabled whether the built-in speaker is enabled in addition to the sound pin */ //% blockId=music_set_built_in_speaker_enable block="set built-in speaker $enabled" +//% enabled.label="value" //% group="micro:bit (V2)" //% parts=builtinspeaker //% help=music/set-built-in-speaker-enabled diff --git a/libs/core/music.ts b/libs/core/music.ts index 13f25614d1d..1854054478e 100644 --- a/libs/core/music.ts +++ b/libs/core/music.ts @@ -196,6 +196,7 @@ namespace music { */ //% help=music/play-tone weight=90 //% blockId=device_play_note block="play|tone %note=device_note|for %duration=device_beat" blockGap=8 + //% frequency.label="note" ms.label="duration" //% parts="headphone" //% useEnumVal=1 //% group="Tone" @@ -212,6 +213,7 @@ namespace music { */ //% help=music/ring-tone weight=80 //% blockId=device_ring block="ring tone (Hz)|%note=device_note" blockGap=8 + //% frequency.label="note" //% parts="headphone" //% useEnumVal=1 //% group="Tone" @@ -225,6 +227,7 @@ namespace music { */ //% help=music/rest weight=79 //% blockId=device_rest block="rest for |%duration=device_beat" + //% ms.label="value" //% parts="headphone" //% group="Tone" export function rest(ms: number): void { @@ -291,6 +294,7 @@ namespace music { */ //% help=music/change-tempo-by weight=39 //% blockId=device_change_tempo block="change tempo by (bpm)|%value" blockGap=8 + //% bpm.label="value" //% group="Tempo" //% weight=100 export function changeTempoBy(bpm: number): void { @@ -305,6 +309,7 @@ namespace music { */ //% help=music/set-tempo weight=38 //% blockId=device_set_tempo block="set tempo to (bpm)|%value" + //% bpm.label="value" //% bpm.min=40 bpm.max=500 //% group="Tempo" //% weight=99 @@ -374,6 +379,7 @@ namespace music { */ //% help=music/begin-melody weight=60 blockGap=16 //% blockId=device_start_melody block="start melody %melody=device_builtin_melody| repeating %options" + //% melodyArray.label="melody" //% parts="headphone" //% group="Melody Advanced" //% deprecated=1 @@ -387,6 +393,7 @@ namespace music { * @param tempo number in beats per minute (bpm), dictating how long each note will play for */ //% block="play melody $melody at tempo $tempo|(bpm)" blockId=playMelody + //% melody.label="melody" tempo.label="tempo" //% weight=85 blockGap=8 help=music/play-melody //% melody.shadow="melody_editor" //% tempo.min=40 tempo.max=500 diff --git a/libs/core/pins.cpp b/libs/core/pins.cpp index 12982e949de..1d2bfe360aa 100644 --- a/libs/core/pins.cpp +++ b/libs/core/pins.cpp @@ -179,6 +179,7 @@ namespace pins { */ //% help=pins/digital-read-pin weight=30 //% blockId=device_get_digital_pin block="digital read|pin %name" blockGap=8 + //% name.label="value" //% name.shadow=digital_pin_shadow int digitalReadPin(int name) { PINREAD(getDigitalValue()); @@ -191,6 +192,7 @@ namespace pins { */ //% help=pins/digital-write-pin weight=29 //% blockId=device_set_digital_pin block="digital write|pin %name|to %value" + //% name.label="pin" value.label="value" //% value.min=0 value.max=1 //% name.shadow=digital_pin_shadow void digitalWritePin(int name, int value) { @@ -203,6 +205,7 @@ namespace pins { */ //% help=pins/analog-read-pin weight=25 //% blockId=device_get_analog_pin block="analog read|pin %name" blockGap="8" + //% name.label="value" //% name.shadow=analog_read_write_pin_shadow int analogReadPin(int name) { PINREAD(getAnalogValue()); @@ -215,6 +218,7 @@ namespace pins { */ //% help=pins/analog-write-pin weight=24 //% blockId=device_set_analog_pin block="analog write|pin %name|to %value" blockGap=8 + //% name.label="pin" value.label="value" //% value.min=0 value.max=1023 //% name.shadow=analog_pin_shadow void analogWritePin(int name, int value) { @@ -229,6 +233,7 @@ namespace pins { */ //% help=pins/analog-set-period weight=23 blockGap=8 //% blockId=device_set_analog_period block="analog set period|pin %pin|to (µs)%micros" + //% name.label="pin" micros.label="microseconds" //% pin.shadow=analog_pin_shadow void analogSetPeriod(int name, int micros) { PINOP(setAnalogPeriodUs(micros)); @@ -273,6 +278,7 @@ namespace pins { * @param maximum duration in microseconds */ //% blockId="pins_pulse_in" block="pulse in (µs)|pin %name|pulsed %value" + //% name.label="pin" //% advanced=true //% help=pins/pulse-in //% name.shadow=digital_pin_shadow @@ -319,6 +325,7 @@ namespace pins { */ //% help=pins/servo-write-pin weight=20 //% blockId=device_set_servo_pin block="servo write|pin %name|to %value" blockGap=8 + //% name.label="pin" value.label="angle" //% parts=microservo trackArgs=0 //% value.min=0 value.max=180 //% name.shadow=analog_pin_shadow @@ -342,6 +349,7 @@ namespace pins { */ //% help=pins/servo-set-pulse weight=19 //% blockId=device_set_servo_pulse block="servo set pulse|pin %value|to (µs) %micros" + //% name.label="pin" micros.label="microseconds" //% value.shadow=analog_pin_shadow //% group="Servo" void servoSetPulse(int name, int micros) { @@ -359,6 +367,7 @@ namespace pins { * @param name pin to modulate pitch from */ //% blockId=device_analog_set_pitch_pin block="analog set pitch pin %name" + //% name.label="value" //% help=pins/analog-set-pitch-pin advanced=true //% name.shadow=analog_pin_shadow //% group="Pins" @@ -383,6 +392,7 @@ namespace pins { * @param volume the intensity of the sound from 0..255 */ //% blockId=device_analog_set_pitch_volume block="analog set pitch volume $volume" + //% volume.label="value" //% help=pins/analog-set-pitch-volume weight=3 advanced=true //% volume.min=0 volume.max=255 //% deprecated @@ -412,6 +422,7 @@ namespace pins { * @param ms duration of the pitch in milliseconds. */ //% blockId=device_analog_pitch block="analog pitch %frequency|for (ms) %ms" + //% frequency.label="frequency" ms.label="duration" //% help=pins/analog-pitch async advanced=true //% group="Pins" //% weight=14 @@ -463,6 +474,7 @@ namespace pins { */ //% help=pins/set-pull advanced=true //% blockId=device_set_pull block="set pull|pin %pin|to %pull" + //% name.label="pin" //% pin.shadow=digital_pin_shadow //% group="Pins" //% weight=15 @@ -491,6 +503,7 @@ namespace pins { */ //% help=pins/set-events advanced=true //% blockId=device_set_pin_events block="set pin %pin|to emit %type|events" + //% name.label="pin" //% pin.shadow=digital_pin_shadow //% group="Pins" //% weight=13 @@ -518,6 +531,7 @@ namespace pins { */ //% help=pins/neopixel-matrix-width advanced=true //% blockId=pin_neopixel_matrix_width block="neopixel matrix width|pin %pin %width" + //% pin.label="pin" width.label="width" //% pin.shadow=digital_pin_shadow //% width.defl=5 width.min=2 //% group="Pins" @@ -564,6 +578,7 @@ namespace pins { */ //% help=pins/spi-write advanced=true //% blockId=spi_write block="spi write %value" + //% value.label="value" //% group="SPI" //% blockGap=8 //% weight=53 @@ -602,6 +617,7 @@ namespace pins { */ //% help=pins/spi-frequency advanced=true //% blockId=spi_frequency block="spi frequency %frequency" + //% frequency.label="value" //% group="SPI" //% blockGap=8 //% weight=55 @@ -617,6 +633,7 @@ namespace pins { */ //% help=pins/spi-format advanced=true //% blockId=spi_format block="spi format|bits %bits|mode %mode" + //% bits.label="bits" mode.label="mode" //% group="SPI" //% blockGap=8 //% weight=54 @@ -637,6 +654,7 @@ namespace pins { */ //% help=pins/spi-pins advanced=true //% blockId=spi_pins block="spi set pins|MOSI %mosi|MISO %miso|SCK %sck" + //% mosi.label="MOSI pin" miso.label="MISO pin" sck.label="SCK pin" //% mosi.shadow=digital_pin_shadow //% miso.shadow=digital_pin_shadow //% sck.shadow=digital_pin_shadow @@ -664,6 +682,7 @@ namespace pins { * @param name pin to modulate pitch from */ //% blockId=pin_set_audio_pin block="set audio pin $name" + //% name.label="value" //% help=pins/set-audio-pin //% name.shadow=digital_pin_shadow //% weight=1 @@ -684,6 +703,7 @@ namespace pins { */ //% blockId=pin_set_audio_pin_enabled //% block="set audio pin enabled $enabled" + //% enabled.label="value" //% weight=0 help=pins/set-audio-pin-enabled void setAudioPinEnabled(bool enabled) { edgeConnectorSoundDisabled = !enabled; diff --git a/libs/core/pins.ts b/libs/core/pins.ts index 8e85698b55d..f44c5607ce1 100644 --- a/libs/core/pins.ts +++ b/libs/core/pins.ts @@ -98,6 +98,7 @@ namespace pins { */ //% help=pins/map weight=23 //% blockId=pin_map block="map %value|from low %fromLow|from high %fromHigh|to low %toLow|to high %toHigh" + //% value.label="value" fromLow.label="from low" fromHigh.label="from high" toLow.label="to low" toHigh.label="to high" export function map(value: number, fromLow: number, fromHigh: number, toLow: number, toHigh: number): number { return ((value - fromLow) * (toHigh - toLow)) / (fromHigh - fromLow) + toLow; } @@ -107,6 +108,7 @@ namespace pins { */ //% help=pins/i2c-read-number blockGap=8 advanced=true //% blockId=pins_i2c_readnumber block="i2c read number|at address %address|of format %format|repeated %repeat" weight=7 + //% address.label="address" repeated.label="repeated" //% group="I2C" //% weight=45 export function i2cReadNumber(address: number, format: NumberFormat, repeated?: boolean): number { @@ -119,6 +121,7 @@ namespace pins { */ //% help=pins/i2c-write-number blockGap=8 advanced=true //% blockId=i2c_writenumber block="i2c write number|at address %address|with value %value|of format %format|repeated %repeat" weight=6 + //% address.label="address" value.label="value" repeated.label="repeated" //% group="I2C" //% weight=44 export function i2cWriteNumber(address: number, value: number, format: NumberFormat, repeated?: boolean): void { diff --git a/libs/core/playable.ts b/libs/core/playable.ts index 095b8b04324..f55fab9e5e1 100644 --- a/libs/core/playable.ts +++ b/libs/core/playable.ts @@ -95,6 +95,7 @@ namespace music { */ //% blockId="music_playable_play" //% block="play $toPlay $playbackMode" + //% toPlay.label="sound" //% toPlay.shadow=music_string_playable //% group="Melody" //% help="music/play" @@ -105,6 +106,7 @@ namespace music { //% blockId="music_playable_play_default_bkg" //% block="play $toPlay $playbackMode" + //% toPlay.label="sound" //% toPlay.shadow=music_string_playable //% playbackMode.defl=music.PlaybackMode.InBackground //% group="Melody" @@ -121,6 +123,7 @@ namespace music { */ //% blockId="music_string_playable" //% block="melody $melody at tempo $bpm|(bpm)" + //% melody.label="melody" bpm.label="tempo" //% weight=85 blockGap=8 //% help=music/string-playable //% group="Melody" @@ -141,6 +144,7 @@ namespace music { */ //% blockId="music_tone_playable" //% block="tone $note for $duration" + //% note.label="note" duration.label="duration" //% toolboxParent=music_playable_play //% toolboxParentArgument=toPlay //% group="Tone" diff --git a/libs/core/serial.cpp b/libs/core/serial.cpp index e4803341fa3..5307c0987f2 100644 --- a/libs/core/serial.cpp +++ b/libs/core/serial.cpp @@ -58,6 +58,7 @@ namespace serial { */ //% help=serial/read-until //% blockId=serial_read_until block="serial|read until %delimiter=serial_delimiter_conv" + //% delimiter.label="delimiter" //% weight=19 String readUntil(String delimiter) { return PSTR(uBit.serial.readUntil(MSTR(delimiter))); @@ -81,6 +82,7 @@ namespace serial { */ //% help=serial/on-data-received //% weight=18 blockId=serial_on_data_received block="serial|on data received %delimiters=serial_delimiter_conv" + //% delimiters.label="delimiter" void onDataReceived(String delimiters, Action body) { uBit.serial.eventOn(MSTR(delimiters)); registerWithDal(MICROBIT_ID_SERIAL, MICROBIT_SERIAL_EVT_DELIM_MATCH, body); @@ -94,6 +96,7 @@ namespace serial { //% help=serial/write-string //% weight=87 blockGap=8 //% blockId=serial_writestring block="serial|write string %text" + //% text.label="value" //% text.shadowOptions.toString=true void writeString(String text) { if (!text) return; @@ -105,6 +108,7 @@ namespace serial { * Send a buffer through serial connection */ //% blockId=serial_writebuffer block="serial|write buffer %buffer=serial_readbuffer" + //% buffer.label="value" //% help=serial/write-buffer advanced=true weight=6 void writeBuffer(Buffer buffer) { if (!buffer) return; @@ -118,6 +122,7 @@ namespace serial { * @param length default buffer length */ //% blockId=serial_readbuffer block="serial|read buffer %length" + //% length.label="value" //% help=serial/read-buffer advanced=true weight=5 Buffer readBuffer(int length) { auto mode = SYNC_SLEEP; @@ -240,6 +245,7 @@ namespace serial { */ //% help=serial/set-rx-buffer-size //% blockId=serialSetRxBufferSize block="serial set rx buffer size to $size" + //% size.label="value" //% advanced=true void setRxBufferSize(uint8_t size) { uBit.serial.setRxBufferSize(size); @@ -251,6 +257,7 @@ namespace serial { */ //% help=serial/set-tx-buffer-size //% blockId=serialSetTxBufferSize block="serial set tx buffer size to $size" + //% size.label="value" //% advanced=true void setTxBufferSize(uint8_t size) { uBit.serial.setTxBufferSize(size); diff --git a/libs/core/serial.ts b/libs/core/serial.ts index 8121a5ca084..e425301d8bd 100644 --- a/libs/core/serial.ts +++ b/libs/core/serial.ts @@ -43,6 +43,7 @@ namespace serial { //% weight=90 //% help=serial/write-line blockGap=8 //% blockId=serial_writeline block="serial|write line %text" + //% text.label="value" //% text.shadowOptions.toString=true export function writeLine(text: string): void { if (!text) text = ""; @@ -65,6 +66,7 @@ namespace serial { //% weight=1 //% help=serial/set-write-line-padding //% blockId=serialWriteNewLinePadding block="serial set write line padding to $length" + //% length.label="value" //% advanced=true //% length.min=0 length.max=128 export function setWriteLinePadding(length: number) { @@ -77,6 +79,7 @@ namespace serial { //% help=serial/write-number //% weight=89 blockGap=8 //% blockId=serial_writenumber block="serial|write number %value" + //% value.label="value" export function writeNumber(value: number): void { writeString(value.toString()); } @@ -87,6 +90,7 @@ namespace serial { //% help=serial/write-numbers //% weight=86 //% blockId=serial_writenumbers block="serial|write numbers %values" + //% values.label="value" export function writeNumbers(values: number[]): void { if (!values) return; for (let i = 0; i < values.length; ++i) { @@ -104,6 +108,7 @@ namespace serial { //% weight=88 blockGap=8 //% help=serial/write-value //% blockId=serial_writevalue block="serial|write value %name|= %value" + //% name.label="name" value.label="value" export function writeValue(name: string, value: number): void { writeLine((name ? name + ":" : "") + value); } diff --git a/libs/core/shims.d.ts b/libs/core/shims.d.ts index 6d4cdaaa8ed..3ab8357ea10 100644 --- a/libs/core/shims.d.ts +++ b/libs/core/shims.d.ts @@ -41,6 +41,7 @@ declare interface Image { */ //% help=images/show-image weight=80 blockNamespace=images //% blockId=device_show_image_offset block="show image %sprite(myImage)|at offset %offset ||and interval (ms) %interval" + //% sprite.label="image" xOffset.label="offset" interval.label="interval" //% //% blockGap=8 parts="ledmatrix" async interval.defl=400 shim=ImageMethods::showImage showImage(xOffset: int32, interval?: int32): void; @@ -61,6 +62,7 @@ declare interface Image { //% help=images/scroll-image weight=79 async blockNamespace=images //% blockId=device_scroll_image //% block="scroll image %sprite(myImage)|with offset %frameoffset|and interval (ms) %delay" + //% id.label="image" frameOffset.label="offset" interval.label="interval" //% blockGap=8 parts="ledmatrix" shim=ImageMethods::scrollImage scrollImage(frameOffset: int32, interval: int32): void; @@ -153,6 +155,7 @@ declare namespace basic { //% help=basic/show-string //% weight=87 blockGap=16 //% block="show|string %text" + //% text.label="value" //% async //% blockId=device_print_message //% parts="ledmatrix" @@ -198,6 +201,7 @@ declare namespace basic { */ //% help=basic/pause weight=54 //% async block="pause (ms) %pause" blockGap=16 + //% ms.label="value" //% blockId=device_pause icon="\uf110" //% pause.shadow=timePicker shim=basic::pause function pause(ms: int32): void; @@ -382,7 +386,8 @@ declare namespace control { * Blocks the calling thread until the specified event is raised. */ //% help=control/wait-for-event async - //% blockId=control_wait_for_event block="wait for event|from %src|with value %value" shim=control::waitForEvent + //% blockId=control_wait_for_event block="wait for event|from %src|with value %value" + //% src.label="source" value.label="value" shim=control::waitForEvent function waitForEvent(src: int32, value: int32): void; /** @@ -398,6 +403,7 @@ declare namespace control { */ //% help=control/wait-micros weight=29 async //% blockId="control_wait_us" block="wait (µs)%micros" + //% micros.label="microseconds" //% micros.min=0 micros.max=6000 shim=control::waitMicros function waitMicros(micros: int32): void; @@ -408,6 +414,7 @@ declare namespace control { * @param mode optional definition of how the event should be processed after construction (default is CREATE_AND_FIRE). */ //% weight=21 blockGap=12 blockId="control_raise_event" block="raise event|from source %src=control_event_source_id|with value %value=control_event_value_id" blockExternalInputs=1 + //% src.label="source" value.label="value" //% help=control/raise-event //% mode.defl=1 shim=control::raiseEvent function raiseEvent(src: int32, value: int32, mode?: EventCreationMode): void; @@ -416,6 +423,7 @@ declare namespace control { * Registers an event handler. */ //% weight=20 blockGap=8 blockId="control_on_event" block="on event|from %src=control_event_source_id|with value %value=control_event_value_id" + //% src.label="source" value.label="value" //% help=control/on-event //% blockExternalInputs=1 flags.defl=0 shim=control::onEvent function onEvent(src: int32, value: int32, handler: () => void, flags?: int32): void; @@ -537,6 +545,7 @@ declare namespace led { */ //% help=led/plot weight=78 //% blockId=device_plot block="plot|x %x|y %y" blockGap=8 + //% x.label="x" y.label="y" //% parts="ledmatrix" //% x.min=0 x.max=4 y.min=0 y.max=4 //% x.fieldOptions.precision=1 y.fieldOptions.precision=1 shim=led::plot @@ -550,6 +559,7 @@ declare namespace led { */ //% help=led/plot-brightness weight=78 //% blockId=device_plot_brightness block="plot|x %x|y %y|brightness %brightness" blockGap=8 + //% x.label="x" y.label="y" brightness.label="brightness" //% parts="ledmatrix" //% x.min=0 x.max=4 y.min=0 y.max=4 brightness.min=0 brightness.max=255 //% x.fieldOptions.precision=1 y.fieldOptions.precision=1 @@ -563,6 +573,7 @@ declare namespace led { */ //% help=led/unplot weight=77 //% blockId=device_unplot block="unplot|x %x|y %y" blockGap=8 + //% x.label="x" y.label="y" //% parts="ledmatrix" //% x.min=0 x.max=4 y.min=0 y.max=4 //% x.fieldOptions.precision=1 y.fieldOptions.precision=1 shim=led::unplot @@ -575,6 +586,7 @@ declare namespace led { */ //% help=led/point-brightness weight=76 //% blockId=device_point_brightness block="point|x %x|y %y brightness" + //% x.label="x" y.label="y" //% parts="ledmatrix" //% x.min=0 x.max=4 y.min=0 y.max=4 //% x.fieldOptions.precision=1 y.fieldOptions.precision=1 @@ -596,6 +608,7 @@ declare namespace led { */ //% help=led/set-brightness weight=59 //% blockId=device_set_brightness block="set brightness %value" + //% value.label="value" //% parts="ledmatrix" //% advanced=true //% value.min=0 value.max=255 shim=led::setBrightness @@ -629,6 +642,7 @@ declare namespace led { * Turns on or off the display */ //% help=led/enable blockId=device_led_enable block="led enable %on" + //% on.label="value" //% advanced=true parts="ledmatrix" shim=led::enable function enable(on: boolean): void; @@ -646,6 +660,7 @@ declare namespace music { * @param volume the volume 0...255 */ //% blockId=synth_set_volume block="set volume %volume" + //% volume.label="value" //% volume.min=0 volume.max=255 //% //% help=music/set-volume @@ -670,6 +685,7 @@ declare namespace music { * @param enabled whether the built-in speaker is enabled in addition to the sound pin */ //% blockId=music_set_built_in_speaker_enable block="set built-in speaker $enabled" + //% enabled.label="value" //% group="micro:bit (V2)" //% parts=builtinspeaker //% help=music/set-built-in-speaker-enabled @@ -705,6 +721,7 @@ declare namespace pins { */ //% help=pins/digital-read-pin weight=30 //% blockId=device_get_digital_pin block="digital read|pin %name" blockGap=8 + //% name.label="value" //% name.shadow=digital_pin_shadow shim=pins::digitalReadPin function digitalReadPin(name: int32): int32; @@ -715,6 +732,7 @@ declare namespace pins { */ //% help=pins/digital-write-pin weight=29 //% blockId=device_set_digital_pin block="digital write|pin %name|to %value" + //% name.label="pin" value.label="value" //% value.min=0 value.max=1 //% name.shadow=digital_pin_shadow shim=pins::digitalWritePin function digitalWritePin(name: int32, value: int32): void; @@ -725,6 +743,7 @@ declare namespace pins { */ //% help=pins/analog-read-pin weight=25 //% blockId=device_get_analog_pin block="analog read|pin %name" blockGap="8" + //% name.label="value" //% name.shadow=analog_read_write_pin_shadow shim=pins::analogReadPin function analogReadPin(name: int32): int32; @@ -735,6 +754,7 @@ declare namespace pins { */ //% help=pins/analog-write-pin weight=24 //% blockId=device_set_analog_pin block="analog write|pin %name|to %value" blockGap=8 + //% name.label="pin" value.label="value" //% value.min=0 value.max=1023 //% name.shadow=analog_pin_shadow shim=pins::analogWritePin function analogWritePin(name: int32, value: int32): void; @@ -747,6 +767,7 @@ declare namespace pins { */ //% help=pins/analog-set-period weight=23 blockGap=8 //% blockId=device_set_analog_period block="analog set period|pin %pin|to (µs)%micros" + //% name.label="pin" micros.label="microseconds" //% pin.shadow=analog_pin_shadow shim=pins::analogSetPeriod function analogSetPeriod(name: int32, micros: int32): void; @@ -781,6 +802,7 @@ declare namespace pins { * @param maximum duration in microseconds */ //% blockId="pins_pulse_in" block="pulse in (µs)|pin %name|pulsed %value" + //% name.label="pin" //% advanced=true //% help=pins/pulse-in //% name.shadow=digital_pin_shadow @@ -796,6 +818,7 @@ declare namespace pins { */ //% help=pins/servo-write-pin weight=20 //% blockId=device_set_servo_pin block="servo write|pin %name|to %value" blockGap=8 + //% name.label="pin" value.label="angle" //% parts=microservo trackArgs=0 //% value.min=0 value.max=180 //% name.shadow=analog_pin_shadow @@ -815,6 +838,7 @@ declare namespace pins { */ //% help=pins/servo-set-pulse weight=19 //% blockId=device_set_servo_pulse block="servo set pulse|pin %value|to (µs) %micros" + //% name.label="pin" micros.label="microseconds" //% value.shadow=analog_pin_shadow //% group="Servo" shim=pins::servoSetPulse function servoSetPulse(name: int32, micros: int32): void; @@ -824,6 +848,7 @@ declare namespace pins { * @param name pin to modulate pitch from */ //% blockId=device_analog_set_pitch_pin block="analog set pitch pin %name" + //% name.label="value" //% help=pins/analog-set-pitch-pin advanced=true //% name.shadow=analog_pin_shadow //% group="Pins" @@ -836,6 +861,7 @@ declare namespace pins { * @param volume the intensity of the sound from 0..255 */ //% blockId=device_analog_set_pitch_volume block="analog set pitch volume $volume" + //% volume.label="value" //% help=pins/analog-set-pitch-volume weight=3 advanced=true //% volume.min=0 volume.max=255 //% deprecated shim=pins::analogSetPitchVolume @@ -855,6 +881,7 @@ declare namespace pins { * @param ms duration of the pitch in milliseconds. */ //% blockId=device_analog_pitch block="analog pitch %frequency|for (ms) %ms" + //% frequency.label="frequency" ms.label="duration" //% help=pins/analog-pitch async advanced=true //% group="Pins" //% weight=14 @@ -868,6 +895,7 @@ declare namespace pins { */ //% help=pins/set-pull advanced=true //% blockId=device_set_pull block="set pull|pin %pin|to %pull" + //% name.label="pin" //% pin.shadow=digital_pin_shadow //% group="Pins" //% weight=15 @@ -882,6 +910,7 @@ declare namespace pins { */ //% help=pins/set-events advanced=true //% blockId=device_set_pin_events block="set pin %pin|to emit %type|events" + //% name.label="pin" //% pin.shadow=digital_pin_shadow //% group="Pins" //% weight=13 @@ -903,6 +932,7 @@ declare namespace pins { */ //% help=pins/neopixel-matrix-width advanced=true //% blockId=pin_neopixel_matrix_width block="neopixel matrix width|pin %pin %width" + //% pin.label="pin" width.label="width" //% pin.shadow=digital_pin_shadow //% width.min=2 //% group="Pins" @@ -928,6 +958,7 @@ declare namespace pins { */ //% help=pins/spi-write advanced=true //% blockId=spi_write block="spi write %value" + //% value.label="value" //% group="SPI" //% blockGap=8 //% weight=53 shim=pins::spiWrite @@ -947,6 +978,7 @@ declare namespace pins { */ //% help=pins/spi-frequency advanced=true //% blockId=spi_frequency block="spi frequency %frequency" + //% frequency.label="value" //% group="SPI" //% blockGap=8 //% weight=55 shim=pins::spiFrequency @@ -959,6 +991,7 @@ declare namespace pins { */ //% help=pins/spi-format advanced=true //% blockId=spi_format block="spi format|bits %bits|mode %mode" + //% bits.label="bits" mode.label="mode" //% group="SPI" //% blockGap=8 //% weight=54 shim=pins::spiFormat @@ -970,6 +1003,7 @@ declare namespace pins { */ //% help=pins/spi-pins advanced=true //% blockId=spi_pins block="spi set pins|MOSI %mosi|MISO %miso|SCK %sck" + //% mosi.label="MOSI pin" miso.label="MISO pin" sck.label="SCK pin" //% mosi.shadow=digital_pin_shadow //% miso.shadow=digital_pin_shadow //% sck.shadow=digital_pin_shadow @@ -989,6 +1023,7 @@ declare namespace pins { * @param name pin to modulate pitch from */ //% blockId=pin_set_audio_pin block="set audio pin $name" + //% name.label="value" //% help=pins/set-audio-pin //% name.shadow=digital_pin_shadow //% weight=1 @@ -1001,6 +1036,7 @@ declare namespace pins { */ //% blockId=pin_set_audio_pin_enabled //% block="set audio pin enabled $enabled" + //% enabled.label="value" //% weight=0 help=pins/set-audio-pin-enabled shim=pins::setAudioPinEnabled function setAudioPinEnabled(enabled: boolean): void; } @@ -1017,6 +1053,7 @@ declare namespace serial { */ //% help=serial/read-until //% blockId=serial_read_until block="serial|read until %delimiter=serial_delimiter_conv" + //% delimiter.label="delimiter" //% weight=19 shim=serial::readUntil function readUntil(delimiter: string): string; @@ -1033,7 +1070,8 @@ declare namespace serial { * @param delimiters the characters to match received characters against. */ //% help=serial/on-data-received - //% weight=18 blockId=serial_on_data_received block="serial|on data received %delimiters=serial_delimiter_conv" shim=serial::onDataReceived + //% weight=18 blockId=serial_on_data_received block="serial|on data received %delimiters=serial_delimiter_conv" + //% delimiters.label="delimiter" shim=serial::onDataReceived function onDataReceived(delimiters: string, body: () => void): void; /** @@ -1042,6 +1080,7 @@ declare namespace serial { //% help=serial/write-string //% weight=87 blockGap=8 //% blockId=serial_writestring block="serial|write string %text" + //% text.label="value" //% text.shadowOptions.toString=true shim=serial::writeString function writeString(text: string): void; @@ -1049,6 +1088,7 @@ declare namespace serial { * Send a buffer through serial connection */ //% blockId=serial_writebuffer block="serial|write buffer %buffer=serial_readbuffer" + //% buffer.label="value" //% help=serial/write-buffer advanced=true weight=6 shim=serial::writeBuffer function writeBuffer(buffer: Buffer): void; @@ -1058,6 +1098,7 @@ declare namespace serial { * @param length default buffer length */ //% blockId=serial_readbuffer block="serial|read buffer %length" + //% length.label="value" //% help=serial/read-buffer advanced=true weight=5 shim=serial::readBuffer function readBuffer(length: int32): Buffer; @@ -1101,6 +1142,7 @@ declare namespace serial { */ //% help=serial/set-rx-buffer-size //% blockId=serialSetRxBufferSize block="serial set rx buffer size to $size" + //% size.label="value" //% advanced=true shim=serial::setRxBufferSize function setRxBufferSize(size: uint8): void; @@ -1110,6 +1152,7 @@ declare namespace serial { */ //% help=serial/set-tx-buffer-size //% blockId=serialSetTxBufferSize block="serial set tx buffer size to $size" + //% size.label="value" //% advanced=true shim=serial::setTxBufferSize function setTxBufferSize(size: uint8): void; diff --git a/libs/core/soundexpressions.ts b/libs/core/soundexpressions.ts index 8be2632bca3..95b46c42080 100644 --- a/libs/core/soundexpressions.ts +++ b/libs/core/soundexpressions.ts @@ -23,6 +23,7 @@ class SoundExpression extends music.Playable { * Starts to play a sound expression. */ //% block="play sound $this" + //% this.label="sound" //% weight=80 //% blockGap=8 //% help=music/play @@ -37,6 +38,7 @@ class SoundExpression extends music.Playable { * Plays a sound expression until finished */ //% block="play sound $this until done" + //% this.label="sound" //% weight=81 //% blockGap=8 //% help=music/play-until-done @@ -327,6 +329,7 @@ namespace music { */ //% blockId=soundExpression_playSoundEffect //% block="play sound $sound $mode" + //% sound.label="sound" //% sound.shadow=soundExpression_createSoundEffect //% weight=100 help=music/play-sound-effect //% blockGap=8 @@ -355,6 +358,7 @@ namespace music { //% blockId=soundExpression_createSoundEffect //% help=music/create-sound-effect //% block="$waveShape|| start frequency $startFrequency end frequency $endFrequency duration $duration start volume $startVolume end volume $endVolume effect $effect interpolation $interpolation" + //% startFrequency.label="start frequency" endFrequency.label="end frequency" duration.label="duration" startVolume.label="start volume" endVolume.label="end volume" //% waveShape.defl=WaveShape.Sine //% waveShape.fieldEditor=soundeffect //% startFrequency.defl=5000 @@ -438,6 +442,7 @@ namespace music { //% blockId=soundExpression_createSoundExpression //% help=music/create-sound-expression //% block="$waveShape|| start frequency $startFrequency end frequency $endFrequency duration $duration start volume $startVolume end volume $endVolume effect $effect interpolation $interpolation" + //% startFrequency.label="start frequency" endFrequency.label="end frequency" duration.label="duration" startVolume.label="start volume" endVolume.label="end volume" //% waveShape.defl=WaveShape.Sine //% waveShape.fieldEditor=soundeffect //% startFrequency.defl=5000 diff --git a/libs/datalogger/_locales/datalogger-strings.json b/libs/datalogger/_locales/datalogger-strings.json index 2c1399f72a2..0b387a4a682 100644 --- a/libs/datalogger/_locales/datalogger-strings.json +++ b/libs/datalogger/_locales/datalogger-strings.json @@ -3,14 +3,39 @@ "datalogger.DeleteType.Full|block": "full", "datalogger._columnField|block": "$column", "datalogger.createCV|block": "column $column value $value", + "datalogger.createCV|param|column|label": "column", + "datalogger.createCV|param|value|label": "value", "datalogger.deleteLog|block": "delete log||$deleteType", "datalogger.includeTimestamp|block": "set timestamp $format", "datalogger.logData|block": "log data array $data", + "datalogger.logData|param|data|label": "value", "datalogger.log|block": "log data $data1||$data2 $data3 $data4 $data5 $data6 $data7 $data8 $data9 $data10", + "datalogger.log|param|data10|label": "data 10", + "datalogger.log|param|data1|label": "data 1", + "datalogger.log|param|data2|label": "data 2", + "datalogger.log|param|data3|label": "data 3", + "datalogger.log|param|data4|label": "data 4", + "datalogger.log|param|data5|label": "data 5", + "datalogger.log|param|data6|label": "data 6", + "datalogger.log|param|data7|label": "data 7", + "datalogger.log|param|data8|label": "data 8", + "datalogger.log|param|data9|label": "data 9", "datalogger.mirrorToSerial|block": "mirror data to serial $on", + "datalogger.mirrorToSerial|param|on|label": "value", "datalogger.onLogFull|block": "on log full", "datalogger.setColumnTitles|block": "set columns $col1||$col2 $col3 $col4 $col5 $col6 $col7 $col8 $col9 $col10", + "datalogger.setColumnTitles|param|col10|label": "column 10", + "datalogger.setColumnTitles|param|col1|label": "column 1", + "datalogger.setColumnTitles|param|col2|label": "column 2", + "datalogger.setColumnTitles|param|col3|label": "column 3", + "datalogger.setColumnTitles|param|col4|label": "column 4", + "datalogger.setColumnTitles|param|col5|label": "column 5", + "datalogger.setColumnTitles|param|col6|label": "column 6", + "datalogger.setColumnTitles|param|col7|label": "column 7", + "datalogger.setColumnTitles|param|col8|label": "column 8", + "datalogger.setColumnTitles|param|col9|label": "column 9", "datalogger.setColumns|block": "set columns $cols", + "datalogger.setColumns|param|cols|label": "value", "datalogger|block": "Data Logger", "{id:category}Datalogger": "Datalogger", "{id:group}micro:bit (V2)": "micro:bit (V2)" diff --git a/libs/datalogger/datalogger.ts b/libs/datalogger/datalogger.ts index ffc1154a1cf..2daddd47d90 100644 --- a/libs/datalogger/datalogger.ts +++ b/libs/datalogger/datalogger.ts @@ -61,6 +61,7 @@ namespace datalogger { * @returns A new value that can be stored in flash storage using log data */ //% block="column $column value $value" + //% column.label="column" value.label="value" //% value.shadow=math_number //% column.shadow=datalogger_columnfield //% blockId=dataloggercreatecolumnvalue @@ -85,6 +86,7 @@ namespace datalogger { * @param data Array of data to be logged to flash storage */ //% block="log data array $data" + //% data.label="value" //% blockId=dataloggerlogdata //% data.shadow=lists_create_with //% data.defl=dataloggercreatecolumnvalue @@ -120,6 +122,7 @@ namespace datalogger { * @param data10 [optional] tenth column and value to be logged */ //% block="log data $data1||$data2 $data3 $data4 $data5 $data6 $data7 $data8 $data9 $data10" + //% data1.label="data 1" data2.label="data 2" data3.label="data 3" data4.label="data 4" data5.label="data 5" data6.label="data 6" data7.label="data 7" data8.label="data 8" data9.label="data 9" data10.label="data 10" //% blockId=dataloggerlog //% data1.shadow=dataloggercreatecolumnvalue //% data2.shadow=dataloggercreatecolumnvalue @@ -168,6 +171,7 @@ namespace datalogger { * @param cols Array of the columns that will be logged. */ //% block="set columns $cols" + //% cols.label="value" //% blockId=dataloggersetcolumns //% data.shadow=list_create_with //% data.defl=datalogger_columnfield @@ -195,6 +199,7 @@ namespace datalogger { * @param col10 Title for tenth column to be added */ //% block="set columns $col1||$col2 $col3 $col4 $col5 $col6 $col7 $col8 $col9 $col10" + //% col1.label="column 1" col2.label="column 2" col3.label="column 3" col4.label="column 4" col5.label="column 5" col6.label="column 6" col7.label="column 7" col8.label="column 8" col9.label="column 9" col10.label="column 10" //% blockId=dataloggersetcolumntitles //% inlineInputMode="variable" //% inlineInputModeLimit=1 @@ -276,6 +281,7 @@ namespace datalogger { * @param on if true, data that is logged will be mirrored to serial */ //% block="mirror data to serial $on" + //% on.label="value" //% blockId=dataloggertogglemirrortoserial //% on.shadow=toggleOnOff //% on.defl=false diff --git a/libs/microphone/_locales/microphone-strings.json b/libs/microphone/_locales/microphone-strings.json index 788890d83ea..38ea4e3605b 100644 --- a/libs/microphone/_locales/microphone-strings.json +++ b/libs/microphone/_locales/microphone-strings.json @@ -5,6 +5,7 @@ "SoundThreshold.Quiet|block": "quiet", "input.onSound|block": "on %sound sound", "input.setSoundThreshold|block": "set %sound sound threshold to %value", + "input.setSoundThreshold|param|threshold|label": "threshold", "input.soundLevel|block": "sound level", "input|block": "input", "{id:category}Input": "Input", diff --git a/libs/microphone/microphone.cpp b/libs/microphone/microphone.cpp index 9f735608c9f..cc1ea6af698 100644 --- a/libs/microphone/microphone.cpp +++ b/libs/microphone/microphone.cpp @@ -75,6 +75,7 @@ int soundLevel() { */ //% help=input/set-sound-threshold //% blockId=input_set_sound_threshold block="set %sound sound threshold to %value" +//% threshold.label="threshold" //% parts="microphone" //% threshold.min=0 threshold.max=255 threshold.defl=128 //% weight=14 blockGap=8 diff --git a/libs/microphone/shims.d.ts b/libs/microphone/shims.d.ts index 54bae85cfaa..b69d6e54f09 100644 --- a/libs/microphone/shims.d.ts +++ b/libs/microphone/shims.d.ts @@ -26,6 +26,7 @@ declare namespace input { */ //% help=input/set-sound-threshold //% blockId=input_set_sound_threshold block="set %sound sound threshold to %value" + //% threshold.label="threshold" //% parts="microphone" //% threshold.min=0 threshold.max=255 //% weight=14 blockGap=8 diff --git a/libs/radio-broadcast/_locales/radio-broadcast-strings.json b/libs/radio-broadcast/_locales/radio-broadcast-strings.json index 6eb2af1556a..5c85d263e03 100644 --- a/libs/radio-broadcast/_locales/radio-broadcast-strings.json +++ b/libs/radio-broadcast/_locales/radio-broadcast-strings.json @@ -1,6 +1,8 @@ { "radio.onReceivedMessage|block": "on radio $msg received", + "radio.onReceivedMessage|param|msg|label": "message", "radio.sendMessage|block": "radio send $msg", + "radio.sendMessage|param|msg|label": "message", "radio|block": "radio", "{id:category}Radio": "Radio", "{id:group}Broadcast": "Broadcast" diff --git a/libs/radio/_locales/radio-strings.json b/libs/radio/_locales/radio-strings.json index 1e66309b648..d704a4fc4fe 100644 --- a/libs/radio/_locales/radio-strings.json +++ b/libs/radio/_locales/radio-strings.json @@ -24,17 +24,29 @@ "radio.onReceivedValue|handlerParam|name": "name", "radio.onReceivedValue|handlerParam|value": "value", "radio.raiseEvent|block": "radio raise event|from source %src=control_event_source_id|with value %value=control_event_value_id", + "radio.raiseEvent|param|src|label": "source", + "radio.raiseEvent|param|value|label": "value", "radio.receiveNumber|block": "radio receive number", "radio.receiveString|block": "radio receive string", "radio.receivedPacket|block": "received packet %type=radio_packet_property", + "radio.receivedPacket|param|type|label": "property", "radio.receivedSignalStrength|block": "radio received signal strength", "radio.sendNumber|block": "radio send number %value", + "radio.sendNumber|param|value|label": "value", "radio.sendString|block": "radio send string %msg", + "radio.sendString|param|value|label": "value", "radio.sendValue|block": "radio send|value %name|= %value", + "radio.sendValue|param|name|defl": "name", + "radio.sendValue|param|name|label": "name", + "radio.sendValue|param|value|label": "value", "radio.setFrequencyBand|block": "radio set frequency band %band", + "radio.setFrequencyBand|param|band|label": "value", "radio.setGroup|block": "radio set group %ID", + "radio.setGroup|param|id|label": "value", "radio.setTransmitPower|block": "radio set transmit power %power", + "radio.setTransmitPower|param|power|label": "value", "radio.setTransmitSerialNumber|block": "radio set transmit serial number %transmit", + "radio.setTransmitSerialNumber|param|transmit|label": "value", "radio.writeReceivedPacketToSerial|block": "radio write received packet to serial", "radio.writeValueToSerial|block": "radio write value to serial", "radio|block": "radio", diff --git a/libs/radio/shims.d.ts b/libs/radio/shims.d.ts index 6df6da4284b..688c6af280e 100644 --- a/libs/radio/shims.d.ts +++ b/libs/radio/shims.d.ts @@ -23,6 +23,7 @@ declare namespace radio { * Sends an event over radio to neigboring devices */ //% blockId=radioRaiseEvent block="radio raise event|from source %src=control_event_source_id|with value %value=control_event_value_id" + //% src.label="source" value.label="value" //% blockExternalInputs=1 //% advanced=true //% weight=1 @@ -58,6 +59,7 @@ declare namespace radio { //% help=radio/set-group //% weight=100 //% blockId=radio_set_group block="radio set group %ID" + //% id.label="value" //% id.min=0 id.max=255 //% group="Group" shim=radio::setGroup function setGroup(id: int32): void; @@ -69,6 +71,7 @@ declare namespace radio { //% help=radio/set-transmit-power //% weight=9 blockGap=8 //% blockId=radio_set_transmit_power block="radio set transmit power %power" + //% power.label="value" //% power.min=0 power.max=7 //% advanced=true shim=radio::setTransmitPower function setTransmitPower(power: int32): void; @@ -80,6 +83,7 @@ declare namespace radio { //% help=radio/set-frequency-band //% weight=8 blockGap=8 //% blockId=radio_set_frequency_band block="radio set frequency band %band" + //% band.label="value" //% band.min=0 band.max=83 //% advanced=true shim=radio::setFrequencyBand function setFrequencyBand(band: int32): void; diff --git a/libs/servo/_locales/servo-strings.json b/libs/servo/_locales/servo-strings.json index 0c0ebb0d804..5f6ead8fb30 100644 --- a/libs/servo/_locales/servo-strings.json +++ b/libs/servo/_locales/servo-strings.json @@ -3,10 +3,16 @@ "servos.P1|block": "servo P1", "servos.P2|block": "servo P2", "servos.Servo.run|block": "continuous %servo run at %speed=speedPicker \\%", + "servos.Servo.run|param|speed|label": "speed", "servos.Servo.setAngle|block": "set %servo angle to %degrees=protractorPicker °", + "servos.Servo.setAngle|param|degrees|label": "angle", "servos.Servo.setPulse|block": "set %servo pulse to %micros μs", + "servos.Servo.setPulse|param|micros|label": "microseconds", "servos.Servo.setRange|block": "set %servo range from %minAngle to %maxAngle", + "servos.Servo.setRange|param|maxAngle|label": "maximum angle", + "servos.Servo.setRange|param|minAngle|label": "minimum angle", "servos.Servo.setStopOnNeutral|block": "set %servo stop on neutral %enabled", + "servos.Servo.setStopOnNeutral|param|enabled|label": "on", "servos.Servo.stop|block": "stop %servo", "{id:category}Servos": "Servos", "{id:group}Configuration": "Configuration",