Script execution

This commit is contained in:
gac-S_Changer
2017-01-26 15:22:54 +01:00
parent 1b023ccd4c
commit 8e95731be5

View File

@@ -51,19 +51,23 @@ class RobotModbus(DeviceBase):
try:
self.request()
ret = robot_ret.read()
if ret == 1:
return True
if ret == 2:
raise Exception("Invalid command: " + str(command))
raise Exception("Unknown error: " + str(ret))
finally:
self.cancel_request()
return ret
def request(self):
robot_req.write(1)
while robot_ack.read() == 0:
time.sleep(0.01)
time.sleep(0.001)
def cancel_request(self):
robot_req.write(0)
while robot_ack.read() == 1:
time.sleep(0.01)
time.sleep(0.001)
def mount(self, puck, sample):
return self.execute('1', '1', puck, sample)