'perform syncronised x/y movement. This is called by seek when needed.'

def _syncSeek(self, pos, curX, curY, speed, waitArrival, units):

    (newX, newY, nullZ) = pos
    if (units == UNITS_STEPS):
        pass
    elif (units == UNITS_MM):
        newX = int((float(newX) * self.stepsPerMM))
        newY = int((float(newY) * self.stepsPerMM))
    elif (units == UNITS_INCHES):
        newX = int(((float(newX) * self.stepsPerMM) * 25.4))
        newX = int(((float(newY) * self.stepsPerMM) * 25.4))
    else:
        raise _RepRapError('Invalid    units')
    deltaX = abs((curX - newX))
    deltaY = abs((curY - newY))
    directionX = ((curX - newX) / (- deltaX))
    directionY = ((curY - newY) / (- deltaY))
    master = _syncAxis(self.x, newX, deltaX, directionX)
    slave = _syncAxis(self.y, newY, deltaY, directionY)
    if (slave.delta > master.delta):
        (slave, master) = (master, slave)
        if printDebug:
            print '                switching    to    y    master'
    if printDebug:
        print '                masterPos', master.seekTo, 'slaveDelta', slave.delta
    slave.axis._setSync(slave.syncMode)
    master.axis._DDA(master.seekTo, slave.delta, speed, True)
    time.sleep(0.01)
    slave.axis._setSync(SYNC_NONE)
    if printDebug:
        print '                sync    seek    complete'
