Skip to content

Commit

Permalink
Merge pull request bluesky#1219 from bluesky/1218-use-the-value-of-tr…
Browse files Browse the repository at this point in the history
…igger_value

use provided value of trigger_value
  • Loading branch information
tacaswell authored Oct 29, 2024
2 parents 5df3f56 + 19e1edb commit 52c082d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ophyd/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -1457,7 +1457,8 @@ def done_acquisition(**ignored_kwargs):
# has finished
self._done_acquiring()

acq_signal.put(1, wait=False, callback=done_acquisition)
trigger_value = self._sig_attrs[acq_signal.attr_name].trigger_value
acq_signal.put(trigger_value, wait=False, callback=done_acquisition)
return status

def stop(self, *, success=False):
Expand Down
25 changes: 25 additions & 0 deletions ophyd/tests/test_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -944,3 +944,28 @@ class MyDevice(Device):
assert MyDevice.cpt3._get_class_from_annotation() is SignalRO
assert MyDevice.cpt3.cls is SignalRO
assert MyDevice.cpt4._get_class_from_annotation() is None


@pytest.mark.parametrize(
"initial, after",
[
[False, True],
[0, 1],
["", "1!"],
],
)
def test_trigger_value(initial, after):
"""Ensure the configured trigger_value is used."""

class FakeTriggerableDevice(Device):
"""Common trigger signals expect value=1"""

strigger = Component(Signal, value=initial, trigger_value=after)

d = FakeTriggerableDevice("", name="test")
assert len(d.trigger_signals) == 1
assert [d.strigger] == d.trigger_signals
assert d.strigger.get() == initial

d.trigger()
assert d.strigger.get() == after

0 comments on commit 52c082d

Please sign in to comment.