Set `axis = ...` earlier in AFM.move_just_onto_surface().
authorW. Trevor King <wking@drexel.edu>
Tue, 19 Apr 2011 17:51:17 +0000 (13:51 -0400)
committerW. Trevor King <wking@drexel.edu>
Tue, 19 Apr 2011 17:51:55 +0000 (13:51 -0400)
pyafm.py

index 7ef3a855fff0729c15c86ddd99f1c75f1b1a3ab5..c16b0b8d79fafffac4dd591507333ee98027af32 100644 (file)
--- a/pyafm.py
+++ b/pyafm.py
@@ -66,11 +66,13 @@ class AFM (object):
         LOG.info('moving to %g onto the surface' % depth)
 
         stepper_tolerance = 2*self.stepper.step_size
+
+        axis = self.piezo.axis_by_name(self.axis_name)
+
         zero = _convert_volts_to_bits(axis.axis_channel_config, 0)
         target_def = _convert_volts_to_bits(axis.channel_config, setpoint)
 
         LOG.debug('zero the %s piezo output' % self.axis_name)
-        axis = self.piezo.axis_by_name(self.axis_name)
         self.piezo.jump(axis_name=self.axis_name, position=zero)
 
         LOG.debug("see if we're starting near the surface")