Files
motorDriverTests/tests/sinqMotor/limits.py

22 lines
743 B
Python

import time
def reread_limits_from_hw(motor):
"""
sinqMotor drivers usually read their limits from the hardware at each poll,
hence any values manually written to DHLM or DLLM should be overwritten
after the next poll at latest
"""
(high_limit, low_limit) = motor.limits()
motor.write_field('dialhighlimit', high_limit+10)
motor.write_field('diallowlimit', low_limit-10)
# After two seconds, at least one poll has been done
time.sleep(2)
# Values should have been reread
assert motor.read_field('highlimit') == high_limit
assert motor.read_field('lowlimit') == low_limit
assert motor.read_field('dialhighlimit') == high_limit
assert motor.read_field('diallowlimit') == low_limit