Changes to the Beta (#115)

* fixes for beta

- hide blocks without function
- digital Pin selection bring P0 in first position
- add compass block to end confusion about "basic.showArrow(ArrowNames.North)"
- add approved repos
- add and sort preffered repos
- add prefferedPackages
- disable webUSB
- disable parts
- remove mobileSafariDownloadProtocol
- update socialOptions

* remove `preferredPackages` from `pxtarget`

Co-authored-by: Juri <gitkraken@juriwolf.de>
This commit is contained in:
Amerlander 2020-09-11 11:19:33 +02:00 committed by GitHub
parent d57b67e52e
commit 9cfba7504a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 322 additions and 33 deletions

View File

@ -396,6 +396,8 @@
"images": "Creation, manipulation and display of LED images.", "images": "Creation, manipulation and display of LED images.",
"images.createBigImage": "Creates an image with 2 frames.", "images.createBigImage": "Creates an image with 2 frames.",
"images.createImage": "Creates an image that fits on the LED screen.", "images.createImage": "Creates an image that fits on the LED screen.",
"images.showCompass": "Draws needle on the screen which always points to north",
"images.showCompass|param|interval": "the amount of time (milliseconds) to show the needle. Default is 600.",
"input": "Events and data from sensors", "input": "Events and data from sensors",
"input.acceleration": "Get the acceleration value in milli-gravitys (when the board is laying flat with the screen up, x=0, y=0 and z=-1024)", "input.acceleration": "Get the acceleration value in milli-gravitys (when the board is laying flat with the screen up, x=0, y=0 and z=-1024)",
"input.acceleration|param|dimension": "x, y, or z dimension, eg: Dimension.X", "input.acceleration|param|dimension": "x, y, or z dimension, eg: Dimension.X",
@ -553,16 +555,16 @@
"pins.analogPitch|param|frequency": "frequency to modulate in Hz.", "pins.analogPitch|param|frequency": "frequency to modulate in Hz.",
"pins.analogPitch|param|ms": "duration of the pitch in milli seconds.", "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": "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.P0", "pins.analogReadPin|param|name": "pin to write to, eg: AnalogPin.P1",
"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": "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|micros": "period in micro seconds. eg:20000",
"pins.analogSetPeriod|param|name": "analog pin to set period to, eg: AnalogPin.P0", "pins.analogSetPeriod|param|name": "analog pin to set period to, eg: AnalogPin.P1",
"pins.analogSetPitchPin": "Set the pin used when using analog pitch or music.", "pins.analogSetPitchPin": "Set the pin used when using analog pitch or music.",
"pins.analogSetPitchPin|param|name": "pin to modulate pitch from", "pins.analogSetPitchPin|param|name": "pin to modulate pitch from",
"pins.analogSetPitchVolume": "Sets the volume on the pitch pin", "pins.analogSetPitchVolume": "Sets the volume on the pitch pin",
"pins.analogSetPitchVolume|param|volume": "the intensity of the sound from 0..255", "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": "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.P0", "pins.analogWritePin|param|name": "pin name to write to, eg: AnalogPin.P1",
"pins.analogWritePin|param|value": "value to write to the pin between ``0`` and ``1023``. eg:1023,0", "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": "Create a new zero-initialized buffer.",
"pins.createBuffer|param|size": "number of bytes in the buffer", "pins.createBuffer|param|size": "number of bytes in the buffer",
@ -594,7 +596,7 @@
"pins.servoSetPulse|param|micros": "pulse duration in micro seconds, eg:1500", "pins.servoSetPulse|param|micros": "pulse duration in micro seconds, eg:1500",
"pins.servoSetPulse|param|name": "pin name", "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": "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.P0", "pins.servoWritePin|param|name": "pin to write to, eg: AnalogPin.P1",
"pins.servoWritePin|param|value": "angle or rotation speed, eg:180,90,0", "pins.servoWritePin|param|value": "angle or rotation speed, eg:180,90,0",
"pins.setEvents": "Configure the events emitted by this pin. Events can be subscribed to\nusing ``control.onEvent()``.", "pins.setEvents": "Configure the events emitted by this pin. Events can be subscribed to\nusing ``control.onEvent()``.",
"pins.setEvents|param|name": "pin to set the event mode on, eg: DigitalPin.P0", "pins.setEvents|param|name": "pin to set the event mode on, eg: DigitalPin.P0",

View File

@ -310,6 +310,7 @@
"images.createBigImage|block": "create big image", "images.createBigImage|block": "create big image",
"images.createImage|block": "create image", "images.createImage|block": "create image",
"images.iconImage|block": "icon image %i", "images.iconImage|block": "icon image %i",
"images.showCompass|block": "show compass needle for $interval|ms",
"images|block": "images", "images|block": "images",
"input.acceleration|block": "acceleration (mg)|%NAME", "input.acceleration|block": "acceleration (mg)|%NAME",
"input.buttonIsPressed|block": "button|%NAME|is pressed", "input.buttonIsPressed|block": "button|%NAME|is pressed",

273
libs/core/compass.ts Normal file
View File

@ -0,0 +1,273 @@
let compassImages = [
images.createImage(`
. . # . .
. . . . .
. . # . .
. . . . .
. . . . .
`),
images.createImage(`
. # . . .
. . . . .
. . # . .
. . . . .
. . . . .
`),
images.createImage(`
# . . . .
. . . . .
. . # . .
. . . . .
. . . . .
`),
images.createImage(`
. . . . .
# . . . .
. . # . .
. . . . .
. . . . .
`),
images.createImage(`
. . . . .
. . . . .
# . # . .
. . . . .
. . . . .
`),
images.createImage(`
. . . . .
. . . . .
. . # . .
# . . . .
. . . . .
`),
images.createImage(`
. . . . .
. . . . .
. . # . .
. . . . .
# . . . .
`),
images.createImage(`
. . . . .
. . . . .
. . # . .
. . . . .
. # . . .
`),
images.createImage(`
. . . . .
. . . . .
. . # . .
. . . . .
. . # . .
`),
images.createImage(`
. . . . .
. . . . .
. . # . .
. . . . .
. . . # .
`),
images.createImage(`
. . . . .
. . . . .
. . # . .
. . . . .
. . . . #
`),
images.createImage(`
. . . . .
. . . . .
. . # . .
. . . . #
. . . . .
`),
images.createImage(`
. . . . .
. . . . .
. . # . #
. . . . .
. . . . .
`),
images.createImage(`
. . . . .
. . . . #
. . # . .
. . . . .
. . . . .
`),
images.createImage(`
. . . . #
. . . . .
. . # . .
. . . . .
. . . . .
`),
images.createImage(`
. . . # .
. . . . .
. . # . .
. . . . .
. . . . .
`)];
let compassImagesDownside = [
images.createImage(`
. . . . .
. . . . .
. . # . .
. . . . .
. . # . .
`),
images.createImage(`
. . . . .
. . . . .
. . # . .
. . . . .
. . . # .
`),
images.createImage(`
. . . . .
. . . . .
. . # . .
. . . . .
. . . . #
`),
images.createImage(`
. . . . .
. . . . .
. . # . .
. . . . #
. . . . .
`),
images.createImage(`
. . . . .
. . . . .
. . # . #
. . . . .
. . . . .
`),
images.createImage(`
. . . . .
. . . . #
. . # . .
. . . . .
. . . . .
`),
images.createImage(`
. . . . #
. . . . .
. . # . .
. . . . .
. . . . .
`),
images.createImage(`
. . . # .
. . . . .
. . # . .
. . . . .
. . . . .
`),
images.createImage(`
. . # . .
. . . . .
. . # . .
. . . . .
. . . . .
`),
images.createImage(`
. # . . .
. . . . .
. . # . .
. . . . .
. . . . .
`),
images.createImage(`
# . . . .
. . . . .
. . # . .
. . . . .
. . . . .
`),
images.createImage(`
. . . . .
# . . . .
. . # . .
. . . . .
. . . . .
`),
images.createImage(`
. . . . .
. . . . .
# . # . .
. . . . .
. . . . .
`),
images.createImage(`
. . . . .
. . . . .
. . # . .
# . . . .
. . . . .
`),
images.createImage(`
. . . . .
. . . . .
. . # . .
. . . . .
# . . . .
`),
images.createImage(`
. . . . .
. . . . .
. . # . .
. . . . .
. # . . .
`)];
namespace images {
/**
* Draws needle on the screen which always points to north
* @param interval the amount of time (milliseconds) to show the needle. Default is 600.
*/
//% weight=50 blockGap=8
//% blockId=basic_show_compass
//% block="show compass needle for $interval|ms"
//% interval.shadow=timePicker
//% interval.min=1
//% interval.defl=600
//% parts="ledmatrix"
//% advanced=true
export function showCompass(interval = 600) {
let i = 0
let startTime = input.runningTime()
let endTime = startTime + interval
let refreshRate = 100
let rest = 0
while ((endTime) > (input.runningTime() + refreshRate)) {
i = Math.round((input.compassHeading() - 11.25) / 22.5)
if (input.isGesture(Gesture.ScreenDown)) {
compassImagesDownside[i].showImage(0, refreshRate)
} else {
compassImages[i].showImage(0, refreshRate)
}
}
rest = (endTime - input.runningTime())
if(rest > 0) {
i = Math.round((input.compassHeading() - 11.25) / 22.5)
if (input.isGesture(Gesture.ScreenDown)) {
compassImagesDownside[i].showImage(0, rest)
} else {
compassImages[i].showImage(0, rest)
}
}
}
}

View File

@ -482,6 +482,7 @@ namespace music {
//% help=music/set-volume //% help=music/set-volume
//% weight=70 //% weight=70
//% group="Volume" //% group="Volume"
//% deprecated=true
export function setVolume(volume: number): void { export function setVolume(volume: number): void {
pins.analogSetPitchVolume(volume); pins.analogSetPitchVolume(volume);
} }
@ -494,6 +495,7 @@ namespace music {
//% help=music/volume //% help=music/volume
//% weight=69 //% weight=69
//% group="Volume" //% group="Volume"
//% deprecated=true
export function volume(): number { export function volume(): number {
return pins.analogPitchVolume(); return pins.analogPitchVolume();
} }

View File

@ -112,7 +112,7 @@ namespace pins {
/** /**
* Read the specified pin or connector as either 0 or 1 * Read the specified pin or connector as either 0 or 1
* @param name pin to read from, eg: DigitalPin.P1 * @param name pin to read from, eg: DigitalPin.P0
*/ */
//% help=pins/digital-read-pin weight=30 //% help=pins/digital-read-pin weight=30
//% blockId=device_get_digital_pin block="digital read|pin %name" blockGap=8 //% blockId=device_get_digital_pin block="digital read|pin %name" blockGap=8
@ -124,7 +124,7 @@ namespace pins {
/** /**
* Set a pin or connector value to either 0 or 1. * Set a pin or connector value to either 0 or 1.
* @param name pin to write to, eg: DigitalPin.P1 * @param name pin to write to, eg: DigitalPin.P0
* @param value value to set on the pin, 1 eg,0 * @param value value to set on the pin, 1 eg,0
*/ */
//% help=pins/digital-write-pin weight=29 //% help=pins/digital-write-pin weight=29
@ -178,7 +178,7 @@ namespace pins {
/** /**
* Configure the pin as a digital input and generate an event when the pin is pulsed either high or low. * Configure the pin as a digital input and generate an event when the pin is pulsed either high or low.
* @param name digital pin to register to, eg: DigitalPin.P1 * @param name digital pin to register to, eg: DigitalPin.P0
* @param pulse the value of the pulse, eg: PulseValue.High * @param pulse the value of the pulse, eg: PulseValue.High
*/ */
//% help=pins/on-pulsed weight=22 blockGap=16 advanced=true //% help=pins/on-pulsed weight=22 blockGap=16 advanced=true
@ -205,7 +205,7 @@ namespace pins {
/** /**
* Return the duration of a pulse at a pin in microseconds. * Return the duration of a pulse at a pin in microseconds.
* @param name the pin which measures the pulse, eg: DigitalPin.P1 * @param name the pin which measures the pulse, eg: DigitalPin.P0
* @param value the value of the pulse, eg: PulseValue.High * @param value the value of the pulse, eg: PulseValue.High
* @param maximum duration in microseconds * @param maximum duration in microseconds
*/ */
@ -366,7 +366,7 @@ namespace pins {
/** /**
* Configure the pull directiion of of a pin. * Configure the pull directiion of of a pin.
* @param name pin to set the pull mode on, eg: DigitalPin.P1 * @param name pin to set the pull mode on, eg: DigitalPin.P0
* @param pull one of the mbed pull configurations, eg: PinPullMode.PullUp * @param pull one of the mbed pull configurations, eg: PinPullMode.PullUp
*/ */
//% help=pins/set-pull weight=3 advanced=true //% help=pins/set-pull weight=3 advanced=true
@ -392,7 +392,7 @@ namespace pins {
/** /**
* Configure the events emitted by this pin. Events can be subscribed to * Configure the events emitted by this pin. Events can be subscribed to
* using ``control.onEvent()``. * using ``control.onEvent()``.
* @param name pin to set the event mode on, eg: DigitalPin.P1 * @param name pin to set the event mode on, eg: DigitalPin.P0
* @param type the type of events for this pin to emit, eg: PinEventType.Edge * @param type the type of events for this pin to emit, eg: PinEventType.Edge
*/ */
//% help=pins/set-events weight=4 advanced=true //% help=pins/set-events weight=4 advanced=true

View File

@ -56,6 +56,7 @@
"templates.ts", "templates.ts",
"sendbuffer.s", "sendbuffer.s",
"light.cpp", "light.cpp",
"compass.ts",
"parts/speaker.svg", "parts/speaker.svg",
"parts/headphone.svg", "parts/headphone.svg",
"parts/dcmotor.svg", "parts/dcmotor.svg",

View File

@ -662,7 +662,7 @@ declare namespace pins {
/** /**
* Read the connector value as analog, that is, as a value comprised between 0 and 1023. * Read the connector value as analog, that is, as a value comprised between 0 and 1023.
* @param name pin to write to, eg: AnalogPin.P0 * @param name pin to write to, eg: AnalogPin.P1
*/ */
//% help=pins/analog-read-pin weight=25 //% help=pins/analog-read-pin weight=25
//% blockId=device_get_analog_pin block="analog read|pin %name" blockGap="8" //% blockId=device_get_analog_pin block="analog read|pin %name" blockGap="8"
@ -672,7 +672,7 @@ declare namespace pins {
/** /**
* Set the connector value as analog. Value must be comprised between 0 and 1023. * Set the connector value as analog. Value must be comprised between 0 and 1023.
* @param name pin name to write to, eg: AnalogPin.P0 * @param name pin name to write to, eg: AnalogPin.P1
* @param value value to write to the pin between ``0`` and ``1023``. eg:1023,0 * @param value value to write to the pin between ``0`` and ``1023``. eg:1023,0
*/ */
//% help=pins/analog-write-pin weight=24 //% help=pins/analog-write-pin weight=24
@ -685,7 +685,7 @@ declare namespace pins {
/** /**
* Configure the pulse-width modulation (PWM) period of the analog output in microseconds. * 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. * 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.P0 * @param name analog pin to set period to, eg: AnalogPin.P1
* @param micros period in micro seconds. eg:20000 * @param micros period in micro seconds. eg:20000
*/ */
//% help=pins/analog-set-period weight=23 blockGap=8 //% help=pins/analog-set-period weight=23 blockGap=8
@ -728,7 +728,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). * 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.P0 * @param name pin to write to, eg: AnalogPin.P1
* @param value angle or rotation speed, eg:180,90,0 * @param value angle or rotation speed, eg:180,90,0
*/ */
//% help=pins/servo-write-pin weight=20 //% help=pins/servo-write-pin weight=20

6
package-lock.json generated
View File

@ -4322,9 +4322,9 @@
} }
}, },
"pxt-core": { "pxt-core": {
"version": "6.0.20", "version": "6.0.23",
"resolved": "https://registry.npmjs.org/pxt-core/-/pxt-core-6.0.20.tgz", "resolved": "https://registry.npmjs.org/pxt-core/-/pxt-core-6.0.23.tgz",
"integrity": "sha512-dugQC1/10P72exsR3Ed3vGuK8rLkP3+NjrWE+NrLqSH9064Fl20d1fGe8yHGjlbPYyKACDjJeX3fZy1Y12GzEA==", "integrity": "sha512-3RYVuojjcN3AkFxivFnjRkghknXGbfVGYwkzdx6UGLlr4c+AtZqKJf9SNV0eJBDpQEukpe4DXEct7ADWHtXwoA==",
"requires": { "requires": {
"applicationinsights-js": "^1.0.20", "applicationinsights-js": "^1.0.20",
"bluebird": "3.5.1", "bluebird": "3.5.1",

View File

@ -21,9 +21,6 @@
"thumbnails": true, "thumbnails": true,
"publishing": true, "publishing": true,
"importing": true, "importing": true,
"preferredPackages": [
"Microsoft/pxt-neopixel"
],
"githubPackages": true, "githubPackages": true,
"cloudProviders": { "cloudProviders": {
"github": {} "github": {}
@ -113,7 +110,7 @@
"pid": "0x1025" "pid": "0x1025"
} }
], ],
"webUSB": true, "webUSB": false,
"useNewFunctions": true "useNewFunctions": true
}, },
"compileService": { "compileService": {
@ -159,7 +156,7 @@
"autoRun": true, "autoRun": true,
"streams": false, "streams": false,
"aspectRatio": 1.13, "aspectRatio": 1.13,
"parts": true, "parts": false,
"partsAspectRatio": 0.69, "partsAspectRatio": 0.69,
"boardDefinition": { "boardDefinition": {
"visual": "calliope", "visual": "calliope",
@ -313,7 +310,6 @@
"boardName": "Calliope mini", "boardName": "Calliope mini",
"driveDisplayName": "MINI", "driveDisplayName": "MINI",
"appStoreID": "1309545545", "appStoreID": "1309545545",
"mobileSafariDownloadProtocol": "microbithex://?data",
"crowdinProject": "kindscript", "crowdinProject": "kindscript",
"extendEditor": true, "extendEditor": true,
"extendFieldEditors": true, "extendFieldEditors": true,
@ -357,10 +353,10 @@
"monacoToolbox": true, "monacoToolbox": true,
"hasAudio": true, "hasAudio": true,
"socialOptions": { "socialOptions": {
"orgTwitterHandle": "MSMakeCode", "orgTwitterHandle": "calliopemini",
"hashtags": "MakeCode", "hashtags": "calliopemini",
"discourse": "https://forum.makecode.com/", "discourse": "https://forum.calliope.cc",
"discourseCategory": "micro:bit" "discourseCategory": "Probleme-Software"
}, },
"blocklyOptions": { "blocklyOptions": {
"grid": { "grid": {

View File

@ -196,18 +196,32 @@
"daferdur/pxt-myHX711", "daferdur/pxt-myHX711",
"CytronTechnologies/pxt-edubit", "CytronTechnologies/pxt-edubit",
"MakeAndLearn/pxt-microshield", "MakeAndLearn/pxt-microshield",
"elecfreaks/pxt-TPBot" "elecfreaks/pxt-TPBot",
],
"preferredRepos": [
"Microsoft/pxt-neopixel",
"calliope-edu/pxt-grove", "calliope-edu/pxt-grove",
"tinysuperlab/motionkit", "tinysuperlab/motionkit",
"tinysuperlab/touchkit", "tinysuperlab/touchkit",
"MKleinSB/pxt-seeed-temperature",
"MKleinSB/pxt-iot-lora-node-calliope",
"MKleinSB/pxt-dht11",
"MKleinSB/pxt-esp-thingspeak",
"MKleinSB/pxt-neopixel-calliope",
"MKleinSB/pxt-OLED-SSD1306"
],
"preferredRepos": [
"tinysuperlab/motionkit",
"tinysuperlab/touchkit",
"calliope-edu/pxt-grove",
"Microsoft/pxt-neopixel",
"Microsoft/pxt-microturtle", "Microsoft/pxt-microturtle",
"MKleinSB/pxt-OLED-SSD1306", "MKleinSB/pxt-OLED-SSD1306",
"MKleinSB/pxt-iot-lora-node", "MKleinSB/pxt-iot-lora-node",
"kittenbot/pxt-robotbit", "MKleinSB/pxt-foldio",
"MKleinSB/pxt-foldio" "MKleinSB/pxt-seeed-temperature",
"MKleinSB/pxt-iot-lora-node-calliope",
"MKleinSB/pxt-dht11",
"MKleinSB/pxt-esp-thingspeak",
"MKleinSB/pxt-neopixel-calliope",
"kittenbot/pxt-robotbit"
] ]
}, },
"galleries": { "galleries": {