Skip to content

Commit

Permalink
test dtr
Browse files Browse the repository at this point in the history
  • Loading branch information
petervanderwalt committed Apr 25, 2024
1 parent 2fb8abe commit 0fddf2e
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions index.js
Expand Up @@ -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);
Expand Down Expand Up @@ -1193,6 +1180,10 @@ io.on("connection", function(socket) {
});

port.on("open", function(e) {
port.set({
dtr: true,
rts: true
});
portOpened(port, data)
});

Expand Down

0 comments on commit 0fddf2e

Please sign in to comment.