Commit d64e722d authored by bliss administrator's avatar bliss administrator

[wip] temp save / debug

parent 9dea77e9
......@@ -42,6 +42,11 @@ config example:
channel: W
"""
def _atomic_communication(fn):
def f(self,*args,**kwargs):
with self._cnx.lock:
return fn(self,*args,**kwargs)
return f
class PI_HEXA(Controller):
COMMAND = enum.Enum("PI_HEXA.COMMAND", "POSITIONS MOVE_STATE MOVE_SEP INIT")
......@@ -114,6 +119,7 @@ class PI_HEXA(Controller):
def read_position(self, axis):
return self._read_all_positions()[axis.channel]
@_atomic_communication
def state(self, axis):
cmd, test_func = self._commands[self.COMMAND.MOVE_STATE]
moving_flag = test_func(self.command(cmd, 1))
......@@ -136,6 +142,7 @@ class PI_HEXA(Controller):
def start_one(self, motion):
self.start_all(motion)
@_atomic_communication
def start_all(self, *motions):
sep = self._commands[self.COMMAND.MOVE_SEP]
cmd = "MOV " + " ".join(
......@@ -150,6 +157,7 @@ class PI_HEXA(Controller):
def stop(self, axis):
self.stop_all()
@_atomic_communication
def stop_all(self, *motions):
self.command("STP")
self._check_error_and_raise(ignore_stop=True)
......@@ -173,6 +181,7 @@ class PI_HEXA(Controller):
else:
return self._cnx.write(cmd)
@_atomic_communication
def home_search(self, axis, switch):
init_cmd = self._commands[self.COMMAND.INIT]
self.command(init_cmd)
......
......@@ -507,7 +507,7 @@ class musst(object):
self._cnx.open()
with KillMask():
self._cnx._write(b"?*EDAT %d %d %d" % (size_to_read, 0, offset))
raw_data = ""
raw_data = b""
while len(raw_data) < (size_to_read * 4):
raw_data += self._cnx.raw_read()
data_pt[
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment