Skip to content

Commit

Permalink
V6.0.25 updates (#261)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Amerlander authored Nov 22, 2023
1 parent 7bb4530 commit 6b427d6
Show file tree
Hide file tree
Showing 63 changed files with 361 additions and 375 deletions.
2 changes: 1 addition & 1 deletion docs/beta-ref.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"appref": "v6.0.24"
"appref": "v"
}
2 changes: 0 additions & 2 deletions docs/device/usb.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
33 changes: 33 additions & 0 deletions docs/docs.md
Original file line number Diff line number Diff line change
@@ -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)

1 change: 1 addition & 0 deletions docs/domains.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- @include domains-template.html -->
7 changes: 1 addition & 6 deletions docs/static/icons/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "makecode.microbit.org",
"name": "makecode.calliope.cc",
"icons": [
{
"src": "\/android-chrome-36x36.png",
Expand All @@ -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",
Expand Down
34 changes: 31 additions & 3 deletions editor/patch.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
/**
* <block type="device_show_leds">
Expand Down Expand Up @@ -196,6 +223,7 @@ arrowImageNodes.forEach(node => {


if (pxt.semver.majorCmp(pkgTargetVersion || "0.0.0", "5.0.12") <= 0) {

// Eighth note misspelling
/*
<block type="basic_show_icon">
Expand Down
8 changes: 4 additions & 4 deletions libs/audio-recording/docs/reference/audio-recording.md
Original file line number Diff line number Diff line change
@@ -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.

### ~

Expand Down
8 changes: 4 additions & 4 deletions libs/audio-recording/docs/reference/record.md
Original file line number Diff line number Diff line change
@@ -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.

### ~

Expand Down
2 changes: 1 addition & 1 deletion libs/audio-recording/docs/reference/record/play-audio.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
4 changes: 2 additions & 2 deletions libs/audio-recording/docs/reference/record/start-recording.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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 () {
Expand Down
3 changes: 2 additions & 1 deletion libs/audio-recording/pxt.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
],
"public": true,
"disablesVariants": [
"minidal"
"minidal",
"minidalusb"
],
"icon": "./static/packages/microphone/icon.png"
}
4 changes: 2 additions & 2 deletions libs/bluetooth/_locales/bluetooth-jsdoc-strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
4 changes: 2 additions & 2 deletions libs/bluetooth/bluetooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions libs/bluetooth/shims.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion libs/color/_locales/color-jsdoc-strings.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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).",
Expand Down
2 changes: 1 addition & 1 deletion libs/core-mini-codal/_locales/core-mini-codal-strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion libs/core-mini-codal/pxt.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"description": "The mini codal core library",
"dependencies": {
"core": "file:../core",
"core-mini": "file:../core-mini",
"microphone": "file:../microphone"
},
"disablesVariants": [
Expand Down
2 changes: 1 addition & 1 deletion libs/core-mini-codal/rgbled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions libs/core-mini-dal/_locales/core-mini-dal-jsdoc-strings.json
Original file line number Diff line number Diff line change
@@ -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).",
Expand All @@ -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.",
Expand Down
5 changes: 1 addition & 4 deletions libs/core-mini-dal/_locales/core-mini-dal-strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
}
15 changes: 2 additions & 13 deletions libs/core-mini-dal/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,14 @@
//% 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.
*/
//% help=input/calibrate-compass advanced=true
//% blockId="input_compass_clear_calibration" block="clear calibration compass"
//% weight=17
//% group="Configuration"
//% blockHidden=true
//% blockHidden=true deprecated=true
void clearCalibrationCompass() {
uBit.compass.clearCalibration();
}
Expand All @@ -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();
}
Expand Down
15 changes: 0 additions & 15 deletions libs/core-mini-dal/microphone.ts

This file was deleted.

4 changes: 1 addition & 3 deletions libs/core-mini-dal/pxt.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -12,7 +11,6 @@
"files": [
"shims.d.ts",
"enums.d.ts",
"microphone.ts",
"motors.ts",
"parts/dcmotor.svg",
"input.cpp",
Expand Down
Loading

0 comments on commit 6b427d6

Please sign in to comment.