Skip to content

Commit 1d9f6fa

Browse files
committed
Improve manual trigger interaction during long sequences.
1 parent cf77f10 commit 1d9f6fa

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

toolbox/src/bossdevice.m

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,9 @@ function sendPulse(obj, port, width, marker)
471471

472472
function manualTrigger(obj)
473473
if obj.isRunning
474+
% Automatically disable GEN at end of sequence or if user aborts
475+
cleanupObj = onCleanup(@() cleanupManualTrigger(obj));
476+
474477
setparam(obj, 'GEN', 'enabled', true);
475478
setparam(obj, 'TRG', 'enabled', 0);
476479

@@ -484,12 +487,19 @@ function manualTrigger(obj)
484487
pause(0.1);
485488
end
486489

487-
obj.logObj.info('Sequence completed.');
488-
489490
else
490491
obj.logObj.error('Target "%s" is not running yet. Start it before sending a trigger.',...
491492
obj.targetObject.TargetSettings.name);
492493
end
494+
495+
function cleanupManualTrigger(obj)
496+
if ~obj.isGeneratorRunning
497+
obj.logObj.info('Sequence completed.');
498+
else
499+
obj.logObj.info('Sequence aborted by the user.');
500+
end
501+
setparam(obj, 'GEN', 'enabled', false);
502+
end
493503
end
494504

495505
function openDocumentation(obj)

0 commit comments

Comments
 (0)