Use path instead of filename in firmware

This commit is contained in:
Paulus Schoutsen 2021-06-04 10:03:01 -07:00
parent c99e22bbdc
commit 1f643f3aa4
3 changed files with 11 additions and 11 deletions

View File

@ -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 }]
}
]
}

View File

@ -2,7 +2,7 @@ export interface Build {
chipFamily: "ESP32" | "ESP8266";
improv: boolean;
parts: {
filename: string;
path: string;
offset: number;
}[];
}

View File

@ -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();