diff --git a/src/assets/translations/en.json b/src/assets/translations/en.json index 82a721e..c19a294 100644 --- a/src/assets/translations/en.json +++ b/src/assets/translations/en.json @@ -122,5 +122,6 @@ "EXPLANATION": "Explanation", "EXPLAIN_BLOCK": "Explain Block ✨", "META_ATTRIBUTION": "Built with Meta Llama 3", - "AI_RATE_LIMITED": "The explanation robot is a little too busy right now, please try again later." + "AI_RATE_LIMITED": "The explanation robot is a little too busy right now, please try again later.", + "CHOOSING_ROBOT": "Choose your board" } diff --git a/src/assets/translations/nl.json b/src/assets/translations/nl.json index f1928c4..e69154b 100644 --- a/src/assets/translations/nl.json +++ b/src/assets/translations/nl.json @@ -122,5 +122,6 @@ "EXPLANATION": "Uitleg", "EXPLAIN_BLOCK": "Leg blok uit ✨", "META_ATTRIBUTION": "Gemaakt met Meta Llama 3", - "AI_RATE_LIMITED": "De uitleg robot is op dit moment erg druk, probeer het later nog eens." + "AI_RATE_LIMITED": "De uitleg robot is op dit moment erg druk, probeer het later nog eens.", + "CHOOSING_ROBOT": "Kies je arduino" } diff --git a/src/lib/components/core/header/Header.svelte b/src/lib/components/core/header/Header.svelte index d6c177b..7211590 100644 --- a/src/lib/components/core/header/Header.svelte +++ b/src/lib/components/core/header/Header.svelte @@ -9,7 +9,7 @@ import Select from "$components/ui/Select.svelte"; import { loadWorkspaceFromString } from "$domain/blockly/blockly"; import { FileHandle } from "$domain/handles"; import { robots } from "$domain/robots"; -import { Screen, Theme, screen, selected, theme } from "$state/app.svelte"; +import { Screen, Theme, screen, theme } from "$state/app.svelte"; import { audio, canRedo, @@ -85,7 +85,6 @@ async function connect() { async function newProject() { popups.clear(); willRestore.set(false); - selected.set(null); screen.set(Screen.START); } diff --git a/src/lib/components/core/popups/popups/PythonUploader.svelte b/src/lib/components/core/popups/popups/PythonUploader.svelte index a01df96..9a1f608 100644 --- a/src/lib/components/core/popups/popups/PythonUploader.svelte +++ b/src/lib/components/core/popups/popups/PythonUploader.svelte @@ -1,8 +1,10 @@ - +
{#if $usbRequest}

{$_("RECONNECT")}

@@ -103,7 +117,7 @@ async function connectUSB() {
- + - \ No newline at end of file diff --git a/src/lib/components/start/RobotSelector.svelte b/src/lib/components/start/RobotSelector.svelte index cd989c1..52bf4db 100644 --- a/src/lib/components/start/RobotSelector.svelte +++ b/src/lib/components/start/RobotSelector.svelte @@ -1,46 +1,31 @@ -
+
{#each robots as row}
{#each row as robot}
diff --git a/src/lib/micropython/index.ts b/src/lib/micropython/index.ts index def8972..2253736 100644 --- a/src/lib/micropython/index.ts +++ b/src/lib/micropython/index.ts @@ -1,9 +1,11 @@ import PythonUploader from "$components/core/popups/popups/PythonUploader.svelte"; import Uploader from "$components/core/popups/popups/Uploader.svelte"; +import type { RobotDevice } from "$domain/robots"; import { popups } from "$state/popup.svelte"; import { port } from "$state/workspace.svelte"; import base64 from "base64-js"; import { get } from "svelte/store"; +import { delay } from "../programmers/utils"; import { Commands } from "./commands"; import { FileSystem } from "./filesystem"; import { PackageManager } from "./packagagemanager"; @@ -73,10 +75,15 @@ export default class MicroPythonIO { }); } - async getFirmware() { - const res = await fetch( - "https://raw.githubusercontent.com/leaphy-robotics/leaphy-firmware/main/micropython/firmware.uf2", - ); + async getFirmware(robot: RobotDevice) { + const firmwareSources = { + l_nano_esp32: + "https://raw.githubusercontent.com/leaphy-robotics/leaphy-firmware/main/micropython/esp32.bin", + l_nano_rp2040: + "https://raw.githubusercontent.com/leaphy-robotics/leaphy-firmware/main/micropython/firmware.uf2", + }; + + const res = await fetch(firmwareSources[robot.id]); const content = await res.arrayBuffer(); return { @@ -126,6 +133,7 @@ export default class MicroPythonIO { const data = encoder.encode(`${code}\x04`); for (let offset = 0; offset < data.length; offset += 256) { await this.writer.write(data.slice(offset, offset + 256)); + await delay(5); } let content = ""; diff --git a/src/lib/state/app.svelte.ts b/src/lib/state/app.svelte.ts index 7da860a..670218a 100644 --- a/src/lib/state/app.svelte.ts +++ b/src/lib/state/app.svelte.ts @@ -66,5 +66,4 @@ function createLibraryState() { } export const screen = writable(Screen.START); -export const selected = writable(null); export const libraries = createLibraryState();