From c0fa5a611db867626fb9a1853b971abdbaddae44 Mon Sep 17 00:00:00 2001 From: openbuilds-engineer Date: Tue, 7 Aug 2018 18:56:40 +0200 Subject: [PATCH] Removed StateLoop --- app/index.html | 4 +- app/js/websocket.js | 102 ++++++++++++++++++++++---------------------- index.js | 26 +++++------ package.json | 2 +- 4 files changed, 68 insertions(+), 66 deletions(-) diff --git a/app/index.html b/app/index.html index d70b842..dab675f 100644 --- a/app/index.html +++ b/app/index.html @@ -612,7 +612,7 @@ -
+
diff --git a/app/js/websocket.js b/app/js/websocket.js index b2132c4..17b0b51 100644 --- a/app/js/websocket.js +++ b/app/js/websocket.js @@ -233,11 +233,13 @@ function initSocket() { $('#runStatus').html("Controller: " + status.comms.runStatus); - if (status.machine.firmware.state.units == "G20") { - var unit = " in" - } else if (status.machine.firmware.state.units == "G21") { - var unit = " mm" - } + // if (status.machine.firmware.state.units == "G20") { + // var unit = " in" + // } else if (status.machine.firmware.state.units == "G21") { + // var unit = " mm" + // } else { + var unit = " mm" + // } if (unit == " mm") { var xpos = status.machine.position.work.x + unit; @@ -342,51 +344,51 @@ function initSocket() { $('#buffstatus').html("NOCOMM"); } - if (status.machine.firmware.state) { - if (status.machine.firmware.state.workoffset.length) { - $('#wcostatus').html(status.machine.firmware.state.workoffset); - } else { - $('#wcostatus').html("NOCOMM"); - } - if (status.machine.firmware.state.plane.length) { - $('#planestatus').html(status.machine.firmware.state.plane); - } else { - $('#planestatus').html("NOCOMM"); - } - if (status.machine.firmware.state.absrel.length) { - if (status.machine.firmware.state.absrel == "G90") { - $('#absrel').html(status.machine.firmware.state.absrel + " (absolute)"); - } else if (status.machine.firmware.state.absrel == "G91") { - $('#absrel').html(status.machine.firmware.state.absrel + " (relative)"); - } - } else { - $('#absrel').html("NOCOMM"); - } - if (status.machine.firmware.state.units.length) { - if (status.machine.firmware.state.units == "G20") { - $('#units').html(status.machine.firmware.state.units + " (inches)"); - $('#dist01label').html("0.1in"); - $('#dist1label').html("1in"); - $('#dist10label').html("10in"); - $('#dist100label').html("100in"); - } else if (status.machine.firmware.state.units == "G21") { - $('#units').html(status.machine.firmware.state.units + " (mm)"); - $('#dist01label').html("0.1mm"); - $('#dist1label').html("1mm"); - $('#dist10label').html("10mm"); - $('#dist100label').html("100mm"); - } - } else { - $('#units').html("NOCOMM"); - } - - if (status.comms.interfaces.activePort) { - $('#activeportstatus').html(status.comms.interfaces.activePort) - } else { - $('#activeportstatus').html("none") - } - - } + // if (status.machine.firmware.state) { + // if (status.machine.firmware.state.workoffset.length) { + // $('#wcostatus').html(status.machine.firmware.state.workoffset); + // } else { + // $('#wcostatus').html("NOCOMM"); + // } + // if (status.machine.firmware.state.plane.length) { + // $('#planestatus').html(status.machine.firmware.state.plane); + // } else { + // $('#planestatus').html("NOCOMM"); + // } + // if (status.machine.firmware.state.absrel.length) { + // if (status.machine.firmware.state.absrel == "G90") { + // $('#absrel').html(status.machine.firmware.state.absrel + " (absolute)"); + // } else if (status.machine.firmware.state.absrel == "G91") { + // $('#absrel').html(status.machine.firmware.state.absrel + " (relative)"); + // } + // } else { + // $('#absrel').html("NOCOMM"); + // } + // if (status.machine.firmware.state.units.length) { + // if (status.machine.firmware.state.units == "G20") { + // $('#units').html(status.machine.firmware.state.units + " (inches)"); + // $('#dist01label').html("0.1in"); + // $('#dist1label').html("1in"); + // $('#dist10label').html("10in"); + // $('#dist100label').html("100in"); + // } else if (status.machine.firmware.state.units == "G21") { + // $('#units').html(status.machine.firmware.state.units + " (mm)"); + // $('#dist01label').html("0.1mm"); + // $('#dist1label').html("1mm"); + // $('#dist10label').html("10mm"); + // $('#dist100label').html("100mm"); + // } + // } else { + // $('#units').html("NOCOMM"); + // } + // + // if (status.comms.interfaces.activePort) { + // $('#activeportstatus').html(status.comms.interfaces.activePort) + // } else { + // $('#activeportstatus').html("none") + // } + // + // } laststatus = status; }); diff --git a/index.js b/index.js index c0e65ed..d04b643 100644 --- a/index.js +++ b/index.js @@ -649,7 +649,7 @@ app.on('certificate-error', function(event, webContents, url, error, function stopPort() { clearInterval(queueCounter); clearInterval(statusLoop); - clearInterval(stateLoop); + // clearInterval(stateLoop); status.comms.interfaces.activePort = false; status.comms.interfaces.activeBaud = false; status.comms.connectionStatus = 0; @@ -831,10 +831,10 @@ io.on("connection", function(socket) { var ignore = true; } - if (data.indexOf("[GC:") === 0) { - command = "$G"; - var ignore = true; - } + // if (data.indexOf("[GC:") === 0) { + // command = "$G"; + // var ignore = true; + // } if (!command) { command = "" @@ -843,7 +843,7 @@ io.on("connection", function(socket) { // console.log("CMD: " + command + " / DATA RECV: " + data.replace(/(\r\n|\n|\r)/gm, "")); - if (command != "$G" && command != "?" && command != "M105" && data.length > 0) { + if (command != "?" && command != "M105" && data.length > 0) { var string = ""; if (status.comms.sduploading) { string += "SD: " @@ -894,13 +894,13 @@ io.on("connection", function(socket) { } } }, 250); - stateLoop = setInterval(function() { - if (status.comms.connectionStatus > 0) { - if (!status.comms.sduploading && status.comms.connectionStatus < 3) { - machineSend("$G\n"); - } - } - }, 500); + // stateLoop = setInterval(function() { + // if (status.comms.connectionStatus > 0) { + // if (!status.comms.sduploading && status.comms.connectionStatus < 3) { + // machineSend("$G\n"); + // } + // } + // }, 500); } else if (data.indexOf("LPC176") >= 0) { // LPC1768 or LPC1769 should be Smoothieware status.comms.blocked = false; console.log("Smoothieware detected"); diff --git a/package.json b/package.json index 59ba24a..1bffbf2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "OpenBuildsMachineDriver", - "version": "1.0.51", + "version": "1.0.52", "license": "AGPL-3.0", "description": "Machine Interface Driver for OpenBuilds", "author": "github.com/openbuilds ",