Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/fastcs/transports/epics/ca/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ def _make_in_record(pv: str, attribute: AttrR) -> RecordWrapper:
case String():
record = builder.longStringIn(
pv,
length=attribute.datatype.length or DEFAULT_STRING_WAVEFORM_LENGTH,
length=(attribute.datatype.length + 1)
if attribute.datatype.length
else DEFAULT_STRING_WAVEFORM_LENGTH + 1,
**common_fields,
)
case Enum():
Expand Down Expand Up @@ -157,7 +159,9 @@ def _make_out_record(pv: str, attribute: AttrW, on_update: Callable) -> RecordWr
case String():
record = builder.longStringOut(
pv,
length=attribute.datatype.length or DEFAULT_STRING_WAVEFORM_LENGTH,
length=(attribute.datatype.length + 1)
if attribute.datatype.length
else DEFAULT_STRING_WAVEFORM_LENGTH + 1,
**common_fields,
)
case Enum():
Expand Down
17 changes: 16 additions & 1 deletion tests/transports/epics/ca/test_softioc.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ async def test_create_and_link_read_pv(mocker: MockerFixture):
(
AttrR(String()),
"longStringIn",
{"length": 256, "DESC": None, "initial_value": ""},
{"length": 257, "DESC": None, "initial_value": ""},
),
(
AttrR(String(length=10)),
"longStringIn",
{"length": 11, "DESC": None, "initial_value": ""},
),
(
AttrR(Enum(ColourEnum)),
Expand Down Expand Up @@ -197,6 +202,16 @@ class LongEnum(enum.Enum):
"initial_value": 0,
},
),
(
AttrW(String()),
"longStringOut",
{"length": 257, "DESC": None, "initial_value": ""},
),
(
AttrW(String(length=10)),
"longStringOut",
{"length": 11, "DESC": None, "initial_value": ""},
),
),
)
def test_make_output_record(
Expand Down
Loading