1
0
mirror of https://github.com/jonathanhogg/scopething synced 2025-07-14 11:12:09 +01:00

Small change to closing of scope

This commit is contained in:
2020-07-23 12:38:22 +01:00
parent 742109336b
commit 829eab570a
2 changed files with 5 additions and 3 deletions

View File

@ -43,8 +43,8 @@ class Scope(vm.VirtualMachine):
break break
else: else:
raise RuntimeError("No matching serial device found") raise RuntimeError("No matching serial device found")
Log.info(f"Connecting to scope at {url}")
self.close() self.close()
Log.info(f"Connecting to scope at {url}")
parts = urlparse(url, scheme='file') parts = urlparse(url, scheme='file')
if parts.scheme == 'file': if parts.scheme == 'file':
self._reader = self._writer = streams.SerialStream(device=parts.path) self._reader = self._writer = streams.SerialStream(device=parts.path)
@ -115,8 +115,8 @@ class Scope(vm.VirtualMachine):
self.close() self.close()
def close(self): def close(self):
super().close() if super().close():
Log.info("Closed scope") Log.info("Closed scope")
def calculate_lo_hi(self, low, high, params): def calculate_lo_hi(self, low, high, params):
if not isinstance(params, self.AnalogParams): if not isinstance(params, self.AnalogParams):

2
vm.py
View File

@ -281,6 +281,8 @@ class VirtualMachine:
self._writer.close() self._writer.close()
self._writer = None self._writer = None
self._reader = None self._reader = None
return True
return False
__del__ = close __del__ = close