File: test-startup.sh

package info (click to toggle)
ledcontrol 0.5.2-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 792 kB
  • ctags: 259
  • sloc: ansic: 3,264; sh: 848; makefile: 176; perl: 49
file content (137 lines) | stat: -rwxr-xr-x 2,187 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#! /bin/sh

#
# This script is used as the startup script in "make test".
# This file is NOT intended to be executed by the user!
#

# fd 5 is used as the messaging channel.

### Functions

ECHONE () {
    echo -ne "$*" >&5
}

ECHO () {
    echo "$*" >&5
}

CMD () {
    echo ">$* " >&5
    echo "$*"
}

waitforfile () {
    while test -e /tmp/$1 ; do
	sleep 1
    done
}

waiting () {
    COUNT=$1
    while test "$COUNT" -gt 0; do
	ECHONE "  Waiting $COUNT...   \r"
	sleep 1
	COUNT=$[ $COUNT - 1 ]
    done
    ECHO "  Waiting 0...   "
}

### Main piece

ECHO "  I'm here..."
touch /tmp/ledd-test-first

waitforfile ledd-test-first
ECHO "  Aye-aye, sir!"


#####


ECHO
ECHO "  First a simple one... Caps Lock BLINKING, Scroll Lock ON"
ECHO

CMD set s on
CMD set c blink 500

waiting 7
CMD set ncs off


#####


ECHO
ECHO "  Now the DUTYCYCLE sequence. Ranges from 0 to 10 on a Scroll Lock near you."
ECHO

COUNT=-1
while test "$COUNT" -le 11; do
    CMD set s dutycycle 1000 0 10 $COUNT
    sleep 5
    COUNT=$[ $COUNT + 2 ]
done
ECHO
CMD set ncs off


#####


ECHO
ECHO "  And the similar, but slightly different FREQUENCY."
ECHO

COUNT=-1
while test "$COUNT" -le 11; do
    CMD set s frequency 0 1000 10 100 $COUNT
    sleep 5
    COUNT=$[ $COUNT + 2 ]
done
ECHO
CMD set ncs off


#####


ECHO
ECHO "  And then ANIMATION! The LEDs should first one at a time go"
ECHO "  on and off, then start flashing with a beam moving over them."
ECHO

sleep 2

CMD anim 1000 N 1000 nC 1000 cS 1000 s 1000 loop N 100 C 100 n 100 S 100 c 100 s 100 S 100 C 100 s 100 N 100 c 100 n 100

waiting 15

ECHO
CMD anim

#####


ECHO
ECHO "  ...and a little tune. Imagine Scroll Lock to be the highest tone."
ECHO

sleep 2

CMD anim scn 1000 S 500 sC 500 cN 500 n 500 S 500 sC 500 cN 500 n 500 N 100 n 100 N 100 n 100 N 100 n 100 N 100 n 100 C 100 c 100 C 100 c 100 C 100 c 100 C 100 c 100 S 500 sC 500 cN 500 n 500 S 500 sC 500 cN 500 n 500 S 500 sC 500 cN 500 n 500 N 100 n 100 N 100 n 100 N 100 n 100 N 100 n 100 C 100 c 100 C 100 c 100 C 100 c 100 C 100 c 100 S 500 sC 500 cN 500 n 1000

waiting 18


#####


ECHO
ECHO "  Thats all from me... now back to your host!"
ECHO

touch /tmp/ledd-test-second