Skip to content

Commit b36fcb7

Browse files
committed
added max_iterations as a parameter got closed loop jhm
1 parent 46b09da commit b36fcb7

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/ephys_link/back_end/platform_handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ async def jackhammer(
241241
phase2_pulses: int,
242242
closed_loop: bool = False,
243243
target_um: float = 0.0,
244+
max_iterations: int = 50,
244245
) -> dict:
245246
"""Perform jackhammer motion to break through dura.
246247
@@ -259,7 +260,6 @@ async def jackhammer(
259260
Dictionary with position, error, and iterations_used (if closed_loop).
260261
"""
261262
# Closed-loop constants
262-
MAX_ITERATIONS = 50
263263
MAX_BACKWARD_UM = 250.0
264264

265265
try:
@@ -273,7 +273,7 @@ async def jackhammer(
273273
iterations_used = 0
274274
last_depth = start_depth
275275

276-
for i in range(MAX_ITERATIONS):
276+
for i in range(max_iterations):
277277
# Run single iteration
278278
await self._bindings.jackhammer(
279279
manipulator_id, axis, 1, phase1_steps, phase1_pulses, phase2_steps, phase2_pulses

src/ephys_link/back_end/server.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ async def platform_event_handler(self, event: str, _: str, data: Any) -> str: #
256256
phase2_pulses=parsed.get("phase2_pulses", parsed.get("Phase2Pulses", -15)),
257257
closed_loop=parsed.get("closed_loop", parsed.get("ClosedLoop", False)),
258258
target_um=parsed.get("target_um", parsed.get("TargetUm", 0.0)),
259+
max_iterations=parsed.get("max_iterations", parsed.get("MaxIterations", 50)),
259260
)
260261
# Build response
261262
position = result.get("position")

0 commit comments

Comments
 (0)