From c32583e3f46bed56d6962b1d766d43f4f94a4c3e Mon Sep 17 00:00:00 2001 From: yczpf2019 Date: Sat, 24 Jan 2026 20:02:11 +0800 Subject: [PATCH] =?UTF-8?q?debug(shell-micropython):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=AF=A6=E7=BB=86=E8=B0=83=E8=AF=95=E6=97=A5=E5=BF=97=E4=BB=A5?= =?UTF-8?q?=E5=AE=9A=E4=BD=8D=E5=BC=95=E5=8F=B7=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/shell-micropython.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/common/shell-micropython.js b/src/common/shell-micropython.js index 91634534..303ac0ac 100755 --- a/src/common/shell-micropython.js +++ b/src/common/shell-micropython.js @@ -25,6 +25,13 @@ export default class ShellMicroPython extends Shell { } async upload(config) { + // 调试:打印接收到的原始配置 + console.log('=== UPLOAD DEBUG START ==='); + console.log('Received config.command:', JSON.stringify(config.command)); + console.log('Received config.reset:', JSON.stringify(config.reset)); + console.log('Received config.port:', config.port); + console.log('Received config.boardDirPath:', config.boardDirPath); + // 正确处理 reset 参数:如果是数组则序列化为 JSON 字符串 let resetValue = config.reset; if (Array.isArray(resetValue)) { @@ -32,6 +39,7 @@ export default class ShellMicroPython extends Shell { } else if (resetValue === undefined || resetValue === null) { resetValue = '[]'; } + console.log('Processed resetValue:', resetValue); const info = { indexPath: path.resolve(CLIENT_PATH, config.boardDirPath), @@ -39,11 +47,18 @@ export default class ShellMicroPython extends Shell { com: config.port, reset: resetValue }; + console.log('Info object:', JSON.stringify(info)); + // 兼容性处理:移除模板中可能存在的冗余引号 let cmdTemplate = config.command || ""; + console.log('Original cmdTemplate:', cmdTemplate); cmdTemplate = cmdTemplate.replace(/"{ampy}"/g, '{ampy}'); + console.log('After quote cleanup:', cmdTemplate); + const command = MString.tpl(cmdTemplate, info); - console.log('DEBUG CMD UPLOAD:', command); + console.log('Final command:', command); + console.log('=== UPLOAD DEBUG END ==='); + return this.execUntilClosed(command); } } \ No newline at end of file