From 0fddf2e6385c05173766b573fefb2a5ce48d6ad4 Mon Sep 17 00:00:00 2001
From: unknown
Date: Thu, 25 Apr 2024 20:48:30 +0200
Subject: [PATCH] test dtr
---
index.js | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/index.js b/index.js
index 7d43796..eb977a8 100644
--- a/index.js
+++ b/index.js
@@ -1133,24 +1133,11 @@ io.on("connection", function(socket) {
if (data.type == "usb") {
console.log("connect", "Connecting to " + data.port + " via " + data.type);
-
- const defaultSetFlags = {
- SetOptions: {
- brk: false,
- cts: false,
- dtr: false,
- rts: false,
- }
- }
-
port = new SerialPort({
path: data.port,
baudRate: parseInt(data.baud),
- autoOpen: false
//hupcl: false // Don't set DTR - useful for X32 Reset
});
- port.set(defaultSetFlags)
- port.open()
} else if (data.type == "telnet") {
console.log("connect", "Connecting to " + data.ip + " via " + data.type);
port = net.connect(23, data.ip);
@@ -1193,6 +1180,10 @@ io.on("connection", function(socket) {
});
port.on("open", function(e) {
+ port.set({
+ dtr: true,
+ rts: true
+ });
portOpened(port, data)
});