@@ -473,18 +473,20 @@ static Function P_CloseDevice(string device)
473473 variable i , j
474474
475475 numDevices = ItemsInList ( ListOfDevicesToClose)
476+ variable numLocked = ItemsInList ( ListOfLockedDA_Ephys)
476477 for ( i = 0; i < numDevices; i += 1 ) // for all the devices used for pressure regulation
477478 // find device ID
478- do
479+ for ( j = 0; j < numLocked ; j += 1 )
479480 device = StringFromList ( j, ListOfLockedDA_Ephys)
480481 DeviceToClose = StringFromList ( i , ListOfDevicesToClose)
481482
482483 ListOfHeadstagesUsingDevice = P_HeadstageUsingDevice ( device, DeviceToClose)
483- j += 1
484- while ( cmpstr ( "" , ListOfHeadstagesUsingDevice) == 0 )
485- j = 0
486- headStage = NumberFromList ( 0, ListOfHeadstagesUsingDevice)
487- P_CloseDeviceLowLevel ( device, DeviceToClose, headstage)
484+ if ( cmpstr ( "" , ListOfHeadstagesUsingDevice) != 0 )
485+ headStage = NumberFromList ( 0, ListOfHeadstagesUsingDevice)
486+ P_CloseDeviceLowLevel ( device, DeviceToClose, headstage)
487+ break
488+ endif
489+ endfor
488490 endfor
489491End
490492
@@ -1050,8 +1052,8 @@ static Function P_DataAcq(string device, variable headStage)
10501052 HW_StopAcq ( hwType, deviceID, flags = HARDWARE_ABORT_ON_ERROR)
10511053
10521054 // record onset of data acquisition
1053- pressureDataWv[][ % OngoingPessurePulse ] = 0 // ensure that only one headstage is recorded as having an ongoing pressure pulse
1054- pressureDataWv[ headStage][ % OngoingPessurePulse ] = 1 // record headstage with ongoing pressure pulse
1055+ pressureDataWv[][ % OngoingPressurePulse ] = 0 // ensure that only one headstage is recorded as having an ongoing pressure pulse
1056+ pressureDataWv[ headStage][ % OngoingPressurePulse ] = 1 // record headstage with ongoing pressure pulse
10551057
10561058 if ( hwType == HARDWARE_ITC_DAC)
10571059 HW_ITC_PrepareAcq ( deviceID, UNKNOWN_MODE, dataFunc = P_GetITCData, configFunc = P_GetITCChanConfig)
@@ -1128,7 +1130,7 @@ Function P_ITC_FIFOMonitorProc(STRUCT WMBackgroundStruct &s)
11281130
11291131 if ( ! moreData)
11301132 HW_StopAcq ( hwType, deviceID)
1131- pressureDataWv[][ % OngoingPessurePulse ] = 0
1133+ pressureDataWv[][ % OngoingPressurePulse ] = 0
11321134 print "Pressure pulse is complete"
11331135 return 1
11341136 endif
@@ -1162,7 +1164,7 @@ static Function P_FindDeviceExecutingPP(string &device, variable &deviceID, vari
11621164 device = StringFromList ( i , ListOfLockedDevices)
11631165 WAVE pressureDataWv = P_GetPressureDataWaveRef ( device)
11641166 for ( headStage = 0; headstage < NUM_HEADSTAGES; headStage += 1 )
1165- if ( pressureDataWv[ headStage][ % OngoingPessurePulse ])
1167+ if ( pressureDataWv[ headStage][ % OngoingPressurePulse ])
11661168 deviceID = pressureDataWv[ headStage][ % DAC_DevID]
11671169 return 1
11681170 endif
0 commit comments