If DFU update fails but we're not using any delay between sending packets, try again but with a delay.

This fixes an issue with *some* Windows 11 PCs where a DFU update would fail on the first 4096 byte block

Fix #80
This commit is contained in:
Gordon Williams
2024-01-11 09:27:17 +00:00
parent 234b38150a
commit 334e336727

View File

@@ -548,7 +548,14 @@ export class SecureDfu extends EventDispatcher {
resolve(device);
});
})
.catch(error => reject(error));
.catch(error => {
if (this.delay === 0) {
this.log("DFU update failed, but delay=0. Trying again with delay=10...");
this.delay = 10;
return this.update(device, init, firmware);
}
reject(error);
});
});
}
}