Browse Source

Use disconnect instead of freePort

pull/110/head
Malte Grimm 3 years ago
parent
commit
ab89802dbc
  1. 7
      src/core/flashing/Flasher.ts

7
src/core/flashing/Flasher.ts

@ -200,11 +200,11 @@ export class FlashOperation {
} }
public async flash() { public async flash() {
let port; let port: SerialPort | undefined;
try { try {
debugger; debugger;
const updatePossible = this.device.nodes.get(this.device.hardware.myNodeNum) !== undefined; const updatePossible = this.device.nodes.get(this.device.hardware.myNodeNum) !== undefined;
port = await (this.device.connection! as ISerialConnection).freePort(); port = await (this.device.connection! as ISerialConnection).disconnect();
if(port === undefined) if(port === undefined)
throw "Port unavailable"; throw "Port unavailable";
const deviceModel = selectedDeviceModel == "auto" ? autoDetectDeviceModel(port) : selectedDeviceModel; const deviceModel = selectedDeviceModel == "auto" ? autoDetectDeviceModel(port) : selectedDeviceModel;
@ -236,14 +236,13 @@ export class FlashOperation {
} }
} }
catch (e) { catch (e) {
debugger;
this.setState("failed"); this.setState("failed");
return; return;
} }
finally { finally {
await this.loader!.disconnect(); await this.loader!.disconnect();
debugger;
} }
this.setState("config"); this.setState("config");
await port!.setSignals({requestToSend: true}); await port!.setSignals({requestToSend: true});
await new Promise(r => setTimeout(r, 100)); await new Promise(r => setTimeout(r, 100));

Loading…
Cancel
Save