diff --git a/extensions/src/doodlebot/Connect.svelte b/extensions/src/doodlebot/Connect.svelte index ef1fe2b95..d2256dfb3 100644 --- a/extensions/src/doodlebot/Connect.svelte +++ b/extensions/src/doodlebot/Connect.svelte @@ -16,8 +16,6 @@ const invoke: ReactiveInvoke = (functionName, ...args) => reactiveInvoke((extension = extension), functionName, args); - let connected = extension.connected; - let error: string | null = null; let bleDevice: BLEDeviceWithUartService | null = null; @@ -68,7 +66,7 @@ let showAdvanced = false; onDestroy(() => { - if (!connected) + if (!extension.connected) try { extension.setIndicator("disconnected"); } catch (e) {} @@ -81,7 +79,7 @@ style:background-color={color.ui.white} style:color={color.text.primary} > - {#if connected} + {#if extension.connected}

You're connected to doodlebot!

If you'd like to reconnect, or connect to a different device, you must diff --git a/extensions/src/doodlebot/index.ts b/extensions/src/doodlebot/index.ts index 78a7691cd..2487e6d44 100644 --- a/extensions/src/doodlebot/index.ts +++ b/extensions/src/doodlebot/index.ts @@ -82,8 +82,6 @@ export default class DoodlebotBlocks extends extension(details, "ui", "customArg await this.setDictionaries(); }) - - // move dictionaries to doodlebot await this.setDictionaries(); this.teachableMachine = new TeachableMachine(); @@ -170,6 +168,8 @@ export default class DoodlebotBlocks extends extension(details, "ui", "customArg try { imageFiles = await this.doodlebot.findImageFiles(); soundFiles = await this.doodlebot.findSoundFiles(); + if (soundFiles.length == 0) soundFiles.push("File"); + } catch (e) { //this.openUI("ArrayError"); } @@ -491,7 +491,16 @@ export default class DoodlebotBlocks extends extension(details, "ui", "customArg type: "command", text: (sound) => `play sound ${sound}`, arg: { - type: "string", options: () => soundFiles.concat(self.getCurrentSounds(self.runtime._editingTarget.id)) + type: "string", options: () => { + const soundList = self.getCurrentSounds(self.runtime._editingTarget.id); + if (soundFiles.length == 0 && soundList.length == 0) { + return ["File"]; + } + if ((soundFiles.length == 1 && soundFiles[0] == "File") && soundList.length > 0) { + soundFiles = []; + } + return soundFiles.concat(soundList); + } } })) async playSoundFile(sound: string, util: BlockUtilityWithID) {