Script execution
This commit is contained in:
@@ -50,12 +50,13 @@ class RobotModbus(DeviceBase):
|
||||
robot_args.write(to_array(args, 'i'))
|
||||
try:
|
||||
self.request()
|
||||
ret = robot_ret.read()
|
||||
if ret == 1:
|
||||
return True
|
||||
if ret == 2:
|
||||
err = robot_ack.take()
|
||||
if err == 1:
|
||||
ret = robot_ret.read()
|
||||
return ret
|
||||
if err == 2:
|
||||
raise Exception("Invalid command: " + str(command))
|
||||
raise Exception("Unknown error: " + str(ret))
|
||||
raise Exception("Unknown error: " + str(err))
|
||||
finally:
|
||||
self.cancel_request()
|
||||
|
||||
@@ -66,7 +67,7 @@ class RobotModbus(DeviceBase):
|
||||
|
||||
def cancel_request(self):
|
||||
robot_req.write(0)
|
||||
while robot_ack.read() == 1:
|
||||
while robot_ack.read() != 0:
|
||||
time.sleep(0.001)
|
||||
|
||||
def mount(self, puck, sample):
|
||||
|
||||
Reference in New Issue
Block a user