Skip to content

Commit d94ccf6

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 5587a21 commit d94ccf6

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")
@@ -1051,6 +1052,27 @@ End
10511052

10521053
static Function AFT13_REENTRY([string str])
10531054

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

@@ -1087,7 +1109,7 @@ static Function AFT13_REENTRY([string str])
10871109
key = StringFromList(MID_SWEEP_EVENT, EVENT_NAME_LIST_LBN)
10881110
WAVE/Z/T anaFuncs = GetLastSetting(textualValues, sweepNo, key, DATA_ACQUISITION_MODE)
10891111
CHECK_WAVE(anaFuncs, TEXT_WAVE)
1090-
CHECK_EQUAL_TEXTWAVES(anaFuncs, {"StopMidSweep", "StopMidSweep", "", "", "", "", "", "", ""})
1112+
CHECK_EQUAL_TEXTWAVES(anaFuncs, {funcName, funcName, "", "", "", "", "", "", ""})
10911113

10921114
key = StringFromList(POST_SWEEP_EVENT, EVENT_NAME_LIST_LBN)
10931115
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
10.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)