]> git.plutz.net Git - rpi_small/commitdiff
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 5616e00e0a2ff824e3061e8586189d8e7d4f5ae9..b24b42bc2ee50b1f6ec0fb49b522aa6f91236d0e 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 288a466554514f8cde77870ff5624e0b3145fca0..53d5a7bbaab71581c3cac279af35a6334bf24f49 100644 (file)
@@ -4,3 +4,4 @@
 # see config.example for the Oktopus build config
 
 dtparam=audio=on
+dtoverlay=w1-gpio
index 0d93731f8e9d30318f5309f3d8e835eac09188b5..05ff1c32836513b132b6e782b6faee44a91275a8 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 812a3b49898206c5da817c7c8652dbddf656a02c..18651b12f52531105bd09fcb813b3fa2c72b5a23 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 ef2d2d7fd1da40b227997ccc5d48127f898fb767..f3165c1fc785d8f2545f514b11cc832dc72102ed 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