From ca2fd9eb7006f185b3b4d2d25f0f79d4cf0dc60a Mon Sep 17 00:00:00 2001 From: bkleiner Date: Wed, 7 Aug 2024 20:33:24 +0200 Subject: [PATCH] serial: add delay to hard_reboot --- src/store/serial/serial.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/store/serial/serial.ts b/src/store/serial/serial.ts index 8b3b536..079d7c3 100644 --- a/src/store/serial/serial.ts +++ b/src/store/serial/serial.ts @@ -6,7 +6,12 @@ import { type QuicHeader, type QuicPacket, } from "./quic"; -import { ArrayWriter, concatUint8Array, stringToUint8Array } from "../util"; +import { + ArrayWriter, + asyncDelay, + concatUint8Array, + stringToUint8Array, +} from "../util"; import { Log } from "@/log"; import { CBOR } from "./cbor"; import { WebSerial } from "./webserial"; @@ -175,7 +180,9 @@ export class Serial { const target = await this.get(QuicVal.Target, 500) .then((p) => p.name) .catch(() => undefined); + await asyncDelay(100); await this.write(stringToUint8Array(HARD_REBOOT_MAGIC)); + await asyncDelay(100); await this.write(stringToUint8Array("\r\nbl\r\n")); await this.close();