palette2: Add support for P2 devices (#4057)

Module which bring support for P2 devices running in connected mode. This enables using a Palette2 directly with Klippy without Octoprint, or without Palette2 plugins for Octoprint which are not functional out of the box with Klipper.

Signed-off-by: Clifford Roche <clifford.roche@gmail.com>
This commit is contained in:
Clifford Roche
2021-03-26 11:21:10 -04:00
committed by GitHub
parent a0307c0e1c
commit e2a3217289
5 changed files with 697 additions and 11 deletions

View File

@@ -91,6 +91,12 @@ class VirtualSD:
self.must_pause_work = True
while self.work_timer is not None and not self.cmd_from_sd:
self.reactor.pause(self.reactor.monotonic() + .001)
def do_resume(self):
if self.work_timer is not None:
raise self.gcode.error("SD busy")
self.must_pause_work = False
self.work_timer = self.reactor.register_timer(
self.work_handler, self.reactor.NOW)
# G-Code commands
def cmd_error(self, gcmd):
raise gcmd.error("SD write not supported")
@@ -167,11 +173,7 @@ class VirtualSD:
self.print_stats.set_current_file(filename)
def cmd_M24(self, gcmd):
# Start/resume SD print
if self.work_timer is not None:
raise gcmd.error("SD busy")
self.must_pause_work = False
self.work_timer = self.reactor.register_timer(
self.work_handler, self.reactor.NOW)
self.do_resume()
def cmd_M25(self, gcmd):
# Pause SD print
self.do_pause()