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