Skip to content

Commit 3356f44

Browse files
authored
Merge pull request #22 from dls-controls/fix-waveform-set
Allow waveform.set() to be called before iocInit()
2 parents ee1ba0c + 3dda72c commit 3356f44

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

softioc/device.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,8 @@ class WaveformBase(ProcessDeviceSupportCore):
293293
# NELM Length of allocated array in number of elements
294294
# NORD Currently reported length of array (0 <= NORD <= NELM)
295295
_fields_ = ['UDF', 'FTVL', 'BPTR', 'NELM', 'NORD']
296+
# Allow set() to be called before init_record:
297+
dtype = None
296298

297299
def init_record(self, record):
298300
self.dtype = DbfCodeToNumpy[record.FTVL]

tests/sim_records.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ def update_sin_wf(value):
4242
sin_wf.set(numpy.sin(
4343
numpy.linspace(0, 2*numpy.pi*sin_ph.get(), sin_len.get())))
4444
sin_wf = Waveform('SIN', datatype = float, length = 1024)
45+
# Check we can update its value before iocInit as per #22
46+
sin_wf.set([1, 2, 3])
4547
sin_len = longOut(
4648
'SINN', 0, 1024, initial_value=1024, on_update=update_sin_wf)
4749
sin_ph = aOut('SINP', initial_value = 0.0, on_update = update_sin_wf)

0 commit comments

Comments
 (0)