From d5e4a5f4aef861cd3379ecf3350a6c77d4d42fd2 Mon Sep 17 00:00:00 2001 From: make-ing Date: Thu, 1 Oct 2015 17:59:56 +0200 Subject: [PATCH] added disconnect special command and added yappi to profile while loop --- src/octoprint/util/comm_acc.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/octoprint/util/comm_acc.py b/src/octoprint/util/comm_acc.py index ace2e3c9..e88efcf5 100644 --- a/src/octoprint/util/comm_acc.py +++ b/src/octoprint/util/comm_acc.py @@ -4,6 +4,9 @@ __author__ = "Gina Häußge based on work by David Braam" __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html" __copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License" +### DEBUGING START +import yappi +### DEBUG END import os import glob @@ -498,6 +501,8 @@ class MachineCom(object): self._temperature_timer = RepeatedTimer(frequency, self._poll_temperature, run_first=True) self._temperature_timer.start() + elif "disconnect" in specialcmd: + self.close() else: self._log("Command not Found! %s" % cmd) self._log("available commands are:") @@ -970,6 +975,8 @@ class MachineCom(object): self._sendCommand("?") self._clear_to_send.set() + yappi.start() + while self._monitoring_active: try: line = self._readline() @@ -1353,6 +1360,8 @@ class MachineCom(object): eventManager().fire(Events.ERROR, {"error": self.getErrorString()}) self._log("Connection closed, closing down monitor") + yappi.get_func_stats().print_all() + def _process_registered_message(self, line, feedback_matcher, feedback_controls, feedback_errors): feedback_match = feedback_matcher.search(line) if feedback_match is None: