Skip to content

Commit

Permalink
execute_trigger forces a software trigger in all modes (#195)
Browse files Browse the repository at this point in the history
closes #194 
depends on acquire-project/acquire-common#34

Changes the `execute_trigger` behavior to force a software trigger when
called regardless of the camera configuration. This helps with
`acquire_abort()`.

Interestingly, we seem to already have an `abort-finite-acquisition`
test. I wonder if it can be improved to cover the problem Micah ran
into. May need to just add a check that the everything is restartable
after the abort.

---------

Co-authored-by: Alan Liddell <[email protected]>
  • Loading branch information
nclack and aliddell authored Jan 19, 2024
1 parent 5119333 commit bb80ec8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
21 changes: 21 additions & 0 deletions src/dcam.camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,28 @@ enum DeviceStatusCode
aq_dcam_fire_software_trigger(struct Camera* self_)
{
struct Dcam4Camera* self = containerof(self_, struct Dcam4Camera, camera);

const HDCAM h = self->hdcam;
int trigger_source;
DCAM(prop_read(i32, h, DCAM_IDPROP_TRIGGERSOURCE, &trigger_source));

if (trigger_source != DCAMPROP_TRIGGERSOURCE__SOFTWARE) {

// Force a software trigger by temporarily disabling external
// triggering, firing a software trigger, and re-enabling the
// external trigger.

DCAM(dcamprop_setvalue(
h, DCAM_IDPROP_TRIGGERSOURCE, DCAMPROP_TRIGGERSOURCE__SOFTWARE));
}

DCAM(dcamcap_firetrigger(self->hdcam, 0));

if (trigger_source != DCAMPROP_TRIGGERSOURCE__SOFTWARE) {
// restore
DCAM(dcamprop_setvalue(h, DCAM_IDPROP_TRIGGERSOURCE, trigger_source));
}

return Device_Ok;
Error:
return Device_Err;
Expand Down
3 changes: 2 additions & 1 deletion tests/abort-finite-acquisition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ main()
};
props.video[0].camera.settings.exposure_time_us = 1e4;
props.video[0].max_frame_count = 10;
props.video[0].camera.settings.input_triggers.frame_start.line = 0;
props.video[0].camera.settings.input_triggers.frame_start.line =
0; // Ext. Trig
props.video[0].camera.settings.input_triggers.frame_start.enable = 1;

OK(acquire_configure(runtime, &props));
Expand Down

0 comments on commit bb80ec8

Please sign in to comment.