Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/4493 - Defer M20 commands until initial capability report is done #4577

Merged
merged 8 commits into from
Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve capability report hook name
  • Loading branch information
kForth committed Aug 10, 2022
commit ee051f7763051ae29b98585487e1b875d86a06ea
2 changes: 1 addition & 1 deletion docs/configuration/config_yaml.rst
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ Use the following settings to configure the serial connection to the printer:
# 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
Expand Down
6 changes: 3 additions & 3 deletions docs/plugins/hooks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -509,17 +509,17 @@ octoprint.comm.protocol.firmware.capabilities

.. _sec-plugins-hook-comm-protocol-action:

octoprint.comm.protocol.firmware.after_report
octoprint.comm.protocol.firmware.capability_report
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. py:function:: firmware_after_report_hook(comm_instance, firmware_capabilities, *args, **kwargs)
.. 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 capabilties and whether they're enabled to the handler.
capability lines and provides a dictionary of all reported capabilities and whether they're enabled to the handler.

.. warning::

Expand Down
8 changes: 5 additions & 3 deletions src/octoprint/util/comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,8 @@ def __init__(
"capabilities": self._pluginManager.get_hooks(
"octoprint.comm.protocol.firmware.capabilities"
),
"after_report": self._pluginManager.get_hooks(
"octoprint.comm.protocol.firmware.after_report"
"capability_report": self._pluginManager.get_hooks(
"octoprint.comm.protocol.firmware.capability_report"
),
}

Expand Down Expand Up @@ -2607,7 +2607,9 @@ def convert_line(line):
self.refreshSdFiles()

# notify plugins
for name, hook in self._firmware_info_hooks["after_report"].items():
for name, hook in self._firmware_info_hooks[
"capability_report"
].items():
try:
hook(self, copy.copy(self._firmware_capabilities))
except Exception:
Expand Down