Skip to content

Commit

Permalink
Merge pull request #15 from dls-controls/alarm
Browse files Browse the repository at this point in the history
Add test case for mbb severity and fix error
  • Loading branch information
coretl authored Jul 5, 2021
2 parents 7baaad3 + df8e470 commit 5825491
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/reference/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ All functions return a wrapped `ProcessDeviceSupportIn` or

status = mbbIn('STATUS',
'OK',
('FAILING', alarm.MINOR_ALARM),
('FAILED', alarm.MAJOR_ALARM))
('FAILING', "MINOR"),
('FAILED', "MAJOR"))

Numerical values are assigned to options sequentially from 0 to 15 and
cannot be overridden.
Expand Down
2 changes: 1 addition & 1 deletion softioc/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def process_value(prefix, value, option, severity=None):
if severity:
fields[prefix + 'SV'] = severity
for prefix, (value, option) in zip(_mbbPrefixes, enumerate(options)):
if isinstance(value, tuple):
if isinstance(option, tuple):
# The option is tuple consisting of the option name and an optional
# alarm severity.
process_value(prefix, value, *option)
Expand Down
1 change: 1 addition & 0 deletions tests/expected_records.db
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ record(mbbi, "TS-DI-TEST-01:MBBI")
field(PINI, "YES")
field(SCAN, "I/O Intr")
field(TWST, "Three")
field(TWSV, "MINOR")
field(TWVL, "2")
field(ZRST, "One")
field(ZRVL, "0")
Expand Down
2 changes: 1 addition & 1 deletion tests/sim_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def on_update_name(value, name):
t_boolin = boolIn('BOOLIN', 'True', 'False', initial_value=False)
t_longin = longIn('LONGIN', initial_value=33)
t_stringin = stringIn('STRINGIN', initial_value="Testing string")
t_mbbi = mbbIn('MBBI', 'One', 'Two', 'Three', initial_value=2)
t_mbbi = mbbIn('MBBI', 'One', 'Two', ('Three', "MINOR"), initial_value=2)

t_ao = aOut('AO', initial_value=12.45, on_update_name=on_update_name)
t_boolout = boolOut(
Expand Down

0 comments on commit 5825491

Please sign in to comment.