1
0
mirror of https://github.com/jonathanhogg/scopething synced 2025-07-13 18:52:10 +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
else:
raise RuntimeError("No matching serial device found")
Log.info(f"Connecting to scope at {url}")
self.close()
Log.info(f"Connecting to scope at {url}")
parts = urlparse(url, scheme='file')
if parts.scheme == 'file':
self._reader = self._writer = streams.SerialStream(device=parts.path)
@ -115,8 +115,8 @@ class Scope(vm.VirtualMachine):
self.close()
def close(self):
super().close()
Log.info("Closed scope")
if super().close():
Log.info("Closed scope")
def calculate_lo_hi(self, low, high, params):
if not isinstance(params, self.AnalogParams):

2
vm.py
View File

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