diff --git a/hardware-testing/hardware_testing/modules/flex_stacker_evt_qc/driver.py b/hardware-testing/hardware_testing/modules/flex_stacker_evt_qc/driver.py index 443140573bd..791ba5ed566 100644 --- a/hardware-testing/hardware_testing/modules/flex_stacker_evt_qc/driver.py +++ b/hardware-testing/hardware_testing/modules/flex_stacker_evt_qc/driver.py @@ -117,7 +117,7 @@ def __init__(self, port: str, simulating: bool = False) -> None: """Constructor.""" self._simulating = simulating if not self._simulating: - self._serial = serial.Serial(port, baudrate=STACKER_FREQ) + self._serial = serial.Serial(port, baudrate=STACKER_FREQ, timeout=60) def _send_and_recv(self, msg: str, guard_ret: str = "") -> str: """Internal utility to send a command and receive the response.""" @@ -155,6 +155,12 @@ def set_serial_number(self, sn: str) -> None: return self._send_and_recv(f"M996 {sn}\n", "M996 OK") + def stop_motor(self) -> None: + """Stop motor movement.""" + if self._simulating: + return + self._send_and_recv("M0\n") + def get_limit_switch(self, axis: StackerAxis, direction: Direction) -> bool: """Get limit switch status. @@ -243,4 +249,5 @@ def move_to_limit_switch( def __del__(self) -> None: """Close serial port.""" if not self._simulating: + self.stop_motor() self._serial.close() diff --git a/hardware-testing/hardware_testing/modules/flex_stacker_evt_qc/utils.py b/hardware-testing/hardware_testing/modules/flex_stacker_evt_qc/utils.py index 2aca90c8886..d30d6eea783 100644 --- a/hardware-testing/hardware_testing/modules/flex_stacker_evt_qc/utils.py +++ b/hardware-testing/hardware_testing/modules/flex_stacker_evt_qc/utils.py @@ -14,7 +14,7 @@ def test_limit_switches_per_direction( direction: Direction, report: CSVReport, section: str, - speed: float = 50.0, + speed: float = 10.0, ) -> None: """Sequence to test the limit switch for one direction.""" ui.print_header(f"{axis} Limit Switch - {direction} direction") @@ -26,7 +26,7 @@ def test_limit_switches_per_direction( # move until the limit switch is reached print(f"moving towards {direction} limit switch...\n") - driver.move_to_limit_switch(axis, direction, MoveParams(max_speed=speed)) + driver.move_to_limit_switch(axis, direction, MoveParams(max_speed_discont=speed)) result = driver.get_limit_switch(axis, direction) opposite_result = not driver.get_limit_switch(axis, direction.opposite()) print(f"{direction} switch triggered: {result}")