Fix: 修复平板下报错instanceof未定义

This commit is contained in:
王立帮
2025-03-06 21:13:49 +08:00
parent 11288a1860
commit 51c5c19793
2 changed files with 5 additions and 5 deletions

View File

@@ -670,9 +670,9 @@ BU.uploadWithAmpy = (portName) => {
const editor = mainWorkspace.getEditorsManager().getActive();
const port = Serial.getPort(portName);
let useBuffer = true, dataLength = 256;
if (port instanceof window.USBDevice) {
if (port.constructor.name === 'USBDevice') {
dataLength = 64;
} else if (port instanceof window.HIDDevice) {
} else if (port.constructor.name === 'HIDDevice') {
dataLength = 31;
}
const layerNum = layer.open({