diff --git a/Packages/MIES/MIES_DAEphys.ipf b/Packages/MIES/MIES_DAEphys.ipf index 066b7f9162..ccb005134d 100644 --- a/Packages/MIES/MIES_DAEphys.ipf +++ b/Packages/MIES/MIES_DAEphys.ipf @@ -1660,12 +1660,16 @@ Function DAP_GetSampInt(string device, variable dataAcqOrTP, variable channelTyp endif if(dataAcqOrTP == DATA_ACQUISITION_MODE) + if(IsDeviceNameFromSutter(device) && channelType != XOP_CHANNEL_TYPE_ADC) + return SI_CalculateMinSampInterval(device, dataAcqOrTP, channelType) + endif + fixedFreqkHzStr = DAG_GetTextualValue(device, "Popup_Settings_FixedFreq") if(cmpstr(fixedFreqkHzStr, "Maximum")) sampInt = 1 / (str2num(fixedFreqkHzStr) * KILO_TO_ONE) * ONE_TO_MICRO if(!ParamIsDefault(valid)) - valid = sampInt >= SI_CalculateMinSampInterval(device, DATA_ACQUISITION_MODE, channelType) + valid = DAP_IsSampleIntervalValid(device, channelType, sampInt) endif return sampInt @@ -1680,6 +1684,29 @@ Function DAP_GetSampInt(string device, variable dataAcqOrTP, variable channelTyp endif End +static Function DAP_IsSampleIntervalValid(string device, variable channelType, variable sampInt) + + if(!IsDeviceNameFromSutter(device)) + return sampInt >= SI_CalculateMinSampInterval(device, DATA_ACQUISITION_MODE, channelType) + endif + + switch(channelType) + case XOP_CHANNEL_TYPE_DAC: // intended drop-through + case XOP_CHANNEL_TYPE_TTL: + WAVE allowedIntervals = GetSutterDACTTLSampleInterval() + FindValue/Z/V=(sampInt) allowedIntervals + return V_value >= 0 + case XOP_CHANNEL_TYPE_ADC: + WAVE allowedIntervals = GetSutterADCSampleInterval() + FindValue/Z/V=(sampInt) allowedIntervals + return V_value >= 0 + default: + ASSERT(0, "Invalid channel type") + endswitch + + ASSERT(0, "If that location is reached a case was not handled that should be handled.") +End + Function DAP_UpdateSweepSetVariables(device) string device @@ -1940,7 +1967,6 @@ End static Function DAP_CheckSampleInterval(string device, variable mode) variable sampIntADC, sampIntDAC, sampIntTTL, validSampInt - variable hardwareType sampIntDAC = DAP_GetSampInt(device, mode, XOP_CHANNEL_TYPE_DAC, valid=validSampInt) if(!validSampInt) @@ -1962,30 +1988,6 @@ static Function DAP_CheckSampleInterval(string device, variable mode) ControlWindowToFront() return 1 endif - return 0 - hardwareType = GetHardwareType(device) - if(hardwareType == HARDWARE_SUTTER_DAC) - WAVE allowedIntervals = GetSutterDACTTLSampleInterval() - FindValue/Z/V=(sampIntDAC) allowedIntervals - if(V_value == -1) - printf "%s: The selected sampling interval is not available for DAC on sutter hardware: %f\r", device, sampIntDAC - ControlWindowToFront() - return 1 - endif - FindValue/Z/V=(sampIntTTL) allowedIntervals - if(V_value == -1) - printf "%s: The selected sampling interval is not available for TTL on sutter hardware: %f\r", device, sampIntTTL - ControlWindowToFront() - return 1 - endif - WAVE allowedIntervals = GetSutterADCSampleInterval() - FindValue/Z/V=(sampIntADC) allowedIntervals - if(V_value == -1) - printf "%s: The selected sampling interval is not available for ADC on sutter hardware: %f\r", device, sampIntADC - ControlWindowToFront() - return 1 - endif - endif return 0 End