From cc550ec5cccfe2ecf0e9330009d45a458dc1bc03 Mon Sep 17 00:00:00 2001 From: yczpf2019 Date: Sat, 24 Jan 2026 19:57:25 +0800 Subject: [PATCH] =?UTF-8?q?fix(shell-micropython):=20=E4=BF=AE=E5=A4=8D=20?= =?UTF-8?q?reset=20=E6=95=B0=E7=BB=84=E5=8F=82=E6=95=B0=E5=BA=8F=E5=88=97?= =?UTF-8?q?=E5=8C=96=E5=AF=BC=E8=87=B4=E7=9A=84=E5=BC=95=E5=8F=B7=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/shell-micropython.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/common/shell-micropython.js b/src/common/shell-micropython.js index 009ab313..91634534 100755 --- a/src/common/shell-micropython.js +++ b/src/common/shell-micropython.js @@ -25,11 +25,19 @@ export default class ShellMicroPython extends Shell { } async upload(config) { + // 正确处理 reset 参数:如果是数组则序列化为 JSON 字符串 + let resetValue = config.reset; + if (Array.isArray(resetValue)) { + resetValue = JSON.stringify(resetValue); + } else if (resetValue === undefined || resetValue === null) { + resetValue = '[]'; + } + const info = { indexPath: path.resolve(CLIENT_PATH, config.boardDirPath), ampy: `"${PYTHON.path.cli}" "${MICROPYTHON.path.ampy}"`, com: config.port, - reset: config.reset || "[]" + reset: resetValue }; // 兼容性处理:移除模板中可能存在的冗余引号 let cmdTemplate = config.command || "";