Skip to content

Commit

Permalink
add custom action command BEDLEVELVISUALIZER_LEVELBED to allow use …
Browse files Browse the repository at this point in the history
…with custom_menu options in Marlin. Will initiate the command contained within the Update Mesh gcode script.
  • Loading branch information
jneilliii committed May 23, 2021
1 parent 3e0265a commit bddcf96
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions octoprint_bedlevelvisualizer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,15 @@ def on_api_get(self, request):
response = dict(stopped=True)
return flask.jsonify(response)

# Custom Action Hook

def custom_action_handler(self, comm, line, action, *args, **kwargs):
if not action == "BEDLEVELVISUALIZER_LEVELBED":
return
self._bedlevelvisualizer_logger.debug("Received BEDLEVELVISUALIZER_LEVELBED command.")
self._printer.commands(self._settings.get(["command"]).split("\n"))
return

# Custom Event Hook

def send_mesh_data_collected_event(self, mesh_data, bed_data):
Expand Down Expand Up @@ -556,6 +565,7 @@ def __plugin_load__():

global __plugin_hooks__
__plugin_hooks__ = {
"octoprint.comm.protocol.action": __plugin_implementation__.custom_action_handler,
"octoprint.comm.protocol.atcommand.sending": __plugin_implementation__.flag_mesh_collection,
"octoprint.comm.protocol.gcode.received": __plugin_implementation__.process_gcode,
"octoprint.events.register_custom_events": __plugin_implementation__.register_custom_events,
Expand Down
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 = "Bed Visualizer"

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

# 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 bddcf96

Please sign in to comment.