🐛 Fix pausing -> paused
Was not waiting for scripts and such to complete before the state change.
This commit is contained in:
1 parent
eca74233eb
commit
e7f1302f3c
3 files changed
+20
-14
No files matched your search
@@ -496,6 +496,12 @@ class SDFilePrintjob(StoragePrintjob, FileAwareProtocolListener):
|
||||
self._protocol.stop_file_print_status_monitor()
|
||||
self.process_job_done()
|
||||
|
||||
def on_protocol_file_print_paused(self, protocol, *args, **kwargs):
|
||||
self._protocol.pause_file_print()
|
||||
|
||||
def on_protocol_file_print_resumed(self, protocol, *args, **kwargs):
|
||||
self._protocol.resume_file_print()
|
||||
|
||||
def reset_job(self, success=True):
|
||||
super(SDFilePrintjob, self).reset_job(success=success)
|
||||
self._active = False
|
||||
|
||||
@@ -509,6 +509,12 @@ class FileAwareProtocolListener(object):
|
||||
def on_protocol_file_print_done(self, protocol, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def on_protocol_file_print_paused(self, protocol, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def on_protocol_file_print_resumed(self, protocol, *args, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
class PositionAwareProtocolListener(object):
|
||||
|
||||
|
||||
@@ -415,15 +415,6 @@ class ReprapGcodeProtocol(Protocol, ThreeDPrinterProtocolMixin, MotorControlProt
|
||||
self._pause_preparation_done()
|
||||
|
||||
def _pause_preparation_done(self, check_timer=True, suppress_script=None):
|
||||
# do we need to suppress the script?
|
||||
if suppress_script is not None:
|
||||
with self._suppress_scripts_mutex:
|
||||
suppress_script = "pause" in self._suppress_scripts
|
||||
try:
|
||||
self._suppress_scripts.remove("pause")
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
# do we need to stop a timer?
|
||||
with self._pause_mutex:
|
||||
if self._pause_position_timer is not None:
|
||||
@@ -432,13 +423,13 @@ class ReprapGcodeProtocol(Protocol, ThreeDPrinterProtocolMixin, MotorControlProt
|
||||
elif check_timer:
|
||||
return
|
||||
|
||||
# wait for current commands to be sent, then switch to paused state
|
||||
def finalize():
|
||||
self.state = ProtocolState.PAUSED
|
||||
self.notify_listeners("on_protocol_job_paused", self, self._job, suppress_script=suppress_script)
|
||||
|
||||
self.send_commands(SendQueueMarker(finalize))
|
||||
self._continue_sending()
|
||||
# wait for current commands to be sent, then switch to paused state
|
||||
def finalize():
|
||||
self.state = ProtocolState.PAUSED
|
||||
self.send_commands(SendQueueMarker(finalize))
|
||||
self._continue_sending()
|
||||
|
||||
def pause_processing(self, user=None, tags=None, log_position=True, suppress_scripts_and_commands=False):
|
||||
# TODO sync with comm.py
|
||||
@@ -734,6 +725,9 @@ class ReprapGcodeProtocol(Protocol, ThreeDPrinterProtocolMixin, MotorControlProt
|
||||
return
|
||||
self._job_processed(job)
|
||||
|
||||
def on_job_paused(self, job, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def on_job_resumed(self, job, *args, **kwargs):
|
||||
if job != self._job:
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user