Allow M23 "File opened" response with no filename

(cherry-picked from ba4b7c0)
This commit is contained in:
Mark Walker 2015-12-30 14:25:58 -07:00
parent 3069e05766
commit 02b0e906f1
2 changed files with 8 additions and 4 deletions

View file

@ -293,7 +293,7 @@ default_settings = {
"okWithLinenumber": False,
"numExtruders": 1,
"includeCurrentToolInTemps": True,
"includeFilenameOnOpened": True,
"includeFilenameInOpened": True,
"movementSpeed": {
"x": 6000,
"y": 6000,

View file

@ -1120,12 +1120,16 @@ class MachineCom(object):
elif 'File opened' in line and not self._ignore_select:
# answer to M23, at least on Marlin, Repetier and Sprinter: "File opened:%s Size:%d"
match = regex_sdFileOpened.search(line)
if match:
name = match.group("name")
size = int(match.group("size"))
else:
name = "Unknown"
size = 0
if self._sdFileToSelect:
name = self._sdFileToSelect
self._sdFileToSelect = None
else:
name = match.group("name")
self._currentFile = PrintingSdFileInformation(name, int(match.group("size")))
self._currentFile = PrintingSdFileInformation(name, size)
elif 'File selected' in line:
if self._ignore_select:
self._ignore_select = False