From b20c15f56d9203d2a4192ed62e5ab030987b1477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 9 Jul 2020 15:41:46 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8=20Improve=20disconnect=20response?= =?UTF-8?q?=20while=20not=20operational?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We don't want to try to send our beforeDisconnect script if we aren't properly connected, as that will severely delay Disconnect execution, so we now limit that to operational states and thus allow a quick(er) connection abort during auto detection or connection attempt. --- src/octoprint/util/comm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index 47456b331..0a5579234 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -959,7 +959,7 @@ class MachineCom(object): self._send_queue_active = False if self._serial is not None: - if not is_error: + if not is_error and self._state in self.OPERATIONAL_STATES: self.sendGcodeScript("beforePrinterDisconnected") if wait: if timeout is not None: