diff --git a/octoprint/static/js/ui.js b/octoprint/static/js/ui.js index 3765ee9..cbc7f34 100644 --- a/octoprint/static/js/ui.js +++ b/octoprint/static/js/ui.js @@ -1462,6 +1462,7 @@ function DataUpdater(loginStateViewModel, connectionViewModel, printerStateViewM self.timelapseViewModel.requestData(); $("#webcam_image").attr("src", CONFIG_WEBCAM_STREAM + "?" + new Date().getTime()); self.loginStateViewModel.requestData(); + self.gcodeFilesViewModel.requestData(); } }) self._socket.on("disconnect", function() { @@ -1822,8 +1823,6 @@ $(function() { return false; }) - //~~ Print job control (should move to PrinterStateViewModel) - //~~ Temperature control (should really move to knockout click binding) $("#temp_newTemp_set").click(function() { diff --git a/octoprint/util/comm.py b/octoprint/util/comm.py index 8241d5e..b84ba11 100644 --- a/octoprint/util/comm.py +++ b/octoprint/util/comm.py @@ -327,6 +327,17 @@ class MachineCom(object): def _changeState(self, newState): if self._state == newState: return + + if newState == self.STATE_CLOSED or newState == self.STATE_CLOSED_WITH_ERROR: + if settings().get(["feature", "sdSupport"]): + self._sdPrinting = False + self._sdFileList = False + self._sdFile = None + self._sdFilePos = None + self._sdFileSize = None + self._sdFiles = [] + self._callback.mcSdFiles([]) + oldState = self.getStateString() self._state = newState self._log('Changing monitoring state from \'%s\' to \'%s\'' % (oldState, self.getStateString())) @@ -685,7 +696,10 @@ class MachineCom(object): else: self._changeState(self.STATE_CLOSED) self._serial = None - + + if settings().get(["feature", "sdSupport"]): + self._sdFileList = [] + def __del__(self): self.close()