From e4bd84a38157e4e0e9ecdd5999fcf339c6d74692 Mon Sep 17 00:00:00 2001
From: Aymeric Bernard <aymeric.bernard@student.ecp.fr>
Date: Tue, 29 May 2018 10:49:38 +0200
Subject: [PATCH] Updated README

---
 README.md | 62 ++++++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 52 insertions(+), 10 deletions(-)

diff --git a/README.md b/README.md
index f952a63..952f11f 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@
 - `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 apt install git vim screen htop xdotool`
 - `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`
@@ -18,7 +18,7 @@
 - `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
+### Telegram message on startup 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
@@ -27,7 +27,7 @@
 @reboot sleep 1 && /root/scripts/waitForNetwork && /root/scripts/startup-telegram-message
 ```
 
-### Boot config
+### Boot config (only on Pi zeros?)
 `vim /boot/config.txt` to comment out `dtparam=audio=on` -> `#dtparam=audio=on` and add
 ```
 # Serial
@@ -48,19 +48,44 @@ export NODEJS_HOME=/usr/lib/nodejs/node-v9
 export PATH=$NODEJS_HOME/bin:$PATH
 ```
 
-After reboot or log out - log in, `npm install -g yarn`
+After reboot or log out - log in, `npm install -g yarn pm2`
 
 ### WS2812
 - Wiring: VCC -> |<diode| -> 5V, GND -> GND, Data -> (resistor ~100 ohm) -> (pin 12 / BCM 18 / PWM0)
-- `sudo apt install scons`
+- `sudo apt install scons python3-dev swig`
 - `git clone https://github.com/jgarff/rpi_ws281x.git && cd rpi_ws281x`
-- Edit `main.c` to put good stuff (width height for testing)
+- Edit `main.c` to put good stuff (width height for testing):
+
+```
+#define WIDTH                   1
+#define HEIGHT                  1
+```
+
+##### Make it Python3 compatible:
+In `python/neopixel.py` file:
+- Add `from builtins import range` after `# Author: Tony DiCola...` line (beginning)
+- `xrange` -> `range` in lines 33 and 46
+
+In `python/setup.py` file, insert 3 lines after line 13:
+```
+    url               = 'https://github.com/jgarff/rpi_ws281x/',
+    install_requires=[
+        'future',
+    ],
+    py_modules        = ['neopixel'],
+```
+
 - `scons`
 - `sudo ./test` to test
-- `follow ./python/README.md for python installation`
 
-To display a status LED without root
-- `cp scripts/statusRGB_listener.py /root/scripts/statusRGB_listener.py` (from `tv_panel` directory)
+##### Python3 installation
+In `python` folder,
+- `python ./setup.py build`
+- `sudo python ./setup.py install`
+
+##### Display a status LED without root, and avoid overhead lag
+Back to `tv_panel` directory
+- `cp scripts/statusRGB_listener.py /root/scripts/statusRGB_listener.py`
 - Add in root crontab (`sudo crontab -e`):
 ```
 @reboot /usr/bin/python3 /root/scripts/statusRGB_listener.py
@@ -79,15 +104,32 @@ To display a status LED without root
 
 ### RFID reader
 
+##### Communicate with the module
 - Wiring: VCC -> 5V, GND -> GND, RX -> TX, TX -> RX
 - In `sudo raspi-config`, disable serial messages but enable serial interface
+
+##### Get and compile libnfc
 ```
 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
+vim examples/nfc-poll.c
+```
+Here you must comment out the bloc near the end of the file that waits for card
+removing (if not, the stream doesn't end until card removal and this is very
+impractical).
+```
+  // printf("Waiting for card removing...");
+  // while (0 == nfc_initiator_target_is_present(pnd, NULL)) {}
+  // nfc_perror(pnd, "nfc_initiator_target_is_present");
+  // printf("done.\n");
+```
+
+Exit vim and continue to the compilation:
+```
 ./configure --prefix=/usr --sysconfdir=/etc
 make
-make install
+sudo make install
 sudo mkdir /etc/nfc
 sudo cp libnfc.conf.sample /etc/nfc/libnfc.conf
 sudo mkdir -p /etc/nfc/devices.d
-- 
GitLab