aboutsummaryrefslogtreecommitdiff
path: root/qolab
diff options
context:
space:
mode:
Diffstat (limited to 'qolab')
-rw-r--r--qolab/hardware/i_server/i800.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/qolab/hardware/i_server/i800.py b/qolab/hardware/i_server/i800.py
index b7b2fc9..264316a 100644
--- a/qolab/hardware/i_server/i800.py
+++ b/qolab/hardware/i_server/i800.py
@@ -10,6 +10,9 @@ from qolab.hardware.basic import BasicInstrument
from cachetools import cached, TTLCache
import socket
+import logging
+logger = logging.getLogger('qolab.hardware.i_server.i800')
+
class I800(BasicInstrument):
""" Newport i800 series controller, should work with similar Omega controllers """
TTL_MEASURED = 30 # Time To Live for device measured things, i.e. Temperature
@@ -39,14 +42,14 @@ class I800(BasicInstrument):
reply = s.recv(100).decode('ascii')
s.close()
rlist=reply.split(); # occasionally there is more than one reply, it also removes \r
- reply=rlist[-1]; # we will use the last one
- if reply[0:5] != f'{modbus_cmnd}':
+ lreply=rlist[-1]; # we will use the last one
+ if lreply[0:5] != f'{modbus_cmnd}':
# check the proper echo response
- print(f'Warning: expected {modbus_cmnd} but got {reply[0:5]}')
+ logger.warning(f'Warning: expected {modbus_cmnd} but got {lreply[0:5]} in full set {reply}')
if trials > 0:
return self.query(cmnd, trials -1 )
return None
- return reply[5:]
+ return lreply[5:]
@BasicInstrument.tsdb_append
@cached(cache=TTLCache(maxsize=1, ttl=TTL_MEASURED))
@@ -74,7 +77,7 @@ class I800(BasicInstrument):
elif raw & (0b100 << 20):
scale = 100
else:
- print(f'Error: unknown decimal point position in decoded {spStr}')
+ logger.error(f'Error: unknown decimal point position in decoded {spStr} {bin(raw)}')
return float('nan')
val = raw & 0xFFFFF