diff --git a/Packages/MIES/MIES_DAEphys.ipf b/Packages/MIES/MIES_DAEphys.ipf index 95566ca8e9..d91ef72ca7 100644 --- a/Packages/MIES/MIES_DAEphys.ipf +++ b/Packages/MIES/MIES_DAEphys.ipf @@ -1880,6 +1880,13 @@ Function DAP_SetVarProc_CAA(STRUCT WMSetVariableAction &sva) : SetVariableContro DAP_UpdateChanAmpAssignStorWv(device) P_UpdatePressureDataStorageWv(device) + + // --- updates pressure during manual pressure mode when TP is not running --- + variable hs = DAG_GetNumericalValue(device, "slider_DataAcq_ActiveHeadstage") + if(P_GetPressureMode(device, hs) == PRESSURE_METHOD_MANUAL) + P_RunP_ControlIfTPOFF(device) + endif + break case 9: // mouse down strswitch(sva.ctrlName) diff --git a/Packages/MIES/MIES_PressureControl.ipf b/Packages/MIES/MIES_PressureControl.ipf index d12e996a91..0566b2a0ff 100644 --- a/Packages/MIES/MIES_PressureControl.ipf +++ b/Packages/MIES/MIES_PressureControl.ipf @@ -2517,3 +2517,31 @@ Function/S P_PressureMethodToString(variable method) ASSERT(0, "Unknown pressure method: " + num2str(method)) endswitch End + +// for external callers to set manual pressure +Function DoPressureManual(string device, variable headstage, variable manualOnOff, variable targetPressure) + + // 0) Select the headstage + PGC_SetAndActivateControl(device, "slider_DataAcq_ActiveHeadstage", val = headstage) + + // 1) Set the requested pressure value on the GUI control + PGC_SetAndActivateControl(device, "setvar_DataAcq_SSPressure", val = targetPressure) + + // 2) Check the current pressure mode + variable currentMode = P_GetPressureMode(device, headstage) + + // 3) If we want manual mode ON... + if(manualOnOff == 1) + // ...and we are NOT in manual mode yet, switch to manual + if(currentMode != PRESSURE_METHOD_MANUAL) + P_SetManual(device, "button_DataAcq_SSSetPressureMan") + endif + else + // If we want manual mode OFF... + // ...and we ARE currently in manual mode, switch to atmospheric (or the "off" state) + if(currentMode == PRESSURE_METHOD_MANUAL) + P_SetManual(device, "button_DataAcq_SSSetPressureMan") + endif + endif + +End