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

@@ -57,6 +57,14 @@ class PauseResume:
self.send_pause_command()
self.gcode.run_script_from_command("SAVE_GCODE_STATE STATE=PAUSE_STATE")
self.is_paused = True
def send_resume_command(self):
if self.sd_paused:
# Printing from virtual sd, run pause command
self.v_sd.do_resume()
self.sd_paused = False
else:
self.gcode.respond_info("action:resumed")
self.pause_command_sent = False
def cmd_RESUME(self, gcmd):
if not self.is_paused:
gcmd.respond_info("Print is not paused, resume aborted")
@@ -65,13 +73,8 @@ class PauseResume:
self.gcode.run_script_from_command(
"RESTORE_GCODE_STATE STATE=PAUSE_STATE MOVE=1 MOVE_SPEED=%.4f"
% (velocity))
self.send_resume_command()
self.is_paused = False
self.pause_command_sent = False
if self.sd_paused:
# Printing from virtual sd, run pause command
self.v_sd.cmd_M24(gcmd)
else:
gcmd.respond_info("action:resumed")
def cmd_CLEAR_PAUSE(self, gcmd):
self.is_paused = self.pause_command_sent = False
def cmd_CANCEL_PRINT(self, gcmd):