Skip to content

Commit

Permalink
Some test code to try out #5. Not sure if this will work, need to tes…
Browse files Browse the repository at this point in the history
…t on a real printer.
  • Loading branch information
drdelaney committed Nov 16, 2017
1 parent 27dea90 commit 690c85e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
29 changes: 26 additions & 3 deletions octoprint_RepetierInformer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,29 @@ def on_event(self, event, payload):
self.sendInformer("Timelapse failed","Timelapse rendering has failed","Timelapse rendering has failed",inform_err)
return



def hook_gcode_pause(self, comm_instance, phase, cmd, cmd_type, gcode, *args, **kwargs):
# Return if not enabled
if not self._settings.get(['enabled']):
self._logger.info("Not enabled, will not send.")
return

# Handle pause/resume gcodes
if gcode and gcode == "M24":
if self._settings.get(['notify','printresume']):
self.sendInformer("Printing resumed","Printng has been resumed","Printing has been resumed via M24",inform_ok)
return
if gcode and gcode == "M25":
if self._settings.get(['notify','printpause']):
self.sendInformer("Printing paused","Printng has been paused","Printing has been paused via M25",inform_pause)
return
if gcode and gcode == "M226":
if self._settings.get(['notify','printpause']):
self.sendInformer("Printing paused","Printng has been paused","Printing has been paused via M226",inform_pause)
return
if gcode and gcode == "M600":
if self._settings.get(['notify','printpause']):
self.sendInformer("Printing paused","Printng has been paused","Printing has been paused via M600",inform_pause)
return


# If you want your plugin to be registered within OctoPrint under a different name than what you defined in setup.py
Expand All @@ -295,6 +316,8 @@ def __plugin_load__():

global __plugin_hooks__
__plugin_hooks__ = {
"octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information
"octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information,
"octoprint.comm.protocol.gcode.sent": __plugin_implementation__.hook_gcode_pause

}

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
plugin_name = "Repetier-Informer for OctoPrint"

# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
plugin_version = "0.1.3"
plugin_version = "0.1.4"

# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
# module
Expand Down

0 comments on commit 690c85e

Please sign in to comment.