From: W. Trevor King Date: Fri, 16 Mar 2012 04:48:17 +0000 (-0400) Subject: Fix move_just_onto_surface() for limited axes. X-Git-Tag: 0.7~15 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=0b0ec873884ddd129b20b29458e4b5e73df0e4d1;p=pypiezo.git Fix move_just_onto_surface() for limited axes. If the channel is limited with AxesConfig['maximum'] less than the channels actual maximum, the position passed in to move_just_onto_surface() may be a floating point bit value (e.g. 62258.25). Because the maximum keeps the position from getting to 62259, the approach phase goes on forever, getting stuck in repeated jumps to 62258. By truncating the positive position down to a lower integer, we ensure that it is an attainable value. --- diff --git a/pypiezo/afm.py b/pypiezo/afm.py index 02c2063..5cf5569 100644 --- a/pypiezo/afm.py +++ b/pypiezo/afm.py @@ -191,6 +191,7 @@ class AFMPiezo (_base.Piezo): # default to the extreme value channel = self._deflection_channel(self) deflection = channel.get_maxdata() + position = int(position) # round down to nearest integer if step == 0: raise ValueError('must have non-zero step size')