blob: aed336702223bab0717c0a3d1cdcbe43d1917fdc (
plain)
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
|
#!/usr/bin/perl -w
$top = 28; # Number of LEDs at the top
$bot = 28; # Number of LEDs at the bottom
$left = 16; # Number of LEDs on the left => might be higher than physically when $cor=1
$right = 16; # Number of LEDs on the right => might be higher than physically when $cor=1
$horz = 3; # horizontal deep on left/right (grabbed Fields)
$vert = 2; # vertical deep at top/bottom (grabbed Fields)
@fit = ('bot', 'right', 'top', 'left'); # pyhsical/technical LED setup
$dir = 'r'; # forward or reverse (clock) direction (f/r)
$cor = 0; # have a single LED in each corner (0/1)
$shift = 0; # shift first LED to last position (0/1)
############## Do not touch below here ##############
$top = $top-1;
$bot = $bot-1;
$left = $left-1;
$right = $right-1;
$horz = $horz-1;
$vert = $vert-1;
for ($t=0;$t<=$top;$t++) {
$value = "led top $t 0";
push(@top, $value);
}
for ($b=$bot;$b>=0;$b--) {
$vert1 = $right-$vert;
$value = "led bot $b $right";
push(@bot, $value);
}
for ($l=$left;$l>=0;$l--) {
if ( $cor==1 and ($l==0 or $l==$left-1)) { next; }
$value = "led left 0 $l";
push(@left, $value);
}
for ($r=0;$r<=$right;$r++) {
if ( $cor==1 and ($r==0 or $r==$right-1)) { next; }
$horz1 = $top-$horz;
$value = "led right $top $r";
push(@right, $value);
}
if ($dir eq 'r') {
@left = reverse(@left);
@bot = reverse(@bot);
@right = reverse(@right);
@top = reverse(@top);
}
open (CONF, ">seduatmo.conf") or die "Can't open CONF file\n";
$cnt = 1;
foreach $side(@fit) {
print CONF "# $side\n";
if ($cnt==1 and $shift==1) {
$first = $$side[0];
shift(@$side);
}
print CONF join("\n",@$side);
print CONF "\n\n";
$cnt++
}
if ($shift==1) {
print CONF "# shift first LED to last position\n";
print CONF $first, "\n";
}
close CONF;
|