✨ Send M20 L if detected as supported

Also support quoted long names, which apparently are sent by some
firmwares? Make a suggestion for a format that is universally parseable,
document it on the reprep wiki, people STILL find a way to be
incompatible to it. I can't even...

Anyhow. See https://community.octoprint.org/t/adding-support-for-m20-l/34402
This commit is contained in:
Gina Häußge committed 2021-05-25 11:15:43 +02:00
1 parent 9cf0802bf2
commit 88921542ef
7 files changed
+37 -6

No files matched your search

@@ -30,7 +30,7 @@ class VirtualPrinterPlugin(
"smoothieTemperatureReporting": False,
"klipperTemperatureReporting": False,
"reprapfwM114": False,
"sdFiles": {"size": True, "longname": False},
"sdFiles": {"size": True, "longname": False, "longname_quoted": True},
"throttle": 0.01,
"sendWait": True,
"waitInterval": 1.0,
@@ -55,6 +55,7 @@ class VirtualPrinterPlugin(
"AUTOREPORT_TEMP": True,
"AUTOREPORT_SD_STATUS": True,
"EMERGENCY_PARSER": True,
"EXTENDED_M20": False,
},
"m114FormatString": "X:{x} Y:{y} Z:{z} E:{e[current]} Count: A:{a} B:{b} C:{c}",
"m105TargetFormatString": "{heater}:{actual:.2f}/ {target:.2f}",
@@ -607,7 +607,7 @@ class VirtualPrinter(object):
def _gcode_M20(self, data):
# type: (str) -> None
if self._sdCardReady:
self._listSd()
self._listSd(incl_long="L" in data)
# noinspection PyUnusedLocal
def _gcode_M21(self, data):
@@ -1415,10 +1415,13 @@ class VirtualPrinter(object):
except Exception:
self._logger.exception("While handling %r", data)
def _listSd(self):
def _listSd(self, incl_long=False):
if self._settings.get_boolean(["sdFiles", "size"]):
if self._settings.get_boolean(["sdFiles", "longname"]):
line = "{dosname} {size} {name}"
if self._settings.get_boolean(["sdFiles", "longname"]) or incl_long:
if self._settings.get_boolean(["sdFiles", "longname_quoted"]):
line = '{dosname} {size} "{name}"'
else:
line = "{dosname} {size} {name}"
else:
line = "{dosname} {size}"
else: