From 9545407e5298cc0df0ff855b9a10818a3feef7a5 Mon Sep 17 00:00:00 2001 From: Michael Huth Date: Mon, 19 Aug 2024 12:17:35 +0200 Subject: [PATCH 1/2] DC: Bugfix BorderVals check for NI only checked first channel In DC_CheckIfDataWaveHasBorderVals only the first channel (from the config wave) was checked if it has border values. Now all channels are checked. since fac268c1 (Acquisition support for NI DAC devices in multi device mode, 2018-08-03) --- Packages/MIES/MIES_DataConfigurator.ipf | 4 ++-- .../tests/HardwareBasic/UTF_TestPulseAndTPDuringDAQ.ipf | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Packages/MIES/MIES_DataConfigurator.ipf b/Packages/MIES/MIES_DataConfigurator.ipf index d3e23d5535..58f7b72d0c 100644 --- a/Packages/MIES/MIES_DataConfigurator.ipf +++ b/Packages/MIES/MIES_DataConfigurator.ipf @@ -1950,9 +1950,9 @@ static Function [variable result, variable row, variable column] DC_CheckIfDataW return [1, V_row, V_col] endif - return [0, NaN, NaN] endfor - break + + return [0, NaN, NaN] case HARDWARE_SUTTER_DAC: // @todo Determine what to check here break diff --git a/Packages/tests/HardwareBasic/UTF_TestPulseAndTPDuringDAQ.ipf b/Packages/tests/HardwareBasic/UTF_TestPulseAndTPDuringDAQ.ipf index aabfde1547..c050328907 100644 --- a/Packages/tests/HardwareBasic/UTF_TestPulseAndTPDuringDAQ.ipf +++ b/Packages/tests/HardwareBasic/UTF_TestPulseAndTPDuringDAQ.ipf @@ -795,6 +795,10 @@ static Function TPDuringDAQWithoodDAQ_PreAcq(device) string device PGC_SetAndActivateControl(device, "check_Settings_RequireAmpConn", val = 0) + // Reduce amplification to prevent border vals + PGC_SetAndActivateControl(device, "Popup_Settings_HeadStage", val = 2) + PGC_SetAndActivateControl(device, "setvar_Settings_VC_DAgain", val = 2) + PGC_SetAndActivateControl(device, "Gain_DA_02", val = 2) End // UTF_TD_GENERATOR DeviceNameGeneratorMD1 @@ -924,6 +928,10 @@ static Function TPDuringDAQTPStoreCheck_PreAcq(device) string device PGC_SetAndActivateControl(device, "check_Settings_RequireAmpConn", val = 0) + // Reduce amplification to prevent border vals + PGC_SetAndActivateControl(device, "Popup_Settings_HeadStage", val = 2) + PGC_SetAndActivateControl(device, "setvar_Settings_VC_DAgain", val = 2) + PGC_SetAndActivateControl(device, "Gain_DA_02", val = 2) End static Constant TP_WAIT_TIMEOUT = 5 From 118353c72746392629ecc1a5a1dcc8b13925134f Mon Sep 17 00:00:00 2001 From: Michael Huth Date: Thu, 15 Aug 2024 13:53:07 +0200 Subject: [PATCH 2/2] DC: Add BorderVals check for sutter hardware - cleaned up function DC_CheckIfDataWaveHasBorderVals - use also HW_GetVoltageRange for ITC - use the same approach for NI and Sutter - check only DA output channels - adapt user message --- Packages/MIES/MIES_DataConfigurator.ipf | 47 ++++++++++++++----------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/Packages/MIES/MIES_DataConfigurator.ipf b/Packages/MIES/MIES_DataConfigurator.ipf index 58f7b72d0c..1ada660442 100644 --- a/Packages/MIES/MIES_DataConfigurator.ipf +++ b/Packages/MIES/MIES_DataConfigurator.ipf @@ -1035,7 +1035,7 @@ static Function DC_PlaceDataInDAQDataWave(device, numActiveChannels, dataAcqOrTP [ret, row, column] = DC_CheckIfDataWaveHasBorderVals(device, dataAcqOrTP) if(ret) - printf "Error writing into DataWave in %s mode: The values at [%g, %g] are out of range. Maybe the DA/AD Gain needs adjustment?\r", SelectString(dataAcqOrTP, "DATA_ACQUISITION", "TestPulse"), row, column + printf "Some values in DataWave exceed device limits for %s mode (channel index %g, position %g). Maybe the DA/AD Gain needs adjustment?\r", SelectString(dataAcqOrTP, "DATA_ACQUISITION", "TestPulse"), column, row ControlWindowToFront() Abort endif @@ -1909,53 +1909,60 @@ End static Function [variable result, variable row, variable column] DC_CheckIfDataWaveHasBorderVals(string device, variable dataAcqOrTP) + variable i, minVal, maxVal, channelType variable hardwareType = GetHardwareType(device) + WAVE configWave = GetDAQConfigWave(device) + switch(hardwareType) case HARDWARE_ITC_DAC: WAVE/Z ITCDataWave = GetDAQDataWave(device, dataAcqOrTP) ASSERT(WaveExists(ITCDataWave), "Missing DAQDataWave") ASSERT(WaveType(ITCDataWave) == IGOR_TYPE_16BIT_INT, "Unexpected wave type: " + num2str(WaveType(ITCDataWave))) - FindValue/UOFV/I=(SIGNED_INT_16BIT_MIN) ITCDataWave + // border vals are the same for all channels for ITC, so just use first + [minVal, maxVal] = HW_GetVoltageRange(hardwareType, configWave[0][%ChannelType], 1) + FindValue/UOFV/I=(minVal) ITCDataWave if(V_Value != -1) return [1, V_row, V_col] endif - FindValue/UOFV/I=(SIGNED_INT_16BIT_MAX) ITCDataWave - + FindValue/UOFV/I=(maxVal) ITCDataWave if(V_Value != -1) return [1, V_row, V_col] endif return [0, NaN, NaN] - break - case HARDWARE_NI_DAC: - WAVE/WAVE NIDataWave = GetDAQDataWave(device, dataAcqOrTP) - ASSERT(IsWaveRefWave(NIDataWave), "Unexpected wave type") - variable channels = numpnts(NIDataWave) - variable i - for(i = 0; i < channels; i += 1) - WAVE NIChannel = NIDataWave[i] + case HARDWARE_NI_DAC: // intended drop through + case HARDWARE_SUTTER_DAC: + WAVE/WAVE dataWave = GetDAQDataWave(device, dataAcqOrTP) + ASSERT(IsWaveRefWave(dataWave), "Unexpected wave type") - FindValue/UOFV/V=(NI_DAC_MIN)/T=1E-6 NIChannel + for(WAVE channel : dataWave) - if(V_Value != -1) - return [1, V_row, V_col] + channelType = configWave[i][%ChannelType] + if(channelType != XOP_CHANNEL_TYPE_DAC) + i += 1 + continue endif + [minVal, maxVal] = HW_GetVoltageRange(hardwareType, channelType, !IsNaN(configWave[i][%HEADSTAGE])) - FindValue/UOFV/V=(NI_DAC_MAX)/T=1E-6 NIChannel + FindValue/UOFV/V=(minVal)/T=1E-6 channel + if(V_Value != -1) + return [1, V_row, i] + endif + FindValue/UOFV/V=(maxVal)/T=1E-6 channel if(V_Value != -1) - return [1, V_row, V_col] + return [1, V_row, i] endif + i += 1 endfor return [0, NaN, NaN] - case HARDWARE_SUTTER_DAC: - // @todo Determine what to check here - break + default: + ASSERT(0, "Unsupported hardware type") endswitch End