From fa9db4e79d9f9eb5c57195f86d043a86123f8c1a Mon Sep 17 00:00:00 2001 From: Youness Alaoui Date: Mon, 7 Dec 2015 14:58:00 -0500 Subject: [PATCH] Fix issue where a line could be sent twice due to race condition --- Cura/util/machineCom.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Cura/util/machineCom.py b/Cura/util/machineCom.py index 0282fd7c..d1327d13 100644 --- a/Cura/util/machineCom.py +++ b/Cura/util/machineCom.py @@ -614,8 +614,9 @@ class MachineCom(object): except: self._log("Unexpected error: %s" % (getExceptionString())) checksum = reduce(lambda x,y:x^y, map(ord, "N%d%s" % (self._gcodePos, line))) - self._sendCommand("N%d%s*%d" % (self._gcodePos, line, checksum)) + pos = self._gcodePos self._gcodePos += 1 + self._sendCommand("N%d%s*%d" % (pos, line, checksum)) self._callback.mcProgress(self._gcodePos) def sendCommand(self, cmd): -- 2.30.2