support for one-wire termal sensor
authorPaul Hänsch <paul@plutz.net>
Sat, 29 Dec 2018 17:09:07 +0000 (18:09 +0100)
committerPaul Hänsch <paul@plutz.net>
Sat, 29 Dec 2018 17:09:07 +0000 (18:09 +0100)
Makefile
files/boot/config.txt
files/etc/rc.local
gummikraken.mk
sensors/hatch.sh [new file with mode: 0755]
sensors/sensor_temp.sh [new file with mode: 0755]
teesock.mk

index 5616e00..b24b42b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -74,10 +74,11 @@ files/root/.ssh/authorized_keys: id_rsa.pub
        chmod 700 files/root/ files/root/.ssh/
        chmod 600 '$@'
 
-include gummikraken.mk
-include teesock.mk
+# include gummikraken.mk
+# include teesock.mk
+include *.mk
 
-raspi.img: raspi_root/ files/ partitions files/root/.ssh/authorized_keys files/etc/network/interfaces.d/wifi files/srv/gummikraken/ files/usr/local/bin/teesock
+raspi.img: raspi_root/ files/ partitions files/root/.ssh/authorized_keys files/etc/network/interfaces.d/wifi
        -rmdir "$@.mnt"
        mkdir "$@.mnt"  # fail receipe if dir is nonempty
        dd bs=1M count=0 seek=1792 of="$@"  # set up sparse file
index 288a466..53d5a7b 100644 (file)
@@ -4,3 +4,4 @@
 # see config.example for the Oktopus build config
 
 dtparam=audio=on
+dtoverlay=w1-gpio
index 0d93731..05ff1c3 100755 (executable)
@@ -1,5 +1,8 @@
 #!/bin/sh
 
+modprobe w1-gpio pullup=1
+modprobe w1-therm
+
 bt-network -s nap br0 &
 hciconfig hci0 up
 hciconfig hci0 sspmode 1
index 812a3b4..18651b1 100644 (file)
@@ -1,5 +1,7 @@
-files/srv/gummikraken/: gummikraken/
+files/srv/gummikraken/: gummikraken/ sensors/ .FORCE
        mkdir -p "$@"
-       cp -av "$</." "$@/."
+       cp -av "$</." sensors/. "$@/."
        chmod a+rX -R "$@"
        cp gummikraken/inetd.conf files/etc/inetd.conf
+
+raspi.img: files/srv/gummikraken/
diff --git a/sensors/hatch.sh b/sensors/hatch.sh
new file mode 100755 (executable)
index 0000000..6cf7560
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+sock=/tmp/oktopus.sock
+
+rm "$sock"
+
+( cd "${0%/*}/"
+  for n in ./sensor_*.sh; do
+    $n &
+  done
+  for n in ekg pulse oxygen heartrate systole diastole; do
+    ./gummikraken.sh ./gummikraken.data $n &
+  done
+) | teesock "$sock" &
+
+for n in 1 2 3 4 5 6 7 8 9 0; do [ ! -S "$sock" ] && sleep 1; done
+chmod a+rw "$sock"
diff --git a/sensors/sensor_temp.sh b/sensors/sensor_temp.sh
new file mode 100755 (executable)
index 0000000..b78e05f
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+while sleep 1; do
+  sed -nr 's;^.*t=([0-9]{3})[0-9]{2};temperature \1;p' /sys/bus/w1/devices/28-*/w1_slave
+done
index ef2d2d7..f3165c1 100644 (file)
@@ -6,3 +6,5 @@ files/usr/local/bin/teesock: teesock/teesock.arm
        mkdir -p files/usr/local/bin
        chmod 755 files/usr/ files/usr/local/ files/usr/local/bin/
        cp -av "$<" "$@"
+
+raspi.img: files/usr/local/bin/teesock