Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions extensions/src/doodlebot/Connect.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
const invoke: ReactiveInvoke<Extension> = (functionName, ...args) =>
reactiveInvoke((extension = extension), functionName, args);

let connected = extension.connected;

let error: string | null = null;

let bleDevice: BLEDeviceWithUartService | null = null;
Expand Down Expand Up @@ -68,7 +66,7 @@
let showAdvanced = false;

onDestroy(() => {
if (!connected)
if (!extension.connected)
try {
extension.setIndicator("disconnected");
} catch (e) {}
Expand All @@ -81,7 +79,7 @@
style:background-color={color.ui.white}
style:color={color.text.primary}
>
{#if connected}
{#if extension.connected}
<h1>You're connected to doodlebot!</h1>
<div>
If you'd like to reconnect, or connect to a different device, you must
Expand Down
15 changes: 12 additions & 3 deletions extensions/src/doodlebot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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");
}
Expand Down Expand Up @@ -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) {
Expand Down
Loading