From 344bbbd804528c378730b06ed784377444230fc9 Mon Sep 17 00:00:00 2001 From: Adi Azulay Date: Wed, 11 Nov 2020 11:27:58 -0800 Subject: [PATCH 1/3] fix dtr on serial open --- src/serialmonitor/serialportctrl.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/serialmonitor/serialportctrl.ts b/src/serialmonitor/serialportctrl.ts index c09e1e78..a7445c4a 100644 --- a/src/serialmonitor/serialportctrl.ts +++ b/src/serialmonitor/serialportctrl.ts @@ -71,7 +71,7 @@ export class SerialPortCtrl { this._outputChannel.appendLine("[Warning] Auto checking serial port open is disabled"); return resolve(); } - + this._currentSerialPort.write("TestingOpen" + "\r\n", (err) => { // TODO: Fix this on the serial port lib: https://github.com/EmergingTechnologyAdvisors/node-serialport/issues/795 if (err && !(err.message.indexOf("Writing to COM port (GetOverlappedResult): Unknown error code 121") >= 0)) { @@ -79,6 +79,11 @@ export class SerialPortCtrl { reject(err); } else { this._outputChannel.appendLine(`[Info] Opened the serial port - ${this._currentPort}`); + this._currentSerialPort.set(['dtr=true'], (err) => { + if (err) { + reject(err); + } + }); resolve(); } }); @@ -164,7 +169,13 @@ export class SerialPortCtrl { if (err) { reject(err); } else { - resolve(); + this._currentSerialPort.set(['dtr=true'], (err) => { + if (err) { + reject(err); + } else { + resolve(); + } + }); } }); }); From 1785737ab26d1297766a506fee89e14a1fe6b93a Mon Sep 17 00:00:00 2001 From: Adi Azulay Date: Wed, 11 Nov 2020 11:27:58 -0800 Subject: [PATCH 2/3] fix dtr on serial open --- src/serialmonitor/serialportctrl.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/serialmonitor/serialportctrl.ts b/src/serialmonitor/serialportctrl.ts index c09e1e78..a7445c4a 100644 --- a/src/serialmonitor/serialportctrl.ts +++ b/src/serialmonitor/serialportctrl.ts @@ -71,7 +71,7 @@ export class SerialPortCtrl { this._outputChannel.appendLine("[Warning] Auto checking serial port open is disabled"); return resolve(); } - + this._currentSerialPort.write("TestingOpen" + "\r\n", (err) => { // TODO: Fix this on the serial port lib: https://github.com/EmergingTechnologyAdvisors/node-serialport/issues/795 if (err && !(err.message.indexOf("Writing to COM port (GetOverlappedResult): Unknown error code 121") >= 0)) { @@ -79,6 +79,11 @@ export class SerialPortCtrl { reject(err); } else { this._outputChannel.appendLine(`[Info] Opened the serial port - ${this._currentPort}`); + this._currentSerialPort.set(['dtr=true'], (err) => { + if (err) { + reject(err); + } + }); resolve(); } }); @@ -164,7 +169,13 @@ export class SerialPortCtrl { if (err) { reject(err); } else { - resolve(); + this._currentSerialPort.set(['dtr=true'], (err) => { + if (err) { + reject(err); + } else { + resolve(); + } + }); } }); }); From abcfcc1a5d0bb191635fbfe179b2252ab48be8b4 Mon Sep 17 00:00:00 2001 From: Adi Azulay Date: Wed, 11 Nov 2020 17:38:46 -0800 Subject: [PATCH 3/3] fix linting --- src/serialmonitor/serialportctrl.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/serialmonitor/serialportctrl.ts b/src/serialmonitor/serialportctrl.ts index a7445c4a..ec02d6b9 100644 --- a/src/serialmonitor/serialportctrl.ts +++ b/src/serialmonitor/serialportctrl.ts @@ -71,7 +71,7 @@ export class SerialPortCtrl { this._outputChannel.appendLine("[Warning] Auto checking serial port open is disabled"); return resolve(); } - + this._currentSerialPort.write("TestingOpen" + "\r\n", (err) => { // TODO: Fix this on the serial port lib: https://github.com/EmergingTechnologyAdvisors/node-serialport/issues/795 if (err && !(err.message.indexOf("Writing to COM port (GetOverlappedResult): Unknown error code 121") >= 0)) { @@ -79,10 +79,10 @@ export class SerialPortCtrl { reject(err); } else { this._outputChannel.appendLine(`[Info] Opened the serial port - ${this._currentPort}`); - this._currentSerialPort.set(['dtr=true'], (err) => { + this._currentSerialPort.set(["dtr=true"], (err) => { if (err) { reject(err); - } + } }); resolve(); } @@ -169,7 +169,7 @@ export class SerialPortCtrl { if (err) { reject(err); } else { - this._currentSerialPort.set(['dtr=true'], (err) => { + this._currentSerialPort.set(["dtr=true"], (err) => { if (err) { reject(err); } else {