mirror of
https://github.com/CharaChorder/DeviceManager.git
synced 2026-01-20 08:52:59 +00:00
feat: update m4g
This commit is contained in:
@@ -113,8 +113,9 @@
|
||||
const { Transport, ESPLoader } = await import("esptool-js");
|
||||
const espLoader = new ESPLoader({
|
||||
transport: new Transport(port),
|
||||
baudrate: Number(esptool.baud),
|
||||
romBaudrate: Number(esptool.baud),
|
||||
baudrate: 9600, // Number(esptool.baud),
|
||||
romBaudrate: 9600, // Number(esptool.baud),
|
||||
debugLogging: true,
|
||||
terminal: {
|
||||
clean: () => {
|
||||
terminalOutput = "";
|
||||
@@ -127,8 +128,10 @@
|
||||
},
|
||||
},
|
||||
} satisfies LoaderOptions);
|
||||
await espLoader.connect(esptool.before);
|
||||
await espLoader.runStub();
|
||||
await espLoader.detectChip(esptool.before);
|
||||
if (!espLoader.IS_STUB) {
|
||||
await espLoader.runStub();
|
||||
}
|
||||
|
||||
return espLoader;
|
||||
}
|
||||
@@ -162,6 +165,25 @@
|
||||
port.close();
|
||||
}
|
||||
}
|
||||
|
||||
async function eraseSPI() {
|
||||
const port = await navigator.serial.requestPort();
|
||||
try {
|
||||
console.log(data.meta);
|
||||
const spiFlash = data.meta.spi_flash!;
|
||||
espLoader = await connectEsp(port);
|
||||
|
||||
/*espLoader.flashSpiAttach(
|
||||
(spiFlash.connection.clk << 0) |
|
||||
(spiFlash.connection.q << 8) |
|
||||
(spiFlash.connection.d << 16) |
|
||||
(spiFlash.connection.cs << 24),
|
||||
);
|
||||
espLoader.flashId();*/
|
||||
} finally {
|
||||
port.close();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="container">
|
||||
@@ -288,6 +310,9 @@
|
||||
<label
|
||||
><input type="checkbox" id="erase" bind:checked={eraseAll} />Erase All</label
|
||||
>
|
||||
<button onclick={eraseSPI}
|
||||
><span class="icon">developer_board</span>Erase SPI Flash</button
|
||||
>
|
||||
</div>
|
||||
|
||||
<pre>{terminalOutput}</pre>
|
||||
|
||||
@@ -44,6 +44,7 @@ export const load = (async ({ fetch, params }) => {
|
||||
(entry) =>
|
||||
entry.type === "file" && (!meta?.files || entry.name in meta.files),
|
||||
) as FileListing[],
|
||||
spi_flash: meta?.spi_flash ?? undefined,
|
||||
},
|
||||
};
|
||||
}) satisfies PageLoad;
|
||||
|
||||
@@ -12,6 +12,21 @@ export interface VersionMeta {
|
||||
esptool: EspToolData | null;
|
||||
};
|
||||
files: string[];
|
||||
spi_flash: SPIFlashInfo | null;
|
||||
}
|
||||
|
||||
export interface SPIFlashInfo {
|
||||
type: string;
|
||||
size: string;
|
||||
connection: SPIConnection;
|
||||
}
|
||||
|
||||
export interface SPIConnection {
|
||||
clk: number;
|
||||
q: number;
|
||||
d: number;
|
||||
hd: number;
|
||||
cs: number;
|
||||
}
|
||||
|
||||
export interface EspToolData {
|
||||
|
||||
Reference in New Issue
Block a user