Enable setting alarm status of Out records#157
Enable setting alarm status of Out records#157AlexanderWells-diamond merged 5 commits intomasterfrom
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 |
Araneidae
left a comment
There was a problem hiding this comment.
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.
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.
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_alarmmethod 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.