From 823c37e6624f212d832b1184ef0433d5d783bf33 Mon Sep 17 00:00:00 2001 From: rp_local Date: Thu, 26 Sep 2024 09:23:34 +0000 Subject: [PATCH] Restrict getSequenceResyncValue to DAC channel --- src/server/control.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/server/control.c b/src/server/control.c index bfd08aed..3e662510 100644 --- a/src/server/control.c +++ b/src/server/control.c @@ -129,8 +129,8 @@ bool getSequenceEnableValue(sequenceData_t *seqData, int seqStep, int channel) { bool getSequenceResyncValue(sequenceData_t *seqData, int seqStep, int channel) { bool result = false; - int numChan = numSlowDACChan > 2 ? 2 : numSlowDACChan; - if (seqData->resyncLUT != NULL) { + int numChan = numSlowDACChan > 2 ? 2 : numSlowDACChan; + if (seqData->resyncLUT != NULL && channel < numChan) { int localStep = seqStep % seqData->numStepsPerRepetition; result = seqData->resyncLUT[localStep * numChan + channel]; } @@ -215,6 +215,7 @@ static void setLUTValuesFor(int futureStep, int channel, int currPDMIndex) { if (activeSequence == NULL) { setPDMValueVolt(0.0, channel, currPDMIndex); setEnableDAC(false, channel, currPDMIndex); + setResyncDAC(false, channel, currPDMIndex); setRampDownDAC(false, channel, currPDMIndex); return; }