Don't set current position to target value when respond to a STop.

r2238 | ffr | 2007-11-07 15:42:31 +1100 (Wed, 07 Nov 2007) | 2 lines
This commit is contained in:
Ferdi Franceschini
2007-11-07 15:42:31 +11:00
committed by Douglas Clowes
parent 1c181fb68f
commit a19b2864e1

View File

@@ -1,5 +1,5 @@
# $Revision: 1.5 $
# $Date: 2007-11-06 03:49:11 $
# $Revision: 1.6 $
# $Date: 2007-11-07 04:42:31 $
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
# Last revision by: $Author: ffr $
@@ -110,12 +110,12 @@ proc nextstep {paxis step target} {
set axis(TP) [expr int($step * $mult + $axis(TP))];
set TD_POS [expr int($axis(TD) + $step)];
set axis(TD) [expr int($TD_POS)];
if {[expr abs($TD_POS - double($target))] < 0.5} {
if {$axis(ST) == 1 || [expr abs($TD_POS - double($target))] < 0.5} {
set axis(TS) 44; # Stopped, limit switches open
set axis(BG) 0; # motor has stopped
set axis(ST) 0; # make sure stop flag is unset
return 0;
} elseif {$axis(ST) == 1 || [expr abs($target - $axis(TD)) < abs($step)]} {
} elseif {[expr abs($target - $axis(TD)) < abs($step)]} {
set diff [expr $target - $axis(TD)];
set axis(TP) [expr int(round($diff*$mult + $axis(TP)))];
set axis(TD) [expr int($target)];