From d4bb75a2eedb5a79c20cabbdd46760232122a538 Mon Sep 17 00:00:00 2001 From: Ross Hendrickson Date: Sun, 4 Aug 2013 04:40:45 +0000 Subject: [PATCH] Work on SD file refresh --- octoprint/cura/__init__.py | 4 ---- octoprint/printer.py | 4 +--- octoprint/util/comm.py | 3 +++ 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/octoprint/cura/__init__.py b/octoprint/cura/__init__.py index 6872bc21..50669f2c 100644 --- a/octoprint/cura/__init__.py +++ b/octoprint/cura/__init__.py @@ -4,7 +4,6 @@ __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agp import logging from octoprint.settings import settings -from octoprint.gcodefiles import GcodeManager class CuraFactory(object): @@ -48,9 +47,6 @@ class CuraEngine(object): logging.info("Subprocess args: %s" % str(call_args)) process = subprocess.call(call_args) call_back(*call_back_args) - # TODO: Figure out a better way to have the file manager refresh - manager = GcodeManager() - manager.processGcode(call_args[4]) logging.info("Slicing call back complete:%s" % str(call_back)) args = [self.cura_path, '-s', config, '-o', gcode, file_path] diff --git a/octoprint/printer.py b/octoprint/printer.py index 0770da15..754552e8 100644 --- a/octoprint/printer.py +++ b/octoprint/printer.py @@ -463,7 +463,6 @@ class Printer(): def addSdFile(self, filename, absolutePath): from octoprint.util import isGcodeFileName from octoprint.util import isSTLFileName - from octoprint.gcodefiles import GcodeManager logging.info("Adding SD Card file:%s" % filename) if not self._comm or self._comm.isBusy(): @@ -481,8 +480,7 @@ class Printer(): callBackArgs = [gcodeFileName, gcodePath] callBack = self.streamSdFile - gcodeManager = GcodeManager() - gcodeManager.processSTL( + self._gcodeManager.processSTL( absolutePath, callBack, callBackArgs) def streamSdFile(self, filename, path): diff --git a/octoprint/util/comm.py b/octoprint/util/comm.py index ce7e1f77..1a8a141f 100644 --- a/octoprint/util/comm.py +++ b/octoprint/util/comm.py @@ -409,6 +409,7 @@ class MachineCom(object): def endSdFileTransfer(self, filename): if not self.isOperational() or self.isBusy(): + logging.info("endSdFile busy") return self.sendCommand("M29 %s" % filename.lower()) @@ -426,7 +427,9 @@ class MachineCom(object): self.refreshSdFiles() def refreshSdFiles(self): + logging.info("refresh sd files") if not self.isOperational() or self.isBusy(): + logging.info("refresh busy") return self.sendCommand("M20")