No autostart when ctrl is set.

Fix a bug when repeating the sequence.
This commit is contained in:
Holger Vogt 2025-06-08 11:09:17 +02:00
parent 2b7e29179b
commit 63f5d102ec
1 changed files with 9 additions and 3 deletions

View File

@ -169,7 +169,11 @@ void cm_seegen(ARGS) /* structure holding parms,
/* Allocate storage for last_t_value */
STATIC_VAR(last_t_value) = (double *) malloc(sizeof(double));
last_t_value = (double *) STATIC_VAR(last_t_value);
*last_t_value = tdelay;
/* no start if ctrl is set */
if (PORT_NULL(ctrl))
*last_t_value = tdelay;
else
*last_t_value = 1e12;
STATIC_VAR(pulse_number) = (int *) malloc(sizeof(int));
pulse_number = (int *) STATIC_VAR(pulse_number);
*pulse_number = 1;
@ -187,10 +191,12 @@ void cm_seegen(ARGS) /* structure holding parms,
pulse_number = (int *) STATIC_VAR(pulse_number);
last_ctrl = (double *) STATIC_VAR(last_ctrl);
/* reset the pulse sequence, to start anew upon a rising ctrl */
if (*last_ctrl < ctrlthres && ctrl >= ctrlthres) {
*last_t_value = *last_t_value + tcurr;
*last_ctrl = ctrl;
*last_t_value = tcurr + tdelay;
*pulse_number = 1;
}
*last_ctrl = ctrl;
/* the double exponential current pulse function */
if (tcurr < *last_t_value)