We can now STop motors when SICS gets and INT1712 1

r2236 | ffr | 2007-11-06 14:49:11 +1100 (Tue, 06 Nov 2007) | 2 lines
This commit is contained in:
Ferdi Franceschini
2007-11-06 14:49:11 +11:00
committed by Douglas Clowes
parent 75ae6a9445
commit d6f484f6dc
2 changed files with 11 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
#!/usr/bin/tclsh
# $Revision: 1.6 $
# $Date: 2007-10-31 06:10:30 $
# $Revision: 1.7 $
# $Date: 2007-11-06 03:49:11 $
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
# Last revision by: $Author: ffr $
@@ -70,7 +70,7 @@ proc mkSimAxes {instrument} {
set enPos 0;
set enCnts 0;
}
puts $simFile($IPtoContName($motor(asyncqueue)-$instrument)) "array set $nm \[\list TD 0 TP $enPos BG 0 SP $speed AC $acc DC $dec cntsperx $enCnts stepsperx $motor(stepsperx) PA 0 TS 44 \]";
puts $simFile($IPtoContName($motor(asyncqueue)-$instrument)) "array set $nm \[\list TD 0 TP $enPos BG 0 ST 0 SP $speed AC $acc DC $dec cntsperx $enCnts stepsperx $motor(stepsperx) PA 0 TS 44 \]";
# eval "lappend $IPtoContName($motor(host))_motors $m";
}

View File

@@ -1,5 +1,5 @@
# $Revision: 1.4 $
# $Date: 2007-10-31 06:10:30 $
# $Revision: 1.5 $
# $Date: 2007-11-06 03:49:11 $
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
# Last revision by: $Author: ffr $
@@ -51,6 +51,9 @@ proc DP {axis val} {
proc TS {axis} {
uplevel #0 eval set ${axis}(TS)
}
proc ST {axis} {
uplevel #0 eval set ${axis}(ST) 1
}
proc SH {args} {}
proc MO {args} {}
@@ -110,13 +113,15 @@ proc nextstep {paxis step target} {
if {[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 {[expr abs($target - $axis(TD)) < abs($step)]} {
} elseif {$axis(ST) == 1 || [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)];
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;
} else {
return 1;