A single-stepping GCODE tool
This commit is contained in:
parent
88b4e7da1f
commit
c2e9b73946
2 changed files with 52 additions and 0 deletions
10
projects/octostep/BUILD
Normal file
10
projects/octostep/BUILD
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
zapp_binary(
|
||||||
|
name = "octostep",
|
||||||
|
shebang = "/usr/bin/env /usr/bin/python3",
|
||||||
|
main = "__main__.py",
|
||||||
|
deps = [
|
||||||
|
py_requirement("colored"),
|
||||||
|
py_requirement("octorest"),
|
||||||
|
py_requirement("pyyaml"),
|
||||||
|
],
|
||||||
|
)
|
42
projects/octostep/__main__.py
Normal file
42
projects/octostep/__main__.py
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
"""A quick and dirty octoprint status screen"""
|
||||||
|
|
||||||
|
from configparser import ConfigParser
|
||||||
|
import os
|
||||||
|
|
||||||
|
from octorest.client import OctoRest
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
config = ConfigParser()
|
||||||
|
config.read(os.path.expanduser("~/.config/octoprint-cli.ini"))
|
||||||
|
|
||||||
|
client = OctoRest(url="http://" + config["server"]["ServerAddress"],
|
||||||
|
apikey=config["server"]["ApiKey"])
|
||||||
|
|
||||||
|
for line in open(sys.argv[1], "r"):
|
||||||
|
l = line.split(";")[0]
|
||||||
|
l = l.strip()
|
||||||
|
if not l:
|
||||||
|
continue
|
||||||
|
|
||||||
|
while True:
|
||||||
|
print(f"\n> {l}")
|
||||||
|
cmd = input("[seq?] >>> ")
|
||||||
|
if cmd == "s":
|
||||||
|
client.gcode(l)
|
||||||
|
break
|
||||||
|
elif cmd == "e":
|
||||||
|
client.gcode("M112")
|
||||||
|
elif cmd == "q":
|
||||||
|
exit(0)
|
||||||
|
elif cmd == "n":
|
||||||
|
break
|
||||||
|
elif cmd == "?":
|
||||||
|
print("""\
|
||||||
|
s[tep] - run the next g-code line in the file
|
||||||
|
n[ext] - skip this line
|
||||||
|
e[stop] - issue an emergency stop
|
||||||
|
q[uit] - exit the debugger""")
|
||||||
|
|
||||||
|
else:
|
||||||
|
client.gcode(line)
|
Loading…
Reference in a new issue