|
@@ -52,6 +52,7 @@ class LoadCells():
|
|
|
def start(self):
|
|
|
self.running = True
|
|
|
self.thread = threading.Thread(target=self.reconnectThread)
|
|
|
+ self.thread.daemon = True
|
|
|
self.thread.start()
|
|
|
|
|
|
|
|
@@ -66,8 +67,9 @@ class LoadCells():
|
|
|
self.tareValues[np.isnan(self.tareValues)] = 0
|
|
|
|
|
|
def stop(self):
|
|
|
- if self.running:
|
|
|
- self.running = False
|
|
|
+ for cell in self.cells:
|
|
|
+ cell.disconnect()
|
|
|
+ self.running = False
|
|
|
|
|
|
def getForces(self):
|
|
|
res = np.ndarray(shape=(len(self.cells),3), dtype=float)
|
|
@@ -94,9 +96,9 @@ if __name__ == "__main__":
|
|
|
try:
|
|
|
cells.start()
|
|
|
while True:
|
|
|
- vals = cells.getForces(0)
|
|
|
- if vals[0] != None:
|
|
|
- print('cell 0: ' + ' '.join(["ch {}: {:8.3f} mV/V".format(i, vals[i]) for i in range(len(vals))]))
|
|
|
+ for vals in cells.getForces():
|
|
|
+ if not np.isnan(vals[0]):
|
|
|
+ print('cell: ' + ' '.join(["ch {}: {:8.3f} mV/V".format(i, vals[i]) for i in range(len(vals))]))
|
|
|
time.sleep(.3)
|
|
|
|
|
|
|