Smaller fixes from cross testing

This commit is contained in:
mohacsi_i 2024-02-21 16:52:43 +01:00
parent 9378d9f74c
commit a7593bb90b

View File

@ -191,11 +191,11 @@ class aa1Tasks(Device):
""" Read a file from the controller """ """ Read a file from the controller """
# Have to use CHAR array due to EPICS LSI bug... # Have to use CHAR array due to EPICS LSI bug...
self.fileName.set(filename).wait() self.fileName.set(filename).wait()
filebytes = self._fileRead.get().astype(np.uint8).tobytes() filebytes = self._fileRead.get()
# C-strings terminate with trailing zero # C-strings terminate with trailing zero
if filebytes[-1]==0: if filebytes[-1]==0:
filebytes = filebytes[:-1] filebytes = filebytes[:-1]
filetext = filebytes.decode('ascii') filetext = filebytes
return filetext return filetext
def writeFile(self, filename: str, filetext: str) -> None: def writeFile(self, filename: str, filetext: str) -> None:
@ -206,14 +206,14 @@ class aa1Tasks(Device):
def runScript(self, filename: str, taskIndex: int==2, filetext=None, settle_time=0.5) -> None: def runScript(self, filename: str, taskIndex: int==2, filetext=None, settle_time=0.5) -> None:
""" Run a script file that either exists, or is newly created and compiled""" """ Run a script file that either exists, or is newly created and compiled"""
self.configure(text=filetext, filename=filename, taskIndex=taskIndex) self.configure({'text': filetext, 'filename': filename, 'taskIndex': taskIndex})
self.trigger().wait() self.trigger().wait()
def execute(self, text: str, taskIndex: int=3, mode: str=0, settle_time=0.5): def execute(self, text: str, taskIndex: int=3, mode: str=0, settle_time=0.5):
""" Run a short text command on the Automation1 controller""" """ Run a short text command on the Automation1 controller"""
print(f"Executing program on task: {taskIndex}") print(f"Executing program on task: {taskIndex}")
self.configure(text=text, taskIndex=taskIndex, mode=mode) self.configure({'text': text, 'taskIndex': taskIndex, 'mode': mode})
self.trigger().wait() self.trigger().wait()
if mode in [0, "None", None]: if mode in [0, "None", None]:
@ -248,7 +248,8 @@ class aa1Tasks(Device):
if (filename is None) and (text not in [None, ""]): if (filename is None) and (text not in [None, ""]):
# Direct command execution # Direct command execution
print("Preparing for direct command execution") print("Preparing for direct command execution")
self._executeMode.set(kwargs['mode']).wait() if mode is not None:
self._executeMode.set(mode).wait()
self._textToExecute = text self._textToExecute = text
elif (filename is not None) and (text in [None, ""]): elif (filename is not None) and (text in [None, ""]):
# Execute existing file # Execute existing file