diff --git a/src/ophyd_async/epics/motion/motor.py b/src/ophyd_async/epics/motion/motor.py index 9eca0916bf..5cf8e28ab6 100644 --- a/src/ophyd_async/epics/motion/motor.py +++ b/src/ophyd_async/epics/motion/motor.py @@ -116,7 +116,6 @@ async def prepare(self, value: FlyMotorInfo): ) await self.set(fly_prepared_position) - await self.velocity.set(fly_velocity) @AsyncStatus.wrap async def kickoff(self): @@ -183,7 +182,7 @@ async def stop(self, success=False): async def _prepare_velocity( self, start_position: float, end_position: float, time_for_move: float ) -> float: - fly_velocity = (end_position - start_position) / time_for_move + fly_velocity = (start_position - end_position) / time_for_move max_speed, egu = await asyncio.gather( self.max_velocity.get_value(), self.motor_egu.get_value() ) @@ -192,8 +191,7 @@ async def _prepare_velocity( f"Motor speed of {abs(fly_velocity)} {egu}/s was requested for a motor " f" with max speed of {max_speed} {egu}/s" ) - # move to prepare position at maximum velocity - await self.velocity.set(abs(max_speed)) + await self.velocity.set(abs(fly_velocity)) return fly_velocity async def _prepare_motor_path( diff --git a/tests/epics/motion/test_motor.py b/tests/epics/motion/test_motor.py index 6875ffb774..1d84bc22d5 100644 --- a/tests/epics/motion/test_motor.py +++ b/tests/epics/motion/test_motor.py @@ -216,9 +216,7 @@ async def test_valid_prepare_velocity(sim_motor: motor.Motor): fly_info.end_position, fly_info.time_for_move, ) - assert ( - await sim_motor.velocity.get_value() == await sim_motor.max_velocity.get_value() - ) + assert await sim_motor.velocity.get_value() == 10 @pytest.mark.parametrize( @@ -296,7 +294,6 @@ async def wait_for_status(status: AsyncStatus): ) # Test that prepare is not marked as complete until correct position is reached await asyncio.gather(do_set(status), wait_for_status(status)) - assert await sim_motor.velocity.get_value() == 10 assert status.done