diff options
author | Kamil TrzciĆski <ayufan@ayufan.eu> | 2021-06-14 21:09:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-14 15:09:55 -0400 |
commit | 46f51b2bb0dadfff0382af32c22356571bb46d17 (patch) | |
tree | ffc30c601b7bc5c21658fb1defb96d4c6ee34a63 /klippy/extras/pause_resume.py | |
parent | f7279a037d7760befb2f085ab0ab99057681862e (diff) | |
download | kutter-46f51b2bb0dadfff0382af32c22356571bb46d17.tar.gz kutter-46f51b2bb0dadfff0382af32c22356571bb46d17.tar.xz kutter-46f51b2bb0dadfff0382af32c22356571bb46d17.zip |
print_stats: add `cancelled` when `CANCEL_PRINT` used (#4366)
Before this change, a `CANCEL_PRINT` set a `print_stats` to `paused`
that would later be workaround-ed with `fluidd`/`mainsail` to re-define
`CANCEL_PRINT`.
This sets a proper canceled state, but additionally closes a file
from a `virtual_sdcard` context for `canceled`/`error`, as this is no longer
resumable from this point.
Signed-off-by: Kamil Trzcinski <ayufan@ayufan.eu>
Diffstat (limited to 'klippy/extras/pause_resume.py')
-rw-r--r-- | klippy/extras/pause_resume.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/klippy/extras/pause_resume.py b/klippy/extras/pause_resume.py index 229bd6f4..4d9684f2 100644 --- a/klippy/extras/pause_resume.py +++ b/klippy/extras/pause_resume.py @@ -42,12 +42,14 @@ class PauseResume: return { 'is_paused': self.is_paused } + def is_sd_active(self): + return self.v_sd is not None and self.v_sd.is_active() def send_pause_command(self): # This sends the appropriate pause command from an event. Note # the difference between pause_command_sent and is_paused, the # module isn't officially paused until the PAUSE gcode executes. if not self.pause_command_sent: - if self.v_sd is not None and self.v_sd.is_active(): + if self.is_sd_active(): # Printing from virtual sd, run pause command self.sd_paused = True self.v_sd.do_pause() @@ -88,8 +90,9 @@ class PauseResume: self.is_paused = self.pause_command_sent = False cmd_CANCEL_PRINT_help = ("Cancel the current print") def cmd_CANCEL_PRINT(self, gcmd): - self.cmd_PAUSE(gcmd) - if not self.sd_paused: + if self.is_sd_active() or self.sd_paused: + self.v_sd.do_cancel() + else: gcmd.respond_info("action:cancel") self.cmd_CLEAR_PAUSE(gcmd) |