Fix: 修复win7下hid上载异常

This commit is contained in:
王立帮
2025-03-06 20:07:11 +08:00
parent fa3b4781e1
commit a4646469c0

View File

@@ -668,10 +668,11 @@ BU.uploadWithAmpy = (portName) => {
mainStatusBarTabs.changeTo('output'); mainStatusBarTabs.changeTo('output');
const mainWorkspace = Workspace.getMain(); const mainWorkspace = Workspace.getMain();
const editor = mainWorkspace.getEditorsManager().getActive(); const editor = mainWorkspace.getEditorsManager().getActive();
const port = Serial.getPort(portName);
let useBuffer = true, dataLength = 256; let useBuffer = true, dataLength = 256;
if (Serial.type === 'usb') { if (port instanceof window.USBDevice) {
dataLength = 64; dataLength = 64;
} else if (Serial.type === 'hid') { } else if (port instanceof window.HIDDevice) {
dataLength = 31; dataLength = 31;
} }
const layerNum = layer.open({ const layerNum = layer.open({