Skip to content

Commit 220677d

Browse files
Allow arrays of strings to be used with Waveforms
Not an ideal fix, as currently you must specify either `FTVL="STRING"` or `datatype=numpy.dtype("S40")` during record creation. This is also untested - specifically I don't know what happens when the strings are longer than 40 characters
1 parent 77ec950 commit 220677d

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

‎softioc/builder.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ def Action(name, **fields):
132132
'uint32': 'ULONG',
133133
'float32': 'FLOAT',
134134
'float64': 'DOUBLE',
135+
'bytes32': 'STRING',
136+
'bytes320': 'STRING',
135137
}
136138

137139
# Coverts FTVL string to numpy type
@@ -144,6 +146,7 @@ def Action(name, **fields):
144146
'ULONG': 'uint32',
145147
'FLOAT': 'float32',
146148
'DOUBLE': 'float64',
149+
'STRING': 'S40',
147150
}
148151

149152

‎softioc/device.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ def _read_value(self, record):
391391
return result
392392

393393
def _write_value(self, record, value):
394+
value = _require_waveform(value, self._dtype)
394395
nord = len(value)
395396
memmove(
396397
record.BPTR, value.ctypes.data_as(c_void_p),

0 commit comments

Comments
 (0)