Don't trigger PRINT_FAILED twice on disconnect

Fixes #2546
This commit is contained in:
Gina Häußge committed 2018-04-04 11:10:43 +02:00
1 parent 0ac9ea518c
commit a821346b07
2 files changed
+3 -5

No files matched your search

+2 -1
View File
@@ -1176,7 +1176,8 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
def on_comm_print_job_failed(self):
payload = self._payload_for_print_job_event()
eventManager().fire(Events.PRINT_FAILED, payload)
if payload:
eventManager().fire(Events.PRINT_FAILED, payload)
def on_comm_print_job_cancelling(self, firmware_error=None):
payload = self._payload_for_print_job_event()
+1 -4
View File
@@ -850,7 +850,6 @@ class MachineCom(object):
self._monitoring_active = False
self._send_queue_active = False
printing = self.isPrinting() or self.isPaused()
if self._serial is not None:
if not is_error:
self.sendGcodeScript("beforePrinterDisconnected")
@@ -883,6 +882,7 @@ class MachineCom(object):
self._logger.exception("Error while trying to close serial port")
is_error = True
# if we are printing, this will also make sure of firing PRINT_FAILED
if is_error:
self._changeState(self.STATE_CLOSED_WITH_ERROR)
else:
@@ -894,9 +894,6 @@ class MachineCom(object):
if settings().getBoolean(["feature", "sdSupport"]):
self._sdFileList = []
if printing:
self._callback.on_comm_print_job_failed()
def setTemperatureOffset(self, offsets):
self._tempOffsets.update(offsets)