Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libs/audio-recording/_locales/audio-recording-strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions libs/audio-recording/recording.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
17 changes: 17 additions & 0 deletions libs/bluetooth/_locales/bluetooth-strings.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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"
}
3 changes: 3 additions & 0 deletions libs/bluetooth/bluetooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)));
}
Expand Down
6 changes: 6 additions & 0 deletions libs/bluetooth/bluetooth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
Expand All @@ -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());
}
Expand All @@ -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);
}
Expand All @@ -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
Expand All @@ -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
Expand Down
7 changes: 5 additions & 2 deletions libs/bluetooth/shims.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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
Expand All @@ -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;

/**
Expand Down
8 changes: 8 additions & 0 deletions libs/color/_locales/color-strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
22 changes: 22 additions & 0 deletions libs/core/_locales/core-jsdoc-strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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``.",
Expand Down Expand Up @@ -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",
Expand Down
Loading