-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Lordnibbler/halo
Remove Halo.pl!
- Loading branch information
Showing
15 changed files
with
349 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
colors.txt | ||
node_modules/* | ||
npm-debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ node_js: | |
- "0.10.30" | ||
before_install: | ||
script: | ||
- "which node" | ||
- "npm test" | ||
|
||
env: | ||
- NODE_ENV=test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[Unit] | ||
Description=Wifi Startup Retry | ||
|
||
[Service] | ||
WorkingDirectory=/home/root/colorpicker-beaglebone/wifiboot | ||
ExecStart=/home/root/colorpicker-beaglebone/wifiboot/wifiboot.sh | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh - | ||
sleep 10 | ||
|
||
# enable the UART1 in the device tree | ||
echo BB-UART1 > /sys/devices/bone_capemgr.9/slots | ||
|
||
# Set proper UART settings with STTY | ||
stty -F /dev/ttyO1 speed 115200 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts | ||
|
||
# start the node client application | ||
cd /home/root/colorpicker-beaglebone/ | ||
NODE_ENV=production npm start |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
#!/usr/bin/perl | ||
|
||
# use Device::SerialPort; | ||
use Time::HiRes qw(usleep time); | ||
use POSIX ":sys_wait_h"; | ||
#use LWP::Simple qw (get); | ||
|
||
# @FIXME missing this dir in github! | ||
$cmddir = "/home/root/halo_git/commands/"; | ||
|
||
our $NUM_LIGHTS = 5; | ||
my $SYSTEM_ON = 0; | ||
my $LIVE_PREVIEW = 1; | ||
|
||
@oldRgb; | ||
for($j = 0;$j < $NUM_LIGHTS; $j++){ | ||
push(@{$oldRgb[$j]},(0,0,0,0)); | ||
} | ||
|
||
# system("echo 20 > /sys/kernel/debug/omap_mux/uart1_rxd"); | ||
# system("echo 0 > /sys/kernel/debug/omap_mux/uart1_txd"); | ||
system("echo BB-UART1 > /sys/devices/bone_capemgr.9/slots"); | ||
system("stty -F /dev/ttyO1 speed 115200 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts"); | ||
|
||
$|=1; | ||
|
||
# Opens file whose filename is given by EXPR (> /dev/tty01), and associates it with FILEHANDLE (SERIAL) | ||
open(SERIAL, "> /dev/ttyO1"); | ||
|
||
sysopen(PREVIEW_DATA, "/home/root/colorpicker-beaglebone/colors.txt", O_RONLY) | ||
or die "can't read pipe: $!"; | ||
|
||
{ | ||
my $previous_default = select(STDOUT); # save previous default | ||
select(SERIAL); | ||
$|++; # autoflush STDERR, to be sure | ||
select($previous_default); # restore previous default | ||
} | ||
|
||
# set all black | ||
for(my $address = 0; $address < $NUM_LIGHTS; $address ++){ | ||
&sendColor($address,0,0,0,0); | ||
} | ||
|
||
sub sendColor { | ||
my($address,$r,$g,$b,$v)= @_; | ||
$address = $address + 1; | ||
print SERIAL "4,$address,$r,$g,$b,$v;"; | ||
} | ||
|
||
sub turnOffAll { | ||
while(waitpid(-1,WNOHANG ) >= 0) {} | ||
for(my $address = 0; $address < $NUM_LIGHTS; $address ++){ | ||
&sendColor($address,0,0,0,0); | ||
@{$oldRgb[$address]} = (0,0,0,0); | ||
} | ||
} | ||
|
||
|
||
|
||
$start_time = time(); | ||
|
||
sub grabLiveData{ | ||
# print @preview_data; | ||
|
||
$rin = ''; | ||
vec($rin, fileno(PREVIEW_DATA), 1) = 1; | ||
$nfound = select($rin, undef, undef, 0); # just check | ||
if ($nfound) { | ||
@processed_data = (); | ||
while($color = <PREVIEW_DATA>){ | ||
#print $color; | ||
#print "Glen\n"; | ||
if($color =~ /.*END_LINE.*/){ | ||
# print "END_FILE FOUND\n"; | ||
last; | ||
} | ||
if($color =~ /([0-9]+)\,([0-9]+)\,([0-9]+)\,([0-9]+)/){ | ||
# print "$1, $2, $3, $4 found\n"; | ||
my @rgb = ($1,$2,$3,0); | ||
push(@processed_data,[@rgb]); | ||
} | ||
} | ||
|
||
# close PREVIEW_DATA or die "bad netstat: $! $?"; | ||
$previewLength = @processed_data; | ||
if( $previewLength > 0){ | ||
my $end_time = time(); | ||
printf("%d %.6f\n", $previewLength,$end_time - $start_time); | ||
$start_time = time(); | ||
# print "$previewLength data chunks\n"; | ||
$start =0; | ||
if($previewLength > $NUM_LIGHTS){ | ||
$start = $previewLength - $NUM_LIGHTS; | ||
}else{ | ||
$start = 0; | ||
} | ||
# print "i is $i, total size is $previewLength"; | ||
$address = 0; | ||
for($i = $start;$i< $previewLength; $i ++){ | ||
my @rgb = @{$processed_data[$i]}; | ||
# print @rgb; | ||
# printf("address %d R= %d G=%d B=%d\n",$address,$rgb[0],$rgb[1],$rgb[2],$rgb[3]); | ||
&sendColor($address,$rgb[0],$rgb[1],$rgb[2],$rgb[3]); | ||
$address ++; | ||
} | ||
if($previewLength < $NUM_LIGHTS){ | ||
while($address < $NUM_LIGHTS){ | ||
&sendColor($address,0,0,0,0); | ||
$address ++; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
while(1){ | ||
if($LIVE_PREVIEW == 1){ | ||
&grabLiveData(); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.