Skip to content

Commit

Permalink
FIX: slight discrepencies in epics string parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
ZLLentz committed Nov 14, 2024
1 parent 2f2ea07 commit 49e95da
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions beams/bin/gen_test_ioc_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class PVInfoForJ2:

@classmethod
def from_result(cls: type[PVInfoForJ2], pvname: str, response: ReadNotifyResponse) -> PVInfoForJ2:
value = response.data if response.data_count > 1 else response.data[0]
if isinstance(value, bytes):
value = value.decode("utf-8")
try:
enum_strings = response.metadata.enum_strings
except AttributeError:
Expand All @@ -34,8 +37,8 @@ def from_result(cls: type[PVInfoForJ2], pvname: str, response: ReadNotifyRespons
return cls(
python_name=pvname.lower().replace(":", "_").replace(".", "_"),
pvname=pvname,
value=response.data if response.data_count > 1 else response.data[0],
dtype=response.data_type.name.removeprefix("CTRL_"),
value=value,
dtype=response.data_type.name.removeprefix("CTRL_").removeprefix("TIME_"),
enum_strings=[bt.decode("utf8") for bt in enum_strings],
precision=precision,
)
Expand Down

0 comments on commit 49e95da

Please sign in to comment.