feat: explicit reboot after ota update

This commit is contained in:
2024-10-16 19:34:16 +02:00
parent bf490ba823
commit 3d25b030c6

View File

@@ -506,11 +506,25 @@ export class CharaDevice {
return it; return it;
}); });
await this.suspend();
if (result !== "OTA OK") { if (result !== "OTA OK") {
throw new Error(result); throw new Error(result);
} }
const writer2 = this.port.writable!.getWriter();
try {
await writer2.write(new TextEncoder().encode(`RST REBOOT\r\n`));
serialLog.update((it) => {
it.push({
type: "input",
value: "RST REBOOT",
});
return it;
});
} finally {
writer2.releaseLock();
}
await this.suspend();
} finally { } finally {
delete this.lock; delete this.lock;
resolveLock!(true); resolveLock!(true);