-
Notifications
You must be signed in to change notification settings - Fork 9
pressure FFI #2561
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
base: main
Are you sure you want to change the base?
pressure FFI #2561
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a Foreign Function Interface (FFI) for pressure control operations, resolving get and set functionality for issue #2546. The changes refactor pressure control code by moving constants to a centralized location, promoting internal functions to public API functions, and adding new FFI functions for external pressure control.
Key changes:
- Moved pressure-related constants (
ATMOSPHERIC_PRESSURE,ACCESS_*) fromMIES_PressureControl.ipftoMIES_Constants.ipffor better code organization - Changed four internal pressure control functions to public API by removing
statickeywords - Added new FFI functions
FFI_GetWithOptionToSetPressure()andFFI_WaitForIdle()for external pressure control operations - Renamed
P_GetPressureMode()toP_GetPressureMethod()for consistency
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| MIES_PressureControl.ipf | Removed pressure constants, promoted four functions from static to public, removed old DoPressureManual(), renamed P_GetPressureMode() to P_GetPressureMethod() |
| MIES_ForeignFunctionInterface.ipf | Added FFI functions for pressure control including FFI_GetWithOptionToSetPressure(), FFI_WaitForIdle(), and several test functions |
| MIES_DAEphys.ipf | Updated function call from P_GetPressureMode() to P_GetPressureMethod() |
| MIES_Constants.ipf | Added pressure constants previously in MIES_PressureControl.ipf |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if(!PD[headstage][%OngoingPessurePulse]) | ||
| return 1 | ||
| endif | ||
|
|
||
| variable t0 = stopmstimer(-2) | ||
| // Wait until the pulse finishes or timeout elapses | ||
| do | ||
| if(!PD[headstage][%OngoingPessurePulse]) | ||
| return 1 | ||
| endif | ||
|
|
||
| // Timeout check (treating stopmstimer(-2) deltas as milliseconds) | ||
| if((stopmstimer(-2) - t0) > (kPressurePulseMaxMS + kPressureWaitSlackMS)) | ||
| // one last check before giving up | ||
| return !PD[headstage][%OngoingPessurePulse] |
Copilot
AI
Nov 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'OngoingPessurePulse' to 'OngoingPressurePulse' (assuming this is the correct column name based on context).
| if(!PD[headstage][%OngoingPessurePulse]) | |
| return 1 | |
| endif | |
| variable t0 = stopmstimer(-2) | |
| // Wait until the pulse finishes or timeout elapses | |
| do | |
| if(!PD[headstage][%OngoingPessurePulse]) | |
| return 1 | |
| endif | |
| // Timeout check (treating stopmstimer(-2) deltas as milliseconds) | |
| if((stopmstimer(-2) - t0) > (kPressurePulseMaxMS + kPressureWaitSlackMS)) | |
| // one last check before giving up | |
| return !PD[headstage][%OngoingPessurePulse] | |
| if(!PD[headstage][%OngoingPressurePulse]) | |
| return 1 | |
| endif | |
| variable t0 = stopmstimer(-2) | |
| // Wait until the pulse finishes or timeout elapses | |
| do | |
| if(!PD[headstage][%OngoingPressurePulse]) | |
| return 1 | |
| endif | |
| // Timeout check (treating stopmstimer(-2) deltas as milliseconds) | |
| if((stopmstimer(-2) - t0) > (kPressurePulseMaxMS + kPressureWaitSlackMS)) | |
| // one last check before giving up | |
| return !PD[headstage][%OngoingPressurePulse] |
| if(!PD[headstage][%OngoingPessurePulse]) | ||
| return 1 | ||
| endif | ||
|
|
||
| variable t0 = stopmstimer(-2) | ||
| // Wait until the pulse finishes or timeout elapses | ||
| do | ||
| if(!PD[headstage][%OngoingPessurePulse]) | ||
| return 1 | ||
| endif | ||
|
|
||
| // Timeout check (treating stopmstimer(-2) deltas as milliseconds) | ||
| if((stopmstimer(-2) - t0) > (kPressurePulseMaxMS + kPressureWaitSlackMS)) | ||
| // one last check before giving up | ||
| return !PD[headstage][%OngoingPessurePulse] |
Copilot
AI
Nov 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'OngoingPessurePulse' to 'OngoingPressurePulse' (assuming this is the correct column name based on context).
| if(!PD[headstage][%OngoingPessurePulse]) | |
| return 1 | |
| endif | |
| variable t0 = stopmstimer(-2) | |
| // Wait until the pulse finishes or timeout elapses | |
| do | |
| if(!PD[headstage][%OngoingPessurePulse]) | |
| return 1 | |
| endif | |
| // Timeout check (treating stopmstimer(-2) deltas as milliseconds) | |
| if((stopmstimer(-2) - t0) > (kPressurePulseMaxMS + kPressureWaitSlackMS)) | |
| // one last check before giving up | |
| return !PD[headstage][%OngoingPessurePulse] | |
| if(!PD[headstage][%OngoingPressurePulse]) | |
| return 1 | |
| endif | |
| variable t0 = stopmstimer(-2) | |
| // Wait until the pulse finishes or timeout elapses | |
| do | |
| if(!PD[headstage][%OngoingPressurePulse]) | |
| return 1 | |
| endif | |
| // Timeout check (treating stopmstimer(-2) deltas as milliseconds) | |
| if((stopmstimer(-2) - t0) > (kPressurePulseMaxMS + kPressureWaitSlackMS)) | |
| // one last check before giving up | |
| return !PD[headstage][%OngoingPressurePulse] |
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Resolves Get and Set of #2546