Skip to content

Commit cc7cb73

Browse files
committed
Merge pull request #945 in ENG/mies-igor from ~THOMASB/mies-igor:feature/support-for-ITC16 to master
* commit '944fe03511f45f70aff3c013d6baa9f2a2066b04': SI_GetMinSampIntWave: Support ITC16/ITC16USB Add SamplingInterval table for ITC16/ITC16USB SI_CreateLookupWave: Store the created lookup wave on disc automatically SI_TestSampInt: Return -1 on failure SI_CreateLookupWave: Make it work again SI_CreateLookupWave: Add setup for ITC16/ITC16USB SI_CreateLookupWave: Initialize raCycleID SI_CompressWave: Avoid using the backup wave NUM_CONSEC_FIFO_STILLSTANDS: Remove unused constant Original-CommitID: 0642453dcabb62e12b9f12977acaa9f32d68eebc
2 parents f8d0032 + 944fe03 commit cc7cb73

File tree

3 files changed

+126
-15
lines changed

3 files changed

+126
-15
lines changed

Diff for: Packages/MIES/MIES_Constants.ipf

-4
Original file line numberDiff line numberDiff line change
@@ -592,10 +592,6 @@ StrConstant ANALYSISBROWSER_FILE_TYPE_IGOR = "I"
592592
StrConstant ANALYSISBROWSER_FILE_TYPE_NWB = "N"
593593
/// @}
594594

595-
/// Device restart happens after this number of sweeps with stuck FIFO, used by
596-
/// TP MD
597-
Constant NUM_CONSEC_FIFO_STILLSTANDS = 3
598-
599595
/// Convenience definition for functions interacting with threads
600596
Constant MAIN_THREAD = 0
601597

Diff for: Packages/MIES/MIES_SamplingInterval.ipf

+35-11
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ static Function SI_CompressWave(wv)
125125

126126
variable i, j
127127

128-
ReplaceWaveWithBackup(wv, nonExistingBackupIsFatal=0)
129-
CreateBackupWave(wv)
128+
CreateBackupWave(wv, forceCreation = 1)
130129
SI_SortWave(wv)
131130

132131
for(i = 0; i < DimSize(wv, ROWS); i += 1)
@@ -224,6 +223,18 @@ static Function/WAVE SI_LoadMinSampIntFromDisk(deviceType)
224223
return wv
225224
End
226225

226+
/// @brief Store the lookup wave on disc
227+
Function/WAVE SI_StoreMinSampIntOnDisk(wv, deviceType)
228+
WAVE wv
229+
string deviceType
230+
231+
Duplicate wv, $("SampInt_" + deviceType)/WAVE=storedWave
232+
233+
string path = GetFolder(FunctionPath("")) + "SampInt_" + deviceType + ".itx"
234+
Save/O/T/M="\n" storedWave as path
235+
KillWaves/Z storedWave
236+
End
237+
227238
/// @brief Query the DA_EPhys panel for the active channels and
228239
/// fill it in the passed structure
229240
///
@@ -276,6 +287,9 @@ Function SI_CreateLookupWave(panelTitle, [ignoreChannelOrder])
276287
ignoreChannelOrder = !!ignoreChannelOrder
277288
endif
278289

290+
NVAR raCycleID = $GetRepeatedAcquisitionCycleID(panelTitle)
291+
raCycleID = 1
292+
279293
DC_ConfigureDataForITC(panelTitle, DATA_ACQUISITION_MODE)
280294

281295
WAVE ITCDataWave = GetITCDataWave(panelTitle)
@@ -286,7 +300,7 @@ Function SI_CreateLookupWave(panelTitle, [ignoreChannelOrder])
286300
ret = ParseDeviceString(panelTitle, deviceType, deviceNumber)
287301
ASSERT(ret, "Could not parse panelTitle")
288302

289-
if(!cmpstr(deviceType, "ITC18USB"))
303+
if(!cmpstr(deviceType, "ITC18USB") || !cmpstr(deviceType, "ITC16USB") || !cmpstr(deviceType, "ITC16"))
290304
totalNumDA = 4
291305
totalNumAD = 8
292306
totalNumTTL = 4
@@ -415,23 +429,21 @@ Function SI_CreateLookupWave(panelTitle, [ignoreChannelOrder])
415429
ITCConfigChannelReset2
416430

417431
SI_CompressWave(results)
432+
SI_StoreMinSampIntOnDisk(results, deviceType)
418433
End
419434

420435
/// @brief Test the preset sampling interval
421436
static Function SI_TestSampInt(panelTitle)
422437
string panelTitle
423438

424-
variable i, sampInt, ret, sampIntRead, numChannels, sampIntRef, iLast
439+
variable i, sampInt, sampIntRead, numChannels, sampIntRef, iLast
425440
variable numConsecutive = -1
426441
variable numTries = 1001
427442

428443
WAVE ITCDataWave = GetITCDataWave(panelTitle)
429444
WAVE ITCChanConfigWave = GetITCChanConfigWave(panelTitle)
430445
numChannels = DimSize(ITCChanConfigWave, ROWS)
431446

432-
Make/I/FREE/N=(2, numChannels) ReqWave
433-
ReqWave[0][] = ITCChanConfigWave[q][0]
434-
ReqWave[1][] = ITCChanConfigWave[q][1]
435447
Make/D/FREE/N=(20, numChannels) ResultWave
436448

437449
for(i=1; i < numTries; i += 1)
@@ -442,15 +454,17 @@ static Function SI_TestSampInt(panelTitle)
442454
endif
443455

444456
ITCChanConfigWave[][2] = sampInt
445-
ITCConfigAllChannels2/Z ITCChanConfigWave, ITCDataWave
446457

447-
if(!ret)
458+
WAVE config_t = HW_ITC_TransposeAndToDouble(ITCChanConfigWave)
459+
ITCConfigAllChannels2/Z config_t, ITCDataWave
460+
461+
if(!V_ITCError)
448462
// we could set the sampling interval
449463
// so we try to read it back and check if it is the same
450464
ITCConfigChannelUpload2
451465
HW_ITC_HandleReturnValues(HARDWARE_ABORT_ON_ERROR, V_ITCError, V_ITCXOPError)
452466

453-
ITCGetAllChannelsConfig2/O ReqWave, ResultWave
467+
ITCGetAllChannelsConfig2/O config_t, ResultWave
454468
HW_ITC_HandleReturnValues(HARDWARE_ABORT_ON_ERROR, V_ITCError, V_ITCXOPError)
455469

456470
WaveStats/Q/R=[12,12] ResultWave
@@ -477,7 +491,7 @@ static Function SI_TestSampInt(panelTitle)
477491
endif
478492
endfor
479493

480-
return NaN
494+
return -1
481495
End
482496

483497
#else
@@ -557,6 +571,16 @@ static Function/WAVE SI_GetMinSampIntWave(panelTitle)
557571
return SI_LoadMinSampIntFromDisk("ITC18USB")
558572
endif
559573

574+
return wv
575+
break
576+
case "ITC16USB":
577+
case "ITC16":
578+
WAVE/SDFR=dfr/Z wv = SampInt_ITC16USB
579+
580+
if(!WaveExists(wv))
581+
return SI_LoadMinSampIntFromDisk("ITC16USB")
582+
endif
583+
560584
return wv
561585
break
562586
case "ITC1600":

Diff for: Packages/MIES/SampInt_ITC16USB.itx

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
IGOR
2+
WAVES/B/N=(79,7) SampInt_ITC16USB
3+
BEGIN
4+
0 0 1 0 0 0 5
5+
0 0 2 0 0 0 10
6+
0 1 1 0 0 0 5
7+
0 1 1 0 0 0 10
8+
0 1 2 0 0 0 10
9+
0 2 1 0 0 0 10
10+
0 2 2 0 0 0 10
11+
0 3 1 0 0 0 20
12+
0 3 2 0 0 0 20
13+
0 4 1 0 0 0 20
14+
0 4 2 0 0 0 20
15+
0 5 1 0 0 0 25
16+
0 5 2 0 0 0 25
17+
1 0 0 0 0 0 5
18+
1 0 1 0 0 0 10
19+
1 0 2 0 0 0 20
20+
1 1 0 0 0 0 5
21+
1 1 1 0 0 0 10
22+
1 1 2 0 0 0 20
23+
1 2 0 0 0 0 10
24+
1 2 1 0 0 0 10
25+
1 2 2 0 0 0 20
26+
1 3 0 0 0 0 20
27+
1 3 1 0 0 0 20
28+
1 3 2 0 0 0 20
29+
1 4 0 0 0 0 20
30+
1 4 1 0 0 0 20
31+
1 4 2 0 0 0 20
32+
1 5 0 0 0 0 25
33+
1 5 1 0 0 0 25
34+
1 5 2 0 0 0 25
35+
2 0 0 0 0 0 10
36+
2 0 1 0 0 0 20
37+
2 0 2 0 0 0 20
38+
2 1 0 0 0 0 10
39+
2 1 1 0 0 0 20
40+
2 1 2 0 0 0 20
41+
2 2 0 0 0 0 10
42+
2 2 1 0 0 0 20
43+
2 2 2 0 0 0 20
44+
2 3 0 0 0 0 20
45+
2 3 1 0 0 0 20
46+
2 3 2 0 0 0 20
47+
2 4 0 0 0 0 20
48+
2 4 1 0 0 0 20
49+
2 4 2 0 0 0 20
50+
2 5 0 0 0 0 25
51+
2 5 1 0 0 0 25
52+
2 5 2 0 0 0 25
53+
3 0 0 0 0 0 20
54+
3 0 1 0 0 0 20
55+
3 0 2 0 0 0 25
56+
3 1 0 0 0 0 20
57+
3 1 1 0 0 0 20
58+
3 1 2 0 0 0 25
59+
3 2 0 0 0 0 20
60+
3 2 1 0 0 0 20
61+
3 2 2 0 0 0 25
62+
3 3 0 0 0 0 20
63+
3 3 1 0 0 0 20
64+
3 3 2 0 0 0 25
65+
3 4 0 0 0 0 20
66+
3 4 1 0 0 0 20
67+
3 4 2 0 0 0 25
68+
3 5 0 0 0 0 25
69+
3 5 1 0 0 0 25
70+
3 5 2 0 0 0 25
71+
4 0 0 0 0 0 20
72+
4 0 1 0 0 0 25
73+
4 1 0 0 0 0 20
74+
4 1 1 0 0 0 25
75+
4 2 0 0 0 0 20
76+
4 2 1 0 0 0 25
77+
4 3 0 0 0 0 20
78+
4 3 1 0 0 0 25
79+
4 4 0 0 0 0 20
80+
4 4 1 0 0 0 25
81+
4 5 0 0 0 0 25
82+
4 5 1 0 0 0 25
83+
END
84+
X SetScale/P x 0,1,"", SampInt_ITC16USB; SetScale/P y 0,1,"", SampInt_ITC16USB; SetScale d 0,0,"", SampInt_ITC16USB
85+
X SetDimLabel 1, 0, numDARack1, SampInt_ITC16USB
86+
X SetDimLabel 1, 1, numADRack1, SampInt_ITC16USB
87+
X SetDimLabel 1, 2, numTTLRack1, SampInt_ITC16USB
88+
X SetDimLabel 1, 3, numDARack2, SampInt_ITC16USB
89+
X SetDimLabel 1, 4, numADRack2, SampInt_ITC16USB
90+
X SetDimLabel 1, 5, numTTLRack2, SampInt_ITC16USB
91+
X SetDimLabel 1, 6, minSampInt, SampInt_ITC16USB

0 commit comments

Comments
 (0)