From 0b0ec873884ddd129b20b29458e4b5e73df0e4d1 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 16 Mar 2012 00:48:17 -0400 Subject: [PATCH] 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. --- pypiezo/afm.py | 1 + 1 file changed, 1 insertion(+) 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') -- 2.26.2