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 || "";