From 8c33680a127d3aa7c5695ddce5e64483b108b996 Mon Sep 17 00:00:00 2001 From: Teja Date: Sat, 28 Mar 2015 17:00:44 +0100 Subject: [PATCH] disabled position updates during print as this caused invalid gcode 24 errors due timing problems. --- .../templates/override_index.jinja2 | 2 +- src/octoprint/util/comm.py | 26 +++++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/octoprint/plugins/svgtogcode/templates/override_index.jinja2 b/src/octoprint/plugins/svgtogcode/templates/override_index.jinja2 index dd852ccb..377fbbc4 100644 --- a/src/octoprint/plugins/svgtogcode/templates/override_index.jinja2 +++ b/src/octoprint/plugins/svgtogcode/templates/override_index.jinja2 @@ -54,7 +54,7 @@
-
+
Mr Beam is in a locked state as it does not know its position. First remove any objects blocking the gantry's travel range. diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index 72e61713..d0e1cd89 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -800,8 +800,19 @@ class MachineCom(object): self._callback.mcPosUpdate(MPos, WPos) if("ALARM: Hard/soft limit" in line): - self._log("Machine Limit Hit. Please reconnect.") + errorMsg = "Machine Limit Hit. Please reset the machine and do a homing cycle" + self._log(errorMsg) + self._errorValue = errorMsg + self._changeState(self.STATE_ERROR) + eventManager().fire(Events.ERROR, {"error": self.getErrorString()}) self.close() + + if("Invalid gcode" in line and self._state == self.STATE_PRINTING): + errorMsg = line + self._log(errorMsg) + self._errorValue = errorMsg + self._changeState(self.STATE_ERROR) + eventManager().fire(Events.ERROR, {"error": self.getErrorString()}) ##~~ SD Card handling elif 'SD init fail' in line or 'volume.init failed' in line or 'openRoot failed' in line: @@ -963,7 +974,7 @@ class MachineCom(object): elif self._state == self.STATE_CONNECTING: if self._grbl: if "Grbl" in line: - self._changeState(self.STATE_OPERATIONAL) + self._changeState(self.STATE_LOCKED) else: if (line == "" or "wait" in line) and startSeen: self._sendCommand("M105") @@ -993,7 +1004,10 @@ class MachineCom(object): else: self._sendCommand("M105") - tempRequestTimeout = getNewTimeout("detection") if self._grbl else getNewTimeout("position") + if self._grbl: + tempRequestTimeout = getNewTimeout("position") + else: + tempRequestTimeout = getNewTimeout("detection") ###print(tempRequestTimeout) # resend -> start resend procedure from requested line @@ -1021,8 +1035,10 @@ class MachineCom(object): # Even when printing request the temperature every 5 seconds. if time.time() > tempRequestTimeout and not self.isStreaming(): if self._grbl: - self._commandQueue.put("?") - tempRequestTimeout = getNewTimeout("position") + # disabled, caused race conditions during streaming resulting in a Invalid Gcode ID24 + #self._commandQueue.put("?") + #tempRequestTimeout = getNewTimeout("position") + pass else: self._commandQueue.put("M105") tempRequestTimeout = getNewTimeout("temperature")