Skip to content

Commit 864bf15

Browse files
committed
Move FlashManager to routes/flashtool
1 parent ded76cc commit 864bf15

5 files changed

Lines changed: 5 additions & 73 deletions

File tree

src/lib/init.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { browser } from '$app/environment';
22
import { initializeDarkModeStore } from '$lib/stores/ColorSchemeStore';
3-
import { initializeFlashManagersStore } from '$lib/stores/FlashManagersStore';
43
import { initializeSerialPortsStore } from '$lib/stores/SerialPortsStore';
54
import { UserStore } from '$lib/stores/UserStore';
65
import { get, writable } from 'svelte/store';
@@ -16,7 +15,6 @@ export async function initializeApp(initializeAuth: boolean) {
1615
isInitializedStore.set(true);
1716

1817
initializeDarkModeStore();
19-
initializeFlashManagersStore(); // TODO: Move this OUT of here
2018
initializeSerialPortsStore(); // TODO: Move this OUT of here
2119

2220
if (!initializeAuth) return;

src/lib/stores/FlashManagersStore.ts

Lines changed: 0 additions & 63 deletions
This file was deleted.

src/routes/flashtool/+page.svelte

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import { MessageCircleQuestion, SquareTerminal } from '@lucide/svelte';
33
import { browser } from '$app/environment';
44
import { PUBLIC_DISCORD_INVITE_URL } from '$env/static/public';
5-
import FlashManager from '$lib/EspTool/FlashManager';
65
import Container from '$lib/components/Container.svelte';
76
import FirmwareChannelSelector from '$lib/components/FirmwareChannelSelector.svelte';
87
import TextInput from '$lib/components/input/TextInput.svelte';
@@ -15,11 +14,11 @@
1514
import { Label } from '$lib/components/ui/label';
1615
import { Progress } from '$lib/components/ui/progress';
1716
import { Sheet, SheetContent, SheetHeader, SheetTitle } from '$lib/components/ui/sheet';
18-
import { FlashManagerStore } from '$lib/stores/FlashManagersStore';
1917
import { isSerialSupported } from '$lib/utils/compatibility';
2018
import Bowser from 'bowser';
2119
import FirmwareBoardSelector from './FirmwareBoardSelector.svelte';
2220
import FirmwareFlasher from './FirmwareFlasher.svelte';
21+
import FlashManager from './FlashManager';
2322
import HelpDialog from './HelpDialog.svelte';
2423
import SerialPortSelector from './SerialPortSelector.svelte';
2524
@@ -47,14 +46,12 @@
4746
$effect(() => {
4847
if (port && !manager) {
4948
connectFailed = false;
50-
FlashManagerStore.getManager(port, terminal).then((m) => {
49+
FlashManager.Connect(port, terminal).then((m) => {
5150
manager = m;
52-
if (!manager) {
53-
connectFailed = true;
54-
}
51+
connectFailed = !manager;
5552
});
5653
} else if (!port && manager) {
57-
FlashManagerStore.removeManager(manager);
54+
manager.disconnect();
5855
manager = null;
5956
}
6057
});

src/routes/flashtool/FirmwareFlasher.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<script lang="ts">
22
import { Microchip, TriangleAlert } from '@lucide/svelte';
3-
import FlashManager from '$lib/EspTool/FlashManager';
43
import { DownloadAndVerifyBoardBinary } from '$lib/api/firmwareCDN';
54
import { Button } from '$lib/components/ui/button';
65
import { Progress } from '$lib/components/ui/progress';
6+
import FlashManager from './FlashManager';
77
88
interface Props {
99
version: string;

0 commit comments

Comments
 (0)