Prevents manual commands from interupting other commands

master
Tom 2013-03-25 14:01:48 -04:00
parent 456ded3f36
commit 9b2d166c6c
1 changed files with 7 additions and 1 deletions

View File

@ -197,7 +197,7 @@ class MachineCom(object):
self._currentLine = 1
self._resendDelta = None
self._lastLines = []
self._sending = False
self.thread = threading.Thread(target=self._monitor)
self.thread.daemon = True
self.thread.start()
@ -537,6 +537,10 @@ class MachineCom(object):
def _sendCommand(self, cmd, sendChecksum=False):
cmd = cmd.upper()
#Wait for current send to finish.
while self._sending:
pass
self._sending = True
if self._serial is None:
return
if 'M109' in cmd or 'M190' in cmd:
@ -621,6 +625,8 @@ class MachineCom(object):
self._log("Unexpected error while writing serial port: %s" % (getExceptionString()))
self._errorValue = getExceptionString()
self.close(True)
#clear sending flag
self._sending = False
def _sendNext(self):
if self._gcodePos >= len(self._gcodeList):