Skip to content

Instantly share code, notes, and snippets.

@foosel
Last active June 10, 2020 17:39
Show Gist options
  • Save foosel/12e89d885c32b3adb81f5a999331f151 to your computer and use it in GitHub Desktop.
Save foosel/12e89d885c32b3adb81f5a999331f151 to your computer and use it in GitHub Desktop.
# coding=utf-8
from __future__ import absolute_import
def handle_m108(comm_instance, phase, cmd, cmd_type, gcode, *args, **kwargs):
if gcode != "M108":
return
command_to_send = cmd.encode("ascii", errors="replace")
if comm_instance.isPrinting() or comm_instance._alwaysSendChecksum:
comm_instance._do_increment_and_send_with_checksum(command_to_send)
else:
comm_instance._do_send_without_checksum(command_to_send)
return None,
def update_hook(*args, **kwargs):
return dict(m108_support=dict(type="jsondata",
jsondata="https://gist.githubusercontent.com/foosel/12e89d885c32b3adb81f5a999331f151/raw/version.js",
url="https://gist.githubusercontent.com/foosel/12e89d885c32b3adb81f5a999331f151/raw/m108_support.py",
method="single_file_plugin"))
__plugin_name__ = "Support for M108"
__plugin_author__ = "Gina Häußge"
__plugin_pythoncompat__ = ">=2.7,<4"
__plugin_url__ = "https://gist.github.com/foosel/12e89d885c32b3adb81f5a999331f151"
__plugin_hooks__ = {
"octoprint.comm.protocol.gcode.queuing": handle_m108,
"octoprint.plugin.softwareupdate.check_config": update_hook
}
{
"version": "1.0.3"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment