This commit is contained in:
David Carley
2022-07-23 13:04:41 -07:00
parent 2e08c824de
commit 15a98972b3
21 changed files with 328 additions and 2932 deletions

View File

@@ -1,37 +0,0 @@
#!/usr/bin/env python3
'''Check that the configuration variable template used on the RPi matches the
variables used in the AVR'''
import sys
import json
templ = json.load(open('src/resources/config-template.json', 'r'))
vars = json.load(open('avr/build/vars.json', 'r'))
def check(section):
errors = 0
for name, entry in section.items():
if 'type' in entry:
ok = False
# TODO check that defaults are valid
# TODO check that types match
if 'code' in entry and not entry['code'] in vars:
print('"%s" with code "%s" not found' % (name, entry['code']))
else: ok = True
if not ok: errors += 1
else: errors += check(entry)
return errors
errors = check(templ)
print('\n%d errors' % errors)
sys.exit(errors != 0)

View File

@@ -1,17 +0,0 @@
#!/bin/bash -ex
ROOT="$PWD/demo"
# Clean up on EXIT
function cleanup {
umount "$ROOT"/{dev/pts,dev,sys,proc} 2>/dev/null || true
}
trap cleanup EXIT
# mount binds
mount --bind /dev "$ROOT/dev/"
mount --bind /sys "$ROOT/sys/"
mount --bind /proc "$ROOT/proc/"
mount --bind /dev/pts "$ROOT/dev/pts"
chroot "$ROOT" "$@"

View File

@@ -93,6 +93,14 @@ if [ $? -ne 0 ]; then
REBOOT=true
fi
# Set the default locale to en_US
grep '^en_US.UTF-8 UTF-8' /etc/locale.gen >/dev/null
if [ $? -ne 0 ]; then
perl -pi -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen
locale-gen en_US.UTF-8
update-locale en_US.UTF-8
fi
# Install .Xresources & .xinitrc
cp scripts/Xresources ~pi/.Xresources
chown pi:pi ~pi/.Xresources

View File

@@ -1,27 +0,0 @@
#!/usr/bin/env python3
import json
import sys
p = [0, 0, 0]
print('F400 G21')
for line in sys.stdin:
try:
if not line.startswith('I:Comm:> '): continue
line = line[9:]
data = json.loads(line)
changed = False
for axis in range(3):
var = 'xyz'[axis] + 'p'
if var in data:
p[axis] = data[var]
changed = True
if changed: print('G1 X%d Y%d Z%d' % tuple(p))
except json.decoder.JSONDecodeError: pass

View File

@@ -1,23 +0,0 @@
#!/usr/bin/env python3
import sys
import subprocess
import os.path
import time
if not os.path.exists('/dev/video0'):
print('/dev/video0 not found')
sys.exit(1)
p = subprocess.Popen('udevadm info -q path /dev/video0'.split(),
stdout = subprocess.PIPE)
s = p.communicate()[0].decode('utf-8')
dev = s.split('/')[7]
with open('/sys/bus/usb/drivers/usb/unbind', 'w') as f:
f.write(dev)
time.sleep(1)
with open('/sys/bus/usb/drivers/usb/bind', 'w') as f:
f.write(dev)

View File

@@ -1,16 +0,0 @@
#!/bin/bash
USER=bbmc
HOST=bbctrl.local
if [ $# -eq 1 ]; then
if [[ "$1" = *@ ]]; then
LOGIN="$1"
else
LOGIN=$USER@"$1"
fi
else
LOGIN=$USER@$HOST
fi
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$LOGIN"

View File

@@ -1,64 +0,0 @@
function convertToAbsolute(path) {
var x0, y0, x1, y1, x2, y2, segs = path.pathSegList;
for (var x = 0, y = 0, i = 0, len = segs.numberOfItems; i < len; i++) {
var seg = segs.getItem(i), c = seg.pathSegTypeAsLetter;
if (/[MLHVCSQTA]/.test(c)){
if ('x' in seg) x = seg.x;
if ('y' in seg) y = seg.y;
} else {
if ('x1' in seg) x1 = x + seg.x1;
if ('x2' in seg) x2 = x + seg.x2;
if ('y1' in seg) y1 = y + seg.y1;
if ('y2' in seg) y2 = y + seg.y2;
if ('x' in seg) x += seg.x;
if ('y' in seg) y += seg.y;
switch(c) {
case 'm':
segs.replaceItem(path.createSVGPathSegMovetoAbs(x, y), i);
break;
case 'l':
segs.replaceItem(path.createSVGPathSegLinetoAbs(x, y), i);
break;
case 'h':
segs.replaceItem(path.createSVGPathSegLinetoHorizontalAbs(x), i);
break;
case 'v':
segs.replaceItem(path.createSVGPathSegLinetoVerticalAbs(y), i);
break;
case 'c':
segs.replaceItem(
path.createSVGPathSegCurvetoCubicAbs(x, y, x1, y1, x2, y2), i);
break;
case 's':
segs.replaceItem(
path.createSVGPathSegCurvetoCubicSmoothAbs(x, y, x2, y2), i);
break;
case 'q':
segs.replaceItem(
path.createSVGPathSegCurvetoQuadraticAbs(x, y, x1, y1), i);
break;
case 't':
segs.replaceItem(
path.createSVGPathSegCurvetoQuadraticSmoothAbs(x, y), i);
break;
case 'a':
segs.replaceItem(
path.createSVGPathSegArcAbs(x, y, seg.r1, seg.r2, seg.angle,
seg.largeArcFlag, seg.sweepFlag), i);
break;
case 'z': case 'Z':
x = x0;
y = y0;
break;
}
}
// Record the start of a subpath
if (c == 'M' || c == 'm') x0 = x, y0 = y;
}
}