diff --git a/docs/configuration/config_yaml.rst b/docs/configuration/config_yaml.rst index baa7e5519..71bf107cc 100644 --- a/docs/configuration/config_yaml.rst +++ b/docs/configuration/config_yaml.rst @@ -764,6 +764,10 @@ Use the following settings to configure the serial connection to the printer: # during connect. waitForStartOnConnect: false + # Specifies whether OctoPrint should wait to load the SD card file list until the first firmware capability + # report is processed. + waitToLoadSdFileList: false + # Specifies whether OctoPrint should send linenumber + checksum with every printer command. Needed for # successful communication with Repetier firmware alwaysSendChecksum: false diff --git a/docs/plugins/hooks.rst b/docs/plugins/hooks.rst index 47822eb48..bf4207bea 100644 --- a/docs/plugins/hooks.rst +++ b/docs/plugins/hooks.rst @@ -509,6 +509,30 @@ octoprint.comm.protocol.firmware.capabilities .. _sec-plugins-hook-comm-protocol-action: +octoprint.comm.protocol.firmware.capability_report +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. py:function:: firmware_capability_report_hook(comm_instance, firmware_capabilities, *args, **kwargs) + + .. versionadded:: 1.9.0 + + Be notified when all capability report entries are received from the printer. + + Hook handlers may use this to react to the end of the custom firmware capability report. OctoPrint parses the received + capability lines and provides a dictionary of all reported capabilities and whether they're enabled to the handler. + + .. warning:: + + Make sure to not perform any computationally expensive or otherwise long running actions within these handlers as + you will effectively block the receive loop, causing the communication with the printer to stall. + + This includes I/O of any kind. + + :param object comm_instance: The :class:`~octoprint.util.comm.MachineCom` instance which triggered the hook. + :param dict firmware_capabilities: Reported capabilities (capability name mapped to enabled flag) + +.. _sec-plugins-hook-comm-protocol-action: + octoprint.comm.protocol.action ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/octoprint/schema/config/serial.py b/src/octoprint/schema/config/serial.py index e336dc0e4..163b0be53 100644 --- a/src/octoprint/schema/config/serial.py +++ b/src/octoprint/schema/config/serial.py @@ -167,6 +167,9 @@ class SerialConfig(BaseModel): waitForStartOnConnect: bool = False """Whether OctoPrint should wait for the `start` response from the printer before trying to send commands during connect.""" + waitToLoadSdFileList: bool = False + """Specifies whether OctoPrint should wait to load the SD card file list until the first firmware capability report is processed.""" + alwaysSendChecksum: bool = False """Specifies whether OctoPrint should send linenumber + checksum with every printer command. Needed for successful communication with Repetier firmware.""" diff --git a/src/octoprint/server/api/settings.py b/src/octoprint/server/api/settings.py index ba01887ca..31b9ef562 100644 --- a/src/octoprint/server/api/settings.py +++ b/src/octoprint/server/api/settings.py @@ -213,6 +213,7 @@ def getSettings(): "abortHeatupOnCancel": s.getBoolean(["serial", "abortHeatupOnCancel"]), "supportResendsWithoutOk": s.get(["serial", "supportResendsWithoutOk"]), "waitForStart": s.getBoolean(["serial", "waitForStartOnConnect"]), + "waitToLoadSdFileList": s.getBoolean(["serial", "waitToLoadSdFileList"]), "alwaysSendChecksum": s.getBoolean(["serial", "alwaysSendChecksum"]), "neverSendChecksum": s.getBoolean(["serial", "neverSendChecksum"]), "sendChecksumWithUnknownCommands": s.getBoolean( @@ -834,6 +835,11 @@ def _saveSettings(data): s.setBoolean( ["serial", "waitForStartOnConnect"], data["serial"]["waitForStart"] ) + if "waitToLoadSdFileList" in data["serial"]: + s.setBoolean( + ["serial", "waitToLoadSdFileList"], + data["serial"]["waitToLoadSdFileList"], + ) if "alwaysSendChecksum" in data["serial"]: s.setBoolean( ["serial", "alwaysSendChecksum"], data["serial"]["alwaysSendChecksum"] diff --git a/src/octoprint/static/js/app/viewmodels/settings.js b/src/octoprint/static/js/app/viewmodels/settings.js index ff26f821b..1d72febf0 100644 --- a/src/octoprint/static/js/app/viewmodels/settings.js +++ b/src/octoprint/static/js/app/viewmodels/settings.js @@ -210,6 +210,7 @@ $(function () { self.serial_serialErrorBehaviour = ko.observable("cancel"); self.serial_triggerOkForM29 = ko.observable(undefined); self.serial_waitForStart = ko.observable(undefined); + self.serial_waitToLoadSdFileList = ko.observable(undefined); self.serial_sendChecksum = ko.observable("print"); self.serial_sendChecksumWithUnknownCommands = ko.observable(undefined); self.serial_unknownCommandsNeedAck = ko.observable(undefined); @@ -392,6 +393,7 @@ $(function () { self.observableCopies = { feature_waitForStart: "serial_waitForStart", + feature_waitToLoadSdFileList: "serial_waitToLoadSdFileList", feature_sendChecksum: "serial_sendChecksum", feature_sdRelativePath: "serial_sdRelativePath", feature_sdAlwaysAvailable: "serial_sdAlwaysAvailable", diff --git a/src/octoprint/templates/dialogs/settings/serialconnection.jinja2 b/src/octoprint/templates/dialogs/settings/serialconnection.jinja2 index 885b86d25..2a147052a 100644 --- a/src/octoprint/templates/dialogs/settings/serialconnection.jinja2 +++ b/src/octoprint/templates/dialogs/settings/serialconnection.jinja2 @@ -453,6 +453,12 @@ {{ _('Try checking this if you run into connection timeouts due to your printer taking too long to respond to OctoPrint\'s handshake attempts on connect.') }} +