-
Notifications
You must be signed in to change notification settings - Fork 9
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
Enable setting alarm status of Out records #157
Conversation
This ensures we only set INVALID_ALARM+UDF_ALARM when there is no value, but otherwise both the severity and the status are set to NO_ALARM
Previously we did this as we wanted to spot the case where no value was provided, either during record creation or by a set() call at some later time, so that we could mark the record as being in an invalid state. Now that we store the severity and status alongside the value, we don't need to handle this special case.
I've done a few more tweaks, and changed the default Status value to I have found one problem: Trying to set STAT and SEVR using the EPICS attribute names during record declaration doesn't work i.e.:
The records created here will not respect these SEVR and STAT values:
I believe this has never worked; they are passed to the Is it worth trying to support these keywords properly? |
I suspect that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good to me
softioc/device.py
Outdated
if self._value is None: | ||
if self._value[0] is None: | ||
# Before startup complete if no value set return default value | ||
value = self._default_value() | ||
else: | ||
value = self._value | ||
value = self._value[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can simplify this, _value[0]
is now never None
, can now just be
return self._epics_to_value(self._value[0])
softioc/device.py
Outdated
# Ignore memoized value, retrieve it from the VAL field directly later | ||
_, severity, alarm = self._value | ||
|
||
self.process_severity(record, severity, alarm) | ||
|
||
value = self._read_value(record) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put reading self._value
and self._read_value(record)
on adjacent lines, then it's much clearer that they're working together and you might not need the comment!
Adds the
set_alarm
method toProcessDeviceSupportOut
, along with extra keyword arguments toset
. As these are keyword args with defaults, there should be no compatibility problems.Tests added to check calling
set_alarm()
before or after IocInit() causes the severity and status attributes to be set as expected.Closes #53.