Skip to content

Commit

Permalink
Merge pull request #7 from drdelaney/dev
Browse files Browse the repository at this point in the history
Enabling some status updates via gcode
  • Loading branch information
drdelaney committed Nov 18, 2017
2 parents 98c74f8 + 690c85e commit 2050bdf
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
35 changes: 29 additions & 6 deletions octoprint_RepetierInformer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def on_event(self, event, payload):
return
if event == 'Error':
if self._settings.get(['notify','printererror']):
# FIXME
# FIXME
#self.sendInformer("Printer Error","Communication error with Printer","{error}",inform_err)
self.sendInformer("Printer Error","Communication error with Printer","Communication error with Printer",inform_err)
return
Expand Down Expand Up @@ -255,7 +255,7 @@ def on_event(self, event, payload):
self.stopTimer()

if self._settings.get(['notify','printcancel']):
self.sendInformer("Printing cancleed","Printng has been canceled","Printing has been cacnceled by user",inform_err)
self.sendInformer("Printing canceled","Printng has been canceled","Printing has been cacnceled by user",inform_err)
return
if event == 'PrintPaused':
if self._settings.get(['notify','printpause']):
Expand All @@ -275,13 +275,34 @@ def on_event(self, event, payload):
return
if event == 'MovieFailed':
if self._settings.get(['notify','timelapsefailed']):
# FIXME
# FIXME
#self.sendInformer("Timelapse failed","Timelapse rendering has failed","{error}",inform_err)
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 2050bdf

Please sign in to comment.