From 8737a8ab44877bcf6a3da78d9fd614174c6dad97 Mon Sep 17 00:00:00 2001 From: Aymeric Bernard <aymeric.bernard@student.ecp.fr> Date: Tue, 29 May 2018 21:10:57 +0200 Subject: [PATCH] Cleaned up some old files, added the nfc-poll-wrapper dummy --- .gitignore | 1 - scripts/install.sh | 23 -------------- scripts/nfc-poll-wrapper-dummy.sh | 9 ++++++ scripts/statusRGB.py | 53 ------------------------------- 4 files changed, 9 insertions(+), 77 deletions(-) delete mode 100644 scripts/install.sh create mode 100755 scripts/nfc-poll-wrapper-dummy.sh delete mode 100755 scripts/statusRGB.py diff --git a/.gitignore b/.gitignore index 9055c5a..0fde43f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,6 @@ build/ server/config.js front/src/config.js -scripts/nfc-poll-wrapper-dummy.sh # *.pub # *.key diff --git a/scripts/install.sh b/scripts/install.sh deleted file mode 100644 index 5862375..0000000 --- a/scripts/install.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# WORK IN PROGRESS, /tmp/ stuff is to avoid breaking stuff - -CURDIR=`pwd` - -ln -s "$CURDIR/.screenrc" /tmp/ # /home/hermod -ln -s "$CURDIR/.vimrc" /tmp/ # /home/hermod - -sudo cp "$CURDIR/waitForNetwork" /tmp/ # /root/scripts -sudo cp "$CURDIR/startup-telegram-message" /tmp/ # /root/scripts - -# Folder containing root scripts that can be used with sudo without password -sudo mkdir /hermod_bin -sudo cp "$CURDIR/statusRGB.py" /hermod_bin - -echo "Put in root crontab (sudo crontab -e):" -echo "@reboot /root/scripts/waitForNetwork && /root/scripts/startup-telegram-message" -echo "" -echo "Edit /root/scripts/startup-telegram-message to add your token and chat id" -echo "" -echo "Add this at the end of /etc/sudoers (sudo visudo):" -echo "hermod ALL=(ALL) NOPASSWD: /hermod_bin/statusRGB.py" diff --git a/scripts/nfc-poll-wrapper-dummy.sh b/scripts/nfc-poll-wrapper-dummy.sh new file mode 100755 index 0000000..a4a8fc0 --- /dev/null +++ b/scripts/nfc-poll-wrapper-dummy.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +while : +do + sleep 5 + echo "12345678901234" + #echo "11ff11 0.2" > /dev/rgb_pipe + sleep 30 +done diff --git a/scripts/statusRGB.py b/scripts/statusRGB.py deleted file mode 100755 index 676255e..0000000 --- a/scripts/statusRGB.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -import sys -import time -import argparse - -from neopixel import * - - -# LED strip configuration: -LED_COUNT = 1 # Number of LED pixels. -LED_PIN = 18 # GPIO pin connected to the pixels (18 uses PWM!). -#LED_PIN = 10 # GPIO pin connected to the pixels (10 uses SPI /dev/spidev0.0). -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 - - -def opt_parse(): - parser = argparse.ArgumentParser() - parser.add_argument('color', help='The color to display') - parser.add_argument('-t', '--time', type=float, help='Display the color during this amount of seconds') - return parser.parse_args() - - -# Main program logic follows: -if __name__ == '__main__': - # Process arguments - args = opt_parse() - - hex_color = args.color - hex_color = hex_color.lstrip('#') - if len(hex_color) == 3: - hex_color = '{0}{0}{1}{1}{2}{2}'.format(*hex_color) - if len(hex_color) != 6: - raise ValueError('Please use 6 hex characters color format') - - (r, g, b) = (int(x, 16) for x in [hex_color[i:i+2] for i in (0, 2, 4)]) - - # 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() - strip.setPixelColorRGB(0, r, g, b) - strip.show() - if isinstance(args.time, float) and args.time > 0: - time.sleep(args.time) - strip.setPixelColorRGB(0, 0, 0, 0) - strip.show() -- GitLab