mirror of
https://github.com/esphome/esp-web-tools.git
synced 2025-07-28 06:06:36 +00:00
Use path instead of filename in firmware
This commit is contained in:
parent
c99e22bbdc
commit
1f643f3aa4
@ -5,15 +5,15 @@
|
||||
"chipFamily": "ESP32",
|
||||
"improv": true,
|
||||
"parts": [
|
||||
{ "filename": "bootloader.bin", "offset": 4096 },
|
||||
{ "filename": "partitions.bin", "offset": 32768 },
|
||||
{ "filename": "ota.bin", "offset": 57344 },
|
||||
{ "filename": "firmware.bin", "offset": 65536 }
|
||||
{ "path": "bootloader.bin", "offset": 4096 },
|
||||
{ "path": "partitions.bin", "offset": 32768 },
|
||||
{ "path": "ota.bin", "offset": 57344 },
|
||||
{ "path": "firmware.bin", "offset": 65536 }
|
||||
]
|
||||
},
|
||||
{
|
||||
"chipFamily": "ESP8266",
|
||||
"parts": [{ "filename": "esp8266.bin", "offset": 0 }]
|
||||
"parts": [{ "path": "esp8266.bin", "offset": 0 }]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ export interface Build {
|
||||
chipFamily: "ESP32" | "ESP8266";
|
||||
improv: boolean;
|
||||
parts: {
|
||||
filename: string;
|
||||
path: string;
|
||||
offset: number;
|
||||
}[];
|
||||
}
|
||||
|
@ -45,9 +45,11 @@ export const startFlash = async (
|
||||
return;
|
||||
}
|
||||
|
||||
const chipFamily = getChipFamilyName(esploader);
|
||||
|
||||
logEl.addRow({
|
||||
id: "initializing",
|
||||
content: html`Initialized. Found ${getChipFamilyName(esploader)}`,
|
||||
content: html`Initialized. Found ${chipFamily}`,
|
||||
});
|
||||
logEl.addRow({ id: "manifest", content: "Fetching manifest..." });
|
||||
|
||||
@ -65,8 +67,6 @@ export const startFlash = async (
|
||||
content: html`Found manifest for ${manifest.name}`,
|
||||
});
|
||||
|
||||
const chipFamily = getChipFamilyName(esploader);
|
||||
|
||||
let build: Build | undefined;
|
||||
for (const b of manifest.builds) {
|
||||
if (b.chipFamily === chipFamily) {
|
||||
@ -87,11 +87,11 @@ export const startFlash = async (
|
||||
});
|
||||
|
||||
const filePromises = build.parts.map(async (part) => {
|
||||
const url = new URL(part.filename, manifestURL).toString();
|
||||
const url = new URL(part.path, manifestURL).toString();
|
||||
const resp = await fetch(url);
|
||||
if (!resp.ok) {
|
||||
throw new Error(
|
||||
`Downlading firmware ${part.filename} failed: ${resp.status}`
|
||||
`Downlading firmware ${part.path} failed: ${resp.status}`
|
||||
);
|
||||
}
|
||||
return resp.arrayBuffer();
|
||||
|
Loading…
x
Reference in New Issue
Block a user