Tool: showgfx.h, viel hardcoded und ruckelt
This commit is contained in:
parent
265ae2f0ac
commit
aaea4c0353
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
echo "Identified $1 with ${width} width and ${height} height."
|
||||
size=32
|
||||
convert -rotate 90 -resize 32x32 "$1" 64.png
|
||||
filename="64.png"
|
||||
width=$(identify 64.png | cut -d' ' -f 3 | cut -d 'x' -f 1)
|
||||
width=$(echo 10*${width}-8 | bc)
|
||||
height=$(identify 64.png | cut -d' ' -f 3 | cut -d 'x' -f 2)
|
||||
height=$(echo 10*${height}-8 | bc)
|
||||
curx=0
|
||||
cury=0
|
||||
chx=5
|
||||
chy=7
|
||||
|
||||
while true; do
|
||||
let curx=curx+chx
|
||||
let cury=cury+chy
|
||||
if [[ ${curx} -gt ${width} || ${curx} -lt 0 ]]; then
|
||||
let chx=-1*chx
|
||||
let curx=curx+2*chx
|
||||
fi
|
||||
if [[ ${cury} -gt ${height} || ${cury} -lt 0 ]]; then
|
||||
let chy=-1*chy
|
||||
let cury=cury+2*chy
|
||||
fi
|
||||
echo "${curx} ${chx} ${cury} ${chy}"
|
||||
actx=$(echo ${curx}/10 | bc)
|
||||
acty=$(echo ${cury}/10 | bc)
|
||||
pixelstring=$(convert -crop 8x8+${actx}+${acty} "${filename}" rgb:- | xxd -ps | sed 's/\(......\)/#\1/g' | tr '[:lower:]' '[:upper:]' | tr -d '\n')
|
||||
mosquitto_pub -h raum.ctdo.de -t 'homie/pixelbox/pixel/pixels/set' -m "${pixelstring}"
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue