Skip to content

Pressure Control: Disable manual controls when user access is enabled #2137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions Packages/MIES/MIES_DAEphys.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -4453,18 +4453,30 @@ Function DAP_CheckProc_Settings_PUser(cba) : CheckBoxControl
STRUCT WMCheckboxAction &cba

variable headstage
string device

switch(cba.eventCode)
case 2: // mouse up
DAP_AbortIfUnlocked(cba.win)
DAG_Update(cba.win, cba.ctrlName, val = cba.checked)
WAVE pressureDataWv = P_GetPressureDataWaveRef(cba.win)
P_RunP_ControlIfTPOFF(cba.win)
device = cba.win
DAP_AbortIfUnlocked(device)
DAG_Update(device, cba.ctrlName, val = cba.checked)

WAVE pressureType = GetPressureTypeWv(device)

WAVE pressureDataWv = P_GetPressureDataWaveRef(device)
headstage = PressureDataWv[0][%UserSelectedHeadStage]
if(P_ValidatePressureSetHeadstage(cba.win, headstage))
P_SetPressureValves(cba.win, headstage, P_GetUserAccess(cba.win, headstage, PressureDataWv[headstage][%Approach_Seal_BrkIn_Clear]))

if(pressureType[headstage] == PRESSURE_TYPE_MANUAL)
PGC_SetAndActivateControl(device, "button_DataAcq_SSSetPressureMan")
endif

P_RunP_ControlIfTPOFF(device)
if(P_ValidatePressureSetHeadstage(device, headstage))
P_SetPressureValves(device, headstage, P_GetUserAccess(device, headstage, PressureDataWv[headstage][%Approach_Seal_BrkIn_Clear]))
endif
P_UpdatePressureType(cba.win)
P_UpdatePressureType(device)

P_UpdatePressureModeTabs(device, headstage)

break
endswitch
Expand Down
29 changes: 18 additions & 11 deletions Packages/MIES/MIES_PressureControl.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -1808,9 +1808,10 @@ Function P_UpdatePressureModeTabs(device, headStage)
string device
variable headStage

WAVE pressureWave = P_GetPressureDataWaveRef(device)
variable pressureMode = PressureWave[headStage][%Approach_Seal_BrkIn_Clear]
string highlightSpec = "\\f01\\Z11"
WAVE pressureWave = P_GetPressureDataWaveRef(device)
variable pressureMode = PressureWave[headStage][%Approach_Seal_BrkIn_Clear]
string highlightSpec = "\\f01\\Z11"
string ctrlsDisableUserAccess = "button_DataAcq_SSSetPressureMan;setvar_DataAcq_SSPressure;button_DataAcq_PPSetPressureMan;setvar_DataAcq_PPPressure;setvar_DataAcq_PPDuration;check_DataAcq_ManPressureAll"

if(pressureMode == PRESSURE_METHOD_ATM)
TabControl tab_DataAcq_Pressure, win=$device, tabLabel(0)="Auto"
Expand All @@ -1825,7 +1826,15 @@ Function P_UpdatePressureModeTabs(device, headStage)
TabControl tab_DataAcq_Pressure, win=$device, tabLabel(1)="Manual"
endif

PGC_SetAndActivateControl(device, "setvar_DataAcq_SSPressure", val = pressureWave[headStage][%ManSSPressure])
PGC_SetAndActivateControl(device, "setvar_DataAcq_SSPressure", val = pressureWave[headStage][%ManSSPressure], mode = PGC_MODE_SKIP_ON_DISABLED)

WAVE pressureType = GetPressureTypeWv(device)

if(pressureType[headstage] == PRESSURE_TYPE_USER)
DisableControls(device, ctrlsDisableUserAccess)
else
EnableControls(device, ctrlsDisableUserAccess)
endif
End

/// @brief Checks if all the pressure settings for a headStage are valid
Expand Down Expand Up @@ -2174,14 +2183,12 @@ End
Function P_SetAllHStoAtmospheric(device)
string device

DFREF dfr = P_DeviceSpecificPressureDFRef(device)
WAVE/Z/SDFR=dfr PressureData
WAVE PressureDataWv = P_GetPressureDataWaveRef(device)
WAVE pressureMethods = GetColfromWavewithDimLabel(PressureDataWv, "Approach_Seal_BrkIn_Clear")

if(WaveExists(PressureData))
if(sum(GetColfromWavewithDimLabel(PressureData, "Approach_Seal_BrkIn_Clear")) != (PRESSURE_METHOD_ATM * NUM_HEADSTAGES)) // Only update pressure wave if pressure methods are different from atmospheric
PressureData[][%Approach_Seal_BrkIn_Clear] = PRESSURE_METHOD_ATM
P_PressureControl(device)
endif
if(sum(pressureMethods) != (PRESSURE_METHOD_ATM * NUM_HEADSTAGES)) // Only update pressure wave if pressure methods are different from atmospheric
PressureDataWv[][%Approach_Seal_BrkIn_Clear] = PRESSURE_METHOD_ATM
P_PressureControl(device)
endif
End

Expand Down