示例#1
0
def test_axis(driver, logger, axis):
    retract_amounts = {'X': 3, 'Y': 3, 'Z': 2, 'A': 2, 'B': 2, 'C': 2}
    retract = retract_amounts[axis]
    expected_point = driver.homed_position[axis] + retract
    points = [
        expected_point - AXIS_TEST_SKIPPING_TOLERANCE,
        expected_point + AXIS_TEST_SKIPPING_TOLERANCE
    ]
    if axis == 'Y':
        driver.move({'X': driver.homed_position['X']})
    driver.push_speed()
    driver.set_speed(8)
    driver.update_position()
    try:
        driver.move({axis: points[0]})
    except SmoothieError:
        button_red()
        logger.error('Test Failed: Pressing {} too soon'.format(axis))
    if axis == 'Y':
        if driver.switch_state[axis] is not False:
            button_red()
            logger.error('Test Failed: Pressing {} too soon'.format(axis))
        else:
            driver.move({axis: points[1]})
            if driver.switch_state[axis] is not True:
                button_red()
                logger.error('Test Failed: Not hitting {} switch'.format(axis))
    else:
        try:
            driver.move({axis: points[1]})
            button_red()
            logger.error('Test Failed: Not hitting {} switch'.format(axis))
        except SmoothieError:
            pass  # hit the switch on purpose, so it's ok
    driver.set_speed(DEFAULT_AXES_SPEED)
示例#2
0
def hourglass_pattern(X_max, Y_max):
    zero = 10
    offset = 5
    driver.move({'X': zero, 'Y': zero + offset})
    driver.move({'X': X_max, 'Y': zero + offset})
    driver.move({'X': zero, 'Y': Y_max})
    driver.move({'X': X_max, 'Y': Y_max})
示例#3
0
def bowtie_pattern(X_max, Y_max):
    zero = 10
    offset = 5
    driver.move({'X': zero, 'Y': zero + offset})
    driver.move({'X': zero, 'Y': Y_max})
    driver.move({'X': X_max, 'Y': zero})
    driver.move({'X': X_max, 'Y': Y_max})
示例#4
0
def attempt_movement(driver, logger, coords_list):
    driver.set_speed(DEFAULT_AXES_SPEED)
    for c in coords_list:
        try:
            driver.move(c)
        except SmoothieError:
            button_red()
            logger.exception('Failed movement: {}'.format(c))
            driver._reset_from_error()
            try:
                driver.update_position()
            except Exception:
                pass
            logger.info('Current Smoothie pos: {}'.format(driver.position))
            attempt_homing(driver, logger)
示例#5
0
def test_axis(axis, tolerance):
    retract_amounts = {
        'X': 3,
        'Y': 3,
        'Z': 2,
        'A': 2,
        'B': 2,
        'C': 2
    }
    # it moves RETRACT_MM away from the endstop
    retract = retract_amounts[axis]
    expected_point = driver.homed_position[axis] + retract
    points = [expected_point - tolerance, expected_point + tolerance]
    # expected_point = home_position + retract
    # safe distance from switch?
    driver.push_speed()
    driver.set_speed(8)
    try:
        driver.move({axis: points[0]})
    except SmoothieError:
        raise Exception('Test Failed: Pressing too soon')
    if axis == 'Y':
        if driver.switch_state[axis] is not False:
            raise Exception('Test Failed: Pressing too soon')
        driver.move({axis: points[1]})
        if driver.switch_state[axis] is not True:
            raise Exception('Test Failed: Not hitting switch')
    else:
        try:
            driver.move({axis: points[1]})
            raise Exception('Test Failed: Not hitting switch')
        except SmoothieError:
            pass
    driver.pop_speed()
示例#6
0
def pick_up_motion(max_dist, max_speed, low_speed):
    zero = 100
    zero_1 = 5

    # Descent Z z to 100mm
    setup(options.high_current, max_speed)
    driver.set_speed(max_speed)
    driver.move({'Z': zero, 'A': zero})
    # Press Action
    setup(options.low_current, max_speed)
    driver.set_speed(low_speed)
    driver.move({'Z': zero_1, 'A': zero_1})
    # Retract Action
    setup(options.high_current, max_speed)
    driver.set_speed(max_speed)
    driver.move({'Z': zero, 'A': zero})
    # Jog up
    driver.set_speed(max_speed)
    driver.move({'Z': max_dist, 'A': max_dist})
示例#7
0
def test_all_axes(driver, logger):
    driver.move(COORDS_MAX)
    for ax in ['Z', 'A', 'X', 'Y']:
        test_axis(driver, logger, ax)