diff --git a/docs/configuration/config_yaml.rst b/docs/configuration/config_yaml.rst index 258e8464..64c372a8 100644 --- a/docs/configuration/config_yaml.rst +++ b/docs/configuration/config_yaml.rst @@ -290,6 +290,14 @@ The following settings are only relevant to you if you want to do OctoPrint deve # < ok T0:34.3/0.0 T1:23.5/0.0 B:43.2/0.0 includeCurrentToolInTemps: true + # Whether to include the selected filename in the M23 File opened response. + # + # True: > M23 filename.gcode + # < File opened: filename.gcode Size: 27 + # False: > M23 filename.gcode + # > File opened + includeFilenameInOpened: true + # The maximum movement speeds of the simulated printer's axes, in mm/s movementSpeed: x: 6000 @@ -426,6 +434,9 @@ Use the following settings to enable or disable OctoPrint features: # Specifies whether support for SD printing and file management should be enabled sdSupport: true + # Specifies whether firmware expects relative paths for selecting SD files + sdRelativePath: false + # Whether to always assume that an SD card is present in the printer. # Needed by some firmwares which don't report the SD card status properly. sdAlwaysAvailable: false diff --git a/src/octoprint/plugins/virtual_printer/virtual.py b/src/octoprint/plugins/virtual_printer/virtual.py index 556bd5ba..fa76a1a5 100644 --- a/src/octoprint/plugins/virtual_printer/virtual.py +++ b/src/octoprint/plugins/virtual_printer/virtual.py @@ -539,7 +539,10 @@ class VirtualPrinter(object): else: self._selectedSdFile = file self._selectedSdFileSize = os.stat(file).st_size - self._send("File opened: %s Size: %d" % (filename, self._selectedSdFileSize)) + if settings().getBoolean(["devel", "virtualPrinter", "includeFilenameInOpened"]): + self._send("File opened: %s Size: %d" % (filename, self._selectedSdFileSize)) + else: + self._send("File opened") self._send("File selected") def _startSdPrint(self): diff --git a/src/octoprint/printer/standard.py b/src/octoprint/printer/standard.py index b9fa8dda..4833942e 100644 --- a/src/octoprint/printer/standard.py +++ b/src/octoprint/printer/standard.py @@ -385,7 +385,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback): self._printAfterSelect = printAfterSelect self._posAfterSelect = pos - self._comm.selectFile("/" + path if sd else path, sd) + self._comm.selectFile("/" + path if sd and not settings().getBoolean(["feature", "sdRelativePath"]) else path, sd) self._setProgressData(completion=0) self._setCurrentZ(None) diff --git a/src/octoprint/server/api/settings.py b/src/octoprint/server/api/settings.py index ba08fc24..350749d5 100644 --- a/src/octoprint/server/api/settings.py +++ b/src/octoprint/server/api/settings.py @@ -67,6 +67,7 @@ def getSettings(): "alwaysSendChecksum": s.getBoolean(["feature", "alwaysSendChecksum"]), "neverSendChecksum": s.getBoolean(["feature", "neverSendChecksum"]), "sdSupport": s.getBoolean(["feature", "sdSupport"]), + "sdRelativePath": s.getBoolean(["feature", "sdRelativePath"]), "sdAlwaysAvailable": s.getBoolean(["feature", "sdAlwaysAvailable"]), "swallowOkAfterResend": s.getBoolean(["feature", "swallowOkAfterResend"]), "repetierTargetTemp": s.getBoolean(["feature", "repetierTargetTemp"]), @@ -229,6 +230,7 @@ def _saveSettings(data): if "alwaysSendChecksum" in data["feature"].keys(): s.setBoolean(["feature", "alwaysSendChecksum"], data["feature"]["alwaysSendChecksum"]) if "neverSendChecksum" in data["feature"].keys(): s.setBoolean(["feature", "neverSendChecksum"], data["feature"]["neverSendChecksum"]) if "sdSupport" in data["feature"].keys(): s.setBoolean(["feature", "sdSupport"], data["feature"]["sdSupport"]) + if "sdRelativePath" in data["feature"].keys(): s.setBoolean(["feature", "sdRelativePath"], data["feature"]["sdRelativePath"]) if "sdAlwaysAvailable" in data["feature"].keys(): s.setBoolean(["feature", "sdAlwaysAvailable"], data["feature"]["sdAlwaysAvailable"]) if "swallowOkAfterResend" in data["feature"].keys(): s.setBoolean(["feature", "swallowOkAfterResend"], data["feature"]["swallowOkAfterResend"]) if "repetierTargetTemp" in data["feature"].keys(): s.setBoolean(["feature", "repetierTargetTemp"], data["feature"]["repetierTargetTemp"]) diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index fed93526..0a35858b 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -172,6 +172,7 @@ default_settings = { "sendChecksumWithUnknownCommands": False, "unknownCommandsNeedAck": False, "sdSupport": True, + "sdRelativePath": False, "sdAlwaysAvailable": False, "swallowOkAfterResend": True, "repetierTargetTemp": False, @@ -307,6 +308,7 @@ default_settings = { "okWithLinenumber": False, "numExtruders": 1, "includeCurrentToolInTemps": True, + "includeFilenameInOpened": True, "movementSpeed": { "x": 6000, "y": 6000, diff --git a/src/octoprint/static/js/app/viewmodels/settings.js b/src/octoprint/static/js/app/viewmodels/settings.js index eb7aacd5..54fad672 100644 --- a/src/octoprint/static/js/app/viewmodels/settings.js +++ b/src/octoprint/static/js/app/viewmodels/settings.js @@ -124,6 +124,7 @@ $(function() { self.feature_waitForStart = ko.observable(undefined); self.feature_sendChecksum = ko.observable("print"); self.feature_sdSupport = ko.observable(undefined); + self.feature_sdRelativePath = ko.observable(undefined); self.feature_sdAlwaysAvailable = ko.observable(undefined); self.feature_swallowOkAfterResend = ko.observable(undefined); self.feature_repetierTargetTemp = ko.observable(undefined); diff --git a/src/octoprint/templates/dialogs/settings/features.jinja2 b/src/octoprint/templates/dialogs/settings/features.jinja2 index c00e9343..ab7a8843 100644 --- a/src/octoprint/templates/dialogs/settings/features.jinja2 +++ b/src/octoprint/templates/dialogs/settings/features.jinja2 @@ -34,6 +34,13 @@ +
+
+ +
+