deps(core): 将 compiler 模式下arduino avr板卡的上载模块改为 AVRUploader
This commit is contained in:
@@ -128,8 +128,8 @@
|
|||||||
"provide": ["PouchDB"],
|
"provide": ["PouchDB"],
|
||||||
"require": []
|
"require": []
|
||||||
}, {
|
}, {
|
||||||
"path": "modules/web-modules/avrbro.min.js",
|
"path": "modules/web-modules/avr-uploader.min.js",
|
||||||
"provide": ["avrbro"],
|
"provide": ["AVRUploader"],
|
||||||
"require": []
|
"require": []
|
||||||
}, {
|
}, {
|
||||||
"path": "modules/web-modules/microbit/microbit-fs.umd.min.js",
|
"path": "modules/web-modules/microbit/microbit-fs.umd.min.js",
|
||||||
|
|||||||
@@ -1745,7 +1745,7 @@
|
|||||||
"path": "/web-compiler/arduino-shell.js",
|
"path": "/web-compiler/arduino-shell.js",
|
||||||
"require": [
|
"require": [
|
||||||
"layui",
|
"layui",
|
||||||
"avrbro",
|
"AVRUploader",
|
||||||
"esptooljs",
|
"esptooljs",
|
||||||
"AdafruitESPTool",
|
"AdafruitESPTool",
|
||||||
"CryptoJS",
|
"CryptoJS",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
goog.loadJs('web', () => {
|
goog.loadJs('web', () => {
|
||||||
|
|
||||||
goog.require('layui');
|
goog.require('layui');
|
||||||
goog.require('avrbro');
|
goog.require('AVRUploader');
|
||||||
goog.require('esptooljs');
|
goog.require('esptooljs');
|
||||||
goog.require('AdafruitESPTool');
|
goog.require('AdafruitESPTool');
|
||||||
goog.require('CryptoJS');
|
goog.require('CryptoJS');
|
||||||
@@ -253,7 +253,7 @@ class WebCompilerArduShell {
|
|||||||
try {
|
try {
|
||||||
const keys = Boards.getSelectedBoardKey().split(':');
|
const keys = Boards.getSelectedBoardKey().split(':');
|
||||||
if (`${keys[0]}:${keys[1]}` === 'arduino:avr') {
|
if (`${keys[0]}:${keys[1]}` === 'arduino:avr') {
|
||||||
await this.uploadWithAvrbro(port, files);
|
await this.uploadWithAVRUploader(port, files);
|
||||||
} else {
|
} else {
|
||||||
await this.uploadWithEsptool(port, files);
|
await this.uploadWithEsptool(port, files);
|
||||||
}
|
}
|
||||||
@@ -333,28 +333,27 @@ class WebCompilerArduShell {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async uploadWithAvrbro(port, files) {
|
async uploadWithAVRUploader(port, files) {
|
||||||
const key = Boards.getSelectedBoardKey();
|
const key = Boards.getSelectedBoardKey();
|
||||||
const boardId = key.split(':')[2];
|
const boardId = key.split(':')[2];
|
||||||
let boardName = '';
|
let boardName = 'uno';
|
||||||
if (boardId === 'uno') {
|
if (boardId === 'nano') {
|
||||||
boardName = 'uno';
|
|
||||||
} else if (boardId === 'nano') {
|
|
||||||
const cpu = Boards.getSelectedBoardConfigParam('cpu');
|
const cpu = Boards.getSelectedBoardConfigParam('cpu');
|
||||||
if (cpu === 'atmega328old') {
|
if (cpu === 'atmega328old') {
|
||||||
boardName = 'nano';
|
boardName = 'nano';
|
||||||
} else {
|
} else {
|
||||||
boardName = 'nano (new bootloader)';
|
boardName = 'nanoOldBootloader';
|
||||||
}
|
}
|
||||||
} else if (boardId === 'pro') {
|
} else if (boardId === 'pro') {
|
||||||
boardName = 'pro-mini';
|
boardName = 'proMini';
|
||||||
} else if (boardId === 'mega') {
|
} else if (boardId === 'mega') {
|
||||||
boardName = 'mega';
|
boardName = 'mega';
|
||||||
} else if (boardId === 'leonardo') {
|
} else if (boardId === 'leonardo') {
|
||||||
boardName = 'leonardo';
|
boardName = 'leonardo';
|
||||||
}
|
}
|
||||||
const buffer = avrbro.parseHex(files[0].data);
|
const serial = Serial.getPort(port);
|
||||||
await avrbro.flash(Serial.getPort(port), buffer, { boardName });
|
const text = files[0].data;
|
||||||
|
await AVRUploader.upload(serial, boardName, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
async kill() {
|
async kill() {
|
||||||
|
|||||||
2
common/modules/web-modules/avr-uploader.min.js
vendored
Normal file
2
common/modules/web-modules/avr-uploader.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
common/modules/web-modules/avrbro.min.js
vendored
1
common/modules/web-modules/avrbro.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user