Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
4e9d3aa413 | |||
1efad776e6 | |||
5e7af872b5 | |||
17683033b1 | |||
31f3d108c5 | |||
b45bf7512c | |||
2dec405a9b | |||
29009aa5e5 | |||
86011827dc | |||
c20cfab069 | |||
197f9096f8 | |||
6d499cb683 | |||
163a4f89f8 | |||
b32aa61cd1 |
@ -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.
|
||||
|
||||
* 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/)
|
||||
|
||||
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-ev3 to ``pxt-ev3`` folder
|
||||
* go to ``pxt`` and run
|
||||
|
@ -28,13 +28,18 @@ namespace pxt.editor {
|
||||
|
||||
let initPromise: Promise<Ev3Wrapper>
|
||||
function initAsync() {
|
||||
if (!initPromise)
|
||||
const forceHexDownload = /forceHexDownload/i.test(window.location.href);
|
||||
if (!initPromise && Cloud.isLocalHost() && Cloud.localToken && !forceHexDownload)
|
||||
initPromise = hf2Async()
|
||||
.catch(err => {
|
||||
initPromise = null
|
||||
noHID = true
|
||||
return Promise.reject(err)
|
||||
})
|
||||
else {
|
||||
noHID = true
|
||||
initPromise = Promise.reject(new Error("no HID"))
|
||||
}
|
||||
return initPromise
|
||||
}
|
||||
|
||||
@ -116,13 +121,9 @@ namespace pxt.editor {
|
||||
const res: pxt.editor.ExtensionResult = {
|
||||
deployCoreAsync,
|
||||
};
|
||||
initAsync()
|
||||
/*
|
||||
.then(w => w.streamFileAsync("/tmp/serial.txt", buf => {
|
||||
let str = Util.fromUTF8(Util.uint8ArrayToString(buf))
|
||||
|
||||
}))
|
||||
*/
|
||||
initAsync().catch(e => {
|
||||
// probably no HID - we'll try this again upon deployment
|
||||
})
|
||||
return Promise.resolve<pxt.editor.ExtensionResult>(res);
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
"input.remoteTopRight": "Remote top-right button.",
|
||||
"output.createBuffer": "Create a new zero-initialized buffer.",
|
||||
"output.createBuffer|param|size": "number of bytes in the buffer",
|
||||
"output.getPattern": "Pattern block.",
|
||||
"output.setLights": "Set lights.",
|
||||
"screen.clear": "Clear screen and reset font to normal.",
|
||||
"screen.doubleIcon": "Double size of an icon.",
|
||||
|
@ -16,7 +16,8 @@
|
||||
"input.remoteTopLeft|block": "remote top-left",
|
||||
"input.remoteTopRight|block": "remote top-right",
|
||||
"input|block": "input",
|
||||
"output.setLights|block": "set lights %pattern",
|
||||
"output.getPattern|block": "%pattern",
|
||||
"output.setLights|block": "set lights %pattern=led_pattern",
|
||||
"output|block": "output",
|
||||
"screen|block": "screen",
|
||||
"serial|block": "serial",
|
||||
|
@ -216,8 +216,8 @@ namespace output {
|
||||
/**
|
||||
* Set lights.
|
||||
*/
|
||||
//% blockId=setLights block="set lights %pattern"
|
||||
export function setLights(pattern: LightsPattern): void {
|
||||
//% blockId=setLights block="set lights %pattern=led_pattern"
|
||||
export function setLights(pattern: number): void {
|
||||
if (currPattern === pattern)
|
||||
return
|
||||
currPattern = pattern
|
||||
@ -225,4 +225,15 @@ namespace output {
|
||||
cmd[0] = pattern + 48
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pxt-ev3",
|
||||
"version": "0.0.5",
|
||||
"version": "0.0.10",
|
||||
"description": "LEGO Mindstorms EV3 for Microsoft MakeCode",
|
||||
"private": true,
|
||||
"keywords": [
|
||||
@ -40,7 +40,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"pxt-common-packages": "0.9.2",
|
||||
"pxt-core": "2.0.2"
|
||||
"pxt-core": "2.0.6"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node node_modules/pxt-core/built/pxt.js travis"
|
||||
|
Reference in New Issue
Block a user