Skip to content

Conversation

@timjarsky
Copy link
Collaborator

Resolves Get and Set of #2546

@timjarsky timjarsky self-assigned this Nov 4, 2025
Copilot AI review requested due to automatic review settings November 4, 2025 20:26
Copy link

Copilot AI left a 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_*) from MIES_PressureControl.ipf to MIES_Constants.ipf for better code organization
  • Changed four internal pressure control functions to public API by removing static keywords
  • Added new FFI functions FFI_GetWithOptionToSetPressure() and FFI_WaitForIdle() for external pressure control operations
  • Renamed P_GetPressureMode() to P_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.

Comment on lines 479 to 493
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]
Copy link

Copilot AI Nov 4, 2025

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).

Suggested change
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]

Copilot uses AI. Check for mistakes.
Comment on lines 479 to 493
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]
Copy link

Copilot AI Nov 4, 2025

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).

Suggested change
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]

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants