Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow waveform.set() to be called before iocInit() #22

Merged
merged 3 commits into from
Aug 10, 2021
Merged
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
2 changes: 2 additions & 0 deletions softioc/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ class WaveformBase(ProcessDeviceSupportCore):
# NELM Length of allocated array in number of elements
# NORD Currently reported length of array (0 <= NORD <= NELM)
_fields_ = ['UDF', 'FTVL', 'BPTR', 'NELM', 'NORD']
# Allow set() to be called before init_record:
dtype = None
Araneidae marked this conversation as resolved.
Show resolved Hide resolved

def init_record(self, record):
self.dtype = DbfCodeToNumpy[record.FTVL]
Expand Down
2 changes: 2 additions & 0 deletions tests/sim_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def update_sin_wf(value):
sin_wf.set(numpy.sin(
numpy.linspace(0, 2*numpy.pi*sin_ph.get(), sin_len.get())))
sin_wf = Waveform('SIN', datatype = float, length = 1024)
# Check we can update its value before iocInit as per #22
sin_wf.set([1, 2, 3])
sin_len = longOut(
'SINN', 0, 1024, initial_value=1024, on_update=update_sin_wf)
sin_ph = aOut('SINP', initial_value = 0.0, on_update = update_sin_wf)
Expand Down