feat(core): micropython板卡烧录固件时支持调整波特率

This commit is contained in:
王立帮
2025-09-13 22:56:12 +08:00
parent 29280ddd9a
commit 167c6e9e30
21 changed files with 676 additions and 57 deletions

View File

@@ -518,6 +518,9 @@ BU.burnByCmd = function (port, command) {
const { mainStatusBarTabs } = Mixly;
const statusBarTerminal = mainStatusBarTabs.getStatusBarById('output');
statusBarTerminal.setValue(Msg.Lang['shell.burning'] + '...\n');
command = MString.tpl(command, {
baudrate: Boards.getSelectedBoardConfigParam('BurnSpeed') ?? '460800'
});
BU.runCmd('burn', port, command);
}

View File

@@ -75,8 +75,6 @@ BU.progressLayer = new LayerProgress({
cancelDisplay: false
});
const BAUD = goog.platform() === 'darwin' ? 460800 : 921600;
if (['BBC micro:bit', 'Mithon CC'].includes(BOARD.boardType)) {
FSWrapper.setupFilesystem(path.join(Env.boardDirPath, 'build'));
}
@@ -265,10 +263,11 @@ BU.burnWithEsptool = async (binFile, erase) => {
let esploader = null;
let transport = null;
try {
const baudrate = Boards.getSelectedBoardConfigParam('BurnSpeed') ?? '460800';
transport = new Transport(port, false);
esploader = new ESPLoader({
transport,
baudrate: BAUD,
baudrate,
terminal: {
clean() {
statusBarTerminal.setValue('');
@@ -281,7 +280,7 @@ BU.burnWithEsptool = async (binFile, erase) => {
}
}
});
let chip = await esploader.main();
await esploader.main();
} catch (error) {
Debug.error(error);
statusBarTerminal.addValue(`\n${error.toString()}\n`);