Import LinuxCNC source tree
This commit is contained in:
36
tests/stepgen.1/checkresult
Executable file
36
tests/stepgen.1/checkresult
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
#prime the "old" states. it seems that stepgen likes to start with phase-A=1
|
||||
read -r oa ob c < "$1"
|
||||
exitval=0
|
||||
count=0
|
||||
# if a leads b, then the count goes up. if b leads a, the count goes down
|
||||
# if a and b stay the same, the count stays the same
|
||||
# if a and b both change, it's an error
|
||||
while read -r a b c; do
|
||||
case "$oa$a$ob$b" in
|
||||
0000) ;;
|
||||
0001) count=$((count-1));;
|
||||
0010) count=$((count+1));;
|
||||
0011) ;;
|
||||
0100) count=$((count+1));;
|
||||
0101) exit 1;;
|
||||
0110) exit 1;;
|
||||
0111) count=$((count-1));;
|
||||
1000) count=$((count-1));;
|
||||
1001) exit 1;;
|
||||
1010) exit 1;;
|
||||
1011) count=$((count+1));;
|
||||
1100) ;;
|
||||
1101) count=$((count+1));;
|
||||
1110) count=$((count-1));;
|
||||
1111) ;;
|
||||
*) echo "$oa$a$ob$b"; exit 1
|
||||
esac
|
||||
oa=$a; ob=$b
|
||||
# if our count doesn't match the stepgen count, it's an error
|
||||
if [ "$c" -ne $count ]; then echo "Counts don't match in the middle (We counted $count, they counted $c)"; exitval=1; fi
|
||||
done < "$1"
|
||||
|
||||
# if the end position isn't 1280, it's an error
|
||||
if [ $count -ne 1280 ]; then echo "Counts don't match at the end (We counted $count, should be 1280)"; exit 1; fi
|
||||
exit $exitval
|
||||
23
tests/stepgen.1/test.hal
Normal file
23
tests/stepgen.1/test.hal
Normal file
@@ -0,0 +1,23 @@
|
||||
setexact_for_test_suite_only
|
||||
|
||||
loadrt sampler cfg=bbs depth=4000
|
||||
loadrt stepgen step_type=2
|
||||
loadrt threads name1=fast period1=100000
|
||||
|
||||
net n0 stepgen.0.phase-A sampler.0.pin.0
|
||||
net n1 stepgen.0.phase-B sampler.0.pin.1
|
||||
net n2 stepgen.0.counts sampler.0.pin.2
|
||||
|
||||
addf stepgen.update-freq fast
|
||||
addf stepgen.make-pulses fast
|
||||
addf stepgen.capture-position fast
|
||||
addf sampler.0 fast
|
||||
|
||||
setp stepgen.0.maxvel .15
|
||||
setp stepgen.0.maxaccel 2
|
||||
setp stepgen.0.position-cmd .04
|
||||
setp stepgen.0.enable 1
|
||||
setp stepgen.0.position-scale 32000
|
||||
|
||||
start
|
||||
loadusr -w halsampler -n 3500
|
||||
Reference in New Issue
Block a user