Skip to content

Commit

Permalink
Improve capability report hook name
Browse files Browse the repository at this point in the history
  • Loading branch information
kForth committed Aug 10, 2022
1 parent eef084e commit ee051f7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
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

0 comments on commit ee051f7

Please sign in to comment.