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.require('path');
|
||||
goog.require('layui');
|
||||
goog.require('dayjs.duration');
|
||||
goog.require('Mixly.Debug');
|
||||
goog.require('Mixly.LayerExt');
|
||||
goog.require('Mixly.Msg');
|
||||
goog.require('Mixly.Env');
|
||||
goog.require('Mixly.Config');
|
||||
goog.require('Mixly.Workspace');
|
||||
goog.require('Mixly.MString');
|
||||
goog.require('Mixly.LayerProgress');
|
||||
goog.require('Mixly.WebSocket.Serial');
|
||||
goog.provide('Mixly.WebSocket.BU');
|
||||
goog.require('path');
|
||||
goog.require('layui');
|
||||
goog.require('dayjs.duration');
|
||||
goog.require('Mixly.Debug');
|
||||
goog.require('Mixly.LayerExt');
|
||||
goog.require('Mixly.Msg');
|
||||
goog.require('Mixly.Env');
|
||||
goog.require('Mixly.Config');
|
||||
goog.require('Mixly.Workspace');
|
||||
goog.require('Mixly.MString');
|
||||
goog.require('Mixly.LayerProgress');
|
||||
goog.require('Mixly.WebSocket.Serial');
|
||||
goog.provide('Mixly.WebSocket.BU');
|
||||
|
||||
const {
|
||||
const {
|
||||
Debug,
|
||||
LayerExt,
|
||||
Config,
|
||||
@@ -24,16 +24,16 @@ const {
|
||||
MString,
|
||||
LayerProgress,
|
||||
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 {
|
||||
this.mixlySocket = null;
|
||||
this.socket = null;
|
||||
@@ -154,8 +154,7 @@ class WebSocketBU {
|
||||
statusBarTerminal.addValue(`\n==${message}==\n`);
|
||||
} else {
|
||||
message = (this.shell.isBurning() ? Msg.Lang['shell.burnSucc'] : Msg.Lang['shell.uploadSucc']);
|
||||
statusBarTerminal.addValue(`\n==${message}(${Msg.Lang['shell.timeCost']} ${
|
||||
dayjs.duration(time).format('HH:mm:ss.SSS')
|
||||
statusBarTerminal.addValue(`\n==${message}(${Msg.Lang['shell.timeCost']} ${dayjs.duration(time).format('HH:mm:ss.SSS')
|
||||
})==\n`);
|
||||
}
|
||||
layer.msg(message, { time: 1000 });
|
||||
@@ -194,7 +193,9 @@ class WebSocketBU {
|
||||
const config = {
|
||||
boardDirPath: `.${Env.boardDirPath}`,
|
||||
port,
|
||||
command: SELECTED_BOARD.burn.command
|
||||
command: SELECTED_BOARD.burn.command,
|
||||
baudrate: Boards.getSelectedBoardConfigParam('BurnSpeed'),
|
||||
reset: SELECTED_BOARD.burn.reset || []
|
||||
};
|
||||
const mixlySocket = WebSocketBU.getMixlySocket();
|
||||
mixlySocket.emit('micropython.burn', config, (response) => {
|
||||
@@ -230,6 +231,8 @@ class WebSocketBU {
|
||||
boardDirPath: `.${Env.boardDirPath}`,
|
||||
command: SELECTED_BOARD.upload.command,
|
||||
filePath: SELECTED_BOARD.upload.filePath,
|
||||
baudrate: Boards.getSelectedBoardConfigParam('BurnSpeed'),
|
||||
reset: SELECTED_BOARD.upload.reset || [],
|
||||
port, code, libraries
|
||||
};
|
||||
|
||||
@@ -343,8 +346,8 @@ class WebSocketBU {
|
||||
isBurning() {
|
||||
return this.#running_ && !this.#upload_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WebSocket.BU = WebSocketBU;
|
||||
WebSocket.BU = WebSocketBU;
|
||||
|
||||
});
|
||||
@@ -17,7 +17,7 @@ MString.tpl = (str, obj) => {
|
||||
return str;
|
||||
}
|
||||
for (let key in obj) {
|
||||
let re = new RegExp(`{*${key}*}`, 'gim');
|
||||
let re = new RegExp(`{${key}}`, 'gm');
|
||||
str = str.replace(re, obj[key]);
|
||||
}
|
||||
return str;
|
||||
|
||||
@@ -14,7 +14,7 @@ export default class ShellMicroPython extends Shell {
|
||||
indexPath: path.resolve(CLIENT_PATH, config.boardDirPath),
|
||||
esptool: `"${PYTHON.path.cli}" "${MICROPYTHON.path.esptool}"`,
|
||||
com: config.port,
|
||||
baudrate: config.baudRates
|
||||
baudrate: config.baudrate || "460800"
|
||||
};
|
||||
// 兼容性处理:移除模板中可能存在的冗余引号
|
||||
let cmdTemplate = config.command || "";
|
||||
@@ -29,7 +29,7 @@ export default class ShellMicroPython extends Shell {
|
||||
indexPath: path.resolve(CLIENT_PATH, config.boardDirPath),
|
||||
ampy: `"${PYTHON.path.cli}" "${MICROPYTHON.path.ampy}"`,
|
||||
com: config.port,
|
||||
reset: config.reset || ""
|
||||
reset: config.reset || "[]"
|
||||
};
|
||||
// 兼容性处理:移除模板中可能存在的冗余引号
|
||||
let cmdTemplate = config.command || "";
|
||||
|
||||
Reference in New Issue
Block a user