Update: 在线版设置选中串口后继续 烧录 和 上传 操作
This commit is contained in:
@@ -59,11 +59,11 @@ BU.FILMWARE_LAYER = new HTMLTemplate(
|
||||
|
||||
const BAUD = goog.platform() === 'darwin' ? 460800 : 921600;
|
||||
|
||||
BU.requestPort = () => {
|
||||
BU.requestPort = async () => {
|
||||
if (SELECTED_BOARD.web.com === 'usb') {
|
||||
USB.requestPort();
|
||||
await USB.requestPort();
|
||||
} else {
|
||||
Serial.requestPort();
|
||||
await Serial.requestPort();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,13 +225,18 @@ BU.burnByUSB = () => {
|
||||
|
||||
BU.burnWithEsptool = async (binFile) => {
|
||||
const { mainStatusBarTabs } = Mixly;
|
||||
const portName = Serial.getSelectedPortName();
|
||||
let portName = Serial.getSelectedPortName();
|
||||
if (!portName) {
|
||||
/*layer.msg(Msg.Lang['statusbar.serial.noDevice'], {
|
||||
time: 1000
|
||||
});*/
|
||||
BU.requestPort();
|
||||
return;
|
||||
try {
|
||||
await BU.requestPort();
|
||||
portName = Serial.getSelectedPortName();
|
||||
if (!portName) {
|
||||
return;
|
||||
}
|
||||
} catch (error) {
|
||||
Debug.error(error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
const statusBarSerial = mainStatusBarTabs.getStatusBarById(portName);
|
||||
if (statusBarSerial) {
|
||||
@@ -337,13 +342,18 @@ BU.burnWithEsptool = async (binFile) => {
|
||||
|
||||
BU.burnWithAdafruitEsptool = async (binFile) => {
|
||||
const { mainStatusBarTabs } = Mixly;
|
||||
const portName = Serial.getSelectedPortName();
|
||||
let portName = Serial.getSelectedPortName();
|
||||
if (!portName) {
|
||||
/*layer.msg(Msg.Lang['statusbar.serial.noDevice'], {
|
||||
time: 1000
|
||||
});*/
|
||||
BU.requestPort();
|
||||
return;
|
||||
try {
|
||||
await BU.requestPort();
|
||||
portName = Serial.getSelectedPortName();
|
||||
if (!portName) {
|
||||
return;
|
||||
}
|
||||
} catch (error) {
|
||||
Debug.error(error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
const statusBarSerial = mainStatusBarTabs.getStatusBarById(portName);
|
||||
if (statusBarSerial) {
|
||||
@@ -504,14 +514,19 @@ BU.searchLibs = (moduleList, libList = []) => {
|
||||
return libList;
|
||||
}
|
||||
|
||||
BU.initUpload = () => {
|
||||
const portName = Serial.getSelectedPortName();
|
||||
BU.initUpload = async () => {
|
||||
let portName = Serial.getSelectedPortName();
|
||||
if (!portName) {
|
||||
/*layer.msg(Msg.Lang['statusbar.serial.noDevice'], {
|
||||
time: 1000
|
||||
});*/
|
||||
BU.requestPort();
|
||||
return;
|
||||
try {
|
||||
await BU.requestPort();
|
||||
portName = Serial.getSelectedPortName();
|
||||
if (!portName) {
|
||||
return;
|
||||
}
|
||||
} catch (error) {
|
||||
Debug.error(error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
BU.uploadWithAmpy(portName);
|
||||
}
|
||||
|
||||
@@ -45,13 +45,10 @@ class WebSerial extends Serial {
|
||||
Serial.renderSelectBox(portsName);
|
||||
}
|
||||
|
||||
this.requestPort = function () {
|
||||
navigator.serial.requestPort()
|
||||
.then((serialport) => {
|
||||
this.addPort(serialport);
|
||||
this.refreshPorts();
|
||||
})
|
||||
.catch(Debug.error);
|
||||
this.requestPort = async function () {
|
||||
const serialport = await navigator.serial.requestPort();
|
||||
this.addPort(serialport);
|
||||
this.refreshPorts();
|
||||
}
|
||||
|
||||
this.getPort = function (name) {
|
||||
|
||||
@@ -46,13 +46,14 @@ class USB extends Serial {
|
||||
Serial.renderSelectBox(portsName);
|
||||
}
|
||||
|
||||
this.requestPort = function () {
|
||||
navigator.usb.requestDevice({ filters: [{ vendorId: 0xD28 }] })
|
||||
.then((device) => {
|
||||
this.addPort(device);
|
||||
this.refreshPorts();
|
||||
})
|
||||
.catch(Debug.error);
|
||||
this.requestPort = async function () {
|
||||
const device = await navigator.usb.requestDevice({
|
||||
filters: [{
|
||||
vendorId: 0xD28
|
||||
}]
|
||||
});
|
||||
this.addPort(device);
|
||||
this.refreshPorts();
|
||||
}
|
||||
|
||||
this.getPort = function (name) {
|
||||
|
||||
Reference in New Issue
Block a user