Included an early return if ret is None
Also corrected typos, received instead of recieved.
This commit is contained in:
parent
ced18c86e0
commit
fa95507177
2 changed files with 11 additions and 10 deletions
|
|
@ -159,14 +159,14 @@ This describes actually four hooks:
|
|||
:param str gcode: Parsed GCODE command, e.g. ``G0`` or ``M110``, may also be None if no known command could be parsed
|
||||
:return: None, 1-tuple, 2-tuple or string, see the description above for details.
|
||||
|
||||
.. _sec-plugins-hook-comm-protocol-gcode-recieved:
|
||||
.. _sec-plugins-hook-comm-protocol-gcode-received:
|
||||
|
||||
octoprint.comm.protocol.gcode.recieved
|
||||
-------------------------------
|
||||
octoprint.comm.protocol.gcode.received
|
||||
--------------------------------------
|
||||
|
||||
.. py:function:: hook(comm_instance, line, *args, **kwargs)
|
||||
|
||||
Get the returned lines sent by the printer. Handlers should return the recieved line or in any case, the modified
|
||||
Get the returned lines sent by the printer. Handlers should return the received line or in any case, the modified
|
||||
version of it.
|
||||
|
||||
**Example:**
|
||||
|
|
@ -179,8 +179,8 @@ octoprint.comm.protocol.gcode.recieved
|
|||
:caption: `read_m115_response.py <https://github.com/OctoPrint/Plugin-Examples/blob/master/read_m115_response.py>`_
|
||||
|
||||
:param MachineCom comm_instance: The :class:`~octoprint.util.comm.MachineCom` instance which triggered the hook.
|
||||
:param str line: The line recieved from the printer.
|
||||
:return: The recieved line or in any case, a modified version of it.
|
||||
:param str line: The line received from the printer.
|
||||
:return: The received line or in any case, a modified version of it.
|
||||
:rtype: str
|
||||
|
||||
.. _sec-plugins-hook-comm-protocol-scripts:
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ class MachineCom(object):
|
|||
sending=self._pluginManager.get_hooks("octoprint.comm.protocol.gcode.sending"),
|
||||
sent=self._pluginManager.get_hooks("octoprint.comm.protocol.gcode.sent")
|
||||
)
|
||||
self._recieved_message_hooks = self._pluginManager.get_hooks("octoprint.comm.protocol.gcode.recieved")
|
||||
self._received_message_hooks = self._pluginManager.get_hooks("octoprint.comm.protocol.gcode.received")
|
||||
|
||||
self._printer_action_hooks = self._pluginManager.get_hooks("octoprint.comm.protocol.action")
|
||||
self._gcodescript_hooks = self._pluginManager.get_hooks("octoprint.comm.protocol.scripts")
|
||||
|
|
@ -1407,13 +1407,14 @@ class MachineCom(object):
|
|||
self._log("WARN: While reading last line: %s" % e)
|
||||
self._log("Recv: %r" % ret)
|
||||
|
||||
for name, hook in self._recieved_message_hooks.items():
|
||||
for name, hook in self._received_message_hooks.items():
|
||||
try:
|
||||
ret = hook(self, ret)
|
||||
except:
|
||||
self._logger.exception("Error while processing hook {name}:".format(**locals()))
|
||||
if ret is None:
|
||||
return ""
|
||||
else:
|
||||
if ret is None:
|
||||
return ""
|
||||
|
||||
return ret
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue