Hopefully fixed a race condition that could occur when pressing "Print" (file not opened yet, but comm layer tries to fetch next command)

Possible fix for #400
This commit is contained in:
Gina Häußge 2014-03-03 16:58:15 +01:00
parent 89cae22b91
commit f09d44d8a0

View file

@ -341,14 +341,14 @@ class MachineCom(object):
if self._currentFile is None:
raise ValueError("No file selected for printing")
wasPaused = self.isPaused()
self._printSection = "CUSTOM"
self._changeState(self.STATE_PRINTING)
eventManager().fire("PrintStarted", self._currentFile.getFilename())
try:
self._currentFile.start()
self._changeState(self.STATE_PRINTING)
eventManager().fire("PrintStarted", self._currentFile.getFilename())
if self.isSdFileSelected():
if wasPaused:
self.sendCommand("M26 S0")
@ -620,7 +620,6 @@ class MachineCom(object):
eventManager().fire("FileSelected", self._currentFile.getFilename())
elif 'Writing to file' in line:
# anwer to M28, at least on Marlin, Repetier and Sprinter: "Writing to file: %s"
self._printSection = "CUSTOM"
self._changeState(self.STATE_PRINTING)
line = "ok"
elif 'Done printing file' in line: