Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tv_panel
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hermod
tv_panel
Commits
fca1be81
Commit
fca1be81
authored
7 years ago
by
Hermod
Browse files
Options
Downloads
Patches
Plain Diff
Using system pipe to diplay color instantly, updated README
parent
4031e242
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
README.md
+20
-10
20 additions, 10 deletions
README.md
scripts/nfc-poll-wrapper.sh
+2
-2
2 additions, 2 deletions
scripts/nfc-poll-wrapper.sh
scripts/statusRGB_listener.py
+80
-0
80 additions, 0 deletions
scripts/statusRGB_listener.py
scripts/waitForNetwork
+2
-1
2 additions, 1 deletion
scripts/waitForNetwork
with
104 additions
and
13 deletions
README.md
+
20
−
10
View file @
fca1be81
...
...
@@ -4,20 +4,29 @@
## Installation
### Beginning
-
Create user
`hermod`
:
`adduser hermod`
-
Create user
`hermod`
:
(as root or
`sudo`
)
`adduser hermod`
-
Put it in the same groups as pi (other than the
`pi`
group):
`groups pi | sed 's/ /,/g'`
,
`usermod -a -G group1,group2,... hermod`
c
hange
`pi`
and
`root`
passwords
-
C
hange
`pi`
and
`root`
passwords
-
`sudo apt remove wolfram-engine minecraft-pi`
-
`sudo apt autoremove`
-
`sudo apt update && sudo apt upgrade && sudo reboot`
-
`sudo apt install git vim screen htop`
-
`sudo date -s '2018-02-15 2:26:00'`
if needed
-
`sudo date -s '2018-02-15 2:26:00'`
if needed
(change the date to current date ofc)
-
Generate RSA key
`ssh-keygen -t rsa -C "hermod.inno@gmail.com" -b 4096`
and add it to gitlab
-
Clone project in
`~`
:
`git clone git@gitlab.viarezo.fr:hermod/tv_panel.git`
-
`cp front/src/config.template.js front/src/config.js`
-
`cp server/config.template.js server/config.js`
-
Useful links:
`ln -s ~/tv_panel/scripts/.screenrc ~/`
,
`ln -s ~/tv_panel/scripts/.vimrc ~/`
### Telegram message on statup to get IP address
-
`cp scripts/waitForNetwork /root/scripts/waitForNetwork`
-
`cp scripts/startup-telegram-message /root/scripts/startup-telegram-message`
-
`sudo vim /root/scripts/startup-telegram-message`
to add the token and chat id
-
Add in root crontab (
`sudo crontab -e`
):
```
@reboot sleep 1 && /root/scripts/waitForNetwork && /root/scripts/startup-telegram-message
```
### Boot config
`vim /boot/config.txt`
to comment out
`dtparam=audio=on`
->
`#dtparam=audio=on`
and add
```
...
...
@@ -50,14 +59,14 @@ After reboot or log out - log in, `npm install -g yarn`
-
`sudo ./test`
to test
-
`follow ./python/README.md for python installation`
Script without password for sudo:
-
`sudo mkdir /hermod_bin`
-
`cp tv_panel/scripts/statusRGB.py /hermod_bin/`
-
`sudo visudo`
to add
To display a status LED without root
-
`cp scripts/statusRGB_listener.py /root/scripts/statusRGB_listener.py`
(from
`tv_panel`
directory)
-
Add in root crontab (
`sudo crontab -e`
):
```
# Allow the scripts here to be run without sudo password
hermod ALL=(ALL) NOPASSWD: /hermod_bin/statusRGB.py
@reboot /usr/bin/python3 /root/scripts/statusRGB_listener.py
```
-
Reboot or run
`/usr/bin/python3 /root/scripts/statusRGB_listener.py &`
as root
-
To display a color for t seconds (float):
`echo "55ee33 1" > /dev/rgb_pipe`
### Disable screen sleeping
...
...
@@ -72,7 +81,8 @@ hermod ALL=(ALL) NOPASSWD: /hermod_bin/statusRGB.py
-
Wiring: VCC -> 5V, GND -> GND, RX -> TX, TX -> RX
-
In
`sudo raspi-config`
, disable serial messages but enable serial interface
```
wget https://github.com/nfc-tools/libnfc/releases/download/libnfc-1.7.1/libnfc-1.7.1.tar.bz2
```
wget https://github.com/nfc-tools/libnfc/releases/download/libnfc-1.7.1/libnfc-1.7.1.tar.bz2
tar xvjf libnfc-1.7.1.tar.bz2
cd libnfc-1.7.1
./configure --prefix=/usr --sysconfdir=/etc
...
...
This diff is collapsed.
Click to expand it.
scripts/nfc-poll-wrapper.sh
+
2
−
2
View file @
fca1be81
...
...
@@ -6,9 +6,9 @@ do
if
[[
!
-z
"
$res
"
]]
then
echo
$res
sudo
/hermod_bin/statusRGB.py 11ff11
-t
0.2 &
echo
"11ff11 0.2"
>
/dev/rgb_pipe
else
sudo
/hermod_bin/statusRGB.py ff1111
-t
0.2 &
echo
"ff1111 0.2"
>
/dev/rgb_pipe
fi
sleep
1
done
This diff is collapsed.
Click to expand it.
scripts/statusRGB_listener.py
0 → 100755
+
80
−
0
View file @
fca1be81
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import
os
import
sys
import
time
import
argparse
import
select
from
neopixel
import
Adafruit_NeoPixel
,
ws
"""
This script opens a pipe to access the RGB status LED by writing into it.
When the script is running, you can use
'
echo
"
11ee55 3
"
> PIPE_PATH
'
(PIPE_PATH defined below) to display the color 11ee55 for 3 seconds.
It must be run as root.
"""
# LED strip configuration:
LED_COUNT
=
1
# Number of LED pixels.
LED_PIN
=
18
# GPIO pin connected to the pixels (18 uses PWM!).
LED_FREQ_HZ
=
800000
# LED signal frequency in hertz (usually 800khz)
LED_DMA
=
10
# DMA channel to use for generating signal (try 10)
LED_BRIGHTNESS
=
255
# Set to 0 for darkest and 255 for brightest
LED_INVERT
=
False
# True to invert the signal (when using NPN transistor level shift)
LED_CHANNEL
=
0
# set to '1' for GPIOs 13, 19, 41, 45 or 53
LED_STRIP
=
ws
.
WS2811_STRIP_GRB
# Strip type and colour ordering
PIPE_PATH
=
'
/dev/rgb_pipe
'
def
sanitize_color
(
s
):
"""
Return (r, g, b) levels from html color format
"""
hex_color
=
s
.
lstrip
(
'
#
'
)
if
len
(
hex_color
)
==
3
:
hex_color
=
'
{0}{0}{1}{1}{2}{2}
'
.
format
(
*
hex_color
)
if
len
(
hex_color
)
!=
6
:
return
None
(
r
,
g
,
b
)
=
(
int
(
x
,
16
)
for
x
in
[
hex_color
[
i
:
i
+
2
]
for
i
in
(
0
,
2
,
4
)])
return
r
,
g
,
b
if
__name__
==
'
__main__
'
:
if
not
os
.
path
.
exists
(
PIPE_PATH
):
os
.
mkfifo
(
PIPE_PATH
)
os
.
system
(
'
chmod 666
'
+
PIPE_PATH
)
# Acces r+w for non-root users
# Create NeoPixel object with appropriate configuration.
strip
=
Adafruit_NeoPixel
(
LED_COUNT
,
LED_PIN
,
LED_FREQ_HZ
,
LED_DMA
,
LED_INVERT
,
LED_BRIGHTNESS
,
LED_CHANNEL
,
LED_STRIP
)
# Intialize the library (must be called once before other functions).
strip
.
begin
()
with
open
(
PIPE_PATH
,
'
r
'
)
as
fifo
:
while
True
:
select
.
select
([
fifo
],[],[
fifo
])
data0
=
fifo
.
read
().
strip
()
data
=
data0
.
split
(
'
'
)
colors
=
sanitize_color
(
data
[
0
])
if
colors
is
None
:
continue
r
,
g
,
b
=
colors
try
:
t
=
float
(
data
[
1
])
except
:
t
=
-
1
strip
.
setPixelColorRGB
(
0
,
r
,
g
,
b
)
strip
.
show
()
if
t
>
0
:
time
.
sleep
(
t
)
strip
.
setPixelColorRGB
(
0
,
0
,
0
,
0
)
strip
.
show
()
strip
.
setPixelColorRGB
(
0
,
0
,
0
,
0
)
strip
.
show
()
This diff is collapsed.
Click to expand it.
scripts/waitForNetwork
+
2
−
1
View file @
fca1be81
...
...
@@ -2,11 +2,13 @@
while
true
do
echo
"1111ff 0.1"
>
/dev/rgb_pipe
ping 8.8.8.8
-c
3
-W
15
-q
>
/dev/null
res
=
$?
if
[
"
$res
"
=
"0"
]
then
echo
"Connection established"
echo
"1111ff 3"
>
/dev/rgb_pipe
break
else
echo
"Connection failed"
...
...
@@ -14,5 +16,4 @@ do
sleep
5
done
exit
0
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment