From 6b427d61f92cd1687a680d33dfa7366850c28764 Mon Sep 17 00:00:00 2001 From: Juri Wolf Date: Wed, 22 Nov 2023 19:02:21 +0100 Subject: [PATCH] V6.0.25 updates (#261) * fix rgb led * add rgb led brightness * fix digitalReadPin() simulator * default pin blocks to P0 * add minidalusb compile variant * move core-mini back to core * board names * update docs pages * move isCalibratedCompass() into core * aply code mappings and block patches * deprecate isCalibratedCompass() * set beta to latest --- docs/beta-ref.json | 2 +- docs/device/usb.md | 2 - docs/docs.md | 33 ++++++ docs/domains.html | 1 + docs/static/icons/manifest.json | 7 +- editor/patch.ts | 34 +++++- .../docs/reference/audio-recording.md | 8 +- libs/audio-recording/docs/reference/record.md | 8 +- .../docs/reference/record/play-audio.md | 2 +- .../docs/reference/record/start-recording.md | 4 +- libs/audio-recording/pxt.json | 3 +- .../_locales/bluetooth-jsdoc-strings.json | 4 +- libs/bluetooth/bluetooth.cpp | 4 +- libs/bluetooth/shims.d.ts | 4 +- libs/color/_locales/color-jsdoc-strings.json | 2 +- .../core-mini-codal-jsdoc-strings.json | 2 +- .../_locales/core-mini-codal-strings.json | 2 +- libs/core-mini-codal/pxt.json | 1 - libs/core-mini-codal/rgbled.ts | 2 +- .../_locales/core-mini-dal-jsdoc-strings.json | 4 +- .../_locales/core-mini-dal-strings.json | 5 +- libs/core-mini-dal/input.cpp | 15 +-- libs/core-mini-dal/microphone.ts | 15 --- libs/core-mini-dal/pxt.json | 4 +- libs/core-mini-dal/rgbled.ts | 2 +- libs/core-mini-dal/shims.d.ts | 13 +-- .../_locales/Untitled-jsdoc-strings.json | 24 ---- libs/core-mini/_locales/Untitled-strings.json | 29 ----- .../_locales/core-mini-jsdoc-strings.json | 24 ---- .../core-mini/_locales/core-mini-strings.json | 29 ----- libs/core-mini/enums.d.ts | 27 ----- libs/core-mini/pxt.json | 16 --- libs/core-mini/shims.d.ts | 83 -------------- libs/core/_locales/core-jsdoc-strings.json | 36 ++++-- libs/core/_locales/core-strings.json | 25 ++++ libs/core/basic.cpp | 2 +- libs/core/basic.ts | 2 +- libs/{core-mini => core}/compass.ts | 0 libs/core/control.cpp | 2 +- libs/core/enums.d.ts | 24 ++++ libs/core/input.cpp | 15 ++- libs/core/microphone.cpp | 3 +- libs/{core-mini => core}/motors.cpp | 0 libs/core/pins.cpp | 10 +- libs/core/pxt.json | 4 + libs/{core-mini => core}/rgbled.cpp | 20 ++-- libs/{core-mini => core}/rgbled.ts | 2 +- libs/core/shims.d.ts | 108 ++++++++++++++++-- libs/datalogger/docs/reference/datalogger.md | 6 +- libs/datalogger/pxt.json | 3 +- .../_locales/devices-jsdoc-strings.json | 4 +- libs/devices/devices.cpp | 2 +- libs/devices/devices.ts | 2 +- libs/devices/shims.d.ts | 2 +- libs/flashlog/pxt.json | 3 +- libs/microphone/pxt.json | 3 +- libs/settings/pxt.json | 3 +- libs/v1/pxt.json | 5 +- libs/v2/pxt.json | 3 +- libs/v3/pxt.json | 3 +- pxtarget.json | 20 +++- sim/state/edgeconnector.ts | 3 +- targetconfig.json | 6 +- 63 files changed, 361 insertions(+), 375 deletions(-) create mode 100644 docs/docs.md create mode 100644 docs/domains.html delete mode 100644 libs/core-mini-dal/microphone.ts delete mode 100644 libs/core-mini/_locales/Untitled-jsdoc-strings.json delete mode 100644 libs/core-mini/_locales/Untitled-strings.json delete mode 100644 libs/core-mini/_locales/core-mini-jsdoc-strings.json delete mode 100644 libs/core-mini/_locales/core-mini-strings.json delete mode 100644 libs/core-mini/enums.d.ts delete mode 100644 libs/core-mini/pxt.json delete mode 100644 libs/core-mini/shims.d.ts rename libs/{core-mini => core}/compass.ts (100%) rename libs/{core-mini => core}/motors.cpp (100%) rename libs/{core-mini => core}/rgbled.cpp (83%) rename libs/{core-mini => core}/rgbled.ts (96%) diff --git a/docs/beta-ref.json b/docs/beta-ref.json index b0b913bdc..b2abd85dc 100644 --- a/docs/beta-ref.json +++ b/docs/beta-ref.json @@ -1,3 +1,3 @@ { - "appref": "v6.0.24" + "appref": "v" } \ No newline at end of file diff --git a/docs/device/usb.md b/docs/device/usb.md index 8376909dd..60d27a681 100644 --- a/docs/device/usb.md +++ b/docs/device/usb.md @@ -4,8 +4,6 @@ Most of the time you'll be writing and testing your programs in the [simulator]( When you plug your @boardname@ into USB, a new drive is created with the **@drivename@** label. This is where you'll save your program. -![](/static/mb/device/usb-thin.jpg) - The basic steps are: 1. Connect your @boardname@ to your computer with a USB cable. diff --git a/docs/docs.md b/docs/docs.md new file mode 100644 index 000000000..a07b85304 --- /dev/null +++ b/docs/docs.md @@ -0,0 +1,33 @@ +# Documentation + +## @description Links to the documentation, reference and projects. + +## Things to do + +* [Projects](/projects) +* [Examples](/examples) +* [Courses](/courses) +* [Lessons](/lessons) + +## @boardname@ reference + +* [The @boardname@ APIs](/reference) +* [The @boardname@ device](/device) + +## Language and data reference + +* [Blocks language](/blocks) +* [JavaScript language](/javascript) + +## More questions? + +* [Frequently Asked Questions](/faq) +* [Help Translate](/translate) +* [Embedding project](/share) + +## Developers + +* [Command Line Interface](/cli) +* Learn about [extensions](/extensions) +* [Flashing via HID (CMSIS-DAP)](/hidflash) + diff --git a/docs/domains.html b/docs/domains.html new file mode 100644 index 000000000..47ca16ea1 --- /dev/null +++ b/docs/domains.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/static/icons/manifest.json b/docs/static/icons/manifest.json index 339e99bac..0c744cf48 100644 --- a/docs/static/icons/manifest.json +++ b/docs/static/icons/manifest.json @@ -1,5 +1,5 @@ { - "name": "makecode.microbit.org", + "name": "makecode.calliope.cc", "icons": [ { "src": "\/android-chrome-36x36.png", @@ -21,11 +21,6 @@ "sizes": "96x96", "type": "image\/png" }, - { - "src": "\/android-chrome-144x144.png", - "sizes": "144x144", - "type": "image\/png" - }, { "src": "\/android-chrome-192x192.png", "sizes": "192x192", diff --git a/editor/patch.ts b/editor/patch.ts index 623063e16..f00a645c9 100644 --- a/editor/patch.ts +++ b/editor/patch.ts @@ -1,5 +1,35 @@ export function patchBlocks(pkgTargetVersion: string, dom: Element) { + + // is this a old script? + if (pxt.semver.majorCmp(pkgTargetVersion || "0.0.0", "5.0.0") >= 0) return; + + // Motor Names mapping + pxt.U.toArray(dom.querySelectorAll('field[name="motor"]')) + .forEach(node => { + const motorValue = node.textContent.trim(); + switch (motorValue) { + case 'Motor.A': + node.textContent = 'Motor.M0'; + break; + case 'Motor.B': + node.textContent = 'Motor.M1'; + break; + case 'Motor.AB': + node.textContent = 'Motor.M0_M1'; + break; + // Add additional cases if needed for other motor values + } + }); + + // Sound level mapping + pxt.U.toArray(dom.querySelectorAll('block[type=device_get_sound_level]')) + .forEach(node => { + node.setAttribute('type', 'soundLevel'); + }); + + + // is this a old script? if (pxt.semver.majorCmp(pkgTargetVersion || "0.0.0", "4.0.20") >= 0) return; // button and pin pressed/released blocks @@ -148,9 +178,6 @@ arrowImageNodes.forEach(node => { arrowNode.textContent = "IconNames.Arrow" + arrowNode.textContent.split('.')[1]; }); - // is this a very old script? - if (pxt.semver.majorCmp(pkgTargetVersion || "0.0.0", "1.0.0") >= 0) return; - // LEDs /** * @@ -196,6 +223,7 @@ arrowImageNodes.forEach(node => { if (pxt.semver.majorCmp(pkgTargetVersion || "0.0.0", "5.0.12") <= 0) { + // Eighth note misspelling /* diff --git a/libs/audio-recording/docs/reference/audio-recording.md b/libs/audio-recording/docs/reference/audio-recording.md index 75b1606e5..17a24d773 100644 --- a/libs/audio-recording/docs/reference/audio-recording.md +++ b/libs/audio-recording/docs/reference/audio-recording.md @@ -1,14 +1,14 @@ # Audio recording -The **audio recording** extension lets you record and play back audio with the micro:bit. If your version of the micro:bit has a microphone you can record a brief amount of audio and play it back on the speaker or at a sound output pin. Audio that you record is stored in an audio [buffer](/types/buffer) and can be played later or recorded over with new audio. +The **audio recording** extension lets you record and play back audio with the Calliope mini. If your version of the Calliope mini has a microphone you can record a brief amount of audio and play it back on the speaker or at a sound output pin. Audio that you record is stored in an audio [buffer](/types/buffer) and can be played later or recorded over with new audio. ### ~ reminder -#### Works with micro:bit V2 +#### Works with Calliope mini 3 -![works with micro:bit V2 only image](/static/v2/v2-only.png) +![works with Calliope mini 3 only image](/static/v2/v2-only.png) -Using these blocks requires the [micro:bit V2](/device/v2) hardware. If you use any blocks that attempt access flash memory on a micro:bit v1 board, you will see the **927** error code on the screen. +Using these blocks requires the [Calliope mini 3](/device/v2) hardware. If you use any blocks that attempt access flash memory on a Calliope mini v1 board, you will see the **927** error code on the screen. ### ~ diff --git a/libs/audio-recording/docs/reference/record.md b/libs/audio-recording/docs/reference/record.md index 75b1606e5..17a24d773 100644 --- a/libs/audio-recording/docs/reference/record.md +++ b/libs/audio-recording/docs/reference/record.md @@ -1,14 +1,14 @@ # Audio recording -The **audio recording** extension lets you record and play back audio with the micro:bit. If your version of the micro:bit has a microphone you can record a brief amount of audio and play it back on the speaker or at a sound output pin. Audio that you record is stored in an audio [buffer](/types/buffer) and can be played later or recorded over with new audio. +The **audio recording** extension lets you record and play back audio with the Calliope mini. If your version of the Calliope mini has a microphone you can record a brief amount of audio and play it back on the speaker or at a sound output pin. Audio that you record is stored in an audio [buffer](/types/buffer) and can be played later or recorded over with new audio. ### ~ reminder -#### Works with micro:bit V2 +#### Works with Calliope mini 3 -![works with micro:bit V2 only image](/static/v2/v2-only.png) +![works with Calliope mini 3 only image](/static/v2/v2-only.png) -Using these blocks requires the [micro:bit V2](/device/v2) hardware. If you use any blocks that attempt access flash memory on a micro:bit v1 board, you will see the **927** error code on the screen. +Using these blocks requires the [Calliope mini 3](/device/v2) hardware. If you use any blocks that attempt access flash memory on a Calliope mini v1 board, you will see the **927** error code on the screen. ### ~ diff --git a/libs/audio-recording/docs/reference/record/play-audio.md b/libs/audio-recording/docs/reference/record/play-audio.md index bd92439e3..5e15c95da 100644 --- a/libs/audio-recording/docs/reference/record/play-audio.md +++ b/libs/audio-recording/docs/reference/record/play-audio.md @@ -16,7 +16,7 @@ Any audio recorded in the audio buffer is played on the speaker or at the sound ## Example -Use the micro:bit as a sound recorder. Record sound when button `A` is pressed and play sound when button `B` is pressed. +Use the Calliope mini as a sound recorder. Record sound when button `A` is pressed and play sound when button `B` is pressed. ```blocks input.onButtonPressed(Button.A, function () { diff --git a/libs/audio-recording/docs/reference/record/start-recording.md b/libs/audio-recording/docs/reference/record/start-recording.md index 7e545cd56..f27e9dfe2 100644 --- a/libs/audio-recording/docs/reference/record/start-recording.md +++ b/libs/audio-recording/docs/reference/record/start-recording.md @@ -6,7 +6,7 @@ Begin recording sound in the audio buffer. record.startRecording(record.BlockingState.Blocking) ``` -Audio recording starts and is recorded for a short period of time. Any previous audio is overwritten and the new audio takes its place. Audio is recorded on the micro:bit as a sequence of [numbers](/types/number) that represent sound and its loudness at a particular moment in time. This is called a sound "sample". The number of "samples" used to record sounds during one second is called the [sample rate](/reference/record/set-sample-rate). +Audio recording starts and is recorded for a short period of time. Any previous audio is overwritten and the new audio takes its place. Audio is recorded on the Calliope mini as a sequence of [numbers](/types/number) that represent sound and its loudness at a particular moment in time. This is called a sound "sample". The number of "samples" used to record sounds during one second is called the [sample rate](/reference/record/set-sample-rate). When audio is recorded, the audio buffer will contain enough samples that, when played back, will approximate natural sound waves as you listen to it. Any previous audio that was recorded is replaced with new audio. @@ -18,7 +18,7 @@ When audio is recorded, the audio buffer will contain enough samples that, when ## Example -Use the micro:bit as a sound recorder. Record sound when button `A` is pressed and play sound when button `B` is pressed. +Use the Calliope mini as a sound recorder. Record sound when button `A` is pressed and play sound when button `B` is pressed. ```blocks input.onButtonPressed(Button.A, function () { diff --git a/libs/audio-recording/pxt.json b/libs/audio-recording/pxt.json index 733af80ce..30b3e8925 100644 --- a/libs/audio-recording/pxt.json +++ b/libs/audio-recording/pxt.json @@ -13,7 +13,8 @@ ], "public": true, "disablesVariants": [ - "minidal" + "minidal", + "minidalusb" ], "icon": "./static/packages/microphone/icon.png" } \ No newline at end of file diff --git a/libs/bluetooth/_locales/bluetooth-jsdoc-strings.json b/libs/bluetooth/_locales/bluetooth-jsdoc-strings.json index 925d5177d..837b50092 100644 --- a/libs/bluetooth/_locales/bluetooth-jsdoc-strings.json +++ b/libs/bluetooth/_locales/bluetooth-jsdoc-strings.json @@ -13,9 +13,9 @@ "bluetooth.advertiseUrl|param|connectable": "true to keep bluetooth connectable for other services, false otherwise.", "bluetooth.advertiseUrl|param|power": "power level between 0 and 7, eg: 7", "bluetooth.advertiseUrl|param|url": "the url to transmit. Must be no longer than the supported eddystone url length, eg: \"https://makecode.com\"", - "bluetooth.onBluetoothConnected": "Register code to run when the micro:bit is connected to over Bluetooth", + "bluetooth.onBluetoothConnected": "Register code to run when the Calliope mini is connected to over Bluetooth", "bluetooth.onBluetoothConnected|param|body": "Code to run when a Bluetooth connection is established", - "bluetooth.onBluetoothDisconnected": "Register code to run when a bluetooth connection to the micro:bit is lost", + "bluetooth.onBluetoothDisconnected": "Register code to run when a bluetooth connection to the Calliope mini is lost", "bluetooth.onBluetoothDisconnected|param|body": "Code to run when a Bluetooth connection is lost", "bluetooth.onUartDataReceived": "Registers an event to be fired when one of the delimiter is matched.", "bluetooth.onUartDataReceived|param|delimiters": "the characters to match received characters against.", diff --git a/libs/bluetooth/bluetooth.cpp b/libs/bluetooth/bluetooth.cpp index 155bfcc35..f056f8b65 100644 --- a/libs/bluetooth/bluetooth.cpp +++ b/libs/bluetooth/bluetooth.cpp @@ -152,7 +152,7 @@ namespace bluetooth { } /** - * Register code to run when the micro:bit is connected to over Bluetooth + * Register code to run when the Calliope mini is connected to over Bluetooth * @param body Code to run when a Bluetooth connection is established */ //% help=bluetooth/on-bluetooth-connected weight=20 @@ -163,7 +163,7 @@ namespace bluetooth { } /** - * Register code to run when a bluetooth connection to the micro:bit is lost + * Register code to run when a bluetooth connection to the Calliope mini is lost * @param body Code to run when a Bluetooth connection is lost */ //% help=bluetooth/on-bluetooth-disconnected weight=19 diff --git a/libs/bluetooth/shims.d.ts b/libs/bluetooth/shims.d.ts index 4e2b6e693..2e91527b9 100644 --- a/libs/bluetooth/shims.d.ts +++ b/libs/bluetooth/shims.d.ts @@ -84,7 +84,7 @@ declare namespace bluetooth { function onUartDataReceived(delimiters: string, body: () => void): void; /** - * Register code to run when the micro:bit is connected to over Bluetooth + * Register code to run when the Calliope mini is connected to over Bluetooth * @param body Code to run when a Bluetooth connection is established */ //% help=bluetooth/on-bluetooth-connected weight=20 @@ -93,7 +93,7 @@ declare namespace bluetooth { function onBluetoothConnected(body: () => void): void; /** - * Register code to run when a bluetooth connection to the micro:bit is lost + * Register code to run when a bluetooth connection to the Calliope mini is lost * @param body Code to run when a Bluetooth connection is lost */ //% help=bluetooth/on-bluetooth-disconnected weight=19 diff --git a/libs/color/_locales/color-jsdoc-strings.json b/libs/color/_locales/color-jsdoc-strings.json index 5d1c5f9f3..66cf8e2c2 100644 --- a/libs/color/_locales/color-jsdoc-strings.json +++ b/libs/color/_locales/color-jsdoc-strings.json @@ -1,6 +1,6 @@ { "ColorHues": "Well known color hues", - "Colors": "Well known colors", + "Colors": "Well known colors\n\nWell known colors", "color": "Color manipulation", "color.ColorBuffer": "A buffer of colors", "color.ColorBuffer.write": "Writes the content of the src color buffer starting at the start dstOffset in the current buffer", diff --git a/libs/core-mini-codal/_locales/core-mini-codal-jsdoc-strings.json b/libs/core-mini-codal/_locales/core-mini-codal-jsdoc-strings.json index 2b2adae91..cb1fae6c9 100644 --- a/libs/core-mini-codal/_locales/core-mini-codal-jsdoc-strings.json +++ b/libs/core-mini-codal/_locales/core-mini-codal-jsdoc-strings.json @@ -3,7 +3,7 @@ "SoundExpression.play": "Starts to play a sound expression.", "SoundExpression.playUntilDone": "Plays a sound expression until finished", "TouchButtonEvent": "An action on a touch button", - "basic": "Provides access to basic micro:bit functionality.\n\nProvides access to basic micro:bit functionality.\n\nProvides access to basic calliope mini functionality.\n\nProvides access to basic calliope mini functionality.", + "basic": "Provides access to basic Calliope mini functionality.\n\nProvides access to basic calliope mini functionality.\n\nProvides access to basic Calliope mini functionality.\n\nProvides access to basic calliope mini functionality.", "basic.setLedColors": "Sets the color on the built-in RGB LED. Set to 0 to turn off.", "basic.setLedColors|param|brightness": "The LED brightness in percent.", "basic.setLedColors|param|color1": "The color of the first LED in RGB format (e.g., 0xFF0000 for red).", diff --git a/libs/core-mini-codal/_locales/core-mini-codal-strings.json b/libs/core-mini-codal/_locales/core-mini-codal-strings.json index 8e3b0bdbf..0cc6869df 100644 --- a/libs/core-mini-codal/_locales/core-mini-codal-strings.json +++ b/libs/core-mini-codal/_locales/core-mini-codal-strings.json @@ -26,7 +26,7 @@ "WaveShape.Sine|block": "sine", "WaveShape.Square|block": "square", "WaveShape.Triangle|block": "triangle", - "basic.setLedColors|block": "set LED to %color1=colorNumberPicker %color2=colorNumberPicker %color3=colorNumberPicker", + "basic.setLedColors|block": "set LED to %color1=colorNumberPicker %color2=colorNumberPicker %color3=colorNumberPicker || brightness %brightness", "basic|block": "basic", "input.logoIsPressed|block": "logo is pressed", "input.onLogoEvent|block": "on logo $action", diff --git a/libs/core-mini-codal/pxt.json b/libs/core-mini-codal/pxt.json index 0b101067c..254296c52 100644 --- a/libs/core-mini-codal/pxt.json +++ b/libs/core-mini-codal/pxt.json @@ -3,7 +3,6 @@ "description": "The mini codal core library", "dependencies": { "core": "file:../core", - "core-mini": "file:../core-mini", "microphone": "file:../microphone" }, "disablesVariants": [ diff --git a/libs/core-mini-codal/rgbled.ts b/libs/core-mini-codal/rgbled.ts index 20f010399..906c3fe3c 100644 --- a/libs/core-mini-codal/rgbled.ts +++ b/libs/core-mini-codal/rgbled.ts @@ -12,7 +12,7 @@ namespace basic { */ //% help=basic/set-led-colors //% blockId=device_set_led_colors - //% block="set LED to %color1=colorNumberPicker %color2=colorNumberPicker %color3=colorNumberPicker" + //% block="set LED to %color1=colorNumberPicker %color2=colorNumberPicker %color3=colorNumberPicker || brightness %brightness" //% color1.defl=0xff0000 //% color2.defl=0xff0000 //% color3.defl=0xff0000 diff --git a/libs/core-mini-dal/_locales/core-mini-dal-jsdoc-strings.json b/libs/core-mini-dal/_locales/core-mini-dal-jsdoc-strings.json index ff9b55bc9..15723c3c2 100644 --- a/libs/core-mini-dal/_locales/core-mini-dal-jsdoc-strings.json +++ b/libs/core-mini-dal/_locales/core-mini-dal-jsdoc-strings.json @@ -1,5 +1,5 @@ { - "basic": "Provides access to basic micro:bit functionality.\n\nProvides access to basic micro:bit functionality.\n\nProvides access to basic calliope mini functionality.\n\r\nProvides access to basic calliope mini functionality.", + "basic": "Provides access to basic Calliope mini functionality.\n\nProvides access to basic calliope mini functionality.\n\nProvides access to basic Calliope mini functionality.\n\r\nProvides access to basic calliope mini functionality.", "basic.setLedColors": "Sets the color on the built-in RGB LED. Set to 0 to turn off.", "basic.setLedColors|param|brightness": "The LED brightness in percent.", "basic.setLedColors|param|color1": "The color of the first LED in RGB format (e.g., 0xFF0000 for red).", @@ -8,8 +8,6 @@ "input": "Events and data from sensors", "input.assumeCalibrationCompass": "Obsolete, compass calibration is automatic.", "input.clearCalibrationCompass": "Obsolete, compass calibration is automatic.", - "input.isCalibratedCompass": "Returns 'true' when the compass is calibrated. Otherwise returns 'false'.", - "input.loudness": "gets the level of loudness from 0 (silent) to 255 (loud)", "motors": "Blocks to control the onboard motors", "motors.dualMotorPower": "Controls two motors attached to the board. Switches to dual-motor mode!", "motors.motorCommand": "Send break, coast or sleep commands to the motor. Has no effect in dual-motor mode.", diff --git a/libs/core-mini-dal/_locales/core-mini-dal-strings.json b/libs/core-mini-dal/_locales/core-mini-dal-strings.json index 085a05266..faefd8c20 100644 --- a/libs/core-mini-dal/_locales/core-mini-dal-strings.json +++ b/libs/core-mini-dal/_locales/core-mini-dal-strings.json @@ -3,8 +3,6 @@ "basic|block": "basic", "input.assumeCalibrationCompass|block": "assume calibration compass", "input.clearCalibrationCompass|block": "clear calibration compass", - "input.isCalibratedCompass|block": "is compass calibrated", - "input.loudness|block": "Loudness", "input|block": "input", "motors.dualMotorPower|block": "motor %motor|at %percent \\%", "motors.motorCommand|block": "motor %command", @@ -14,6 +12,5 @@ "{id:category}Input": "Input", "{id:category}Motors": "Motors", "{id:group}Configuration": "Configuration", - "{id:group}RGB LED": "RGB LED", - "{id:group}System": "System" + "{id:group}RGB LED": "RGB LED" } \ No newline at end of file diff --git a/libs/core-mini-dal/input.cpp b/libs/core-mini-dal/input.cpp index af2a79ccc..e2859df17 100644 --- a/libs/core-mini-dal/input.cpp +++ b/libs/core-mini-dal/input.cpp @@ -3,17 +3,6 @@ //% color=#c90072 weight=99 icon="\uf192" namespace input { - /** - * Returns 'true' when the compass is calibrated. Otherwise returns 'false'. - */ - //% help=input/calibrate-compass advanced=true - //% blockId="input_compass_is_calibrated" block="is compass calibrated" - //% weight=19 - //% group="System" - bool isCalibratedCompass() { - return (uBit.compass.isCalibrated() == 1); - } - /** * Obsolete, compass calibration is automatic. */ @@ -21,7 +10,7 @@ namespace input { //% blockId="input_compass_clear_calibration" block="clear calibration compass" //% weight=17 //% group="Configuration" - //% blockHidden=true + //% blockHidden=true deprecated=true void clearCalibrationCompass() { uBit.compass.clearCalibration(); } @@ -33,7 +22,7 @@ namespace input { //% blockId="input_compass_assume_calibration" block="assume calibration compass" //% weight=16 //% group="Configuration" - //% blockHidden=true + //% blockHidden=true deprecated=true void assumeCalibrationCompass() { uBit.compass.assumeCalibration(); } diff --git a/libs/core-mini-dal/microphone.ts b/libs/core-mini-dal/microphone.ts deleted file mode 100644 index c19042f79..000000000 --- a/libs/core-mini-dal/microphone.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Events and data from sensors - */ -//% color=#C90072 weight=99 -namespace input { - /** - * gets the level of loudness from 0 (silent) to 255 (loud) - */ - //% blockId="loudness" - //% block="Loudness" - //% deprecated=true - export function loudness(): number { - return input.soundLevel() - } -} diff --git a/libs/core-mini-dal/pxt.json b/libs/core-mini-dal/pxt.json index 0da253a54..094718992 100644 --- a/libs/core-mini-dal/pxt.json +++ b/libs/core-mini-dal/pxt.json @@ -2,8 +2,7 @@ "name": "core-mini-dal", "description": "The mini dal core library", "dependencies": { - "core": "file:../core", - "core-mini": "file:../core-mini" + "core": "file:../core" }, "disablesVariants": [ "minicodal" @@ -12,7 +11,6 @@ "files": [ "shims.d.ts", "enums.d.ts", - "microphone.ts", "motors.ts", "parts/dcmotor.svg", "input.cpp", diff --git a/libs/core-mini-dal/rgbled.ts b/libs/core-mini-dal/rgbled.ts index 140983622..e72496d82 100644 --- a/libs/core-mini-dal/rgbled.ts +++ b/libs/core-mini-dal/rgbled.ts @@ -21,7 +21,7 @@ namespace basic { //% weight=10 //% group="RGB LED" //% inlineInputMode=inline - //% hidden=1 + //% hidden=1 deprecated=1 export function setLedColors(color1: number, color2: number, color3: number, brightness: number = 20) { setLedColorDal(color1); } diff --git a/libs/core-mini-dal/shims.d.ts b/libs/core-mini-dal/shims.d.ts index 2ddc0c616..906e6ccc4 100644 --- a/libs/core-mini-dal/shims.d.ts +++ b/libs/core-mini-dal/shims.d.ts @@ -5,15 +5,6 @@ //% color=#c90072 weight=99 icon="\uf192" declare namespace input { - /** - * Returns 'true' when the compass is calibrated. Otherwise returns 'false'. - */ - //% help=input/calibrate-compass advanced=true - //% blockId="input_compass_is_calibrated" block="is compass calibrated" - //% weight=19 - //% group="System" shim=input::isCalibratedCompass - function isCalibratedCompass(): boolean; - /** * Obsolete, compass calibration is automatic. */ @@ -21,7 +12,7 @@ declare namespace input { //% blockId="input_compass_clear_calibration" block="clear calibration compass" //% weight=17 //% group="Configuration" - //% blockHidden=true shim=input::clearCalibrationCompass + //% blockHidden=true deprecated=true shim=input::clearCalibrationCompass function clearCalibrationCompass(): void; /** @@ -31,7 +22,7 @@ declare namespace input { //% blockId="input_compass_assume_calibration" block="assume calibration compass" //% weight=16 //% group="Configuration" - //% blockHidden=true shim=input::assumeCalibrationCompass + //% blockHidden=true deprecated=true shim=input::assumeCalibrationCompass function assumeCalibrationCompass(): void; } diff --git a/libs/core-mini/_locales/Untitled-jsdoc-strings.json b/libs/core-mini/_locales/Untitled-jsdoc-strings.json deleted file mode 100644 index d8b6a6975..000000000 --- a/libs/core-mini/_locales/Untitled-jsdoc-strings.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "Colors": "Well known colors", - "basic": "Provides access to basic micro:bit functionality.\n\nProvides access to basic micro:bit functionality.\n\nProvides access to basic calliope mini functionality.", - "basic.color": "Converts the color name to a number", - "basic.rgb": "Converts red, green, blue channels into a RGB color", - "basic.rgb|param|blue": "value of the blue channel between 0 and 255. eg: 255", - "basic.rgb|param|green": "value of the green channel between 0 and 255. eg: 255", - "basic.rgb|param|red": "value of the red channel between 0 and 255. eg: 255", - "basic.setLedColor": "Sets the color on the built-in RGB LED. Set to 0 to turn off.", - "basic.setLedColorDal": "Sets the color on the built-in RGB LED. Set to 0 to turn off.", - "basic.setLedColorsCodal": "Sets the color on the built-in RGB LED. Set to 0 to turn off.", - "basic.setLedColorsCodal|param|brightness": "The LED brightness in percent.", - "basic.setLedColorsCodal|param|color1": "The color of the first LED in RGB format (e.g., 0xFF0000 for red).", - "basic.setLedColorsCodal|param|color2": "The second LED color.", - "basic.setLedColorsCodal|param|color3": "The third LED color.", - "basic.setLedColor|param|color": "The color of the LED in RGB format (e.g., 0xFF0000 for red).", - "basic.showCompass": "Draws needle on the screen which always points to north", - "basic.showCompass|param|interval": "the amount of time (milliseconds) to show the needle. Default is 600.", - "basic.turnRgbLedOff": "Sets the color on the built-in RGB LED. Set to 0 to turn off.", - "motors.dualMotorPowerDal": "Controls two motors attached to the board. Switches to dual-motor mode!", - "motors.motorCommandDal": "Send break, coast or sleep commands to the motor. Has no effect in dual-motor mode.", - "motors.motorPowerDal": "Turns on the motor at a certain percent of power. Switches to single motor mode!", - "motors.motorPowerDal|param|power": "%percent of power sent to the motor. Negative power goes backward. eg: 50" -} \ No newline at end of file diff --git a/libs/core-mini/_locales/Untitled-strings.json b/libs/core-mini/_locales/Untitled-strings.json deleted file mode 100644 index a9494232b..000000000 --- a/libs/core-mini/_locales/Untitled-strings.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "Colors.Blue|block": "blue", - "Colors.Green|block": "green", - "Colors.Indigo|block": "indigo", - "Colors.Off|block": "off", - "Colors.Orange|block": "orange", - "Colors.Purple|block": "purple", - "Colors.Red|block": "red", - "Colors.Violet|block": "violet", - "Colors.White|block": "white", - "Colors.Yellow|block": "yellow", - "Motor.M0_M1|block": "M0 & M1", - "Motor.M0|block": "M0", - "Motor.M1|block": "M1", - "MotorCommand.Break|block": "break", - "MotorCommand.Coast|block": "coast", - "MotorCommand.Sleep|block": "sleep", - "basic.color|block": "%c", - "basic.rgb|block": "red %red|green %green|blue %blue", - "basic.setLedColor|block": "set LED to %color=colorNumberPicker", - "basic.showCompass|block": "show compass needle for $interval|ms", - "basic.turnRgbLedOff|block": "turn built-in LED off", - "basic|block": "basic", - "motors|block": "motors", - "{id:category}Basic": "Basic", - "{id:category}Motors": "Motors", - "{id:group}LED matrix": "LED matrix", - "{id:group}RGB LED": "RGB LED" -} \ No newline at end of file diff --git a/libs/core-mini/_locales/core-mini-jsdoc-strings.json b/libs/core-mini/_locales/core-mini-jsdoc-strings.json deleted file mode 100644 index d8b6a6975..000000000 --- a/libs/core-mini/_locales/core-mini-jsdoc-strings.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "Colors": "Well known colors", - "basic": "Provides access to basic micro:bit functionality.\n\nProvides access to basic micro:bit functionality.\n\nProvides access to basic calliope mini functionality.", - "basic.color": "Converts the color name to a number", - "basic.rgb": "Converts red, green, blue channels into a RGB color", - "basic.rgb|param|blue": "value of the blue channel between 0 and 255. eg: 255", - "basic.rgb|param|green": "value of the green channel between 0 and 255. eg: 255", - "basic.rgb|param|red": "value of the red channel between 0 and 255. eg: 255", - "basic.setLedColor": "Sets the color on the built-in RGB LED. Set to 0 to turn off.", - "basic.setLedColorDal": "Sets the color on the built-in RGB LED. Set to 0 to turn off.", - "basic.setLedColorsCodal": "Sets the color on the built-in RGB LED. Set to 0 to turn off.", - "basic.setLedColorsCodal|param|brightness": "The LED brightness in percent.", - "basic.setLedColorsCodal|param|color1": "The color of the first LED in RGB format (e.g., 0xFF0000 for red).", - "basic.setLedColorsCodal|param|color2": "The second LED color.", - "basic.setLedColorsCodal|param|color3": "The third LED color.", - "basic.setLedColor|param|color": "The color of the LED in RGB format (e.g., 0xFF0000 for red).", - "basic.showCompass": "Draws needle on the screen which always points to north", - "basic.showCompass|param|interval": "the amount of time (milliseconds) to show the needle. Default is 600.", - "basic.turnRgbLedOff": "Sets the color on the built-in RGB LED. Set to 0 to turn off.", - "motors.dualMotorPowerDal": "Controls two motors attached to the board. Switches to dual-motor mode!", - "motors.motorCommandDal": "Send break, coast or sleep commands to the motor. Has no effect in dual-motor mode.", - "motors.motorPowerDal": "Turns on the motor at a certain percent of power. Switches to single motor mode!", - "motors.motorPowerDal|param|power": "%percent of power sent to the motor. Negative power goes backward. eg: 50" -} \ No newline at end of file diff --git a/libs/core-mini/_locales/core-mini-strings.json b/libs/core-mini/_locales/core-mini-strings.json deleted file mode 100644 index a9494232b..000000000 --- a/libs/core-mini/_locales/core-mini-strings.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "Colors.Blue|block": "blue", - "Colors.Green|block": "green", - "Colors.Indigo|block": "indigo", - "Colors.Off|block": "off", - "Colors.Orange|block": "orange", - "Colors.Purple|block": "purple", - "Colors.Red|block": "red", - "Colors.Violet|block": "violet", - "Colors.White|block": "white", - "Colors.Yellow|block": "yellow", - "Motor.M0_M1|block": "M0 & M1", - "Motor.M0|block": "M0", - "Motor.M1|block": "M1", - "MotorCommand.Break|block": "break", - "MotorCommand.Coast|block": "coast", - "MotorCommand.Sleep|block": "sleep", - "basic.color|block": "%c", - "basic.rgb|block": "red %red|green %green|blue %blue", - "basic.setLedColor|block": "set LED to %color=colorNumberPicker", - "basic.showCompass|block": "show compass needle for $interval|ms", - "basic.turnRgbLedOff|block": "turn built-in LED off", - "basic|block": "basic", - "motors|block": "motors", - "{id:category}Basic": "Basic", - "{id:category}Motors": "Motors", - "{id:group}LED matrix": "LED matrix", - "{id:group}RGB LED": "RGB LED" -} \ No newline at end of file diff --git a/libs/core-mini/enums.d.ts b/libs/core-mini/enums.d.ts deleted file mode 100644 index 3ac4c75d4..000000000 --- a/libs/core-mini/enums.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Auto-generated. Do not edit. - - - declare const enum MotorCommand { - //% block=coast - Coast = 0, - //% block=break - Break = 1, - //% block=sleep - Sleep = 2, - } - - - declare const enum Motor { - //% block="M0" - M0 = 0, - //% block="M1" - M1 = 1, - //% block="M0 & M1" - M0_M1 = 2, - } -declare namespace motors { -} -declare namespace basic { -} - -// Auto-generated. Do not edit. Really. diff --git a/libs/core-mini/pxt.json b/libs/core-mini/pxt.json deleted file mode 100644 index a54b3f71c..000000000 --- a/libs/core-mini/pxt.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "core-mini", - "description": "The mini core library", - "dependencies": { - "core": "file:../core" - }, - "hidden": true, - "files": [ - "shims.d.ts", - "enums.d.ts", - "compass.ts", - "motors.cpp", - "rgbled.cpp", - "rgbled.ts" - ] -} diff --git a/libs/core-mini/shims.d.ts b/libs/core-mini/shims.d.ts deleted file mode 100644 index da4109138..000000000 --- a/libs/core-mini/shims.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -// Auto-generated. Do not edit. - - - - //% color=#008272 weight=30 icon="\uf1b9" -declare namespace motors { - - /** - * Turns on the motor at a certain percent of power. Switches to single motor mode! - * @param power %percent of power sent to the motor. Negative power goes backward. eg: 50 - */ - //% blockId=motor_power_dal shim=motors::motorPowerDal - function motorPowerDal(power: int32): void; - - /** - * Send break, coast or sleep commands to the motor. Has no effect in dual-motor mode. - */ - //% blockId=motor_command_dal - //% hidden=1 shim=motors::motorCommandDal - function motorCommandDal(command: MotorCommand): void; - - /** - * Controls two motors attached to the board. Switches to dual-motor mode! - */ - //% blockId=dual_motor_power_dal - //% hidden=1 shim=motors::dualMotorPowerDal - function dualMotorPowerDal(motor: Motor, duty_percent: int32): void; -} - - - /** - * Provides access to basic calliope mini functionality. - */ - -declare namespace basic { - - /** - * Sets the color on the built-in RGB LED. Set to 0 to turn off. - */ - //% blockId=device_turn_rgb_led_off block="turn built-in LED off" - //% help=basic/turn-rgb-led-off - //% weight=10 - //% group="RGB LED" - //% advanced=true shim=basic::turnRgbLedOff - function turnRgbLedOff(): void; - - /** - * Sets the color on the built-in RGB LED. Set to 0 to turn off. - * @param color1 The color of the first LED in RGB format (e.g., 0xFF0000 for red). - */ - //% blockId=device_set_led_colors-dal - //% hidden=1 shim=basic::setLedColorDal - function setLedColorDal(color: int32): void; - - /** - * Sets the color on the built-in RGB LED. Set to 0 to turn off. - * @param color1 The color of the first LED in RGB format (e.g., 0xFF0000 for red). - * @param color2 The second LED color. - * @param color3 The third LED color. - * @param brightness The LED brightness in percent. - */ - //% blockId=device_set_led_colors-codal - //% hidden=1 brightness.defl=20 shim=basic::setLedColorsCodal - function setLedColorsCodal(color1: int32, color2: int32, color3: int32, brightness?: int32): void; - - /** - * Sets the color on the built-in RGB LED. Set to 0 to turn off. - * @param color The color of the LED in RGB format (e.g., 0xFF0000 for red). - */ - //% help=basic/set-led-color - //% blockId=device_set_led_color - //% block="set LED to %color=colorNumberPicker" - //% expandableArgumentMode="toggle" - //% - //% - //% - //% - //% weight=10 - //% group="RGB LED" color.defl=0xff0000 shim=basic::setLedColor - function setLedColor(color?: int32): void; -} - -// Auto-generated. Do not edit. Really. diff --git a/libs/core/_locales/core-jsdoc-strings.json b/libs/core/_locales/core-jsdoc-strings.json index 5d9851e13..276c479df 100644 --- a/libs/core/_locales/core-jsdoc-strings.json +++ b/libs/core/_locales/core-jsdoc-strings.json @@ -93,6 +93,7 @@ "Buffer.toString": "Convert a buffer to string assuming UTF8 encoding", "Buffer.unpack": "Reads numbers from the buffer according to the format", "Buffer.write": "Write contents of `src` at `dstOffset` in current buffer.", + "Colors": "Well known colors", "EventCreationMode": "How to create the event.", "EventCreationMode.CreateAndFire": "MicroBitEvent is initialised, and its event handlers are immediately fired (not suitable for use in interrupts!).", "EventCreationMode.CreateOnly": "MicroBitEvent is initialised, and no further processing takes place.", @@ -247,19 +248,34 @@ "_py.range|param|stop": "The value to end the sequence before. This value will not show up in the result", "_py.slice": "Returns a section of an array according to python's extended slice syntax", "_py.stringSlice": "Returns a section of a string according to python's extended slice syntax", - "basic": "Provides access to basic micro:bit functionality.\n\nProvides access to basic micro:bit functionality.", + "basic": "Provides access to basic Calliope mini functionality.\n\nProvides access to basic calliope mini functionality.\n\nProvides access to basic Calliope mini functionality.", "basic.clearScreen": "Turn off all LEDs", + "basic.color": "Converts the color name to a number", "basic.forever": "Repeats the code forever in the background. On each iteration, allows other codes to run.", "basic.pause": "Pause for the specified time in milliseconds", "basic.pause|param|ms": "how long to pause for, eg: 100, 200, 500, 1000, 2000", "basic.plotLeds": "Draws an image on the LED screen.", "basic.plotLeds|param|leds": "pattern of LEDs to turn on/off", + "basic.rgb": "Converts red, green, blue channels into a RGB color", + "basic.rgb|param|blue": "value of the blue channel between 0 and 255. eg: 255", + "basic.rgb|param|green": "value of the green channel between 0 and 255. eg: 255", + "basic.rgb|param|red": "value of the red channel between 0 and 255. eg: 255", + "basic.setLedColor": "Sets the color on the built-in RGB LED. Set to 0 to turn off.", + "basic.setLedColorDal": "Sets the color on the built-in RGB LED. Set to 0 to turn off.", + "basic.setLedColorsCodal": "Sets the color on the built-in RGB LED. Set to 0 to turn off.", + "basic.setLedColorsCodal|param|brightness": "The LED brightness in percent.", + "basic.setLedColorsCodal|param|color1": "The color of the first LED in RGB format (e.g., 0xFF0000 for red).", + "basic.setLedColorsCodal|param|color2": "The second LED color.", + "basic.setLedColorsCodal|param|color3": "The third LED color.", + "basic.setLedColor|param|color": "The color of the LED in RGB format (e.g., 0xFF0000 for red).", "basic.showAnimation": "Shows a sequence of LED screens as an animation.", "basic.showAnimation|param|interval": "time in milliseconds between each redraw.", "basic.showAnimation|param|leds": "pattern of LEDs to turn on/off", "basic.showArrow": "Draws an arrow on the LED screen", "basic.showArrow|param|direction": "the direction of the arrow", "basic.showArrow|param|interval": "the amount of time (milliseconds) to show the icon. Default is 600.", + "basic.showCompass": "Draws needle on the screen which always points to north", + "basic.showCompass|param|interval": "the amount of time (milliseconds) to show the needle. Default is 600.", "basic.showIcon": "Draws the selected icon on the LED screen", "basic.showIcon|param|icon": "the predefined icon id", "basic.showIcon|param|interval": "the amount of time (milliseconds) to block the LED Matrix for showing the icon. Default is 600.", @@ -271,6 +287,7 @@ "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: 50, 100, 150, 200", "basic.showString|param|text": "the text to scroll on the screen, eg: \"hi!\"", + "basic.turnRgbLedOff": "Sets the color on the built-in RGB LED. Set to 0 to turn off.", "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", @@ -319,7 +336,7 @@ "control.raiseEvent|param|src": "ID of the MicroBit Component that generated the event e.g. MICROBIT_ID_BUTTON_A.", "control.raiseEvent|param|value": "Component specific code indicating the cause of the event.", "control.ramSize": "Returns estimated size of memory in bytes.", - "control.reset": "Resets the BBC micro:bit.", + "control.reset": "Resets the Calliope mini.", "control.runInParallel": "Run other code in the parallel.", "control.runtimeWarning": "Display warning in the simulator.", "control.setDebugFlags": "Set flags used when connecting an external debugger.", @@ -427,6 +444,7 @@ "input.buttonIsPressed|param|button": "the button to query the request, eg: Button.A", "input.calibrateCompass": "Obsolete, compass calibration is automatic.", "input.compassHeading": "Get the current compass heading in degrees.", + "input.isCalibratedCompass": "Returns 'true' when the compass is calibrated. Otherwise returns 'false'.", "input.isGesture": "Tests if a gesture is currently detected.", "input.isGesture|param|gesture": "the type of gesture to detect, eg: Gesture.Shake", "input.lightLevel": "Reads the light level applied to the LED screen in a range from ``0`` (dark) to ``255`` bright.", @@ -439,7 +457,7 @@ "input.onButtonPressed": "Do something when a button (A, B or both A+B) is pushed down and released again.", "input.onButtonPressed|param|body": "code to run when event is raised", "input.onButtonPressed|param|button": "the button that needs to be pressed", - "input.onGesture": "Do something when when a gesture is done (like shaking the micro:bit).", + "input.onGesture": "Do something when when a gesture is done (like shaking the Calliope mini).", "input.onGesture|param|body": "code to run when gesture is raised", "input.onGesture|param|gesture": "the type of gesture to track, eg: Gesture.Shake", "input.onPinPressed": "Do something when a pin is touched and released again (while also touching the GND pin).", @@ -506,6 +524,10 @@ "light.setMode": "Sets the light mode of a pin", "loops.everyInterval": "Repeats the code forever in the background.\nAfter each iteration, allows other codes to run for a set duration\nso that it runs on a timer", "loops.everyInterval|param|interval": "time (in ms) to wait between each iteration of the action.", + "motors.dualMotorPowerDal": "Controls two motors attached to the board. Switches to dual-motor mode!", + "motors.motorCommandDal": "Send break, coast or sleep commands to the motor. Has no effect in dual-motor mode.", + "motors.motorPowerDal": "Turns on the motor at a certain percent of power. Switches to single motor mode!", + "motors.motorPowerDal|param|power": "%percent of power sent to the motor. Negative power goes backward. eg: 50", "msgpack.packNumberArray": "Pack a number array into a buffer.", "msgpack.packNumberArray|param|nums": "the numbers to be packed", "msgpack.unpackNumberArray": "Unpacks a buffer into a number array.", @@ -574,16 +596,16 @@ "pins.analogPitch|param|frequency": "frequency to modulate in Hz.", "pins.analogPitch|param|ms": "duration of the pitch in milli seconds.", "pins.analogReadPin": "Read the connector value as analog, that is, as a value comprised between 0 and 1023.", - "pins.analogReadPin|param|name": "pin to write to, eg: AnalogPin.P1", + "pins.analogReadPin|param|name": "pin to write to, eg: AnalogPin.P0", "pins.analogSetPeriod": "Configure the pulse-width modulation (PWM) period of the analog output in microseconds.\nIf this pin is not configured as an analog output (using `analog write pin`), the operation has no effect.", "pins.analogSetPeriod|param|micros": "period in micro seconds. eg:20000", - "pins.analogSetPeriod|param|name": "analog pin to set period to, eg: AnalogPin.P1", + "pins.analogSetPeriod|param|name": "analog pin to set period to, eg: AnalogPin.P0", "pins.analogSetPitchPin": "Set the pin used when using analog pitch or music.", "pins.analogSetPitchPin|param|name": "pin to modulate pitch from", "pins.analogSetPitchVolume": "Sets the volume on the pitch pin", "pins.analogSetPitchVolume|param|volume": "the intensity of the sound from 0..255", "pins.analogWritePin": "Set the connector value as analog. Value must be comprised between 0 and 1023.", - "pins.analogWritePin|param|name": "pin name to write to, eg: AnalogPin.P1", + "pins.analogWritePin|param|name": "pin name to write to, eg: AnalogPin.P0", "pins.analogWritePin|param|value": "value to write to the pin between ``0`` and ``1023``. eg:1023,0", "pins.createBuffer": "Create a new zero-initialized buffer.", "pins.createBuffer|param|size": "number of bytes in the buffer", @@ -615,7 +637,7 @@ "pins.servoSetPulse|param|micros": "pulse duration in micro seconds, eg:1500", "pins.servoSetPulse|param|name": "pin name", "pins.servoWritePin": "Write a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).", - "pins.servoWritePin|param|name": "pin to write to, eg: AnalogPin.P1", + "pins.servoWritePin|param|name": "pin to write to, eg: AnalogPin.P0", "pins.servoWritePin|param|value": "angle or rotation speed, eg:180,90,0", "pins.setAudioPin": "Set the pin used when producing sounds and melodies. Default is P0.", "pins.setAudioPinEnabled": "Sets whether or not audio will be output using a pin on the edge\nconnector.", diff --git a/libs/core/_locales/core-strings.json b/libs/core/_locales/core-strings.json index 4a5e497af..97aca9833 100644 --- a/libs/core/_locales/core-strings.json +++ b/libs/core/_locales/core-strings.json @@ -78,6 +78,16 @@ "ButtonEvent.Hold|block": "hold", "ButtonEvent.LongClick|block": "long clicked", "ButtonEvent.Up|block": "released up", + "Colors.Blue|block": "blue", + "Colors.Green|block": "green", + "Colors.Indigo|block": "indigo", + "Colors.Off|block": "off", + "Colors.Orange|block": "orange", + "Colors.Purple|block": "purple", + "Colors.Red|block": "red", + "Colors.Violet|block": "violet", + "Colors.White|block": "white", + "Colors.Yellow|block": "yellow", "Delimiters.CarriageReturn|block": "carriage return (\r)", "Delimiters.Colon|block": ":", "Delimiters.Comma|block": ",", @@ -232,6 +242,12 @@ "MesDpadButtonInfo._3Up|block": "3 up", "MesDpadButtonInfo._4Down|block": "4 down", "MesDpadButtonInfo._4Up|block": "4 up", + "Motor.M0_M1|block": "M0 & M1", + "Motor.M0|block": "M0", + "Motor.M1|block": "M1", + "MotorCommand.Break|block": "break", + "MotorCommand.Coast|block": "coast", + "MotorCommand.Sleep|block": "sleep", "MusicEvent.BackgroundMelodyEnded|block": "background melody ended", "MusicEvent.BackgroundMelodyNotePlayed|block": "background melody note played", "MusicEvent.BackgroundMelodyPaused|block": "background melody paused", @@ -283,13 +299,18 @@ "String|block": "String", "_py|block": "_py", "basic.clearScreen|block": "clear screen", + "basic.color|block": "%c", "basic.forever|block": "forever", "basic.pause|block": "pause (ms) %pause", + "basic.rgb|block": "red %red|green %green|blue %blue", + "basic.setLedColor|block": "set LED to %color=colorNumberPicker", "basic.showArrow|block": "show arrow %i=device_arrow", + "basic.showCompass|block": "show compass needle for $interval|ms", "basic.showIcon|block": "show icon %i || for %interval ms", "basic.showLeds|block": "show leds", "basic.showNumber|block": "show|number %number || in an interval of %interval ms", "basic.showString|block": "show|string %text || in an interval of %interval ms", + "basic.turnRgbLedOff|block": "turn built-in LED off", "basic|block": "basic", "console|block": "console", "control.deviceName|block": "device name", @@ -345,6 +366,7 @@ "input.buttonIsPressed|block": "button|%NAME|is pressed", "input.calibrateCompass|block": "calibrate compass", "input.compassHeading|block": "compass heading (°)", + "input.isCalibratedCompass|block": "is compass calibrated", "input.isGesture|block": "is %gesture gesture", "input.lightLevel|block": "light level", "input.magneticForce|block": "magnetic force (µT)|%NAME", @@ -378,6 +400,7 @@ "light|block": "light", "loops.everyInterval|block": "every $interval ms", "loops|block": "loops", + "motors|block": "motors", "msgpack|block": "msgpack", "music.beat|block": "%fraction|beat", "music.builtInMelody|block": "%melody", @@ -466,6 +489,7 @@ "{id:category}Loops": "Loops", "{id:category}Math": "Math", "{id:category}MicrobitPin": "MicrobitPin", + "{id:category}Motors": "Motors", "{id:category}Msgpack": "Msgpack", "{id:category}Music": "Music", "{id:category}Number": "Number", @@ -488,6 +512,7 @@ "{id:group}Operations": "Operations", "{id:group}Pitch": "Pitch", "{id:group}Pulse": "Pulse", + "{id:group}RGB LED": "RGB LED", "{id:group}Read": "Read", "{id:group}Sensors": "Sensors", "{id:group}Servo": "Servo", diff --git a/libs/core/basic.cpp b/libs/core/basic.cpp index adbfac6b8..3a9df4684 100644 --- a/libs/core/basic.cpp +++ b/libs/core/basic.cpp @@ -2,7 +2,7 @@ /** - * Provides access to basic micro:bit functionality. + * Provides access to basic Calliope mini functionality. */ namespace basic { diff --git a/libs/core/basic.ts b/libs/core/basic.ts index f28235433..b2605cecc 100644 --- a/libs/core/basic.ts +++ b/libs/core/basic.ts @@ -1,5 +1,5 @@ /** - * Provides access to basic micro:bit functionality. + * Provides access to basic Calliope mini functionality. */ //% color=#54C9C9 weight=100 icon="\uf00a" //% groups=['LED matrix', 'Control', 'RGB LED', 'others'] diff --git a/libs/core-mini/compass.ts b/libs/core/compass.ts similarity index 100% rename from libs/core-mini/compass.ts rename to libs/core/compass.ts diff --git a/libs/core/control.cpp b/libs/core/control.cpp index da2a4fc22..aaa245fea 100644 --- a/libs/core/control.cpp +++ b/libs/core/control.cpp @@ -263,7 +263,7 @@ namespace control { } /** - * Resets the BBC micro:bit. + * Resets the Calliope mini. */ //% weight=30 async help=control/reset blockGap=8 //% blockId="control_reset" block="reset" diff --git a/libs/core/enums.d.ts b/libs/core/enums.d.ts index 9a945e48e..519f3311f 100644 --- a/libs/core/enums.d.ts +++ b/libs/core/enums.d.ts @@ -738,4 +738,28 @@ declare namespace input { declare namespace serial { } + + declare const enum MotorCommand { + //% block=coast + Coast = 0, + //% block=break + Break = 1, + //% block=sleep + Sleep = 2, + } + + + declare const enum Motor { + //% block="M0" + M0 = 0, + //% block="M1" + M1 = 1, + //% block="M0 & M1" + M0_M1 = 2, + } +declare namespace motors { +} +declare namespace basic { +} + // Auto-generated. Do not edit. Really. diff --git a/libs/core/input.cpp b/libs/core/input.cpp index 0665edee5..5a437edeb 100644 --- a/libs/core/input.cpp +++ b/libs/core/input.cpp @@ -187,7 +187,7 @@ namespace input { } /** - * Do something when when a gesture is done (like shaking the micro:bit). + * Do something when when a gesture is done (like shaking the Calliope mini). * @param gesture the type of gesture to track, eg: Gesture.Shake * @param body code to run when gesture is raised */ @@ -438,4 +438,17 @@ namespace input { void setAccelerometerRange(AcceleratorRange range) { uBit.accelerometer.setRange((int)range); } + + /** + * Returns 'true' when the compass is calibrated. Otherwise returns 'false'. + */ + //% help=input/calibrate-compass advanced=true + //% blockId="input_compass_is_calibrated" block="is compass calibrated" + //% weight=19 + //% group="System" + //% deprecated=true + bool isCalibratedCompass() { + return (uBit.compass.isCalibrated() == 1); + } + } diff --git a/libs/core/microphone.cpp b/libs/core/microphone.cpp index 0a9d479ca..21979d0da 100644 --- a/libs/core/microphone.cpp +++ b/libs/core/microphone.cpp @@ -15,7 +15,7 @@ namespace input { * Reads the loudness through the microphone from 0 (silent) to 255 (loud) */ //% help=input/sound-level -//% blockId=device_get_sound_level block="sound level" +//% blockId=soundLevel block="sound level" //% parts="microphone" //% weight=34 blockGap=8 //% group="Sound" @@ -48,4 +48,5 @@ int soundLevel() { return level; #endif } + } \ No newline at end of file diff --git a/libs/core-mini/motors.cpp b/libs/core/motors.cpp similarity index 100% rename from libs/core-mini/motors.cpp rename to libs/core/motors.cpp diff --git a/libs/core/pins.cpp b/libs/core/pins.cpp index e2b91d999..ed7472f00 100644 --- a/libs/core/pins.cpp +++ b/libs/core/pins.cpp @@ -334,7 +334,7 @@ namespace pins { /** * Read the connector value as analog, that is, as a value comprised between 0 and 1023. - * @param name pin to write to, eg: AnalogPin.P1 + * @param name pin to write to, eg: AnalogPin.P0 */ //% help=pins/analog-read-pin weight=25 //% blockId=device_get_analog_pin block="analog read|pin %name" blockGap="8" @@ -347,7 +347,7 @@ namespace pins { /** * Set the connector value as analog. Value must be comprised between 0 and 1023. - * @param name pin name to write to, eg: AnalogPin.P1 + * @param name pin name to write to, eg: AnalogPin.P0 * @param value value to write to the pin between ``0`` and ``1023``. eg:1023,0 */ //% help=pins/analog-write-pin weight=24 @@ -363,7 +363,7 @@ namespace pins { /** * Configure the pulse-width modulation (PWM) period of the analog output in microseconds. * If this pin is not configured as an analog output (using `analog write pin`), the operation has no effect. - * @param name analog pin to set period to, eg: AnalogPin.P1 + * @param name analog pin to set period to, eg: AnalogPin.P0 * @param micros period in micro seconds. eg:20000 */ //% help=pins/analog-set-period weight=23 blockGap=8 @@ -465,7 +465,7 @@ namespace pins { /** * Write a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement). - * @param name pin to write to, eg: AnalogPin.P1 + * @param name pin to write to, eg: AnalogPin.P0 * @param value angle or rotation speed, eg:180,90,0 */ //% help=pins/servo-write-pin weight=20 @@ -671,7 +671,7 @@ namespace pins { /** * Set the matrix width for Neopixel strip (already assigned to a pin). * Should be used in conjunction with `set matrix width` from Neopixel package. - * @param name pin of Neopixel strip, eg: DigitalPin.P1 + * @param name pin of Neopixel strip, eg: DigitalPin.P0 * @param value width of matrix (at least ``2``) */ //% help=pins/neopixel-matrix-width weight=3 advanced=true diff --git a/libs/core/pxt.json b/libs/core/pxt.json index ebda2813f..83f8dfd55 100644 --- a/libs/core/pxt.json +++ b/libs/core/pxt.json @@ -65,6 +65,10 @@ "sendbufferbrightness.s", "light.cpp", "loops.ts", + "compass.ts", + "motors.cpp", + "rgbled.cpp", + "rgbled.ts", "_locales/de/core-jsdoc-strings.json", "_locales/de/core-strings.json", "soundexpressions.cpp", diff --git a/libs/core-mini/rgbled.cpp b/libs/core/rgbled.cpp similarity index 83% rename from libs/core-mini/rgbled.cpp rename to libs/core/rgbled.cpp index 34c8aabcc..694b5f988 100644 --- a/libs/core-mini/rgbled.cpp +++ b/libs/core/rgbled.cpp @@ -8,7 +8,7 @@ namespace basic { // Define an array to hold RGB LED data uint8_t rgbBuffer[9] = {0}; - // Call this function once to initialize the micro:bit board + // Call this function once to initialize the Calliope mini board // void initializeMicroBit() { // uBit.init(); // } @@ -66,17 +66,17 @@ namespace basic { void setLedColorsCodal(int color1, int color2, int color3, int brightness = 20) { #if MICROBIT_CODAL // Extract RGB components from the color values - int r1 = ((color1 >> 16) & 0xFF) / 100 * brightness; - int g1 = ((color1 >> 8) & 0xFF) / 100 * brightness; - int b1 = (color1 & 0xFF) / 100 * brightness; + int r1 = ((color1 >> 16) & 0xFF) * brightness / 100; + int g1 = ((color1 >> 8) & 0xFF) * brightness / 100; + int b1 = (color1 & 0xFF) * brightness / 100; - int r2 = ((color2 >> 16) & 0xFF) / 100 * brightness; - int g2 = ((color2 >> 8) & 0xFF) / 100 * brightness; - int b2 = (color2 & 0xFF) / 100 * brightness; + int r2 = ((color2 >> 16) & 0xFF) * brightness / 100; + int g2 = ((color2 >> 8) & 0xFF) * brightness / 100; + int b2 = (color2 & 0xFF) * brightness / 100; - int r3 = ((color3 >> 16) & 0xFF) / 100 * brightness; - int g3 = ((color3 >> 8) & 0xFF) / 100 * brightness; - int b3 = (color3 & 0xFF) / 100 * brightness; + int r3 = ((color3 >> 16) & 0xFF) * brightness / 100; + int g3 = ((color3 >> 8) & 0xFF) * brightness / 100; + int b3 = (color3 & 0xFF) * brightness / 100; memset(rgbBuffer, 0, sizeof(rgbBuffer)); // Clear the buffer rgbBuffer[0] = g1; diff --git a/libs/core-mini/rgbled.ts b/libs/core/rgbled.ts similarity index 96% rename from libs/core-mini/rgbled.ts rename to libs/core/rgbled.ts index 75a516412..1445a8b23 100644 --- a/libs/core-mini/rgbled.ts +++ b/libs/core/rgbled.ts @@ -35,7 +35,7 @@ enum Colors { } /** - * Provides access to basic micro:bit functionality. + * Provides access to basic Calliope mini functionality. */ //% color=#54C9C9 weight=100 icon="\uf00a" //% groups=['LED matrix', 'Control', 'RGB LED', 'others'] diff --git a/libs/core/shims.d.ts b/libs/core/shims.d.ts index aabb21cf0..c58f78446 100644 --- a/libs/core/shims.d.ts +++ b/libs/core/shims.d.ts @@ -127,7 +127,7 @@ declare interface Image { /** - * Provides access to basic micro:bit functionality. + * Provides access to basic Calliope mini functionality. */ declare namespace basic { @@ -232,7 +232,7 @@ declare namespace input { function onButtonEvent(button: Button, eventType: int32, body: () => void): void; /** - * Do something when when a gesture is done (like shaking the micro:bit). + * Do something when when a gesture is done (like shaking the Calliope mini). * @param gesture the type of gesture to track, eg: Gesture.Shake * @param body code to run when gesture is raised */ @@ -402,6 +402,16 @@ declare namespace input { //% advanced=true //% group="Configuration" shim=input::setAccelerometerRange function setAccelerometerRange(range: AcceleratorRange): void; + + /** + * Returns 'true' when the compass is calibrated. Otherwise returns 'false'. + */ + //% help=input/calibrate-compass advanced=true + //% blockId="input_compass_is_calibrated" block="is compass calibrated" + //% weight=19 + //% group="System" + //% deprecated=true shim=input::isCalibratedCompass + function isCalibratedCompass(): boolean; } @@ -438,7 +448,7 @@ declare namespace control { function waitForEvent(src: int32, value: int32): void; /** - * Resets the BBC micro:bit. + * Resets the Calliope mini. */ //% weight=30 async help=control/reset blockGap=8 //% blockId="control_reset" block="reset" shim=control::reset @@ -701,7 +711,7 @@ declare namespace input { * Reads the loudness through the microphone from 0 (silent) to 255 (loud) */ //% help=input/sound-level - //% blockId=device_get_sound_level block="sound level" + //% blockId=soundLevel block="sound level" //% parts="microphone" //% weight=34 blockGap=8 //% group="Sound" shim=input::soundLevel @@ -746,7 +756,7 @@ declare namespace pins { /** * Read the connector value as analog, that is, as a value comprised between 0 and 1023. - * @param name pin to write to, eg: AnalogPin.P1 + * @param name pin to write to, eg: AnalogPin.P0 */ //% help=pins/analog-read-pin weight=25 //% blockId=device_get_analog_pin block="analog read|pin %name" blockGap="8" @@ -757,7 +767,7 @@ declare namespace pins { /** * Set the connector value as analog. Value must be comprised between 0 and 1023. - * @param name pin name to write to, eg: AnalogPin.P1 + * @param name pin name to write to, eg: AnalogPin.P0 * @param value value to write to the pin between ``0`` and ``1023``. eg:1023,0 */ //% help=pins/analog-write-pin weight=24 @@ -771,7 +781,7 @@ declare namespace pins { /** * Configure the pulse-width modulation (PWM) period of the analog output in microseconds. * If this pin is not configured as an analog output (using `analog write pin`), the operation has no effect. - * @param name analog pin to set period to, eg: AnalogPin.P1 + * @param name analog pin to set period to, eg: AnalogPin.P0 * @param micros period in micro seconds. eg:20000 */ //% help=pins/analog-set-period weight=23 blockGap=8 @@ -818,7 +828,7 @@ declare namespace pins { /** * Write a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement). - * @param name pin to write to, eg: AnalogPin.P1 + * @param name pin to write to, eg: AnalogPin.P0 * @param value angle or rotation speed, eg:180,90,0 */ //% help=pins/servo-write-pin weight=20 @@ -929,7 +939,7 @@ declare namespace pins { /** * Set the matrix width for Neopixel strip (already assigned to a pin). * Should be used in conjunction with `set matrix width` from Neopixel package. - * @param name pin of Neopixel strip, eg: DigitalPin.P1 + * @param name pin of Neopixel strip, eg: DigitalPin.P0 * @param value width of matrix (at least ``2``) */ //% help=pins/neopixel-matrix-width weight=3 advanced=true @@ -1279,6 +1289,86 @@ declare namespace light { //% shim=light::setMode function setMode(pin: int32, mode: int32): void; } + + + + //% color=#008272 weight=30 icon="\uf1b9" +declare namespace motors { + + /** + * Turns on the motor at a certain percent of power. Switches to single motor mode! + * @param power %percent of power sent to the motor. Negative power goes backward. eg: 50 + */ + //% blockId=motor_power_dal shim=motors::motorPowerDal + function motorPowerDal(power: int32): void; + + /** + * Send break, coast or sleep commands to the motor. Has no effect in dual-motor mode. + */ + //% blockId=motor_command_dal + //% hidden=1 shim=motors::motorCommandDal + function motorCommandDal(command: MotorCommand): void; + + /** + * Controls two motors attached to the board. Switches to dual-motor mode! + */ + //% blockId=dual_motor_power_dal + //% hidden=1 shim=motors::dualMotorPowerDal + function dualMotorPowerDal(motor: Motor, duty_percent: int32): void; +} + + + /** + * Provides access to basic calliope mini functionality. + */ + +declare namespace basic { + + /** + * Sets the color on the built-in RGB LED. Set to 0 to turn off. + */ + //% blockId=device_turn_rgb_led_off block="turn built-in LED off" + //% help=basic/turn-rgb-led-off + //% weight=10 + //% group="RGB LED" + //% advanced=true shim=basic::turnRgbLedOff + function turnRgbLedOff(): void; + + /** + * Sets the color on the built-in RGB LED. Set to 0 to turn off. + * @param color1 The color of the first LED in RGB format (e.g., 0xFF0000 for red). + */ + //% blockId=device_set_led_colors-dal + //% hidden=1 shim=basic::setLedColorDal + function setLedColorDal(color: int32): void; + + /** + * Sets the color on the built-in RGB LED. Set to 0 to turn off. + * @param color1 The color of the first LED in RGB format (e.g., 0xFF0000 for red). + * @param color2 The second LED color. + * @param color3 The third LED color. + * @param brightness The LED brightness in percent. + */ + //% blockId=device_set_led_colors-codal + //% hidden=1 brightness.defl=20 shim=basic::setLedColorsCodal + function setLedColorsCodal(color1: int32, color2: int32, color3: int32, brightness?: int32): void; + + /** + * Sets the color on the built-in RGB LED. Set to 0 to turn off. + * @param color The color of the LED in RGB format (e.g., 0xFF0000 for red). + */ + //% help=basic/set-led-color + //% blockId=device_set_led_color + //% block="set LED to %color=colorNumberPicker" + //% expandableArgumentMode="toggle" + //% + //% + //% + //% + //% weight=10 + //% group="RGB LED" color.defl=0xff0000 shim=basic::setLedColor + function setLedColor(color?: int32): void; +} declare namespace music { /** diff --git a/libs/datalogger/docs/reference/datalogger.md b/libs/datalogger/docs/reference/datalogger.md index d19569135..6b5edcf7e 100644 --- a/libs/datalogger/docs/reference/datalogger.md +++ b/libs/datalogger/docs/reference/datalogger.md @@ -4,11 +4,11 @@ The Datalogger extension logs user data to the flash storage on the @boardname@. ### ~ reminder -#### Works with micro:bit V2 +#### Works with Calliope mini 3 -![works with micro:bit V2 only image](/static/v2/v2-only.png) +![works with Calliope mini 3 only image](/static/v2/v2-only.png) -Using these blocks requires the [micro:bit V2](/device/v2) hardware. If you use any blocks that attempt access flash memory on a micro:bit v1 board, you will see the **927** error code on the screen. +Using these blocks requires the [Calliope mini 3](/device/v2) hardware. If you use any blocks that attempt access flash memory on a Calliope mini 1 or 2 board, you will see the **927** error code on the screen. ### ~ diff --git a/libs/datalogger/pxt.json b/libs/datalogger/pxt.json index 7c09634a2..c940328e0 100644 --- a/libs/datalogger/pxt.json +++ b/libs/datalogger/pxt.json @@ -6,7 +6,8 @@ ], "public": true, "disablesVariants": [ - "minidal" + "minidal", + "minidalusb" ], "icon": "./static/packages/datalogger/icon.png", "dependencies": { diff --git a/libs/devices/_locales/devices-jsdoc-strings.json b/libs/devices/_locales/devices-jsdoc-strings.json index 42cc20e60..e99e1a7dc 100644 --- a/libs/devices/_locales/devices-jsdoc-strings.json +++ b/libs/devices/_locales/devices-jsdoc-strings.json @@ -1,6 +1,6 @@ { - "devices": "Control a phone with the BBC micro:bit via Bluetooth.", - "devices.onGamepadButton": "Register code to run when the micro:bit receives a command from the paired gamepad.", + "devices": "Control a phone with the Calliope mini via Bluetooth.", + "devices.onGamepadButton": "Register code to run when the Calliope mini receives a command from the paired gamepad.", "devices.onGamepadButton|param|body": "code to run when button is pressed", "devices.onGamepadButton|param|name": "button name", "devices.onNotified": "Registers code to run when the device notifies about a particular event.", diff --git a/libs/devices/devices.cpp b/libs/devices/devices.cpp index abd050765..4d1ab13ee 100644 --- a/libs/devices/devices.cpp +++ b/libs/devices/devices.cpp @@ -86,7 +86,7 @@ enum class MesRemoteControlEvent { }; /** - * Control a phone with the BBC micro:bit via Bluetooth. + * Control a phone with the Calliope mini via Bluetooth. */ //% color=#008272 weight=80 icon="\uf10b" namespace devices { diff --git a/libs/devices/devices.ts b/libs/devices/devices.ts index fbf63bc7e..59492da68 100644 --- a/libs/devices/devices.ts +++ b/libs/devices/devices.ts @@ -42,7 +42,7 @@ namespace devices { } /** - * Register code to run when the micro:bit receives a command from the paired gamepad. + * Register code to run when the Calliope mini receives a command from the paired gamepad. * @param name button name * @param body code to run when button is pressed */ diff --git a/libs/devices/shims.d.ts b/libs/devices/shims.d.ts index 7860dc4af..103fa13c1 100644 --- a/libs/devices/shims.d.ts +++ b/libs/devices/shims.d.ts @@ -2,7 +2,7 @@ /** - * Control a phone with the BBC micro:bit via Bluetooth. + * Control a phone with the Calliope mini via Bluetooth. */ //% color=#008272 weight=80 icon="\uf10b" declare namespace devices { diff --git a/libs/flashlog/pxt.json b/libs/flashlog/pxt.json index 347fd23c5..e5579aa5e 100644 --- a/libs/flashlog/pxt.json +++ b/libs/flashlog/pxt.json @@ -13,7 +13,8 @@ "searchOnly": true, "public": true, "disablesVariants": [ - "minidal" + "minidal", + "minidalusb" ], "dependencies": { "core": "file:../core" diff --git a/libs/microphone/pxt.json b/libs/microphone/pxt.json index 00547f0bd..db09c2ac3 100644 --- a/libs/microphone/pxt.json +++ b/libs/microphone/pxt.json @@ -6,7 +6,8 @@ "core": "file:../core" }, "disablesVariants": [ - "minidal" + "minidal", + "minidalusb" ], "icon": "./static/packages/microphone/icon.png" } \ No newline at end of file diff --git a/libs/settings/pxt.json b/libs/settings/pxt.json index d93a41c3a..53fe94ad7 100644 --- a/libs/settings/pxt.json +++ b/libs/settings/pxt.json @@ -1,7 +1,8 @@ { "hidden": true, "disablesVariants": [ - "minidal" + "minidal", + "minidalusb" ], "additionalFilePath": "../../node_modules/pxt-common-packages/libs/settings" } \ No newline at end of file diff --git a/libs/v1/pxt.json b/libs/v1/pxt.json index 7653d5fb6..3ce782597 100644 --- a/libs/v1/pxt.json +++ b/libs/v1/pxt.json @@ -2,9 +2,10 @@ "name": "v1", "version": "1.0.0", "description": "Calliope mini 1", - "compileServiceVariant": "minidal", + "compileServiceVariant": "minidalusb", "disablesVariants": [ - "minicodal" + "minicodal", + "minidal" ], "core": true, "dependencies": { diff --git a/libs/v2/pxt.json b/libs/v2/pxt.json index 0fa41156b..2ef663251 100644 --- a/libs/v2/pxt.json +++ b/libs/v2/pxt.json @@ -4,7 +4,8 @@ "description": "Calliope mini 2", "compileServiceVariant": "minidal", "disablesVariants": [ - "minicodal" + "minicodal", + "minidalusb" ], "core": true, "dependencies": { diff --git a/libs/v3/pxt.json b/libs/v3/pxt.json index dc40da6ff..0ac2870fd 100644 --- a/libs/v3/pxt.json +++ b/libs/v3/pxt.json @@ -4,7 +4,8 @@ "core": true, "compileServiceVariant": "minicodal", "disablesVariants": [ - "minidal" + "minidal", + "minidalusb" ], "dependencies": { "core": "file:../core", diff --git a/pxtarget.json b/pxtarget.json index be2f476a3..ee5b9c1d6 100644 --- a/pxtarget.json +++ b/pxtarget.json @@ -7,7 +7,6 @@ "corepkg": "v1", "bundleddirs": [ "libs/core", - "libs/core-mini", "libs/core-mini-dal", "libs/core-mini-codal", "libs/v1", @@ -134,6 +133,17 @@ "input\\s*\\.\\s*onButtonEvent\\s*\\(\\s*(.*?),\\s*ButtonEvent\\s*.\\s*(.*?),": "input.onButtonEvent($1, input.buttonEventValue(ButtonEvent.$2)," } } + ], + "0.0.0 - 5.0.0": [ + { + "type": "api", + "map": { + "input\\s*\\.\\s*loudness\\s*\\(": "input.soundLevel(", + "Motor\\s*\\.\\s*AB": "Motor.M0_M1", + "Motor\\s*\\.\\s*A": "Motor.M0", + "Motor\\s*\\.\\s*B": "Motor.M1" + } + } ] }, "hidSelectors": [{ @@ -161,6 +171,14 @@ "compileService": { } }, + "minidalusb": { + "compile": { + "useUF2": false, + "webUSB": true + }, + "compileService": { + } + }, "minicodal": { "compile": { "flashCodeAlign": 4096, diff --git a/sim/state/edgeconnector.ts b/sim/state/edgeconnector.ts index 1baacd33c..ff687eb4d 100644 --- a/sim/state/edgeconnector.ts +++ b/sim/state/edgeconnector.ts @@ -27,7 +27,8 @@ namespace pxsim.pins { let pin = getPin(pinId); if (!pin) return -1; pin.mode = PinFlags.Digital | PinFlags.Input; - return pin.value > 100 ? 1 : 0; + console.log(pin.value) + return pin.value >= 1 ? 1 : 0; } export function digitalWritePin(pinId: number, value: number) { diff --git a/targetconfig.json b/targetconfig.json index 94030335d..006bb8ca6 100644 --- a/targetconfig.json +++ b/targetconfig.json @@ -211,7 +211,7 @@ "vengit/pxt-sbrick", "CalliTGS3/pxt-calliope-grovePCF85063TP", "calliope-net/i2c-liste", - "amerlander/pxt-storage" + "calliope-edu/pxt-storage" ], "preferredRepos": [ "calliope-edu/CO2-Sensor-SCD40", @@ -253,7 +253,7 @@ "Microsoft/pxt-microturtle", "Microsoft/pxt-neopixel", "calliope-net/i2c-liste", - "amerlander/pxt-storage" + "calliope-edu/pxt-storage" ], "approvedRepoLib": { "calliope-edu/co2-sensor-scd40": { @@ -766,7 +766,7 @@ }, "calliope-net/i2c-liste": {}, "vengit/pxt-sbrick": {}, - "amerlander/pxt-storage": {"preferred": true} + "calliope-edu/pxt-storage": {"preferred": true} }, "approvedEditorExtensionUrls": [ "https://microsoft.github.io/jacdac-docs/tools/makecode-editor-extension"