From cd5e5d55bc87e43b7f52c466fd335a212432b15c Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Thu, 2 Feb 2017 23:16:28 -0800 Subject: [PATCH 01/37] Bump pxt-core to 0.11.10 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7a8eef87..910e7dfd 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,6 @@ "semantic-ui-less": "^2.2.4" }, "dependencies": { - "pxt-core": "0.10.15" + "pxt-core": "0.11.10" } } From 969ecee5b55c0965ae1ee0e476a150c646573972 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Thu, 2 Feb 2017 23:16:33 -0800 Subject: [PATCH 02/37] 0.8.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 910e7dfd..3ba1cd06 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pxt-calliope", - "version": "0.8.3", + "version": "0.8.4", "description": "Calliope Mini editor for PXT", "keywords": [ "JavaScript", From fcfcf901aaeeb1f88c0d498c74efc3f79088a910 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Thu, 2 Feb 2017 23:23:52 -0800 Subject: [PATCH 03/37] Bump pxt-core to 0.11.11 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3ba1cd06..833aa511 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,6 @@ "semantic-ui-less": "^2.2.4" }, "dependencies": { - "pxt-core": "0.11.10" + "pxt-core": "0.11.11" } } From b984af2130747dd2ec2f2af229120af41483f956 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Thu, 2 Feb 2017 23:23:55 -0800 Subject: [PATCH 04/37] 0.8.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 833aa511..1c64dd8c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pxt-calliope", - "version": "0.8.4", + "version": "0.8.5", "description": "Calliope Mini editor for PXT", "keywords": [ "JavaScript", From 8fe328b2e861a58fb9cfebfe915021c0fb845ea8 Mon Sep 17 00:00:00 2001 From: "Matthias L. Jugel" Date: Fri, 3 Feb 2017 17:26:04 +0100 Subject: [PATCH 05/37] add some safety test codes to the production test --- pxtarget.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pxtarget.json b/pxtarget.json index 38c17c16..58ee9530 100644 --- a/pxtarget.json +++ b/pxtarget.json @@ -170,7 +170,7 @@ "yottaTarget": "bbc-microbit-classic-gcc", "yottaCorePackage": "microbit", "githubCorePackage": "calliope-mini/microbit", - "gittag": "2.0.0-rc7-calliope-p2", + "gittag": "2.0.0-rc7-calliope-p3", "serviceId": "microbit" }, "serial": { From f2ccad6c26318e654540b9e82b89b0722b611cbc Mon Sep 17 00:00:00 2001 From: "Matthias L. Jugel" Date: Fri, 3 Feb 2017 17:26:29 +0100 Subject: [PATCH 06/37] 0.8.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1c64dd8c..35d344db 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pxt-calliope", - "version": "0.8.5", + "version": "0.8.6", "description": "Calliope Mini editor for PXT", "keywords": [ "JavaScript", From a39067a0f46d12663a0bd6b6541d8883934afeca Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 3 Feb 2017 16:03:17 -0800 Subject: [PATCH 07/37] enable sharing --- pxtarget.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pxtarget.json b/pxtarget.json index 58ee9530..a0c9928b 100644 --- a/pxtarget.json +++ b/pxtarget.json @@ -15,7 +15,7 @@ "workspace": false, "packages": true, "sharing": true, - "publish": true, + "publishing": true, "preferredPackages": [ ], "githubPackages": true From a1104010e415bc95bcfba6d080d42e459b6ce8cd Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 3 Feb 2017 16:04:32 -0800 Subject: [PATCH 08/37] Bump pxt-core to 0.11.13 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 35d344db..5a2cdeb2 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,6 @@ "semantic-ui-less": "^2.2.4" }, "dependencies": { - "pxt-core": "0.11.11" + "pxt-core": "0.11.13" } } From 7a741622a9f942284904024f20ee81a4b8b5067d Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 3 Feb 2017 16:04:35 -0800 Subject: [PATCH 09/37] 0.8.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5a2cdeb2..62f6e91b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pxt-calliope", - "version": "0.8.6", + "version": "0.8.7", "description": "Calliope Mini editor for PXT", "keywords": [ "JavaScript", From b31d6188f946c4c65c061d67ed49e5f3b7ea2f5f Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 3 Feb 2017 16:19:22 -0800 Subject: [PATCH 10/37] added jenkins --- jenkins.groovy | 32 ++++++++++++++++++++++++++++ jenkins.sh | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 3 +++ travis-tests.sh | 1 - 4 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 jenkins.groovy create mode 100644 jenkins.sh diff --git a/jenkins.groovy b/jenkins.groovy new file mode 100644 index 00000000..193e506e --- /dev/null +++ b/jenkins.groovy @@ -0,0 +1,32 @@ +import jobs.generation.Utilities; +import jobs.generation.InternalUtilities; + +def project = GithubProject +def branch = GithubBranchName + +[true, false].each { isPR -> + def newJobName = InternalUtilities.getFullJobName(project, "Default", isPR) + def newJob = job(newJobName) { + steps { + shell("./jenkins.sh ${isPR}") + } + + if (!isPR) { + wrappers { + credentialsBinding { + string('PXT_ACCESS_TOKEN', 'pxt_access_token') + string('PXT_RELEASE_REPO', 'pxt_release_repo_calliope') + } + } + } + } + + Utilities.setMachineAffinity(newJob, 'Ubuntu', '20161020') + InternalUtilities.standardJobSetup(newJob, project, isPR, "*/*") + + if (isPR) { + Utilities.addGithubPRTrigger(newJob, "Default Testing") + } else { + Utilities.addGithubPushTrigger(newJob) + } +} diff --git a/jenkins.sh b/jenkins.sh new file mode 100644 index 00000000..2e8e964b --- /dev/null +++ b/jenkins.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +# Set up NVM +export NVM_DIR="/home/dotnet-bot/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" + +nvm install 5 + +# Set up build environment variables +echo ---------- Setting build environment variables +echo Git branch: $GIT_BRANCH +echo isPR: $1 + +originRegex="^origin/.*" +branchRegex="^origin/\K.*(?=$)" + +if [[ "$GIT_BRANCH" =~ $originRegex ]]; then + branchName=$(echo ${GIT_BRANCH} | grep -oP $branchRegex) + echo Setting TRAVIS_BRANCH to ${branchName} + export TRAVIS_BRANCH=${branchName} +else + echo Setting TRAVIS_BRANCH to $GIT_BRANCH + export TRAVIS_BRANCH=$GIT_BRANCH +fi + +if [ "$1" == "false" ]; then + echo Setting TRAVIS_PULL_REQUEST to false + export TRAVIS_PULL_REQUEST=false + + if [ $TRAVIS_BRANCH == "master" ]; then + if [[ -z $PXT_RELEASE_REPO ]]; then + echo Cannot find release repo; skipping tag checks + else + gitTag=$(git describe --tags --exact-match 2> /dev/null) + builtTag=$(git ls-remote --tags $PXT_RELEASE_REPO | grep -o "refs/tags/$gitTag$") + + echo Current tag: $gitTag + echo Built tag: $builtTag + + if [[ ! -z $gitTag && -z $builtTag ]]; then + echo Built tag not found; building tag + echo Setting TRAVIS_BRANCH to $gitTag + export TRAVIS_BRANCH=$gitTag + echo Setting TRAVIS_TAG to $gitTag + export TRAVIS_TAG=$gitTag + else + echo Not a tag build + fi + fi + fi +fi + +# Perform build +npm install +npm test diff --git a/package.json b/package.json index 62f6e91b..7458224d 100644 --- a/package.json +++ b/package.json @@ -35,5 +35,8 @@ }, "dependencies": { "pxt-core": "0.11.13" + }, + "scripts": { + "test": "node node_modules/pxt-core/built/pxt.js travis" } } diff --git a/travis-tests.sh b/travis-tests.sh index bcc0c613..f1b58d3c 100755 --- a/travis-tests.sh +++ b/travis-tests.sh @@ -7,4 +7,3 @@ export KS_FORCE_CLOUD=yes (cd libs/lang-test0; node ../../node_modules/pxt-core/built/pxt.js test) (cd libs/lang-test1; node ../../node_modules/pxt-core/built/pxt.js test) node node_modules/pxt-core/built/pxt.js testdir tests -(cd libs/hello; node ../../node_modules/pxt-core/built/pxt.js testconv https://az851932.vo.msecnd.net/files/td-converter-tests-v1.json) From 4376d3cefedfa649c20b7244663e4c00ed823554 Mon Sep 17 00:00:00 2001 From: "Matthias L. Jugel" Date: Sat, 4 Feb 2017 14:26:21 +0100 Subject: [PATCH 11/37] fix typos, fix accelerometer --- libs/calliope-test/calliope.ts | 6 +++--- libs/core/_locales/core-strings.json | 10 +++++----- pxtarget.json | 2 +- sim/state/accelerometer.ts | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libs/calliope-test/calliope.ts b/libs/calliope-test/calliope.ts index 2b7b5dad..5fa3f3b9 100644 --- a/libs/calliope-test/calliope.ts +++ b/libs/calliope-test/calliope.ts @@ -138,7 +138,7 @@ function getNoteName(frequency: number): string { } } -var notes = [ +let notes = [ note(Note.E, BeatFraction.Quarter), note(Note.E, BeatFraction.Quarter), note(Note.F, BeatFraction.Quarter), note(Note.G, BeatFraction.Quarter), note(Note.G, BeatFraction.Quarter), note(Note.F, BeatFraction.Quarter), note(Note.E, BeatFraction.Quarter), note(Note.D, BeatFraction.Quarter), note(Note.C, BeatFraction.Quarter), @@ -166,8 +166,8 @@ var notes = [ note(Note.C, BeatFraction.Eighth), note(Note.C, BeatFraction.Half) ]; -for (var t = 0; t < notes.length; t++) { +for (let t = 0; t < notes.length; t++) { music.playTone(notes[t][0], notes[t][1]); basic.showString(getNoteName(notes[t][0])); music.rest(whole - notes[t][1]); -} \ No newline at end of file +} diff --git a/libs/core/_locales/core-strings.json b/libs/core/_locales/core-strings.json index 5e5444b0..ea60d955 100644 --- a/libs/core/_locales/core-strings.json +++ b/libs/core/_locales/core-strings.json @@ -88,13 +88,13 @@ "PinPullMode.PullUp|block": "up", "Rotation.Pitch|block": "pitch", "Rotation.Roll|block": "roll", - "String.charAt|block": "char from %this|at %pos", - "String.compare|block": "compare %this| to %that", - "String.concat|block": "join %this|%other", + "String.charAt|block": "char from %this=text|at %pos", + "String.compare|block": "compare %this=text| to %that", + "String.concat|block": "join %this=text|%other", "String.fromCharCode|block": "text from char code %code", - "String.isEmpty|block": "%this| is empty", + "String.isEmpty|block": "%this=text| is empty", "String.length|block": "length of %VALUE", - "String.substr|block": "substring of %this|from %start|of length %length", + "String.substr|block": "substring of %this=text|from %start|of length %length", "String|block": "String", "basic.clearScreen|block": "clear screen", "basic.color|block": "%c", diff --git a/pxtarget.json b/pxtarget.json index a0c9928b..0108b70e 100644 --- a/pxtarget.json +++ b/pxtarget.json @@ -170,7 +170,7 @@ "yottaTarget": "bbc-microbit-classic-gcc", "yottaCorePackage": "microbit", "githubCorePackage": "calliope-mini/microbit", - "gittag": "2.0.0-rc7-calliope-p3", + "gittag": "2.0.0-rc7-calliope-p6", "serviceId": "microbit" }, "serial": { diff --git a/sim/state/accelerometer.ts b/sim/state/accelerometer.ts index b1a01257..6acbf1a7 100644 --- a/sim/state/accelerometer.ts +++ b/sim/state/accelerometer.ts @@ -223,10 +223,10 @@ namespace pxsim { return DAL.MICROBIT_ACCELEROMETER_EVT_TILT_UP; if (this.getZ() < (-1000 + DAL.MICROBIT_ACCELEROMETER_TILT_TOLERANCE)) - return DAL.MICROBIT_ACCELEROMETER_EVT_FACE_UP; + return DAL.MICROBIT_ACCELEROMETER_EVT_FACE_DOWN; if (this.getZ() > (1000 - DAL.MICROBIT_ACCELEROMETER_TILT_TOLERANCE)) - return DAL.MICROBIT_ACCELEROMETER_EVT_FACE_DOWN; + return DAL.MICROBIT_ACCELEROMETER_EVT_FACE_UP; return 0; } From 3fb21e590c963a543b1327628a2c7d00516afee7 Mon Sep 17 00:00:00 2001 From: "Matthias L. Jugel" Date: Sat, 4 Feb 2017 14:26:41 +0100 Subject: [PATCH 12/37] 0.8.8 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7458224d..27637d33 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pxt-calliope", - "version": "0.8.7", + "version": "0.8.8", "description": "Calliope Mini editor for PXT", "keywords": [ "JavaScript", From ae8cb2dc530fdae833044f8726477fea48bff893 Mon Sep 17 00:00:00 2001 From: "Matthias L. Jugel" Date: Sun, 5 Feb 2017 20:49:09 +0100 Subject: [PATCH 13/37] update dependency for new calliope target --- pxtarget.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pxtarget.json b/pxtarget.json index 0108b70e..1d0bf881 100644 --- a/pxtarget.json +++ b/pxtarget.json @@ -167,10 +167,10 @@ } }, "compileService": { - "yottaTarget": "bbc-microbit-classic-gcc", + "yottaTarget": "calliope-mini-classic-gcc", "yottaCorePackage": "microbit", "githubCorePackage": "calliope-mini/microbit", - "gittag": "2.0.0-rc7-calliope-p6", + "gittag": "v2.0.0-rc7-calliope-p8_1", "serviceId": "microbit" }, "serial": { From 9db0335844829d61e0e14e8906fe43e475c22fd0 Mon Sep 17 00:00:00 2001 From: "Matthias L. Jugel" Date: Sun, 5 Feb 2017 20:49:54 +0100 Subject: [PATCH 14/37] 0.8.9 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 27637d33..0dc9b516 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pxt-calliope", - "version": "0.8.8", + "version": "0.8.9", "description": "Calliope Mini editor for PXT", "keywords": [ "JavaScript", From a34004c14a2e3012df54147501a201bf6d6f24ab Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Mon, 6 Feb 2017 10:10:42 -0800 Subject: [PATCH 15/37] using calliope compile service --- pxtarget.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pxtarget.json b/pxtarget.json index 1d0bf881..9030e0c5 100644 --- a/pxtarget.json +++ b/pxtarget.json @@ -171,7 +171,7 @@ "yottaCorePackage": "microbit", "githubCorePackage": "calliope-mini/microbit", "gittag": "v2.0.0-rc7-calliope-p8_1", - "serviceId": "microbit" + "serviceId": "calliope" }, "serial": { "manufacturerFilter": "^mbed$", From b1fd48882c4fa36d739ebe3afc5a59835c6199dd Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 3 Feb 2017 20:39:18 -0800 Subject: [PATCH 16/37] merged from microbit --- libs/core/images.cpp | 10 +++++----- libs/core/shims.d.ts | 8 ++++---- sim/state/ledmatrix.ts | 7 ++++--- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/libs/core/images.cpp b/libs/core/images.cpp index 6e6fc286..45c9eb35 100644 --- a/libs/core/images.cpp +++ b/libs/core/images.cpp @@ -43,9 +43,9 @@ namespace ImageMethods { */ //% help=images/show-image weight=80 blockNamespace=images //% blockId=device_show_image_offset block="show image %sprite|at offset %offset" blockGap=8 - //% parts="ledmatrix" - void showImage(Image sprite, int xOffset) { - uBit.display.print(MicroBitImage(sprite), -xOffset, 0, 0); + //% parts="ledmatrix" async + void showImage(Image sprite, int xOffset, int interval = 400) { + uBit.display.print(MicroBitImage(sprite), -xOffset, 0, 0, interval); } /** @@ -150,7 +150,7 @@ namespace ImageMethods { */ //% weight=70 help=images/show-frame //% parts="ledmatrix" - void showFrame(Image i, int frame) { - showImage(i, frame * 5); + void showFrame(Image i, int frame, int interval = 400) { + showImage(i, frame * 5, interval); } } diff --git a/libs/core/shims.d.ts b/libs/core/shims.d.ts index dfd6a74d..e2f09c7b 100644 --- a/libs/core/shims.d.ts +++ b/libs/core/shims.d.ts @@ -40,8 +40,8 @@ declare interface Image { */ //% help=images/show-image weight=80 blockNamespace=images //% blockId=device_show_image_offset block="show image %sprite|at offset %offset" blockGap=8 - //% parts="ledmatrix" shim=ImageMethods::showImage - showImage(xOffset: number): void; + //% parts="ledmatrix" async interval.defl=400 shim=ImageMethods::showImage + showImage(xOffset: number, interval?: number): void; /** * Draws the ``index``-th frame of the image on the screen. @@ -118,8 +118,8 @@ declare interface Image { * @param frame TODO */ //% weight=70 help=images/show-frame - //% parts="ledmatrix" shim=ImageMethods::showFrame - showFrame(frame: number): void; + //% parts="ledmatrix" interval.defl=400 shim=ImageMethods::showFrame + showFrame(frame: number, interval?: number): void; } diff --git a/sim/state/ledmatrix.ts b/sim/state/ledmatrix.ts index c2e628f9..e105953c 100644 --- a/sim/state/ledmatrix.ts +++ b/sim/state/ledmatrix.ts @@ -129,10 +129,11 @@ namespace pxsim.images { } namespace pxsim.ImageMethods { - export function showImage(leds: Image, offset: number) { + export function showImage(leds: Image, offset: number, interval: number) { pxtrt.nullCheck(leds) leds.copyTo(offset, 5, board().ledMatrixState.image, 0) runtime.queueDisplayUpdate() + basic.pause(interval); } export function plotImage(leds: Image, offset: number): void { @@ -155,8 +156,8 @@ namespace pxsim.ImageMethods { ImageMethods.plotImage(leds, frame * Image.height); } - export function showFrame(leds: Image, frame: number) { - ImageMethods.showImage(leds, frame * Image.height); + export function showFrame(leds: Image, frame: number, interval: number) { + ImageMethods.showImage(leds, frame * Image.height, interval); } export function pixel(leds: Image, x: number, y: number): number { From a5aca0dfcf4b7b992c32125d49d5bc8068fc54d2 Mon Sep 17 00:00:00 2001 From: Richard Knoll Date: Mon, 30 Jan 2017 11:19:54 -0800 Subject: [PATCH 17/37] merged master --- docs/reference/pins/set-events.md | 30 ++++++++ libs/core/_locales/core-jsdoc-strings.json | 3 + libs/core/_locales/core-strings.json | 5 ++ libs/core/control.cpp | 4 + libs/core/enums.d.ts | 16 ++++ libs/core/pins.cpp | 88 ++++++++++++++-------- libs/core/shims.d.ts | 16 +++- sim/state/misc.ts | 3 + 8 files changed, 132 insertions(+), 33 deletions(-) create mode 100644 docs/reference/pins/set-events.md diff --git a/docs/reference/pins/set-events.md b/docs/reference/pins/set-events.md new file mode 100644 index 00000000..105a5cb9 --- /dev/null +++ b/docs/reference/pins/set-events.md @@ -0,0 +1,30 @@ +# Set Events + +Configure the type of events emitted by a given pin. + +```sig +pins.setEvents(DigitalPin.P0, PinEventType.Edge); +``` + +### Parameters + +* ``name``: The @boardname@ hardware pin to configure (``P0`` through ``P20``) +* ``type``: The type of events this pin should emit + +### Example + +The following example configures pin ``P0`` and then +subscribes to the rise and fall events. + +```blocks +control.onEvent(control.eventSourceId(EventBusSource.MICROBIT_ID_IO_P0), control.eventValueId(EventBusValue.MICROBIT_PIN_EVT_RISE), () => { + basic.showString("Rise") +}) +control.onEvent(control.eventSourceId(EventBusSource.MICROBIT_ID_IO_P0), control.eventValueId(EventBusValue.MICROBIT_PIN_EVT_FALL), () => { + basic.showString("Fall") +}) +pins.setEvents(DigitalPin.P0, PinEventType.Edge) +``` + +**This is an advanced API.** For more information, see the +[@boardname@ runtime messageBus documentation](https://lancaster-university.github.io/microbit-docs/ubit/messageBus/) \ No newline at end of file diff --git a/libs/core/_locales/core-jsdoc-strings.json b/libs/core/_locales/core-jsdoc-strings.json index 2a9ac5d3..685c6b3e 100644 --- a/libs/core/_locales/core-jsdoc-strings.json +++ b/libs/core/_locales/core-jsdoc-strings.json @@ -230,6 +230,9 @@ "pins.servoWritePin": "Writes 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", "pins.servoWritePin|param|value": "angle or rotation speed, eg:180,90,0", + "pins.setEvents": "Configures 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|type": "the type of events for this pin to emit, eg: PinEventType.Edge", "pins.setPull": "Configures the pull of this pin.", "pins.setPull|param|name": "pin to set the pull mode on", "pins.setPull|param|pull": "one of the mbed pull configurations: PullUp, PullDown, PullNone ", diff --git a/libs/core/_locales/core-strings.json b/libs/core/_locales/core-strings.json index ea60d955..5fd4824a 100644 --- a/libs/core/_locales/core-strings.json +++ b/libs/core/_locales/core-strings.json @@ -83,6 +83,10 @@ "Note.GSharp4|block": "G#4", "Note.GSharp5|block": "G#5", "Note.GSharp|block": "G#", + "PinEventType.Edge|block": "edge", + "PinEventType.None|block": "none", + "PinEventType.Pulse|block": "pulse", + "PinEventType.Touch|block": "touch", "PinPullMode.PullDown|block": "down", "PinPullMode.PullNone|block": "none", "PinPullMode.PullUp|block": "up", @@ -177,6 +181,7 @@ "pins.pulseIn|block": "pulse in (µs)|pin %name|pulsed %value", "pins.servoSetPulse|block": "servo set pulse|pin %value|to (µs) %micros", "pins.servoWritePin|block": "servo write|pin %name|to %value", + "pins.setEvents|block": "set pin %pin|to emit %type|events", "pins.setPull|block": "set pull|pin %pin|to %pull", "pins.spiWrite|block": "spi write %value", "pins|block": "pins", diff --git a/libs/core/control.cpp b/libs/core/control.cpp index d50def0a..432a9134 100644 --- a/libs/core/control.cpp +++ b/libs/core/control.cpp @@ -57,6 +57,10 @@ enum EventBusValue { MICROBIT_BUTTON_EVT_CLICK_ = MICROBIT_BUTTON_EVT_CLICK, MICROBIT_RADIO_EVT_DATAGRAM_ = MICROBIT_RADIO_EVT_DATAGRAM, MICROBIT_ACCELEROMETER_EVT_DATA_UPDATE_ = MICROBIT_ACCELEROMETER_EVT_DATA_UPDATE, + MICROBIT_PIN_EVT_RISE_ = MICROBIT_PIN_EVT_RISE, + MICROBIT_PIN_EVT_FALL_ = MICROBIT_PIN_EVT_FALL, + MICROBIT_PIN_EVT_PULSE_HI_ = MICROBIT_PIN_EVT_PULSE_HI, + MICROBIT_PIN_EVT_PULSE_LO_ = MICROBIT_PIN_EVT_PULSE_LO, MES_ALERT_EVT_ALARM1_ = MES_ALERT_EVT_ALARM1, MES_ALERT_EVT_ALARM2_ = MES_ALERT_EVT_ALARM2, MES_ALERT_EVT_ALARM3_ = MES_ALERT_EVT_ALARM3, diff --git a/libs/core/enums.d.ts b/libs/core/enums.d.ts index e8b9707e..7c6626a1 100644 --- a/libs/core/enums.d.ts +++ b/libs/core/enums.d.ts @@ -176,6 +176,10 @@ declare namespace input { MICROBIT_BUTTON_EVT_CLICK = 3, // MICROBIT_BUTTON_EVT_CLICK MICROBIT_RADIO_EVT_DATAGRAM = 1, // MICROBIT_RADIO_EVT_DATAGRAM MICROBIT_ACCELEROMETER_EVT_DATA_UPDATE = 1, // MICROBIT_ACCELEROMETER_EVT_DATA_UPDATE + MICROBIT_PIN_EVT_RISE = 2, // MICROBIT_PIN_EVT_RISE + MICROBIT_PIN_EVT_FALL = 3, // MICROBIT_PIN_EVT_FALL + MICROBIT_PIN_EVT_PULSE_HI = 4, // MICROBIT_PIN_EVT_PULSE_HI + MICROBIT_PIN_EVT_PULSE_LO = 5, // MICROBIT_PIN_EVT_PULSE_LO MES_ALERT_EVT_ALARM1 = 6, // MES_ALERT_EVT_ALARM1 MES_ALERT_EVT_ALARM2 = 7, // MES_ALERT_EVT_ALARM2 MES_ALERT_EVT_ALARM3 = 8, // MES_ALERT_EVT_ALARM3 @@ -310,6 +314,18 @@ declare namespace motors { } + declare enum PinEventType { + //% block="edge" + Edge = 1, // MICROBIT_PIN_EVENT_ON_EDGE + //% block="pulse" + Pulse = 2, // MICROBIT_PIN_EVENT_ON_PULSE + //% block="touch" + Touch = 3, // MICROBIT_PIN_EVENT_ON_TOUCH + //% block="none" + None = 0, // MICROBIT_PIN_EVENT_NONE + } + + declare enum SerialPin { P0 = 7, // MICROBIT_ID_IO_P0 P1 = 8, // MICROBIT_ID_IO_P1 diff --git a/libs/core/pins.cpp b/libs/core/pins.cpp index 440dbe03..28b78ff5 100644 --- a/libs/core/pins.cpp +++ b/libs/core/pins.cpp @@ -43,6 +43,17 @@ enum class PinPullMode { PullNone = 2 }; +enum class PinEventType { + //% block="edge" + Edge = MICROBIT_PIN_EVENT_ON_EDGE, + //% block="pulse" + Pulse = MICROBIT_PIN_EVENT_ON_PULSE, + //% block="touch" + Touch = MICROBIT_PIN_EVENT_ON_TOUCH, + //% block="none" + None = MICROBIT_PIN_EVENT_NONE +}; + MicroBitPin *getPin(int id) { switch (id) { case MICROBIT_ID_IO_P0: return &uBit.io.P0; @@ -104,7 +115,7 @@ namespace pins { */ //% help=pins/digital-write-pin weight=29 //% blockId=device_set_digital_pin block="digital write|pin %name|to %value" - void digitalWritePin(DigitalPin name, int value) { + void digitalWritePin(DigitalPin name, int value) { PINOP(setDigitalValue(value)); } @@ -113,7 +124,7 @@ namespace pins { * @param name pin to write to */ //% 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" int analogReadPin(AnalogPin name) { PINREAD(getAnalogValue()); } @@ -125,7 +136,7 @@ namespace pins { */ //% help=pins/analog-write-pin weight=24 //% blockId=device_set_analog_pin block="analog write|pin %name|to %value" blockGap=8 - void analogWritePin(AnalogPin name, int value) { + void analogWritePin(AnalogPin name, int value) { PINOP(setAnalogValue(value)); } @@ -136,11 +147,11 @@ namespace pins { * @param micros period in micro seconds. eg:20000 */ //% help=pins/analog-set-period weight=23 blockGap=8 - //% blockId=device_set_analog_period block="analog set period|pin %pin|to (µs)%micros" - void analogSetPeriod(AnalogPin name, int micros) { + //% blockId=device_set_analog_period block="analog set period|pin %pin|to (µs)%micros" + void analogSetPeriod(AnalogPin name, int micros) { PINOP(setAnalogPeriodUs(micros)); } - + /** * Configures this pin to a digital input, and generates events where the timestamp is the duration that this pin was either ``high`` or ``low``. */ @@ -149,11 +160,11 @@ namespace pins { void onPulsed(DigitalPin name, PulseValue pulse, Action body) { MicroBitPin* pin = getPin((int)name); if (!pin) return; - - pin->eventOn(MICROBIT_PIN_EVENT_ON_PULSE); + + pin->eventOn(MICROBIT_PIN_EVENT_ON_PULSE); registerWithDal((int)name, (int)pulse, body); } - + /** * Gets the duration of the last pulse in micro-seconds. This function should be called from a ``onPulsed`` handler. */ @@ -169,7 +180,7 @@ namespace pins { * @param name the pin which measures the pulse * @param value the value of the pulse (default high) * @param maximum duration in micro-seconds - */ + */ //% blockId="pins_pulse_in" block="pulse in (µs)|pin %name|pulsed %value" //% weight=20 int pulseIn(DigitalPin name, PulseValue value, int maxDuration = 2000000) { @@ -177,20 +188,20 @@ namespace pins { if (!pin) return 0; int pulse = value == PulseValue::High ? 1 : 0; - uint64_t tick = system_timer_current_time_us(); - uint64_t maxd = (uint64_t)maxDuration; + uint64_t tick = system_timer_current_time_us(); + uint64_t maxd = (uint64_t)maxDuration; while(pin->getDigitalValue() != pulse) { if(system_timer_current_time_us() - tick > maxd) - return 0; + return 0; } - uint64_t start = system_timer_current_time_us(); + uint64_t start = system_timer_current_time_us(); while(pin->getDigitalValue() == pulse) { if(system_timer_current_time_us() - tick > maxd) - return 0; - } - uint64_t end = system_timer_current_time_us(); - return end - start; + return 0; + } + uint64_t end = system_timer_current_time_us(); + return end - start; } /** @@ -201,7 +212,7 @@ namespace pins { //% help=pins/servo-write-pin weight=20 //% blockId=device_set_servo_pin block="servo write|pin %name|to %value" blockGap=8 //% parts=microservo trackArgs=0 - void servoWritePin(AnalogPin name, int value) { + void servoWritePin(AnalogPin name, int value) { PINOP(setServoValue(value)); } @@ -212,7 +223,7 @@ namespace pins { */ //% help=pins/servo-set-pulse weight=19 //% blockId=device_set_servo_pulse block="servo set pulse|pin %value|to (µs) %micros" - void servoSetPulse(AnalogPin name, int micros) { + void servoSetPulse(AnalogPin name, int micros) { PINOP(setServoPulseUs(micros)); } @@ -223,8 +234,9 @@ namespace pins { * Sets the pin used when using `pins->analog pitch`. * @param name TODO */ - //% help=pins/analog-set-pitch weight=12 - void analogSetPitchPin(AnalogPin name) { + //% blockId=device_analog_set_pitch_pin block="analog set pitch pin %name" + //% help=pins/analog-set-pitch weight=3 advanced=true + void analogSetPitchPin(AnalogPin name) { pitchPin = getPin((int)name); } @@ -233,16 +245,18 @@ namespace pins { * @param frequency TODO * @param ms TODO */ - //% help=pins/analog-pitch weight=14 async - void analogPitch(int frequency, int ms) { - if (pitchPin == NULL) return; + //% blockId=device_analog_pitch block="analog pitch %frequency|for (ms) %ms" + //% help=pins/analog-pitch weight=4 async advanced=true blockGap=8 + void analogPitch(int frequency, int ms) { + if (pitchPin == NULL) + analogSetPitchPin(AnalogPin::P1); if (frequency <= 0) { pitchPin->setAnalogValue(0); } else { pitchPin->setAnalogValue(512); pitchPin->setAnalogPeriodUs(1000000/frequency); } - + if (ms > 0) { fiber_sleep(ms); pitchPin->setAnalogValue(0); @@ -251,7 +265,7 @@ namespace pins { } } - + /** * Configures the pull of this pin. * @param name pin to set the pull mode on @@ -260,13 +274,25 @@ namespace pins { //% help=pins/set-pull weight=3 //% blockId=device_set_pull block="set pull|pin %pin|to %pull" void setPull(DigitalPin name, PinPullMode pull) { - PinMode m = pull == PinPullMode::PullDown + PinMode m = pull == PinPullMode::PullDown ? PinMode::PullDown - : pull == PinPullMode::PullUp ? PinMode::PullUp + : pull == PinPullMode::PullUp ? PinMode::PullUp : PinMode::PullNone; PINOP(setPull(m)); } + /** + * Configures the events emitted by this pin. Events can be subscribed to + * using ``control.onEvent()``. + * @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 + */ + //% help=pins/set-events weight=4 advanced=true + //% blockId=device_set_pin_events block="set pin %pin|to emit %type|events" + void setEvents(DigitalPin name, PinEventType type) { + getPin((int)name)->eventOn((int)type); + } + /** * Create a new zero-initialized buffer. * @param size number of bytes in the buffer @@ -287,7 +313,7 @@ namespace pins { uBit.i2c.read(address << 1, (char*)buf->payload, size, repeat); return buf; } - + /** * Write bytes to a 7-bit I2C `address`. */ @@ -314,5 +340,5 @@ namespace pins { auto p = allocSPI(); return p->write(value); } - + } diff --git a/libs/core/shims.d.ts b/libs/core/shims.d.ts index e2f09c7b..0072bae3 100644 --- a/libs/core/shims.d.ts +++ b/libs/core/shims.d.ts @@ -651,7 +651,8 @@ declare namespace pins { * Sets the pin used when using `pins->analog pitch`. * @param name TODO */ - //% help=pins/analog-set-pitch weight=12 shim=pins::analogSetPitchPin + //% blockId=device_analog_set_pitch_pin block="analog set pitch pin %name" + //% help=pins/analog-set-pitch weight=3 advanced=true shim=pins::analogSetPitchPin function analogSetPitchPin(name: AnalogPin): void; /** @@ -659,7 +660,8 @@ declare namespace pins { * @param frequency TODO * @param ms TODO */ - //% help=pins/analog-pitch weight=14 async shim=pins::analogPitch + //% blockId=device_analog_pitch block="analog pitch %frequency|for (ms) %ms" + //% help=pins/analog-pitch weight=4 async advanced=true blockGap=8 shim=pins::analogPitch function analogPitch(frequency: number, ms: number): void; /** @@ -671,6 +673,16 @@ declare namespace pins { //% blockId=device_set_pull block="set pull|pin %pin|to %pull" shim=pins::setPull function setPull(name: DigitalPin, pull: PinPullMode): void; + /** + * Configures the events emitted by this pin. Events can be subscribed to + * using ``control.onEvent()``. + * @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 + */ + //% help=pins/set-events weight=4 advanced=true + //% blockId=device_set_pin_events block="set pin %pin|to emit %type|events" shim=pins::setEvents + function setEvents(name: DigitalPin, type: PinEventType): void; + /** * Create a new zero-initialized buffer. * @param size number of bytes in the buffer diff --git a/sim/state/misc.ts b/sim/state/misc.ts index d2d20061..5130801b 100644 --- a/sim/state/misc.ts +++ b/sim/state/misc.ts @@ -119,6 +119,9 @@ namespace pxsim.pins { export function getPinAddress(name: number) { return getPin(name) } + + export function setEvents(name: number, event: number) { + } } namespace pxsim.devices { From a91c28bd564e079d50f62458fad9afd1f3ad7328 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Mon, 6 Feb 2017 10:17:39 -0800 Subject: [PATCH 18/37] 0.8.10 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0dc9b516..d3e12831 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pxt-calliope", - "version": "0.8.9", + "version": "0.8.10", "description": "Calliope Mini editor for PXT", "keywords": [ "JavaScript", From 7f134f330d31ef20aa9470978e33f5f46d300ca9 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Mon, 6 Feb 2017 11:52:50 -0800 Subject: [PATCH 19/37] updated translations --- .../_locales/de/bluetooth-jsdoc-strings.json | 2 + libs/core/_locales/de/core-jsdoc-strings.json | 43 ------------------- pxtarget.json | 1 + 3 files changed, 3 insertions(+), 43 deletions(-) diff --git a/libs/bluetooth/_locales/de/bluetooth-jsdoc-strings.json b/libs/bluetooth/_locales/de/bluetooth-jsdoc-strings.json index 776a4444..c39e2568 100644 --- a/libs/bluetooth/_locales/de/bluetooth-jsdoc-strings.json +++ b/libs/bluetooth/_locales/de/bluetooth-jsdoc-strings.json @@ -1,4 +1,6 @@ { + "bluetooth": "Unterstützung für zusätzliche Bluetooth-Dienste.", + "bluetooth.onBluetoothConnected|param|body": "Code, der ausgeführt wird, wenn eine Bluetooth-Verbindung aufgebaut wurde", "bluetooth.uartWriteNumber": "Gibt einen numerischen Wert an die serielle", "bluetooth.uartWriteValue": "Schreibt ein ``Namen: Wert`` Wertepaar auf die serielle Schnittstelle.", "bluetooth.uartWriteValue|param|name": "Name des Wertestreams, z.B.: x", diff --git a/libs/core/_locales/de/core-jsdoc-strings.json b/libs/core/_locales/de/core-jsdoc-strings.json index 47667faf..cf9c1879 100644 --- a/libs/core/_locales/de/core-jsdoc-strings.json +++ b/libs/core/_locales/de/core-jsdoc-strings.json @@ -71,7 +71,6 @@ "control.waitMicros|param|micros": "Anzahl der Mikrosekunden, die gewartet werden soll, z.B.: 4", "game": "Eine Einzel-LED-Sprite-Spielumgebung", "game.addLife": "Fügt Leben zum aktuellen Spielstand hinzu", - "game.addLife|param|lives": "TODO", "game.addScore": "Fügt zum aktuellen Spielstand Punkte hinzu", "game.addScore|param|points": "Anzahl von zu verändernden Punkten, z.B.: 1", "game.createSprite": "Erzeugt einen neuen LED-Sprite, der nach rechts zeigt.", @@ -86,12 +85,9 @@ "game.levelUp": "Erhöht das Level und zeigt eine Nachricht an.", "game.life": "Ruft das aktuelle Leben ab", "game.removeLife": "Entfernt ein Leben", - "game.removeLife|param|life": "TODO", "game.score": "Ruft den aktuellen Punktestand ab", "game.setLife": "Setzt den aktuellen Wert der Leben", - "game.setLife|param|value": "TODO", "game.setScore": "Setzt den aktuellen Wert des Spielstands", - "game.setScore|param|value": "TODO", "game.showScore": "Zeigt den Spielstand auf dem Display.", "game.startCountdown": "Startet einen Spiel-Countdown", "game.startCountdown|param|ms": "Countdown-Dauer in Millisekunden, z.B.: 10000", @@ -101,38 +97,24 @@ "images.createImage": "Erstellt ein Bild, das auf den LED-Bildschirm passt.", "input": "Ereignisse und Daten der Sensoren", "input.acceleration": "Holt den Beschleunigungswert in Milli-Erdanziehung (wenn das Board flach mit dem Display nach oben liegt, X = 0, y = 0 und Z =-1024)", - "input.acceleration|param|dimension": "TODO", "input.buttonIsPressed": "Erhalte den Sie den Tastenstatus (gepresst oder nicht) für ``A`` und ``B``.", "input.calibrate": "Veraltet, Kompasskalibrierung erfolgt automatisch.", "input.compassHeading": "Holt die aktuelle Kompassrichtung in Grad.", "input.lightLevel": "Liest die Lichtintensität auf dem LED-Bildschirm im Bereich von ``0`` (dunkel) und `` 255`` (hell).", "input.magneticForce": "Ruft den Wert der Magnetkraft in ``Mikro-Tesla`` (``µT``) ab. Diese Funktion wird im Simulator nicht unterstützt.", - "input.magneticForce|param|dimension": "TODO", "input.onButtonPressed": "Tue etwas, wenn eine Taste (``A``, ``B`` oder ``A + B``) gedrückt wird", - "input.onButtonPressed|param|body": "TODO", - "input.onButtonPressed|param|button": "TODO", "input.onGesture": "Mache etwas, wenn eine Geste gemacht wird (wie den mini zu schütteln).", - "input.onGesture|param|body": "TODO", "input.onLogoDown": "Fügt Code hinzu, der ausgeführt wird, wenn das Logo nach unten zeigt und das Board vertikal ausgerichtet ist.", - "input.onLogoDown|param|body": "TODO", "input.onLogoUp": "Fügt Code hinzu, der ausgeführt wird, wenn das Logo nach oben zeigt und das Board vertikal ausgerichtet ist.", - "input.onLogoUp|param|body": "TODO", "input.onPinPressed": "Mache etwas, wenn eine Pin gehalten wird.", "input.onPinPressed|param|body": "Code, der ausführt wird, wenn ein Pin gehalten wird", - "input.onPinPressed|param|name": "Der Pin, der gehalten werden muss", "input.onPinReleased": "Mache etwas, wenn der Pin losgelassen wird.", "input.onPinReleased|param|body": "Code, der ausgeführt werden soll, wenn der Pin losgelassen wird", - "input.onPinReleased|param|name": "Der Pin, der losgelassen werden muss", "input.onScreenDown": "Hängt Code an, der ausgeführt wird, wenn der Bildschirm nach unten zeigt.", - "input.onScreenDown|param|body": "TODO", "input.onScreenUp": "Hängt Code an, der ausgeführt wird, wenn der Bildschirm nach oben zeigt.", - "input.onScreenUp|param|body": "TODO", "input.onShake": "Hängt Code an, der ausgeführt wird, wenn der mini geschüttelt wird.", - "input.onShake|param|body": "TODO", "input.pinIsPressed": "Ruft den Pin-Zustand (gehalten oder nicht) ab. Die Erdung muss gehalten werden, um den Stromkreis zu schließen.", - "input.pinIsPressed|param|name": "Pin, der verwendet wird, um eine Berührung zu erkennen", "input.rotation": "Die Neigung und Drehung des mini Drehung auf ``X-Achse``oder ``Y-Achse``, in Grad.", - "input.rotation|param|kind": "TODO", "input.runningTime": "Ruft die Anzahl der Millisekunden auf, die seit dem Einschalten vergangen sind.", "input.setAccelerometerRange": "Legt die Stichprobenbereich des Beschleunigungssensors in Schwerkraft fest.", "input.setAccelerometerRange|param|range": "Ein Wert, der die maximale Stärke der gemessenen Beschleunigung beschreibt", @@ -141,19 +123,13 @@ "led.brightness": "Ruft die Helligkeit des Bildschirms ab, von 0 (aus) bis 255 (volle Helligkeit).", "led.enable": "Schaltet das Display an und aus", "led.fadeIn": "Blendet die Bildschirmanzeige ein.", - "led.fadeIn|param|ms": "TODO", "led.fadeOut": "Blendet die Bildschirmhelligkeit aus.", - "led.fadeOut|param|ms": "TODO", "led.plot": "Schalte die angegebene LED mit Hilfe von X- und Y-Koordinaten ein (X ist horizontal, Y ist vertikal). (0,0) ist die obere linke Ecke.", "led.plotAll": "Schaltet alle LEDs an", "led.plotBarGraph": "Zeigt ein vertikales Balkendiagramm an, basierend auf dem `Wert`und dem `Hoch`-Wert. Wenn `Hoch`0 ist, wird das Diagramm automatisch angepasst.", "led.plotBarGraph|param|high": "maximalen Wert. Wenn dieser 0 ist, wird der Maximalwert automatisch angepasst, z.B.: 0", "led.plotBarGraph|param|value": "aktueller Wert zum Darstellen", - "led.plot|param|x": "TODO", - "led.plot|param|y": "TODO", "led.point": "Ruft den An/Aus-Status einer vorgegebenen LED mittels X-/Y-Koordinaten ab. (0,0) ist oben links.", - "led.point|param|x": "TODO", - "led.point|param|y": "TODO", "led.screenshot": "Macht einen Screenshot vom LED-Bildschirm und gibt ein Bild aus.", "led.setBrightness": "Lege die Helligkeit des Bildschirms fest, von 0 (aus) bis 255 (volle Helligkeit).", "led.setBrightness|param|value": "Helligkeitswert, z.B.: 255, 127, 0", @@ -162,11 +138,7 @@ "led.stopAnimation": "Bricht die aktuelle Animation ab und löscht andere ausstehende Animationen.", "led.toggle": "Schaltet ein bestimmtes Pixel ein", "led.toggleAll": "Invertiert die aktuelle LED-Anzeige", - "led.toggle|param|x": "TODO", - "led.toggle|param|y": "TODO", "led.unplot": "Schalte die angegebene LED mit x-und y-Koordinaten ab (X ist horizontal, y ist vertikal). (0,0) ist oben links.", - "led.unplot|param|x": "TODO", - "led.unplot|param|y": "TODO", "motors": "Blöcke, die genutzt werden, um Onboard-Motoren zu steuern", "motors.dualMotorPower": "Steuert zwei an das Board angeschlossene Motoren. Schaltet auf Dual-Motor-Modus um!", "motors.motorCommand": "Schicke Anhalten, Ausrollen oder Anhalten-Befehle an den Motor. Hat im Dual-Motor-Modus keinen Effekt.", @@ -177,7 +149,6 @@ "music.changeTempoBy": "Ändere die Geschwindigkeit um den angegebenen Betrag", "music.changeTempoBy|param|bpm": "Die Änderung in Schlägen pro Minute auf das Tempo, z.B.: 20", "music.noteFrequency": "Ruft die Frequenz einer Note ab.", - "music.noteFrequency|param|name": "der Name der Notiz", "music.playTone": "Spielt einen Ton für den angegebenen Zeitraum auf dem Lautsprecher ab.", "music.playTone|param|ms": "Tondauer in Millisekunden (ms)", "music.rest": "Ruht (spielt nichts) für eine bestimmte Zeit auf Pin ``P0``.", @@ -189,24 +160,15 @@ "music.tempo": "Gibt die Geschwindigkeit in Schlägen pro Minute aus. Die Geschwindigkeit ist Schnelligkeit (Bpm = Beats pro Minute), in der Töne abgespielt werden. Je größer der Wert, desto schneller werden die Töne abgespielt.", "pins": "Steuere die Stromstärke über die Pins für analoge/digitale Signale, Servos, I2C,...", "pins.analogPitch": "Gibt ein Pulsweiten Modulation (PWM)-Signal über den aktuellen Pitch-Pin. Benutze `analog set pitch pin`, um den Pitch-Pin festzulegen.", - "pins.analogPitch|param|frequency": "TODO", - "pins.analogPitch|param|ms": "TODO", "pins.analogReadPin": "Lese den Anschlusswert als Analog aus, d. h. als einen Wert zwischen 0 und 1023.", - "pins.analogReadPin|param|name": "Pin, auf den geschrieben werden soll", "pins.analogSetPeriod": "Stellt die Pulsweite Modulation (PWM) des Analogausganges auf den angegebenen Wert in ** Mikrosekunden ** oder `1/1000` Millisekunden ein.\nWenn dieser Pin nicht als einen Analogausgang (mit `analog write pin`) konfiguriert ist, hat der Vorgang keine Auswirkungen.", "pins.analogSetPeriod|param|micros": "Zeit in Mikrosekunden. z.B.: 20000", - "pins.analogSetPeriod|param|name": "analoger Pin, der zeitlich festgelegt werden soll", - "pins.analogSetPitchPin": "Setzt den genutzten Pin, wenn `pins->analog pitch`angewendet wird.", - "pins.analogSetPitchPin|param|name": "TODO", "pins.analogWritePin": "Legt den Wert des Verbinders auf analog fest. Der Wert muss zwischen 0 und 1023 liegen.", - "pins.analogWritePin|param|name": "PIN-Name, auf den geschrieben werden soll", "pins.analogWritePin|param|value": "Wert, der auf den Pin geschrieben werden soll, zwischen ``0`` und ``1023`` z.B.: 1023,0", "pins.createBuffer": "Erstellt einen Null-initialisierten Zwischenspeicher.", "pins.createBuffer|param|size": "Anzahl der Bytes im Zwischenspeicher", "pins.digitalReadPin": "Lese den angegebene Pin oder Verbinder als 0 oder 1", - "pins.digitalReadPin|param|name": "Pin, aus dem gelesen werden soll", "pins.digitalWritePin": "Setzt einen Pin- oder Verbinder-Wert auf 0 oder 1.", - "pins.digitalWritePin|param|name": "Pin, auf den geschrieben werden soll", "pins.digitalWritePin|param|value": "Wert, der auf dem Pin 1 gesetzt werden soll, z.B. 0", "pins.i2cReadBuffer": "Lese `Größe`bytes aus einer 7-bit I2C-Adresse.", "pins.i2cReadNumber": "Lese eine Nummer aus einer 7-bit I2C-Adresse.", @@ -227,11 +189,8 @@ "pins.servoSetPulse|param|micros": "Impulsdauer in Mikrosekunden, z.B.: 1500", "pins.servoSetPulse|param|name": "PIN-Name", "pins.servoWritePin": "Schreibt einen Wert in den Servo, der die Welle entsprechend kontroliert. Auf einem Standard-Servo wird so der Winkel der Welle (in Grad) eingestellt, sodass sich die Welle entsprechend anpasst. Auf einem kontinuierlich drehenden Servo wird dadurch die Geschwindigkeit des Servos festgelegt, wobei ``0``die volle Geschwindigkeit in eine Richtung darstellt, ``180``die volle Geschwindigkeit in die andere, und ein Wert von ``90`` einen Stillstand erzeugt.", - "pins.servoWritePin|param|name": "Pin, auf den geschrieben werden soll", "pins.servoWritePin|param|value": "Winkel oder Rotationsbeschleunigung, z.B.: 180,90,0", "pins.setPull": "Stellt die Anziehungskraft des Pins ein.", - "pins.setPull|param|name": "Pin, auf dem der Pull-Modus aktiviert wird", - "pins.setPull|param|pull": "eine der mbed-Pull-Konfigurationen: PullUp, PullDown, PullNone", "pins.sizeOf": "Ruft die Bytegröße im spezifierten Nummernformat ab.", "pins.spiWrite": "Schreibe in den SPI-Slave und gebe die Antwort aus", "pins.spiWrite|param|value": "Daten, die an den SPI-Slave geschickt werden sollen", @@ -242,8 +201,6 @@ "serial.readUntil": "Liest aus eine Textzeile aus dem seriellen Anschluss und gibt den Puffer aus, wenn die Begrenzung erreicht wurde.", "serial.readUntil|param|delimiter": "Text-Begrenzung, die die Textblöcke voneinander trennt", "serial.redirect": "Konfiguriert dynamisch die serielle Instanz, damit sie andere Pins als USBTX und USBRX benutzt.", - "serial.redirect|param|rx": "der neue Empfangs-Pin", - "serial.redirect|param|tx": "Der neue Übertragungs-Pin", "serial.writeLine": "Gibt eine Zeile des Textes an die serielle", "serial.writeNumber": "Gibt einen numerischen Wert an die serielle", "serial.writeString": "Sendet ein Stück Text über serielle Verbindung.", diff --git a/pxtarget.json b/pxtarget.json index 9030e0c5..f086cb3f 100644 --- a/pxtarget.json +++ b/pxtarget.json @@ -193,6 +193,7 @@ "privacyUrl": "https://go.microsoft.com/fwlink/?LinkId=521839", "termsOfUseUrl": "https://go.microsoft.com/fwlink/?LinkID=206977", "githubUrl": "https://github.com/Microsoft/pxt-calliope", + "crowdinProject": "kindscript", "organization": "Microsoft", "organizationUrl": "https://pxt.io/", "organizationLogo": "./static/Microsoft-logo_rgb_c-gray.png", From 2420a7c781e1ee81453eba199ba20020fa46be97 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Mon, 6 Feb 2017 11:53:35 -0800 Subject: [PATCH 20/37] 0.8.11 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d3e12831..94e31617 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pxt-calliope", - "version": "0.8.10", + "version": "0.8.11", "description": "Calliope Mini editor for PXT", "keywords": [ "JavaScript", From 279f72c80063fbad4671fb9f1907d211fcf014b7 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Mon, 6 Feb 2017 12:10:41 -0800 Subject: [PATCH 21/37] Bump pxt-core to 0.11.14 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 94e31617..22c56fc3 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "semantic-ui-less": "^2.2.4" }, "dependencies": { - "pxt-core": "0.11.13" + "pxt-core": "0.11.14" }, "scripts": { "test": "node node_modules/pxt-core/built/pxt.js travis" From 991aa40f1992c28c705aa907e8cbb5c3e36a2fef Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Mon, 6 Feb 2017 12:10:43 -0800 Subject: [PATCH 22/37] 0.8.12 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 22c56fc3..6d4a237b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pxt-calliope", - "version": "0.8.11", + "version": "0.8.12", "description": "Calliope Mini editor for PXT", "keywords": [ "JavaScript", From 8bfa79fd1599b1a1ec709bbd5576daa5ab446108 Mon Sep 17 00:00:00 2001 From: "Matthias L. Jugel" Date: Mon, 6 Feb 2017 22:07:40 +0100 Subject: [PATCH 23/37] update dependency on dal --- libs/core/_locales/core-strings.json | 2 ++ pxtarget.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/core/_locales/core-strings.json b/libs/core/_locales/core-strings.json index 5fd4824a..33649d06 100644 --- a/libs/core/_locales/core-strings.json +++ b/libs/core/_locales/core-strings.json @@ -168,8 +168,10 @@ "music.setTempo|block": "set tempo to (bpm)|%value", "music.tempo|block": "tempo (bpm)", "music|block": "music", + "pins.analogPitch|block": "analog pitch %frequency|for (ms) %ms", "pins.analogReadPin|block": "analog read|pin %name", "pins.analogSetPeriod|block": "analog set period|pin %pin|to (µs)%micros", + "pins.analogSetPitchPin|block": "analog set pitch pin %name", "pins.analogWritePin|block": "analog write|pin %name|to %value", "pins.digitalReadPin|block": "digital read|pin %name", "pins.digitalWritePin|block": "digital write|pin %name|to %value", diff --git a/pxtarget.json b/pxtarget.json index f086cb3f..e169b44e 100644 --- a/pxtarget.json +++ b/pxtarget.json @@ -170,7 +170,7 @@ "yottaTarget": "calliope-mini-classic-gcc", "yottaCorePackage": "microbit", "githubCorePackage": "calliope-mini/microbit", - "gittag": "v2.0.0-rc7-calliope-p8_1", + "gittag": "v2.0.0-rc7-calliope-p9", "serviceId": "calliope" }, "serial": { From b1d8ab020637e5f542a725b35701c1e335ca394f Mon Sep 17 00:00:00 2001 From: "Matthias L. Jugel" Date: Mon, 6 Feb 2017 22:07:56 +0100 Subject: [PATCH 24/37] 0.8.13 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6d4a237b..6fad87de 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pxt-calliope", - "version": "0.8.12", + "version": "0.8.13", "description": "Calliope Mini editor for PXT", "keywords": [ "JavaScript", From 1f7ad1f114d9662d9e3ec287a623375b866c4b44 Mon Sep 17 00:00:00 2001 From: "Matthias L. Jugel" Date: Mon, 6 Feb 2017 22:48:27 +0100 Subject: [PATCH 25/37] add correct serial pins --- libs/core/enums.d.ts | 15 ++++++--------- libs/core/serial.cpp | 15 ++++++--------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/libs/core/enums.d.ts b/libs/core/enums.d.ts index 7c6626a1..f305d9b3 100644 --- a/libs/core/enums.d.ts +++ b/libs/core/enums.d.ts @@ -327,15 +327,12 @@ declare namespace motors { declare enum SerialPin { - P0 = 7, // MICROBIT_ID_IO_P0 - P1 = 8, // MICROBIT_ID_IO_P1 - P2 = 9, // MICROBIT_ID_IO_P2 - //P8 = MICROBIT_ID_IO_P8, - //P12 = MICROBIT_ID_IO_P12, - //P13 = MICROBIT_ID_IO_P13, - //P14 = MICROBIT_ID_IO_P14, - //P15 = MICROBIT_ID_IO_P15, - //P16 = MICROBIT_ID_IO_P16 + C16 = 9, // MICROBIT_ID_IO_P2 + C17 = 15, // MICROBIT_ID_IO_P8 + P0 = 19, // MICROBIT_ID_IO_P12 + P1 = 7, // MICROBIT_ID_IO_P0 + P2 = 8, // MICROBIT_ID_IO_P1 + P3 = 23, // MICROBIT_ID_IO_P16 } diff --git a/libs/core/serial.cpp b/libs/core/serial.cpp index bf7f3811..614423fe 100644 --- a/libs/core/serial.cpp +++ b/libs/core/serial.cpp @@ -1,15 +1,12 @@ #include "pxt.h" enum SerialPin { - P0 = MICROBIT_ID_IO_P0, - P1 = MICROBIT_ID_IO_P1, - P2 = MICROBIT_ID_IO_P2, - //P8 = MICROBIT_ID_IO_P8, - //P12 = MICROBIT_ID_IO_P12, - //P13 = MICROBIT_ID_IO_P13, - //P14 = MICROBIT_ID_IO_P14, - //P15 = MICROBIT_ID_IO_P15, - //P16 = MICROBIT_ID_IO_P16 + C16 = MICROBIT_ID_IO_P2, + C17 = MICROBIT_ID_IO_P8, + P0 = MICROBIT_ID_IO_P12, + P1 = MICROBIT_ID_IO_P0, + P2 = MICROBIT_ID_IO_P1, + P3 = MICROBIT_ID_IO_P16, }; enum BaudRate { From cf1b85f85b2bcaa757ed1c7487a17deb7eeec8be Mon Sep 17 00:00:00 2001 From: "Matthias L. Jugel" Date: Mon, 6 Feb 2017 22:48:37 +0100 Subject: [PATCH 26/37] 0.8.14 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6fad87de..8410c80d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pxt-calliope", - "version": "0.8.13", + "version": "0.8.14", "description": "Calliope Mini editor for PXT", "keywords": [ "JavaScript", From 3d70526d055901e6e272d6ed2649ec4be0ea8ed4 Mon Sep 17 00:00:00 2001 From: guillaumejenkins Date: Mon, 6 Feb 2017 14:06:41 -0800 Subject: [PATCH 27/37] Fix Jenkins build permissions --- jenkins.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/jenkins.groovy b/jenkins.groovy index 193e506e..7d73a57d 100644 --- a/jenkins.groovy +++ b/jenkins.groovy @@ -8,6 +8,7 @@ def branch = GithubBranchName def newJobName = InternalUtilities.getFullJobName(project, "Default", isPR) def newJob = job(newJobName) { steps { + shell("chmod +x ./jenkins.sh") shell("./jenkins.sh ${isPR}") } From 0c0c1cdd731bcdf7e46c48a8b148e5b2270a4476 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Mon, 6 Feb 2017 14:41:24 -0800 Subject: [PATCH 28/37] fix simulator y value --- sim/visuals/microbit.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sim/visuals/microbit.ts b/sim/visuals/microbit.ts index 8a619f18..b79c398d 100644 --- a/sim/visuals/microbit.ts +++ b/sim/visuals/microbit.ts @@ -1728,7 +1728,7 @@ namespace pxsim.visuals { let ay = (ev.clientY - bbox.height / 2) / (bbox.height / 3); let x = - Math.max(- 1023, Math.min(1023, Math.floor(ax * 1023))); - let y = Math.max(- 1023, Math.min(1023, Math.floor(ay * 1023))); + let y = - Math.max(- 1023, Math.min(1023, Math.floor(ay * 1023))); let z2 = 1023 * 1023 - x * x - y * y; let z = Math.floor((z2 > 0 ? -1 : 1) * Math.sqrt(Math.abs(z2))); From 5c62e5d697642ccda62f2a598b934658e1836c64 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Mon, 6 Feb 2017 14:41:47 -0800 Subject: [PATCH 29/37] 0.8.15 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8410c80d..f9ef8e1e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pxt-calliope", - "version": "0.8.14", + "version": "0.8.15", "description": "Calliope Mini editor for PXT", "keywords": [ "JavaScript", From 38c60710d1fc6b7eab2fcd5e641ecf3e965669fc Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Mon, 6 Feb 2017 14:49:49 -0800 Subject: [PATCH 30/37] disable sharing --- pxtarget.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pxtarget.json b/pxtarget.json index e169b44e..d9e81430 100644 --- a/pxtarget.json +++ b/pxtarget.json @@ -14,8 +14,8 @@ "cloud": { "workspace": false, "packages": true, - "sharing": true, - "publishing": true, + "sharing": false, + "publishing": false, "preferredPackages": [ ], "githubPackages": true From 9cb426e060709c4198d2574570d70400399376ed Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Mon, 6 Feb 2017 14:50:14 -0800 Subject: [PATCH 31/37] 0.8.16 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f9ef8e1e..5d0250ec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pxt-calliope", - "version": "0.8.15", + "version": "0.8.16", "description": "Calliope Mini editor for PXT", "keywords": [ "JavaScript", From 0dc9f53e302661fe1b719c733b44c9f98d798a35 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Mon, 6 Feb 2017 15:19:32 -0800 Subject: [PATCH 32/37] bumped to 0.8.16 --- docs/index-ref.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index-ref.json b/docs/index-ref.json index dc73b3f2..04ed5e5c 100644 --- a/docs/index-ref.json +++ b/docs/index-ref.json @@ -1,3 +1,3 @@ { - "appref": "v0.8.2" + "appref": "v0.8.16" } From be88603d576376d0e4c4ccb8851cca192e3bd6fe Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Mon, 6 Feb 2017 22:28:44 -0800 Subject: [PATCH 33/37] enabling text blocks --- pxtarget.json | 1 + 1 file changed, 1 insertion(+) diff --git a/pxtarget.json b/pxtarget.json index d9e81430..c168e9e8 100644 --- a/pxtarget.json +++ b/pxtarget.json @@ -55,6 +55,7 @@ "loopsBlocks": true, "logicBlocks": true, "variablesBlocks": true, + "textBlocks": true, "onStartColor": "#54C9C9", "onStartNamespace": "basic" }, From f7f9a29e556c321f30fa98c55bdc0777f4fd3895 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Mon, 6 Feb 2017 22:29:00 -0800 Subject: [PATCH 34/37] Bump pxt-core to 0.11.16 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5d0250ec..d876e94a 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "semantic-ui-less": "^2.2.4" }, "dependencies": { - "pxt-core": "0.11.14" + "pxt-core": "0.11.16" }, "scripts": { "test": "node node_modules/pxt-core/built/pxt.js travis" From 4d2981489da788f38f91ea0a89bde95fab4eaeeb Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Mon, 6 Feb 2017 22:29:02 -0800 Subject: [PATCH 35/37] 0.8.17 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d876e94a..eec36b31 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pxt-calliope", - "version": "0.8.16", + "version": "0.8.17", "description": "Calliope Mini editor for PXT", "keywords": [ "JavaScript", From e28cd3c3c6fc56df32f91dd83005f8e4aaf48c3b Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Wed, 8 Feb 2017 21:10:07 -0800 Subject: [PATCH 36/37] Bump pxt-core to 0.11.26 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index eec36b31..1733c679 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "semantic-ui-less": "^2.2.4" }, "dependencies": { - "pxt-core": "0.11.16" + "pxt-core": "0.11.26" }, "scripts": { "test": "node node_modules/pxt-core/built/pxt.js travis" From 28fc309a64a9be65b256181453b7252d9bfd2006 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Wed, 8 Feb 2017 21:10:09 -0800 Subject: [PATCH 37/37] 0.8.18 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1733c679..b67f8989 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pxt-calliope", - "version": "0.8.17", + "version": "0.8.18", "description": "Calliope Mini editor for PXT", "keywords": [ "JavaScript",