diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..88a0187 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,20 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Debug Main Process", + "type": "node", + "request": "launch", + "cwd": "${workspaceFolder}", + "env": { + "DEBUGCONTROL": "true", + }, + "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron", + "windows": { + "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd" + }, + "args" : ["."], + "outputCapture": "std" + } + ] + } \ No newline at end of file diff --git a/index.js b/index.js index b61e632..f04f3d4 100644 --- a/index.js +++ b/index.js @@ -100,9 +100,8 @@ io.attach(httpsserver); const grblStrings = require("./grblStrings.js"); // Serial -const serialport = require('serialport'); const { SerialPort } = require('serialport') -const Readline = require('@serialport/parser-readline'); +const { ReadlineParser } = require('@serialport/parser-readline'); // telnet const net = require('net'); @@ -914,7 +913,8 @@ io.on("connection", function(socket) { if (data.type == "usb") { console.log("connect", "Connecting to " + data.port + " via " + data.type); - port = new SerialPort(data.port, { + port = new SerialPort({ + path: data.port, baudRate: parseInt(data.baud), hupcl: false // Don't set DTR - useful for X32 Reset }); @@ -924,9 +924,7 @@ io.on("connection", function(socket) { port.isOpen = true; } - - - parser = port.pipe(new Readline({ + parser = port.pipe(new ReadlineParser({ delimiter: '\r\n' }));