Skip to content

Instantly share code, notes, and snippets.

@foosel
Created June 21, 2018 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save foosel/39cc61552fb6dbec222f075a6fece855 to your computer and use it in GitHub Desktop.
Save foosel/39cc61552fb6dbec222f075a6fece855 to your computer and use it in GitHub Desktop.
Turns broken temperature responses of the form "echo: T:28.7 /0.0 B:28.6 /0.0ok" into proper "ok T:28.7 /0.0 B:28.6 /0.0" ones.
# coding=utf-8
import logging
def fix_temperature_responses(comm, line, *args, **kwargs):
if "T" not in line or not line.startswith("echo:") or not line.endswith("ok"):
return line
return "ok {}".format(line[len("echo:"):-len("ok")])
__plugin_name__ = "Fix Lerdge 3D temperature responses"
__plugin_hooks__ = {
"octoprint.comm.protocol.gcode.received": fix_temperature_responses
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment