chiark / gitweb /
quacks-ingredients: gcode manipulation
[reprap-play.git] / quacks-ingredients-make-copy-gcodes
index c2c08492963f75dd708553b5791a7c0cf3a6b385..bcddcf7a1948301ce4fe19525fed462acdace716 100755 (executable)
@@ -14,9 +14,6 @@ set -e
 f=$1
 shift
 
-umount /media/sd >/dev/null 2>&1 ||:
-mount /media/sd
-
 lhs=quacks-ingredients-L
 
 gh () {
@@ -31,17 +28,21 @@ for l in 1 2 3 4 5; do
        1|2|3|4)
                perl -i~ -pe 's/^/;/ if m/^M140 S0\b.*\n/' $g
                ;;
-       5)      ;;
-       *)      echo >&2 "??? $l"; exit 1 ;;
        esac
 
        perl -i~ -ne '
                $l =~ s/^/;/ if m/^M400/;
+               $l .= "G91\nG1 Z5\nG90\n" if m/^M84/;
                print $l or die $!;
                $l = $_;
                END { print $l or die $!; }
        ' $g
+done
 
+umount /media/sd >/dev/null 2>&1 ||:
+mount /media/sd
+
+for l in 1 2 3 4 5; do
        cp $g $h
 done