The fake motors now work with the current motor driver.
r2211 | ffr | 2007-10-31 17:10:30 +1100 (Wed, 31 Oct 2007) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
34c0c59594
commit
991662fa5d
@@ -1,5 +1,5 @@
|
||||
# $Revision: 1.3 $
|
||||
# $Date: 2007-03-16 06:20:33 $
|
||||
# $Revision: 1.4 $
|
||||
# $Date: 2007-10-31 06:10:30 $
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
# Last revision by: $Author: ffr $
|
||||
|
||||
@@ -42,7 +42,6 @@ proc dmget {cmd axis} {
|
||||
}
|
||||
|
||||
proc dmcall {cmd paxis} {
|
||||
upvar $paxis axis;
|
||||
uplevel #0 eval $cmd $paxis
|
||||
}
|
||||
|
||||
@@ -55,10 +54,14 @@ proc TS {axis} {
|
||||
|
||||
proc SH {args} {}
|
||||
proc MO {args} {}
|
||||
proc LV {args} {return "FRED=1\nBARNEY=2"}
|
||||
proc TI {args} {return 240}
|
||||
proc XQ {args} {return 1}
|
||||
|
||||
proc BG {_axis} {
|
||||
upvar #0 $_axis axis;
|
||||
set axis(TS) 140; # moving, limit switches open
|
||||
set axis(BG) 1; # motor is moving
|
||||
set timeStep 0.1; # seconds
|
||||
set target $axis(PA);
|
||||
set diff [expr $target - $axis(TD)];
|
||||
@@ -77,7 +80,11 @@ proc BG {_axis} {
|
||||
}
|
||||
|
||||
# Don't handle _XQ _HX
|
||||
proc MG {msg} {
|
||||
proc MG {args} {
|
||||
# Skip formatting
|
||||
if {[string index [lindex $args 0] 0] == F} {
|
||||
set msg [lrange $args 1 end]
|
||||
}
|
||||
# If msg starts with _ then return val for axis
|
||||
if {[string index $msg 0] == "_"} {
|
||||
return [evalArgList $msg];
|
||||
@@ -97,16 +104,19 @@ proc every {ms body} {
|
||||
proc nextstep {paxis step target} {
|
||||
upvar #0 $paxis axis;
|
||||
set mult [expr double($axis(cntsperx))/$axis(stepsperx)];
|
||||
set axis(TP) [expr $step * $mult + $axis(TP)];
|
||||
set axis(TD) [expr $axis(TD) + $step];
|
||||
if {[expr abs($axis(TD) - double($target))] < 0.5} {
|
||||
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} {
|
||||
set axis(TS) 44; # Stopped, limit switches open
|
||||
set axis(BG) 0; # motor has stopped
|
||||
return 0;
|
||||
} elseif {[expr abs($target - $axis(TD)) < abs($step)]} {
|
||||
set diff [expr $target - $axis(TD)];
|
||||
set axis(TP) [expr round($diff*$mult + $axis(TP))];
|
||||
set axis(TD) $target;
|
||||
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
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user