Fix: 修复在线版下一些micropython板卡烧录固件时未erase
This commit is contained in:
@@ -121,11 +121,11 @@ const readBinFileAsArrayBuffer = (path, offset) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BU.initBurn = () => {
|
BU.initBurn = () => {
|
||||||
if (SELECTED_BOARD.web.com === 'usb') {
|
if (['BBC micro:bit', 'Mithon CC'].includes(BOARD.boardType)) {
|
||||||
BU.burnByUSB();
|
BU.burnByUSB();
|
||||||
} else {
|
} else {
|
||||||
const boardKey = Boards.getSelectedBoardKey();
|
|
||||||
const { web } = SELECTED_BOARD;
|
const { web } = SELECTED_BOARD;
|
||||||
|
const boardKey = Boards.getSelectedBoardKey();
|
||||||
if (!web?.burn?.binFile) {
|
if (!web?.burn?.binFile) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -311,7 +311,7 @@ BU.burnWithEsptool = async (binFile, erase) => {
|
|||||||
const flashOptions = {
|
const flashOptions = {
|
||||||
fileArray: data,
|
fileArray: data,
|
||||||
flashSize: 'keep',
|
flashSize: 'keep',
|
||||||
eraseAll: false,
|
eraseAll: erase,
|
||||||
compress: true,
|
compress: true,
|
||||||
calculateMD5Hash: (image) => CryptoJS.MD5(CryptoJS.enc.Latin1.parse(image))
|
calculateMD5Hash: (image) => CryptoJS.MD5(CryptoJS.enc.Latin1.parse(image))
|
||||||
};
|
};
|
||||||
@@ -334,9 +334,6 @@ BU.burnWithEsptool = async (binFile, erase) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
if (erase) {
|
|
||||||
await esploader.eraseFlash();
|
|
||||||
}
|
|
||||||
await esploader.writeFlash(flashOptions);
|
await esploader.writeFlash(flashOptions);
|
||||||
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`);
|
||||||
@@ -883,9 +880,9 @@ BU.burnWithSpecialBin = () => {
|
|||||||
const boardKey = Boards.getSelectedBoardKey();
|
const boardKey = Boards.getSelectedBoardKey();
|
||||||
const { web } = SELECTED_BOARD;
|
const { web } = SELECTED_BOARD;
|
||||||
if (boardKey.indexOf('micropython:esp32s2') !== -1) {
|
if (boardKey.indexOf('micropython:esp32s2') !== -1) {
|
||||||
BU.burnWithAdafruitEsptool(binFile);
|
BU.burnWithAdafruitEsptool(binFile, web.burn.erase);
|
||||||
} else {
|
} else {
|
||||||
BU.burnWithEsptool(binFile);
|
BU.burnWithEsptool(binFile, web.burn.erase);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user