22
33rm -f gcode-output
44
5+ if ! command -v nc ; then
6+ echo " E: Binary 'nc' not in PATH or not installed."
7+ exit 1
8+ fi
9+
10+ if ! command -v linuxcnc ; then
11+ echo " E: Binary 'linuxcnc' not in PATH or not installed."
12+ exit 1
13+ fi
14+
515if nc -z localhost 5007; then
6- echo " Process already listening on port 5007. Exiting"
16+ echo " E: Process already listening on port 5007. Exiting"
717 exit 1
818fi
919
@@ -13,31 +23,31 @@ linuxcnc -r linuxcncrsh-test.ini &
1323# let linuxcnc come up
1424TOGO=80
1525while [ $TOGO -gt 0 ]; do
16- echo trying to connect to linuxcncrsh TOGO=$TOGO
26+ echo " I: trying to connect to linuxcncrsh TOGO=$TOGO "
1727 if nc -z localhost 5007; then
1828 break
1929 fi
2030 sleep 0.25
2131 TOGO=$(( $TOGO - 1 ))
2232done
2333if [ $TOGO -eq 0 ]; then
24- echo connection to linuxcncrsh timed out
34+ echo " E: connection to linuxcncrsh timed out"
2535 exit 1
2636fi
2737
2838# switch back and forth between tool 1 and tool 2 every few MDI calls
2939rm -f expected-gcode-output lots-of-gcode
30- printf " P is %.6f\n " -100 >> expected-gcode-output
40+ echo " P is -100.000000 " >> expected-gcode-output
3141NUM_MDIS=1
3242NUM_MDIS_LEFT=$NUM_MDIS
3343TOOL=1
3444for i in $( seq 0 1000) ; do
3545 NUM_MDIS_LEFT=$(( $NUM_MDIS_LEFT - 1 ))
3646 if [ $NUM_MDIS_LEFT -eq 0 ]; then
3747 echo " set mdi o<queue-buster> call [$TOOL ]" >> lots-of-gcode
38- printf " P is 12345.000000\n " >> expected-gcode-output
39- printf " P is %.6f\n " $(( - 1 * $TOOL )) >> expected-gcode-output
40- printf " P is 54321.000000\n " >> expected-gcode-output
48+ echo " P is 12345.000000" >> expected-gcode-output
49+ echo " P is $(( - 1 * $TOOL )) .000000 " >> expected-gcode-output
50+ echo " P is 54321.000000" >> expected-gcode-output
4151
4252 if [ $TOOL -eq 1 ]; then
4353 TOOL=2
@@ -53,9 +63,9 @@ for i in $(seq 0 1000); do
5363 NUM_MDIS_LEFT=$NUM_MDIS
5464 fi
5565 echo " set mdi m100 p$i " >> lots-of-gcode
56- printf " P is %.6f\n " $i >> expected-gcode-output
66+ echo " P is $i .000000 " >> expected-gcode-output
5767done
58- printf " P is %.6f\n " -200 >> expected-gcode-output
68+ echo " P is -200.000000 " >> expected-gcode-output
5969
6070(
6171 echo hello EMC mt 1.0
0 commit comments