Skip to content

Commit 3565b66

Browse files
MichaelHutht-b
authored andcommitted
Fix: LeftOverSweepTime - treat fifopos of NaN as finished sweep
Previously a fifopos of NaN triggered an ASSERTion. However if the sweep already finished when LeftOverSweepTime was called, then the fifopos was NaN. Fix: Correctly return 0 for this case.
1 parent b96726e commit 3565b66

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed

Packages/MIES/MIES_MiesUtilities_Sweep.ipf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,10 @@ End
440440

441441
Function LeftOverSweepTime(string device, variable fifoPos)
442442

443-
ASSERT(IsFinite(fifoPos), "Unexpected non-finite fifoPos")
443+
if(IsNaN(fifopos))
444+
// TFH_FifoLoop thread finished -> sweep finished regular (or manually stopped)
445+
return 0
446+
endif
444447

445448
WAVE DAQDataWave = GetDAQDataWave(device, DATA_ACQUISITION_MODE)
446449
NVAR stopCollectionPoint = $GetStopCollectionPoint(device)

Packages/tests/HardwareBasic/UTF_AnalysisFunctionManagement.ipf

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ static Function ChangeAnalysisFunctions_IGNORE()
4848
ST_SetStimsetParameter("AnaFuncInvalid2_DA_0", "Analysis post DAQ function", str = "InvalidSignatureAndReturnType")
4949

5050
ST_SetStimsetParameter("AnaFuncStopMid_DA_0", "Analysis mid sweep function", str = "StopMidSweep")
51+
ST_SetStimsetParameter("AnaFuncWaitMid_DA_0", "Analysis mid sweep function", str = "WaitMidSweep")
5152

5253
ST_SetStimsetParameter("AnaFuncValidMult_DA_0", "Analysis pre DAQ function", str = "ValidMultHS_V1")
5354
ST_SetStimsetParameter("AnaFuncValidMult_DA_0", "Analysis pre set function", str = "ValidMultHS_V1")
@@ -1049,6 +1050,27 @@ End
10491050

10501051
static Function AFT13_REENTRY([string str])
10511052

1053+
AFT13x_Checks(str, "StopMidSweep")
1054+
End
1055+
1056+
// Delay acquisition background task call until sweep already finished and ITC fifopos returned == NaN
1057+
// UTF_TD_GENERATOR DeviceNameGeneratorMD1
1058+
static Function AFT13a([string str])
1059+
1060+
STRUCT DAQSettings s
1061+
InitDAQSettingsFromString(s, "MD1_RA0_I0_L0_BKG1" + \
1062+
"__HS0_DA0_AD0_CM:IC:_ST:AnaFuncWaitMid_DA_0:" + \
1063+
"__HS1_DA1_AD1_CM:IC:_ST:AnaFuncWaitMid_DA_0:")
1064+
AcquireData_NG(s, str)
1065+
End
1066+
1067+
static Function AFT13a_REENTRY([string str])
1068+
1069+
AFT13x_Checks(str, "WaitMidSweep")
1070+
End
1071+
1072+
static Function AFT13x_Checks(string str, string funcName)
1073+
10521074
variable sweepNo
10531075
string key
10541076

@@ -1085,7 +1107,7 @@ static Function AFT13_REENTRY([string str])
10851107
key = StringFromList(MID_SWEEP_EVENT, EVENT_NAME_LIST_LBN)
10861108
WAVE/Z/T anaFuncs = GetLastSetting(textualValues, sweepNo, key, DATA_ACQUISITION_MODE)
10871109
CHECK_WAVE(anaFuncs, TEXT_WAVE)
1088-
CHECK_EQUAL_TEXTWAVES(anaFuncs, {"StopMidSweep", "StopMidSweep", "", "", "", "", "", "", ""})
1110+
CHECK_EQUAL_TEXTWAVES(anaFuncs, {funcName, funcName, "", "", "", "", "", "", ""})
10891111

10901112
key = StringFromList(POST_SWEEP_EVENT, EVENT_NAME_LIST_LBN)
10911113
WAVE/Z/T anaFuncs = GetLastSetting(textualValues, sweepNo, key, DATA_ACQUISITION_MODE)

Packages/tests/UserAnalysisFunctions.ipf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,19 @@ Function StopMidSweep_V3(string device, STRUCT AnalysisFunction_V3 &s)
891891
return 0
892892
End
893893

894+
Function WaitMidSweep(string device, variable eventType, WAVE DAQDataWave, variable headStage, variable realDataLength)
895+
896+
WAVE anaFuncTracker = TrackAnalysisFunctionCalls()
897+
898+
CHECK_GE_VAR(eventType, 0)
899+
CHECK_LT_VAR(eventType, DimSize(anaFuncTracker, ROWS))
900+
anaFuncTracker[eventType][headstage] += 1
901+
902+
Sleep/S 5
903+
904+
return ANALYSIS_FUNC_RET_REPURP_TIME
905+
End
906+
894907
Function AddTooLargeUserEpoch_V3(string device, STRUCT AnalysisFunction_V3 &s)
895908

896909
variable DAC
8.79 KB
Binary file not shown.

0 commit comments

Comments
 (0)