Skip to content

Commit

Permalink
Merge pull request #2361 from AllenInstitute/Pressure_control_updates…
Browse files Browse the repository at this point in the history
…_for_manual_mode

feature/Pressure control updates for manual mode
  • Loading branch information
t-b authored Feb 28, 2025
2 parents dca94bd + daffe38 commit ec91fd7
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Packages/MIES/MIES_DAEphys.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
28 changes: 28 additions & 0 deletions Packages/MIES/MIES_PressureControl.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ec91fd7

Please sign in to comment.