Skip to content

Commit

Permalink
add estop cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
falkecarlsen committed Aug 14, 2024
1 parent 19afeea commit 93a2287
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions py_driver/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ class ClaireDevice:
"""

def __init__(self, port):
self.e_stop = False
self.state = None
self.device = port
self.busy = True # initially unknown, therefore busy
Expand Down Expand Up @@ -385,6 +386,16 @@ def close(self):
self.underflow_thread.join() # Wait until read thread has been stopped.
self.ser.close()

def e_stop(self):
"""Emergency stop the device."""
self.write("3;")
# wait for device to be ready again after e_stopping
while not self.ready():
sleep(0.1)
self.update_state(quick=True)
assert not self.state.dynamic, "Device is still dynamic after emergency stop."
self.e_stop = True

def set_water_level(self, tube, level):
"""
Set the water level in the selected tube to the provided height.
Expand Down

0 comments on commit 93a2287

Please sign in to comment.