diff --git a/docs/static/download/connect.svg b/docs/static/download/connect.svg new file mode 100644 index 00000000..10c162e3 --- /dev/null +++ b/docs/static/download/connect.svg @@ -0,0 +1,331 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/static/download/firmware.svg b/docs/static/download/firmware.svg new file mode 100644 index 00000000..417e3d1f --- /dev/null +++ b/docs/static/download/firmware.svg @@ -0,0 +1,252 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/static/download/transfer.svg b/docs/static/download/transfer.svg new file mode 100644 index 00000000..6eb0839f --- /dev/null +++ b/docs/static/download/transfer.svg @@ -0,0 +1,327 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/editor/extension.ts b/editor/extension.ts index 347b3ab1..6e9e9d26 100644 --- a/editor/extension.ts +++ b/editor/extension.ts @@ -8,7 +8,7 @@ import { FieldSpeed } from "./field_speed"; import { FieldBrickButtons } from "./field_brickbuttons"; import { FieldTurnRatio } from "./field_turnratio"; -pxt.editor.initExtensionsAsync = function(opts: pxt.editor.ExtensionOptions): Promise { +pxt.editor.initExtensionsAsync = function (opts: pxt.editor.ExtensionOptions): Promise { pxt.debug('loading pxt-ev3 target extensions...') updateBlocklyShape(); const res: pxt.editor.ExtensionResult = { @@ -28,7 +28,95 @@ pxt.editor.initExtensionsAsync = function(opts: pxt.editor.ExtensionOptions): Pr selector: "turnratio", editor: FieldTurnRatio }], - deployCoreAsync + deployCoreAsync, + showUploadInstructionsAsync: (fn: string, url: string, confirmAsync: (options: any) => Promise) => { + let resolve: (thenableOrResult?: void | PromiseLike) => void; + let reject: (error: any) => void; + const deferred = new Promise((res, rej) => { + resolve = res; + reject = rej; + }); + const boardName = pxt.appTarget.appTheme.boardName || "???"; + const boardDriveName = pxt.appTarget.appTheme.driveDisplayName || pxt.appTarget.compile.driveName || "???"; + + // https://msdn.microsoft.com/en-us/library/cc848897.aspx + // "For security reasons, data URIs are restricted to downloaded resources. + // Data URIs cannot be used for navigation, for scripting, or to populate frame or iframe elements" + const downloadAgain = !pxt.BrowserUtils.isIE() && !pxt.BrowserUtils.isEdge(); + const docUrl = pxt.appTarget.appTheme.usbDocs; + const saveAs = pxt.BrowserUtils.hasSaveAs(); + + const htmlBody = ` + + + + + + + + + 1 + ${lf("Connect EV3 to computer with USB cable")} + + ${lf("Use the miniUSB port on top of EV3 brick")} + + + + + + + + + + + + 2 + ${lf("Make sure you have the latest EV3 firmware")} + + ${lf("Click here to update to latest firmware")} + + + + + + + + + + + + 3 + ${lf("Move the .uf2 file to EV3 brick")} + + ${lf("Locate the downloaded .uf2 file and drag it to the EV3 drive")} + + + + + `; + + return confirmAsync({ + header: lf("Download to your EV3"), + htmlBody, + hasCloseIcon: true, + hideCancel: true, + hideAgree: false, + agreeLbl: lf("I got it"), + buttons: [downloadAgain ? { + label: fn, + icon: "download", + class: "lightgrey focused", + url, + fileName: fn + } : undefined, docUrl ? { + label: lf("Help"), + icon: "help", + class: "lightgrey", + url: docUrl + } : undefined] + //timeout: 20000 + }).then(() => { }); + } }; initAsync().catch(e => { // probably no HID - we'll try this again upon deployment diff --git a/package.json b/package.json index e22a16fc..58c9c879 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ }, "dependencies": { "pxt-common-packages": "0.17.11", - "pxt-core": "3.0.25" + "pxt-core": "3.0.26" }, "scripts": { "test": "node node_modules/pxt-core/built/pxt.js travis"