Reset SD file data when disconnecting or when losing/regaining connection to the backend
parent
b048cc390b
commit
eeddf0ae1a
|
@ -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() {
|
||||
|
|
|
@ -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()))
|
||||
|
@ -686,6 +697,9 @@ class MachineCom(object):
|
|||
self._changeState(self.STATE_CLOSED)
|
||||
self._serial = None
|
||||
|
||||
if settings().get(["feature", "sdSupport"]):
|
||||
self._sdFileList = []
|
||||
|
||||
def __del__(self):
|
||||
self.close()
|
||||
|
||||
|
|
Loading…
Reference in New Issue