Compare commits

..

14 Commits

Author SHA1 Message Date
4e9d3aa413 0.0.10 2017-08-07 11:33:51 -07:00
1efad776e6 bump pxt-core to 2.0.6, 2017-08-07 11:33:46 -07:00
5e7af872b5 Add setLights shadow block 2017-08-07 10:19:38 -07:00
17683033b1 Add branch info 2017-08-07 12:15:56 +02:00
31f3d108c5 Update build instructions 2017-08-07 12:15:06 +02:00
b45bf7512c 0.0.9 2017-08-07 11:13:05 +02:00
2dec405a9b Catch errors from initAsync 2017-08-07 11:12:52 +02:00
29009aa5e5 0.0.8 2017-08-07 11:08:15 +02:00
86011827dc Fix initialization without HID 2017-08-07 10:56:21 +02:00
c20cfab069 Fix web deployment, only use HF2 when in localhost (#2) 2017-08-05 17:54:18 +01:00
197f9096f8 0.0.7 2017-08-04 22:53:11 -07:00
6d499cb683 Fix package.json 2017-08-04 22:52:53 -07:00
163a4f89f8 0.0.6 2017-08-04 22:41:39 -07:00
b32aa61cd1 Update package.json 2017-08-04 21:17:52 -07:00
6 changed files with 29 additions and 15 deletions

View File

@ -9,12 +9,12 @@ This repo contains the editor target hosted at https://lego.makecode.com
These instructions assume familiarity with dev tools and languages. These instructions assume familiarity with dev tools and languages.
* install Node.js 6+ * install Node.js 6+
* install [yotta](http://docs.yottabuild.org/#installing) * install Docker; make sure `docker` command is in your `PATH`
* (optional) install [Visual Studio Code](https://code.visualstudio.com/) * (optional) install [Visual Studio Code](https://code.visualstudio.com/)
In a common folder, In a common folder,
* clone https://github.com/Microsoft/pxt to ``pxt`` folder * clone https://github.com/Microsoft/pxt to ``pxt`` folder (currently, build against `freshcoat` branch)
* clone https://github.com/Microsoft/pxt-common-packages to ``pxt-common-packages`` folder * clone https://github.com/Microsoft/pxt-common-packages to ``pxt-common-packages`` folder
* clone https://github.com/Microsoft/pxt-ev3 to ``pxt-ev3`` folder * clone https://github.com/Microsoft/pxt-ev3 to ``pxt-ev3`` folder
* go to ``pxt`` and run * go to ``pxt`` and run

View File

@ -28,13 +28,18 @@ namespace pxt.editor {
let initPromise: Promise<Ev3Wrapper> let initPromise: Promise<Ev3Wrapper>
function initAsync() { function initAsync() {
if (!initPromise) const forceHexDownload = /forceHexDownload/i.test(window.location.href);
if (!initPromise && Cloud.isLocalHost() && Cloud.localToken && !forceHexDownload)
initPromise = hf2Async() initPromise = hf2Async()
.catch(err => { .catch(err => {
initPromise = null initPromise = null
noHID = true noHID = true
return Promise.reject(err) return Promise.reject(err)
}) })
else {
noHID = true
initPromise = Promise.reject(new Error("no HID"))
}
return initPromise return initPromise
} }
@ -116,13 +121,9 @@ namespace pxt.editor {
const res: pxt.editor.ExtensionResult = { const res: pxt.editor.ExtensionResult = {
deployCoreAsync, deployCoreAsync,
}; };
initAsync() initAsync().catch(e => {
/* // probably no HID - we'll try this again upon deployment
.then(w => w.streamFileAsync("/tmp/serial.txt", buf => { })
let str = Util.fromUTF8(Util.uint8ArrayToString(buf))
}))
*/
return Promise.resolve<pxt.editor.ExtensionResult>(res); return Promise.resolve<pxt.editor.ExtensionResult>(res);
} }
} }

View File

@ -20,6 +20,7 @@
"input.remoteTopRight": "Remote top-right button.", "input.remoteTopRight": "Remote top-right button.",
"output.createBuffer": "Create a new zero-initialized buffer.", "output.createBuffer": "Create a new zero-initialized buffer.",
"output.createBuffer|param|size": "number of bytes in the buffer", "output.createBuffer|param|size": "number of bytes in the buffer",
"output.getPattern": "Pattern block.",
"output.setLights": "Set lights.", "output.setLights": "Set lights.",
"screen.clear": "Clear screen and reset font to normal.", "screen.clear": "Clear screen and reset font to normal.",
"screen.doubleIcon": "Double size of an icon.", "screen.doubleIcon": "Double size of an icon.",

View File

@ -16,7 +16,8 @@
"input.remoteTopLeft|block": "remote top-left", "input.remoteTopLeft|block": "remote top-left",
"input.remoteTopRight|block": "remote top-right", "input.remoteTopRight|block": "remote top-right",
"input|block": "input", "input|block": "input",
"output.setLights|block": "set lights %pattern", "output.getPattern|block": "%pattern",
"output.setLights|block": "set lights %pattern=led_pattern",
"output|block": "output", "output|block": "output",
"screen|block": "screen", "screen|block": "screen",
"serial|block": "serial", "serial|block": "serial",

View File

@ -216,8 +216,8 @@ namespace output {
/** /**
* Set lights. * Set lights.
*/ */
//% blockId=setLights block="set lights %pattern" //% blockId=setLights block="set lights %pattern=led_pattern"
export function setLights(pattern: LightsPattern): void { export function setLights(pattern: number): void {
if (currPattern === pattern) if (currPattern === pattern)
return return
currPattern = pattern currPattern = pattern
@ -225,4 +225,15 @@ namespace output {
cmd[0] = pattern + 48 cmd[0] = pattern + 48
input.internal.getBtnsMM().write(cmd) input.internal.getBtnsMM().write(cmd)
} }
/**
* Pattern block.
*/
//% blockId=led_pattern block="%pattern"
//% shim=TD_ID colorSecondary="#6e9a36"
//% blockHidden=true
export function getPattern(pattern: LightsPattern): number {
return pattern;
}
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "pxt-ev3", "name": "pxt-ev3",
"version": "0.0.5", "version": "0.0.10",
"description": "LEGO Mindstorms EV3 for Microsoft MakeCode", "description": "LEGO Mindstorms EV3 for Microsoft MakeCode",
"private": true, "private": true,
"keywords": [ "keywords": [
@ -40,7 +40,7 @@
}, },
"dependencies": { "dependencies": {
"pxt-common-packages": "0.9.2", "pxt-common-packages": "0.9.2",
"pxt-core": "2.0.2" "pxt-core": "2.0.6"
}, },
"scripts": { "scripts": {
"test": "node node_modules/pxt-core/built/pxt.js travis" "test": "node node_modules/pxt-core/built/pxt.js travis"