deps(core): 将 compiler 模式下arduino avr板卡的上载模块改为 AVRUploader

This commit is contained in:
王立帮
2025-05-23 23:09:48 +08:00
parent e9040945a8
commit 814d210016
5 changed files with 15 additions and 15 deletions

View File

@@ -1745,7 +1745,7 @@
"path": "/web-compiler/arduino-shell.js",
"require": [
"layui",
"avrbro",
"AVRUploader",
"esptooljs",
"AdafruitESPTool",
"CryptoJS",

View File

@@ -1,7 +1,7 @@
goog.loadJs('web', () => {
goog.require('layui');
goog.require('avrbro');
goog.require('AVRUploader');
goog.require('esptooljs');
goog.require('AdafruitESPTool');
goog.require('CryptoJS');
@@ -253,7 +253,7 @@ class WebCompilerArduShell {
try {
const keys = Boards.getSelectedBoardKey().split(':');
if (`${keys[0]}:${keys[1]}` === 'arduino:avr') {
await this.uploadWithAvrbro(port, files);
await this.uploadWithAVRUploader(port, files);
} else {
await this.uploadWithEsptool(port, files);
}
@@ -333,28 +333,27 @@ class WebCompilerArduShell {
}
}
async uploadWithAvrbro(port, files) {
async uploadWithAVRUploader(port, files) {
const key = Boards.getSelectedBoardKey();
const boardId = key.split(':')[2];
let boardName = '';
if (boardId === 'uno') {
boardName = 'uno';
} else if (boardId === 'nano') {
let boardName = 'uno';
if (boardId === 'nano') {
const cpu = Boards.getSelectedBoardConfigParam('cpu');
if (cpu === 'atmega328old') {
boardName = 'nano';
} else {
boardName = 'nano (new bootloader)';
boardName = 'nanoOldBootloader';
}
} else if (boardId === 'pro') {
boardName = 'pro-mini';
boardName = 'proMini';
} else if (boardId === 'mega') {
boardName = 'mega';
} else if (boardId === 'leonardo') {
boardName = 'leonardo';
}
const buffer = avrbro.parseHex(files[0].data);
await avrbro.flash(Serial.getPort(port), buffer, { boardName });
const serial = Serial.getPort(port);
const text = files[0].data;
await AVRUploader.upload(serial, boardName, text);
}
async kill() {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long