Skip to content

Instantly share code, notes, and snippets.

@foosel
Last active January 31, 2022 00:42
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save foosel/9ca02e8a3ea0cb748f4b220981eab12d to your computer and use it in GitHub Desktop.
Save foosel/9ca02e8a3ea0cb748f4b220981eab12d to your computer and use it in GitHub Desktop.
# coding=utf-8
from __future__ import absolute_import
def convert_TF_SD(comm, line, *args, **kwargs):
if "TF" not in line:
return line
return line.replace("TF","SD")
__plugin_name__ = "Convert TF to SD"
__plugin_version__ = "1.0.2"
__plugin_author__ = "@b-morgan"
__plugin_description__ = "Convert TF to SD in printer responses"
__plugin_pythoncompat__ = ">=2.7,<4"
__plugin_hooks__ = {
"octoprint.comm.protocol.gcode.received": (convert_TF_SD, 1)
}
@jneilliii
Copy link

@foosel you may want to adjust the ordering on this. Ran into an issue on the discord. This seemed to have fixed it.

https://gist.githubusercontent.com/kantlivelong/bd79e474ecd86959549c12201288b7fb/raw/2d073b56775a9bc96b18c1b21918b746a1204faa/convert_TF_SD.py

@foosel
Copy link
Author

foosel commented Aug 13, 2021

Done, and upped the version to 1.0.2

@glencoe2004
Copy link

Whenever I use this script, my ender 3 pro gives an "SSCB~1.GCO 4480601" error and OctoPrint disconnects. Any solution besides setting OctoPrint to ignore errors?

@foosel
Copy link
Author

foosel commented Nov 2, 2021

The only thing this script does is replace two characters from the printer to OctoPrint. So whatever is going on there, it's either unrelated to the plugin or something really really weird and your should open a Get Help thread on the forums.

@glencoe2004
Copy link

Question: Are file names from the SD card supposed to be truncated? Local gcode files show the full name, whereas ones from the SD card are shortened.

@foosel
Copy link
Author

foosel commented Nov 2, 2021

Yes, and that is even in the FAQ ;) Please reach out on the forums.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment