fix(shell-micropython): 修复 reset 数组参数序列化导致的引号错误
This commit is contained in:
@@ -25,11 +25,19 @@ export default class ShellMicroPython extends Shell {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async upload(config) {
|
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 = {
|
const info = {
|
||||||
indexPath: path.resolve(CLIENT_PATH, config.boardDirPath),
|
indexPath: path.resolve(CLIENT_PATH, config.boardDirPath),
|
||||||
ampy: `"${PYTHON.path.cli}" "${MICROPYTHON.path.ampy}"`,
|
ampy: `"${PYTHON.path.cli}" "${MICROPYTHON.path.ampy}"`,
|
||||||
com: config.port,
|
com: config.port,
|
||||||
reset: config.reset || "[]"
|
reset: resetValue
|
||||||
};
|
};
|
||||||
// 兼容性处理:移除模板中可能存在的冗余引号
|
// 兼容性处理:移除模板中可能存在的冗余引号
|
||||||
let cmdTemplate = config.command || "";
|
let cmdTemplate = config.command || "";
|
||||||
|
|||||||
Reference in New Issue
Block a user