Show stepper position when commenting about steps in or out.
authorW. Trevor King <wking@tremily.us>
Thu, 12 Jul 2012 21:57:10 +0000 (17:57 -0400)
committerW. Trevor King <wking@tremily.us>
Thu, 12 Jul 2012 21:57:10 +0000 (17:57 -0400)
pyafm/afm.py

index b7adcfbb1b7fc61ccc8dc834250a63ba70aa47ef..bda92d53ea6a4271b144fae81f515e8a70f02beb 100644 (file)
@@ -375,8 +375,8 @@ 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.single_step(-1)
+            _LOG.debug('step back to {}'.format(self.stepper.position))
             try:
                 pos = self.piezo.get_surface_position(
                     axis_name=self.config['main-axis'],
@@ -389,8 +389,8 @@ class AFM (object):
             _LOG.debug('located surface at stepper %d, piezo %d (%g m)'
                       % (self.stepper.position, pos, pos_m))
         while pos_m > stepper_tolerance:  # step forward if we need to
-            _LOG.debug('step forward')
             self.stepper.single_step(1)
+            _LOG.debug('step forward to {}'.format(self.stepper.position))
             try:
                 pos = self.piezo.get_surface_position(
                     axis_name=self.config['main-axis'],
@@ -446,6 +446,7 @@ class AFM (object):
             except _SurfaceError, e:
                 _LOG.info(e)
             self.stepper.single_step(-1)  # step out
+            _LOG.debug('stepped back to {}'.format(self.stepper.position))
         _LOG.debug('giving up on finding the surface')
         _LOG.warn(e)
         raise e