From b97995323a18f6e943d060bd028141216a772781 Mon Sep 17 00:00:00 2001 From: make-ing Date: Mon, 12 Oct 2015 17:41:55 +0200 Subject: [PATCH] added stop of temperature_poll during printing --- src/octoprint/util/comm_acc.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/octoprint/util/comm_acc.py b/src/octoprint/util/comm_acc.py index 2c7ca3b7..83d6b82f 100644 --- a/src/octoprint/util/comm_acc.py +++ b/src/octoprint/util/comm_acc.py @@ -256,6 +256,15 @@ class MachineCom(object): if self._state == newState: return + if newState == self.STATE_PRINTING: + if self._temperature_timer is not None: + self._temperature_timer.cancel() + elif newState == self.STATE_OPERATIONAL: + if self._temperature_timer is not None: + self._temperature_timer.cancel() + self._temperature_timer = RepeatedTimer(1, self._poll_temperature, run_first=True) + self._temperature_timer.start() + if newState == self.STATE_CLOSED or newState == self.STATE_CLOSED_WITH_ERROR: if settings().get(["feature", "sdSupport"]): self._sdFileList = False @@ -1386,8 +1395,7 @@ class MachineCom(object): """ if self.isOperational() and not self.isStreaming() and not self._long_running_command and not self._heating: - #self.sendCommand("?", cmd_type="temperature_poll") - self._sendCommand("?") + self.sendCommand("?", cmd_type="temperature_poll") def _poll_sd_status(self): """