fix: core template engine and upload params to resolve Syntax error
This commit is contained in:
@@ -1,21 +0,0 @@
|
|||||||
import os
|
|
||||||
import json
|
|
||||||
|
|
||||||
boards_dir = r"D:\DE-MIXLY\mixly3-server\mixly\boards"
|
|
||||||
|
|
||||||
for root, dirs, files in os.walk(boards_dir):
|
|
||||||
for file in files:
|
|
||||||
if file == "config.json":
|
|
||||||
file_path = os.path.join(root, file)
|
|
||||||
try:
|
|
||||||
with open(file_path, "r", encoding="utf-8") as f:
|
|
||||||
content = f.read()
|
|
||||||
|
|
||||||
new_content = content.replace('\\"{esptool}\\"', '{esptool}').replace('\\"{ampy}\\"', '{ampy}')
|
|
||||||
|
|
||||||
if content != new_content:
|
|
||||||
print(f"Fixing: {file_path}")
|
|
||||||
with open(file_path, "w", encoding="utf-8") as f:
|
|
||||||
f.write(new_content)
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error processing {file_path}: {e}")
|
|
||||||
@@ -1,20 +1,20 @@
|
|||||||
goog.loadJs('web', () => {
|
goog.loadJs('web', () => {
|
||||||
|
|
||||||
goog.require('path');
|
goog.require('path');
|
||||||
goog.require('layui');
|
goog.require('layui');
|
||||||
goog.require('dayjs.duration');
|
goog.require('dayjs.duration');
|
||||||
goog.require('Mixly.Debug');
|
goog.require('Mixly.Debug');
|
||||||
goog.require('Mixly.LayerExt');
|
goog.require('Mixly.LayerExt');
|
||||||
goog.require('Mixly.Msg');
|
goog.require('Mixly.Msg');
|
||||||
goog.require('Mixly.Env');
|
goog.require('Mixly.Env');
|
||||||
goog.require('Mixly.Config');
|
goog.require('Mixly.Config');
|
||||||
goog.require('Mixly.Workspace');
|
goog.require('Mixly.Workspace');
|
||||||
goog.require('Mixly.MString');
|
goog.require('Mixly.MString');
|
||||||
goog.require('Mixly.LayerProgress');
|
goog.require('Mixly.LayerProgress');
|
||||||
goog.require('Mixly.WebSocket.Serial');
|
goog.require('Mixly.WebSocket.Serial');
|
||||||
goog.provide('Mixly.WebSocket.BU');
|
goog.provide('Mixly.WebSocket.BU');
|
||||||
|
|
||||||
const {
|
const {
|
||||||
Debug,
|
Debug,
|
||||||
LayerExt,
|
LayerExt,
|
||||||
Config,
|
Config,
|
||||||
@@ -24,16 +24,16 @@ const {
|
|||||||
MString,
|
MString,
|
||||||
LayerProgress,
|
LayerProgress,
|
||||||
WebSocket
|
WebSocket
|
||||||
} = Mixly;
|
} = Mixly;
|
||||||
|
|
||||||
const { SELECTED_BOARD } = Config;
|
const { SELECTED_BOARD } = Config;
|
||||||
|
|
||||||
const { Serial } = WebSocket;
|
const { Serial } = WebSocket;
|
||||||
|
|
||||||
const { layer } = layui;
|
const { layer } = layui;
|
||||||
|
|
||||||
|
|
||||||
class WebSocketBU {
|
class WebSocketBU {
|
||||||
static {
|
static {
|
||||||
this.mixlySocket = null;
|
this.mixlySocket = null;
|
||||||
this.socket = null;
|
this.socket = null;
|
||||||
@@ -154,8 +154,7 @@ class WebSocketBU {
|
|||||||
statusBarTerminal.addValue(`\n==${message}==\n`);
|
statusBarTerminal.addValue(`\n==${message}==\n`);
|
||||||
} else {
|
} else {
|
||||||
message = (this.shell.isBurning() ? Msg.Lang['shell.burnSucc'] : Msg.Lang['shell.uploadSucc']);
|
message = (this.shell.isBurning() ? Msg.Lang['shell.burnSucc'] : Msg.Lang['shell.uploadSucc']);
|
||||||
statusBarTerminal.addValue(`\n==${message}(${Msg.Lang['shell.timeCost']} ${
|
statusBarTerminal.addValue(`\n==${message}(${Msg.Lang['shell.timeCost']} ${dayjs.duration(time).format('HH:mm:ss.SSS')
|
||||||
dayjs.duration(time).format('HH:mm:ss.SSS')
|
|
||||||
})==\n`);
|
})==\n`);
|
||||||
}
|
}
|
||||||
layer.msg(message, { time: 1000 });
|
layer.msg(message, { time: 1000 });
|
||||||
@@ -194,7 +193,9 @@ class WebSocketBU {
|
|||||||
const config = {
|
const config = {
|
||||||
boardDirPath: `.${Env.boardDirPath}`,
|
boardDirPath: `.${Env.boardDirPath}`,
|
||||||
port,
|
port,
|
||||||
command: SELECTED_BOARD.burn.command
|
command: SELECTED_BOARD.burn.command,
|
||||||
|
baudrate: Boards.getSelectedBoardConfigParam('BurnSpeed'),
|
||||||
|
reset: SELECTED_BOARD.burn.reset || []
|
||||||
};
|
};
|
||||||
const mixlySocket = WebSocketBU.getMixlySocket();
|
const mixlySocket = WebSocketBU.getMixlySocket();
|
||||||
mixlySocket.emit('micropython.burn', config, (response) => {
|
mixlySocket.emit('micropython.burn', config, (response) => {
|
||||||
@@ -230,6 +231,8 @@ class WebSocketBU {
|
|||||||
boardDirPath: `.${Env.boardDirPath}`,
|
boardDirPath: `.${Env.boardDirPath}`,
|
||||||
command: SELECTED_BOARD.upload.command,
|
command: SELECTED_BOARD.upload.command,
|
||||||
filePath: SELECTED_BOARD.upload.filePath,
|
filePath: SELECTED_BOARD.upload.filePath,
|
||||||
|
baudrate: Boards.getSelectedBoardConfigParam('BurnSpeed'),
|
||||||
|
reset: SELECTED_BOARD.upload.reset || [],
|
||||||
port, code, libraries
|
port, code, libraries
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -343,8 +346,8 @@ class WebSocketBU {
|
|||||||
isBurning() {
|
isBurning() {
|
||||||
return this.#running_ && !this.#upload_;
|
return this.#running_ && !this.#upload_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WebSocket.BU = WebSocketBU;
|
WebSocket.BU = WebSocketBU;
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -17,7 +17,7 @@ MString.tpl = (str, obj) => {
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
for (let key in obj) {
|
for (let key in obj) {
|
||||||
let re = new RegExp(`{*${key}*}`, 'gim');
|
let re = new RegExp(`{${key}}`, 'gm');
|
||||||
str = str.replace(re, obj[key]);
|
str = str.replace(re, obj[key]);
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export default class ShellMicroPython extends Shell {
|
|||||||
indexPath: path.resolve(CLIENT_PATH, config.boardDirPath),
|
indexPath: path.resolve(CLIENT_PATH, config.boardDirPath),
|
||||||
esptool: `"${PYTHON.path.cli}" "${MICROPYTHON.path.esptool}"`,
|
esptool: `"${PYTHON.path.cli}" "${MICROPYTHON.path.esptool}"`,
|
||||||
com: config.port,
|
com: config.port,
|
||||||
baudrate: config.baudRates
|
baudrate: config.baudrate || "460800"
|
||||||
};
|
};
|
||||||
// 兼容性处理:移除模板中可能存在的冗余引号
|
// 兼容性处理:移除模板中可能存在的冗余引号
|
||||||
let cmdTemplate = config.command || "";
|
let cmdTemplate = config.command || "";
|
||||||
@@ -29,7 +29,7 @@ export default class ShellMicroPython extends Shell {
|
|||||||
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: config.reset || "[]"
|
||||||
};
|
};
|
||||||
// 兼容性处理:移除模板中可能存在的冗余引号
|
// 兼容性处理:移除模板中可能存在的冗余引号
|
||||||
let cmdTemplate = config.command || "";
|
let cmdTemplate = config.command || "";
|
||||||
|
|||||||
Reference in New Issue
Block a user