Permalink
Browse files

add stickMan picture and test script

invoke misc/stickManAnimation.sh after starting clock application to
make a dance floor! :)
  • Loading branch information...
flavio-fernandes committed Apr 6, 2016
1 parent 624d446 commit d43a7cf83768c8a83fa46962d94925e0e2d56b73
Showing with 115 additions and 1 deletion.
  1. +20 −0 ht1632/images.h
  2. +86 −0 misc/stickManAnimation.sh
  3. +5 −1 src/displayInternal.cpp
  4. +4 −0 src/displayTypes.h
View
@@ -71,4 +71,24 @@ const char IMG_8X8 [] { 0b1111, 0b1111, 0b1111, 0b1111, 0b1111, 0b1111, 0b1111,
#define IMG_8X8_WIDTH 8
#define IMG_8X8_HEIGHT 8
// stickman1
const char IMG_STICKMAN1 [] { 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0010, 0b0000, 0b0000, 0b0000, 0b0100, 0b0000, 0b0000, 0b0000, 0b1000, 0b0000, 0b1000, 0b1110, 0b1000, 0b0000, 0b1110, 0b0101, 0b1001, 0b0000, 0b0001, 0b0001, 0b1111, 0b1111, 0b0000, 0b0101, 0b1001, 0b0000, 0b0001, 0b1110, 0b0000, 0b0001, 0b1110, 0b0000, 0b0000, 0b0101, 0b1000, 0b0000, 0b0000, 0b0110, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000 };
#define IMG_STICKMAN1_WIDTH 12
#define IMG_STICKMAN1_HEIGHT 16
// stickman2
const char IMG_STICKMAN2 [] { 0b0000, 0b0100, 0b0000, 0b0000, 0b0000, 0b1000, 0b0000, 0b0000, 0b0000, 0b1000, 0b0000, 0b0000, 0b0000, 0b1000, 0b0000, 0b1000, 0b1110, 0b1000, 0b0000, 0b1110, 0b0101, 0b1001, 0b0000, 0b0001, 0b0001, 0b1111, 0b1111, 0b0000, 0b0101, 0b1001, 0b0000, 0b0001, 0b1110, 0b0000, 0b0001, 0b1110, 0b0000, 0b0000, 0b0001, 0b1000, 0b0000, 0b0000, 0b0010, 0b0000, 0b0000, 0b0000, 0b0110, 0b0000 };
#define IMG_STICKMAN2_WIDTH 12
#define IMG_STICKMAN2_HEIGHT 16
// stickman3
const char IMG_STICKMAN3 [] { 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0110, 0b0000, 0b0000, 0b0000, 0b0101, 0b0000, 0b0000, 0b1000, 0b0000, 0b1000, 0b1110, 0b1000, 0b0000, 0b1110, 0b0101, 0b1001, 0b0000, 0b0001, 0b0001, 0b1111, 0b1111, 0b0000, 0b0101, 0b1001, 0b0000, 0b1111, 0b1110, 0b0000, 0b0001, 0b1000, 0b0000, 0b0000, 0b0001, 0b0000, 0b0000, 0b1000, 0b0000, 0b0000, 0b0000, 0b0100, 0b0000, 0b0000 };
#define IMG_STICKMAN3_WIDTH 12
#define IMG_STICKMAN3_HEIGHT 16
// stickman4
const char IMG_STICKMAN4 [] { 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0100, 0b0000, 0b0000, 0b0000, 0b0110, 0b0000, 0b1110, 0b1000, 0b0001, 0b1000, 0b0101, 0b1001, 0b0000, 0b1111, 0b0001, 0b1111, 0b1111, 0b0000, 0b0101, 0b1001, 0b0000, 0b1111, 0b1110, 0b0000, 0b0001, 0b1000, 0b0000, 0b0000, 0b0001, 0b0000, 0b0000, 0b1110, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000 };
#define IMG_STICKMAN4_WIDTH 12
#define IMG_STICKMAN4_HEIGHT 16
#endif // __IMAGES_H
View
@@ -0,0 +1,86 @@
#!/bin/bash
urlBase='http://localhost:80'
urlImgBg="${urlBase}/imgBackground"
urlMsgBg="${urlBase}/msgBackground"
urlMsgMode="${urlBase}/msgMode"
declare -a on_exit_items
function on_exit()
{
for i in "${on_exit_items[@]}"
do
# echo "on_exit: $i"
eval $i
done
}
function add_on_exit()
{
local n=${#on_exit_items[*]}
on_exit_items[$n]="$*"
if [[ $n -eq 0 ]]; then
# echo "Setting trap fo on_exit"
trap on_exit EXIT
fi
}
function main()
{
# commands to execute on the way out
add_on_exit curl --request POST ${urlImgBg} --data 'clearAll=1'
add_on_exit curl --request POST ${urlMsgMode} --data 'timeout=1'
curl --request POST ${urlImgBg} --data 'clearAll=1'
# curl --request POST ${urlMsgBg} --data 'clearAll=1'
curl --request POST ${urlMsgMode} --data 'timeout=0&confetti=2'
y=0
imgBase=12
color=1
animationSpeed=2 ; # 1=fastest
animationFrames=6
animationInfo="animationStep=${animationSpeed}&animationPhase=${animationFrames}"
while : ; do
x=-2
idx=0
for dancer in $(seq 11); do
curl --request POST ${urlImgBg} --data \
"index=${idx}&imgArt=$((imgBase+0))&enabled=1&color=${color}&x=${x}&y=${y}&${animationInfo}&animationPhaseValue=$((idx % animationFrames))"
idx=$((idx + 1))
curl --request POST ${urlImgBg} --data \
"index=${idx}&imgArt=$((imgBase+1))&enabled=1&color=${color}&x=${x}&y=${y}&${animationInfo}&animationPhaseValue=$((idx % animationFrames))"
idx=$((idx + 1))
curl --request POST ${urlImgBg} --data \
"index=${idx}&imgArt=$((imgBase+2))&enabled=1&color=${color}&x=${x}&y=${y}&${animationInfo}&animationPhaseValue=$((idx % animationFrames))"
idx=$((idx + 1))
curl --request POST ${urlImgBg} --data \
"index=${idx}&imgArt=$((imgBase+3))&enabled=1&color=${color}&x=${x}&y=${y}&${animationInfo}&animationPhaseValue=$((idx % animationFrames))"
idx=$((idx + 1))
curl --request POST ${urlImgBg} --data \
"index=${idx}&imgArt=$((imgBase+2))&enabled=1&color=${color}&x=${x}&y=${y}&${animationInfo}&animationPhaseValue=$((idx % animationFrames))"
idx=$((idx + 1))
curl --request POST ${urlImgBg} --data \
"index=${idx}&imgArt=$((imgBase+1))&enabled=1&color=${color}&x=${x}&y=${y}&${animationInfo}&animationPhaseValue=$((idx % animationFrames))"
idx=$((idx + 1))
idx=$((idx + 2)) ; # skip some idx to make dancers out of sync from each other
x=$((x + 12)) ; # update x for spot where next dancer will be
color=$((color + 1)) ; color=$((color % 3)) ; # make next dancer with different color
done
sleep 13
done
}
main
View
@@ -709,7 +709,11 @@ static ImgArtInfo getImgArtInfo(ImgArt imgArt) {
case imgArtSpeakerA: GET_ART_INFO(SPEAKER_A); break;
case imgArtSpeakerB: GET_ART_INFO(SPEAKER_B); break;
//
case imgArt8x8: GET_ART_INFO(8X8); break;
case imgArt8x8: GET_ART_INFO(8X8); break;
case imgArtStickMan1: GET_ART_INFO(STICKMAN1); break;
case imgArtStickMan2: GET_ART_INFO(STICKMAN2); break;
case imgArtStickMan3: GET_ART_INFO(STICKMAN3); break;
case imgArtStickMan4: GET_ART_INFO(STICKMAN4); break;
default: GET_ART_INFO(SMILEY); break;
}
View
@@ -44,6 +44,10 @@ typedef enum {
X(imgArtSpeakerA), \
X(imgArtSpeakerB), \
X(imgArt8x8), \
X(imgArtStickMan1), \
X(imgArtStickMan2), \
X(imgArtStickMan3), \
X(imgArtStickMan4), \
X(imgArtLast)
#define X(x) x

0 comments on commit d43a7cf

Please sign in to comment.