Skip to content

Commit

Permalink
Ensure trigger is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-sweet committed Oct 16, 2023
1 parent 6d8d9c2 commit 432d90b
Showing 1 changed file with 17 additions and 23 deletions.
40 changes: 17 additions & 23 deletions tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,39 +640,33 @@ def test_execute_trigger(runtime: Runtime):
dm = runtime.device_manager()
p = runtime.get_configuration()

p.video[0].camera.identifier = dm.select(DeviceKind.Camera, "simulated.*random.*")
p.video[0].camera.identifier = dm.select(DeviceKind.Camera, "simulated.*empty.*")
p.video[0].storage.identifier = dm.select(DeviceKind.Storage, "Trash")
p.video[0].camera.settings.binning = 1
p.video[0].camera.settings.shape = (64, 48)
p.video[0].camera.settings.exposure_time_us = 1e4
p.video[0].camera.settings.exposure_time_us = 1e3
p.video[0].camera.settings.pixel_type = acquire.SampleType.U8
p.video[0].camera.settings.input_triggers.frame_start.line = 1
p.video[0].camera.settings.input_triggers.frame_start.enable = True
p.video[0].max_frame_count = 100
p.video[0].camera.settings.input_triggers.frame_start = Trigger(enable=True, line=0, edge='Rising')
p.video[0].max_frame_count = 10

p = runtime.set_configuration(p)

assert p.video[0].camera.settings.input_triggers.frame_start.enable

runtime.start()

# Snap one frame
runtime.execute_trigger(0)
packet = wait_for_data(runtime, 0)
# TODO: why do i get more than one frame?
assert packet.get_frame_count() >= 1
frames = tuple(packet.frames())
assert frames[0].metadata().frame_id >= 0
del frames
del packet
# No triggers yet, so no data.
assert runtime.get_available_data(0) is None

# Snap another frame
runtime.execute_trigger(0)
packet = wait_for_data(runtime, 0)
# TODO: why do i get more than one frame?
assert packet.get_frame_count() >= 1
frames = tuple(packet.frames())
assert frames[0].metadata().frame_id >= 1
del frames
del packet
# Snap a few individual frames
for i in range(p.video[0].max_frame_count):
runtime.execute_trigger(0)
packet = wait_for_data(runtime, 0)
frames = tuple(packet.frames())
assert packet.get_frame_count() == 1
assert frames[0].metadata().frame_id == i
del frames
del packet

runtime.stop()

Expand Down

0 comments on commit 432d90b

Please sign in to comment.