Skip to content

Commit

Permalink
Move user inquiry on first place before initializing the exit procedu…
Browse files Browse the repository at this point in the history
…re, make the consequences of exit a print more transparent kliment#1415
  • Loading branch information
DivingDuck committed Mar 7, 2024
1 parent ba3b293 commit 67f5bc4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions printrun/pronsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,11 @@ def default(self, l):
cmd.Cmd.default(self, l)

def do_exit(self, l):
if self.p.printing and l != "force":
self.log(_("Are you sure you want to exit while printing?\n\
Disables all heaters upon exit."))
if not self.confirm():
return
if self.status.extruder_temp_target != 0:
self.log(_("Setting extruder temp to 0"))
self.p.send_now("M104 S0.0")
Expand All @@ -411,11 +416,7 @@ def do_exit(self, l):
self.log(_("Setting bed temp to 0"))
self.p.send_now("M140 S0.0")
self.log(_("Disconnecting from printer..."))
if self.p.printing and l != "force":
self.log(_("Are you sure you want to exit while printing?\n\
(this will terminate the print)."))
if not self.confirm():
return

self.log(_("Exiting program. Goodbye!"))
self.p.disconnect()
self.kill()
Expand Down

0 comments on commit 67f5bc4

Please sign in to comment.