chiark / gitweb /
Fix issue where a line could be sent twice due to race condition
authorYouness Alaoui <kakaroto@kakaroto.homelinux.net>
Mon, 7 Dec 2015 19:58:00 +0000 (14:58 -0500)
committerYouness Alaoui <kakaroto@kakaroto.homelinux.net>
Tue, 8 Dec 2015 18:36:20 +0000 (13:36 -0500)
Cura/util/machineCom.py

index 0282fd7c7d67c8567bcf54c249826e9aab27f564..d1327d133bb34f199439ddf96bc5dc9bbb0aba1e 100644 (file)
@@ -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):