Compare commits

...

7 Commits

Author SHA1 Message Date
peli
7b303b0fd2 3.0.28 2020-09-11 02:19:51 -07:00
Amerlander
9cfba7504a 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>
2020-09-11 02:19:33 -07:00
peli
d57b67e52e 3.0.27 2020-09-10 00:25:08 -07:00
Amerlander
79517f8a30 Fix Sound (#114)
* change simulator svg

* change radio image

* Remove google fonts cdn

* change color of 'advanced' button

* font fix

* font fix 2

* display fix

* change fullsceen simulator bg

* Continuous servo

* handle continuous state

* adding shims

* update rendering for continuous servos

* fixing sim

* fix sig

* typo

* fix sim

* bump pxt

* bump pxt

* rerun travis

* Input blocks revision

- add Button and Pin event types
- merge onPinPressed & onPinReleased in new onPinEvent function
- create new onButtonEvent function

* update input blocks in docs and tests

* remove device_pin_release block

* Hide DAL.x behind Enum

* bring back deprecated blocks, but hide them

* shims and locales files

* fix input.input. typing

* remove buildpr

* bump V3

* update simulator aspect ratio

* add Loudness Block

* revoke loudness block

* Adds soundLevel

To be replaced by pxt-common-packages when DAL is updated.

* Remove P0 & P3 from AnalogPin

* Fix Sound and replace AnalogPin.P0

Co-authored-by: Juri <gitkraken@juriwolf.de>
2020-09-10 00:24:06 -07:00
peli
17b1953889 add workspace 2020-09-09 01:00:03 -07:00
peli
33e6fbbcb2 3.0.26 2020-09-08 11:02:05 -07:00
peli
9a7bf30e80 disable docs checking 2020-09-08 11:01:55 -07:00
12 changed files with 328 additions and 40 deletions

View File

@@ -396,6 +396,8 @@
"images": "Creation, manipulation and display of LED images.",
"images.createBigImage": "Creates an image with 2 frames.",
"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.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",
@@ -553,16 +555,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.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|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|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.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.createBuffer": "Create a new zero-initialized 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|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.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.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",

View File

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

@@ -200,7 +200,7 @@ namespace music {
//% group="Tone"
export function playTone(frequency: number, ms: number): void {
if (_playTone) _playTone(frequency, ms);
else pins.analogPitch(frequency, ms);
else speakerPlayTone(frequency, ms);
}
/**
@@ -482,6 +482,7 @@ namespace music {
//% help=music/set-volume
//% weight=70
//% group="Volume"
//% deprecated=true
export function setVolume(volume: number): void {
pins.analogSetPitchVolume(volume);
}
@@ -494,6 +495,7 @@ namespace music {
//% help=music/volume
//% weight=69
//% group="Volume"
//% deprecated=true
export function volume(): number {
return pins.analogPitchVolume();
}

View File

@@ -138,7 +138,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.P0
* @param name pin to write to, eg: AnalogPin.P1
*/
//% help=pins/analog-read-pin weight=25
//% blockId=device_get_analog_pin block="analog read|pin %name" blockGap="8"
@@ -150,7 +150,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.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
*/
//% help=pins/analog-write-pin weight=24
@@ -165,7 +165,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.P0
* @param name analog pin to set period to, eg: AnalogPin.P1
* @param micros period in micro seconds. eg:20000
*/
//% help=pins/analog-set-period weight=23 blockGap=8
@@ -248,7 +248,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.P0
* @param name pin to write to, eg: AnalogPin.P1
* @param value angle or rotation speed, eg:180,90,0
*/
//% help=pins/servo-write-pin weight=20
@@ -342,7 +342,7 @@ namespace pins {
void analogPitch(int frequency, int ms) {
// init pins if needed
if (NULL == pitchPin) {
pitchPin = getPin((int)DigitalPin::P0);
pitchPin = getPin((int)DigitalPin::P1);
#ifdef SOUND_MIRROR_EXTENSION
pitchPin2 = &SOUND_MIRROR_EXTENSION;
#endif

View File

@@ -56,6 +56,7 @@
"templates.ts",
"sendbuffer.s",
"light.cpp",
"compass.ts",
"parts/speaker.svg",
"parts/headphone.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.
* @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
//% 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.
* @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
*/
//% 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.
* 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
*/
//% 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).
* @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
*/
//% help=pins/servo-write-pin weight=20

12
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "pxt-calliope",
"version": "3.0.25",
"version": "3.0.28",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -405,7 +405,6 @@
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz",
"integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=",
"optional": true,
"requires": {
"hoek": "2.x.x"
}
@@ -2096,8 +2095,7 @@
"hoek": {
"version": "2.16.3",
"resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz",
"integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=",
"optional": true
"integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0="
},
"hsl-regex": {
"version": "1.0.0",
@@ -4324,9 +4322,9 @@
}
},
"pxt-core": {
"version": "6.0.20",
"resolved": "https://registry.npmjs.org/pxt-core/-/pxt-core-6.0.20.tgz",
"integrity": "sha512-dugQC1/10P72exsR3Ed3vGuK8rLkP3+NjrWE+NrLqSH9064Fl20d1fGe8yHGjlbPYyKACDjJeX3fZy1Y12GzEA==",
"version": "6.0.23",
"resolved": "https://registry.npmjs.org/pxt-core/-/pxt-core-6.0.23.tgz",
"integrity": "sha512-3RYVuojjcN3AkFxivFnjRkghknXGbfVGYwkzdx6UGLlr4c+AtZqKJf9SNV0eJBDpQEukpe4DXEct7ADWHtXwoA==",
"requires": {
"applicationinsights-js": "^1.0.20",
"bluebird": "3.5.1",

View File

@@ -1,6 +1,6 @@
{
"name": "pxt-calliope",
"version": "3.0.25",
"version": "3.0.28",
"description": "micro:bit target for Microsoft MakeCode (PXT)",
"keywords": [
"JavaScript",

View File

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

View File

@@ -196,18 +196,32 @@
"daferdur/pxt-myHX711",
"CytronTechnologies/pxt-edubit",
"MakeAndLearn/pxt-microshield",
"elecfreaks/pxt-TPBot"
],
"preferredRepos": [
"Microsoft/pxt-neopixel",
"elecfreaks/pxt-TPBot",
"calliope-edu/pxt-grove",
"tinysuperlab/motionkit",
"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",
"MKleinSB/pxt-OLED-SSD1306",
"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": {

View File

@@ -130,7 +130,7 @@ function readSensor(): number {
// Produce a sensor value in range 0..1023
if (sensorType == "ANALOG") {
// Input range is 0..1023
value = pins.analogReadPin(AnalogPin.P0)
value = pins.analogReadPin(AnalogPin.P1)
} else if (sensorType == "TILT") {
// Input range is -1024 (pads highest)..1023 (pads lowest)
value = input.acceleration(Dimension.Y)