From 7f5e6d63b7ed94f910791ca0edfe4f743401e201 Mon Sep 17 00:00:00 2001 From: Tim Jarsky Date: Thu, 27 Feb 2025 11:51:40 -0800 Subject: [PATCH 1/2] New pressure function that enables caller to set manual pressure mode. --- Packages/MIES/MIES_PressureControl.ipf | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) 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 From daffe3855276393c273508d161b0e0ae046c0a8e Mon Sep 17 00:00:00 2001 From: Tim Jarsky Date: Thu, 27 Feb 2025 11:52:43 -0800 Subject: [PATCH 2/2] Update to control setvar for manual pressure control; when TP is not running and manual mode is ON, pressure will update (It didn't before). --- Packages/MIES/MIES_DAEphys.ipf | 7 +++++++ 1 file changed, 7 insertions(+) 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)