From 33a6542679a148a7c655e4471410cb22c699cc83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=AB=8B=E5=B8=AE?= <3294713004@qq.com> Date: Thu, 17 Apr 2025 23:35:07 +0800 Subject: [PATCH] =?UTF-8?q?fix(core):=20=E4=BF=AE=E5=A4=8D=E6=97=A0?= =?UTF-8?q?=E5=BB=B6=E6=97=B6=E5=8F=91=E9=80=81=E4=B8=A4=E6=AC=A1=20`Ctrl?= =?UTF-8?q?=20+=20C`=20=E5=8F=AF=E8=83=BD=E5=AF=BC=E8=87=B4k210=E6=9D=BF?= =?UTF-8?q?=E5=8D=A1=E4=B8=B2=E5=8F=A3=E6=97=A0=E5=93=8D=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/modules/mixly-modules/web/ampy.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/common/modules/mixly-modules/web/ampy.js b/common/modules/mixly-modules/web/ampy.js index 5277af3e..3e2692cc 100644 --- a/common/modules/mixly-modules/web/ampy.js +++ b/common/modules/mixly-modules/web/ampy.js @@ -95,7 +95,9 @@ class AmpyExt extends Ampy { async interrupt(timeout = 1000) { for (let i = 0; i < 5; i++) { // 中断两次 - await this.#device_.sendBuffer([3, 3]); + await this.#device_.sendBuffer([0x0D, 0x03]); + await this.#device_.sleep(100); + await this.#device_.sendBuffer([0x03]); await this.#device_.sleep(100); if (await this.readUntil('>>>', true, timeout)) { return true; @@ -106,7 +108,7 @@ class AmpyExt extends Ampy { async enterRawREPL(timeout = 1000) { for (let i = 0; i < 5; i++) { - await this.#device_.sendBuffer([1]); + await this.#device_.sendBuffer([0x01]); await this.#device_.sleep(100); if (await this.readUntil('raw repl; ctrl-b to exit', true, timeout)) { return true; @@ -116,7 +118,7 @@ class AmpyExt extends Ampy { } async exitRawREPL(timeout = 5000) { - await this.#device_.sendBuffer([2]); + await this.#device_.sendBuffer([0x02]); await this.#device_.sleep(100); let succeed = false; if (await this.readUntil('>>>', true, timeout)) { @@ -126,7 +128,7 @@ class AmpyExt extends Ampy { } async exitREPL(timeout = 5000) { - await this.#device_.sendBuffer([4]); + await this.#device_.sendBuffer([0x04]); await this.#device_.sleep(100); let succeed = false; if (await this.readUntil('soft reboot', false, timeout)) { @@ -155,7 +157,7 @@ class AmpyExt extends Ampy { await this.#device_.sleep(10); } } - await this.#device_.sendBuffer([4]); + await this.#device_.sendBuffer([0x04]); return await this.follow(timeout); } @@ -184,7 +186,7 @@ class AmpyExt extends Ampy { this.#active_ = true; await this.#device_.open(115200); await this.#device_.sleep(500); - await this.#device_.sendBuffer([2]); + await this.#device_.sendBuffer([0x02]); if (!await this.interrupt()) { throw new Error(Msg.Lang['ampy.interruptFailed']); }