chore(core): ESPTool 调整为 esptooljs

This commit is contained in:
王立帮
2025-05-09 16:50:42 +08:00
parent 3b10f7742c
commit fb5303c311
5 changed files with 19 additions and 18 deletions

View File

@@ -233,7 +233,7 @@
"require": [] "require": []
}, { }, {
"path": "modules/web-modules/esptool.min.js", "path": "modules/web-modules/esptool.min.js",
"provide": ["ESPTool"], "provide": ["esptooljs"],
"require": [] "require": []
}, { }, {
"path": "modules/web-modules/adafruit-esptool/index.js", "path": "modules/web-modules/adafruit-esptool/index.js",

View File

@@ -1566,7 +1566,7 @@
"FSWrapper", "FSWrapper",
"DAPWrapper", "DAPWrapper",
"PartialFlashing", "PartialFlashing",
"ESPTool", "esptooljs",
"AdafruitESPTool", "AdafruitESPTool",
"CryptoJS", "CryptoJS",
"Mixly.Env", "Mixly.Env",
@@ -1729,7 +1729,7 @@
"require": [ "require": [
"layui", "layui",
"avrbro", "avrbro",
"ESPTool", "esptooljs",
"AdafruitESPTool", "AdafruitESPTool",
"CryptoJS", "CryptoJS",
"dayjs.duration", "dayjs.duration",

View File

@@ -2,7 +2,7 @@ goog.loadJs('web', () => {
goog.require('layui'); goog.require('layui');
goog.require('avrbro'); goog.require('avrbro');
goog.require('ESPTool'); goog.require('esptooljs');
goog.require('AdafruitESPTool'); goog.require('AdafruitESPTool');
goog.require('CryptoJS'); goog.require('CryptoJS');
goog.require('dayjs.duration'); goog.require('dayjs.duration');
@@ -29,7 +29,7 @@ const {
const { Serial } = Web; const { Serial } = Web;
const { layer } = layui; const { layer } = layui;
const { ESPLoader, Transport } = ESPTool; const { ESPLoader, Transport } = esptooljs;
function hexToBinaryString (hex) { function hexToBinaryString (hex) {
@@ -98,7 +98,6 @@ class WebCompilerArduShell {
statusBarTerminal.setValue(`${Msg.Lang['shell.compiling']}...\n`); statusBarTerminal.setValue(`${Msg.Lang['shell.compiling']}...\n`);
this.shell.compile(code) this.shell.compile(code)
.then((info) => { .then((info) => {
console.log(info)
this.endCallback(info.code, info.time); this.endCallback(info.code, info.time);
}) })
.catch((error) => { .catch((error) => {
@@ -271,7 +270,6 @@ class WebCompilerArduShell {
} }
async uploadWithEsptool(port, files) { async uploadWithEsptool(port, files) {
console.log(port, files)
const { mainStatusBarTabs } = Mixly; const { mainStatusBarTabs } = Mixly;
const statusBarTerminal = mainStatusBarTabs.getStatusBarById('output'); const statusBarTerminal = mainStatusBarTabs.getStatusBarById('output');
let esploader = null; let esploader = null;

View File

@@ -5,7 +5,7 @@ goog.require('BoardId');
goog.require('FSWrapper'); goog.require('FSWrapper');
goog.require('DAPWrapper'); goog.require('DAPWrapper');
goog.require('PartialFlashing'); goog.require('PartialFlashing');
goog.require('ESPTool'); goog.require('esptooljs');
goog.require('AdafruitESPTool'); goog.require('AdafruitESPTool');
goog.require('CryptoJS'); goog.require('CryptoJS');
goog.require('Mixly.Env'); goog.require('Mixly.Env');
@@ -51,7 +51,7 @@ const { BOARD, SELECTED_BOARD } = Config;
const { const {
ESPLoader, ESPLoader,
Transport Transport
} = ESPTool; } = esptooljs;
BU.uploading = false; BU.uploading = false;
BU.burning = false; BU.burning = false;
@@ -332,6 +332,9 @@ BU.burnWithEsptool = async (binFile, erase) => {
}; };
try { try {
await esploader.writeFlash(flashOptions); await esploader.writeFlash(flashOptions);
await transport.setDTR(false);
await new Promise((resolve) => setTimeout(resolve, 100));
await transport.setDTR(true);
BU.progressLayer.hide(); BU.progressLayer.hide();
layer.msg(Msg.Lang['shell.burnSucc'], { time: 1000 }); layer.msg(Msg.Lang['shell.burnSucc'], { time: 1000 });
statusBarTerminal.addValue(`==${Msg.Lang['shell.burnSucc']}==\n`); statusBarTerminal.addValue(`==${Msg.Lang['shell.burnSucc']}==\n`);

File diff suppressed because one or more lines are too long