Skip to content

Commit 5f46132

Browse files
Change default alarm values
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
1 parent 2ff3460 commit 5f46132

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

docs/reference/api.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ class which provides the methods documented below.
550550
This class is used to implement Python device support for the record types
551551
``ai``, ``bi``, ``longin``, ``mbbi`` and IN ``waveform`` records.
552552

553-
.. method:: set(value, severity=NO_ALARM, alarm=UDF_ALARM, timestamp=None)
553+
.. method:: set(value, severity=NO_ALARM, alarm=NO_ALARM, timestamp=None)
554554

555555
Updates the stored value and severity status and triggers an update. If
556556
``SCAN`` has been set to ``'I/O Intr'`` (which is the default if the
@@ -609,7 +609,7 @@ Working with OUT records
609609
``ao``, ``bo``, ``longout``, ``mbbo`` and OUT ``waveform`` records. All OUT
610610
records support the following methods.
611611

612-
.. method:: set(value, process=True, severity=NO_ALARM, alarm=UDF_ALARM)
612+
.. method:: set(value, process=True, severity=NO_ALARM, alarm=NO_ALARM)
613613

614614
Updates the stored value and severity status. By default this will
615615
trigger record processing, and so will cause any associated `on_update`

softioc/device.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def _process(self, record):
137137
return self._epics_rc_
138138

139139
def set(self, value,
140-
severity=alarm.NO_ALARM, alarm=alarm.UDF_ALARM, timestamp=None):
140+
severity=alarm.NO_ALARM, alarm=alarm.NO_ALARM, timestamp=None):
141141
'''Updates the stored value and triggers an update. The alarm
142142
severity and timestamp can also be specified if appropriate.'''
143143
value = self._value_to_epics(value)
@@ -177,14 +177,16 @@ def __init__(self, name, **kargs):
177177

178178
if 'initial_value' in kargs:
179179
value = self._value_to_epics(kargs.pop('initial_value'))
180-
initial_alarm = alarm.NO_ALARM
180+
initial_severity = alarm.NO_ALARM
181+
initial_status = alarm.NO_ALARM
181182
else:
182183
value = None
183184
# To maintain backwards compatibility, if there is no initial value
184185
# we mark the record as invalid
185-
initial_alarm = alarm.INVALID_ALARM
186+
initial_severity = alarm.INVALID_ALARM
187+
initial_status = alarm.UDF_ALARM
186188

187-
self._value = (value, initial_alarm, alarm.UDF_ALARM)
189+
self._value = (value, initial_severity, initial_status)
188190

189191
self._blocking = kargs.pop('blocking', blocking)
190192
if self._blocking:
@@ -274,7 +276,7 @@ def set_alarm(self, severity, alarm):
274276

275277

276278
def set(self, value, process=True,
277-
severity=alarm.NO_ALARM, alarm=alarm.UDF_ALARM):
279+
severity=alarm.NO_ALARM, alarm=alarm.NO_ALARM):
278280
'''Special routine to set the value directly.'''
279281
value = self._value_to_epics(value)
280282
try:

0 commit comments

Comments
 (0)