From: W. Trevor King Date: Fri, 2 Mar 2012 21:22:08 +0000 (-0500) Subject: Use stepper.single_step instead of stepper.step_relative in AFM methods. X-Git-Tag: v0.4~33 X-Git-Url: http://git.tremily.us/?p=pyafm.git;a=commitdiff_plain;h=b680a4388dde3503fb7754f16606fe742fdfb53f Use stepper.single_step instead of stepper.step_relative in AFM methods. This avoids problems with steppers in full-step mode always rounding the asked-for half step back to the current position. The drawback to the new approach is that we loose backlash protection when moving away from the surface, but the surface fitting condition ...? --- diff --git a/pyafm/afm.py b/pyafm/afm.py index fe3da22..fdacc81 100644 --- a/pyafm/afm.py +++ b/pyafm/afm.py @@ -68,7 +68,7 @@ class AFM (object): Uses `.piezo.get_surface_position()` to pinpoint the position of the surface. Adjusts the stepper position as required via - `.stepper.step_relative()` to get within + `.stepper.single_step()` to get within `2*.stepper.step_size` meters of the surface. Then adjusts the piezo to place the cantilever `depth` meters onto the surface. Negative `depth`\s place the tip off the surface @@ -115,7 +115,7 @@ class AFM (object): _LOG.debug('fine tune the stepper position') while pos_m < -stepper_tolerance: # step back if we need to _LOG.debug('step back') - self.stepper.step_relative(-1, backlash_safe=True) + self.stepper.single_step(-1) try: pos = self.piezo.get_surface_position( axis_name=self.axis_name, max_deflection=target_def, @@ -128,7 +128,7 @@ class AFM (object): % (self.stepper.position, pos, pos_m)) while pos_m > stepper_tolerance: # step forward if we need to _LOG.debug('step forward') - self.stepper.step_relative(1) + self.stepper.single_step(1) try: pos = self.piezo.get_surface_position( axis_name=self.axis_name, max_deflection=target_def,