From b6ced39b4e188c59360fe367cc21ad98add6a0b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=AB=8B=E5=B8=AE?= <3294713004@qq.com> Date: Thu, 16 Jan 2025 10:34:22 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20=E4=BF=AE=E5=A4=8D=E5=9C=A8=E7=BA=BF?= =?UTF-8?q?=E7=89=88=E4=B8=8B=E4=B8=80=E4=BA=9Bmicropython=E6=9D=BF?= =?UTF-8?q?=E5=8D=A1=E7=83=A7=E5=BD=95=E5=9B=BA=E4=BB=B6=E6=97=B6=E6=9C=AA?= =?UTF-8?q?erase?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/modules/mixly-modules/web/burn-upload.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/common/modules/mixly-modules/web/burn-upload.js b/common/modules/mixly-modules/web/burn-upload.js index f9ee6236..af2a316e 100644 --- a/common/modules/mixly-modules/web/burn-upload.js +++ b/common/modules/mixly-modules/web/burn-upload.js @@ -121,11 +121,11 @@ const readBinFileAsArrayBuffer = (path, offset) => { } BU.initBurn = () => { - if (SELECTED_BOARD.web.com === 'usb') { + if (['BBC micro:bit', 'Mithon CC'].includes(BOARD.boardType)) { BU.burnByUSB(); } else { - const boardKey = Boards.getSelectedBoardKey(); const { web } = SELECTED_BOARD; + const boardKey = Boards.getSelectedBoardKey(); if (!web?.burn?.binFile) { return; } @@ -311,7 +311,7 @@ BU.burnWithEsptool = async (binFile, erase) => { const flashOptions = { fileArray: data, flashSize: 'keep', - eraseAll: false, + eraseAll: erase, compress: true, calculateMD5Hash: (image) => CryptoJS.MD5(CryptoJS.enc.Latin1.parse(image)) }; @@ -334,9 +334,6 @@ BU.burnWithEsptool = async (binFile, erase) => { } }); try { - if (erase) { - await esploader.eraseFlash(); - } await esploader.writeFlash(flashOptions); layer.msg(Msg.Lang['shell.burnSucc'], { time: 1000 }); statusBarTerminal.addValue(`==${Msg.Lang['shell.burnSucc']}==\n`); @@ -883,9 +880,9 @@ BU.burnWithSpecialBin = () => { const boardKey = Boards.getSelectedBoardKey(); const { web } = SELECTED_BOARD; if (boardKey.indexOf('micropython:esp32s2') !== -1) { - BU.burnWithAdafruitEsptool(binFile); + BU.burnWithAdafruitEsptool(binFile, web.burn.erase); } else { - BU.burnWithEsptool(binFile); + BU.burnWithEsptool(binFile, web.burn.erase); } }); });