Flask web-app init commit
3
.gitignore
vendored
@ -160,3 +160,6 @@ cython_debug/
|
||||
#.idea/
|
||||
#
|
||||
dump/
|
||||
|
||||
#herreweb_site
|
||||
repositories/
|
||||
|
36
2023-12-24-old/Readme.md
Normal file
@ -0,0 +1,36 @@
|
||||
# Herreweb Site
|
||||
Internally build website for [Herreweb](https://www.herreweb.nl).
|
||||
|
||||
## Getting Started
|
||||
To help contribute to the website, install dependencies in a ``Virtual Environment``:
|
||||
|
||||
```
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
pip3 install -r requirements.txt
|
||||
```
|
||||
|
||||
## Project documentation
|
||||
As with all Herreweb projects, the docs are provided in their stand-alone ``ReadTheDocs`` environment.
|
||||
|
||||
When contributing to the project, make sure you write your documentation.
|
||||
|
||||
To view the documentation, navigate to **documentation/readthedocs** and run the following commands:
|
||||
|
||||
```
|
||||
make html
|
||||
cd build/html
|
||||
python3 -m http.server
|
||||
```
|
||||
The website can be accessed at **localhost:8000**
|
||||
|
||||
## Development
|
||||
To run the backend server navigate to ``herreweb_backend/`` and run:
|
||||
|
||||
> python3 manage.py runserver
|
||||
|
||||
And for the frontend, navigate to ``herreweb_frontend`` and run:
|
||||
|
||||
> npm start
|
||||
|
||||
The file servers are accessible on ports 8000 and 3000.
|
Before Width: | Height: | Size: 185 KiB After Width: | Height: | Size: 185 KiB |
Before Width: | Height: | Size: 185 KiB After Width: | Height: | Size: 185 KiB |
Before Width: | Height: | Size: 185 KiB After Width: | Height: | Size: 185 KiB |
Before Width: | Height: | Size: 185 KiB After Width: | Height: | Size: 185 KiB |
Before Width: | Height: | Size: 185 KiB After Width: | Height: | Size: 185 KiB |
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 86 KiB |
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 86 KiB |
Before Width: | Height: | Size: 185 KiB After Width: | Height: | Size: 185 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
5
2023-12-24-old/requirements.txt
Normal file
@ -0,0 +1,5 @@
|
||||
django
|
||||
sphinx
|
||||
djangorestframework
|
||||
django-cors-headers
|
||||
Pillow
|
23
Dockerfile
Normal file
@ -0,0 +1,23 @@
|
||||
# Use an official Python runtime as a parent image
|
||||
FROM python:3.9-slim AS base
|
||||
|
||||
# Set the working directory in the container
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the current directory contents into the container at /app
|
||||
COPY . /app
|
||||
|
||||
# Install any needed packages specified in requirements.txt
|
||||
RUN --mount=type=cache,target=/root/.cache/pip pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Intermediate build stage (named 'dev' for example)
|
||||
FROM base AS dev
|
||||
|
||||
# Make port 5000 available to the world outside this container
|
||||
EXPOSE 5000
|
||||
|
||||
# Define environment variable
|
||||
ENV NAME World
|
||||
|
||||
# Run app.py when the container launches
|
||||
CMD ["flask", "run", "--host=0.0.0.0"]
|
39
Readme.md
@ -1,36 +1,9 @@
|
||||
# Herreweb Site
|
||||
Internally build website for [Herreweb](https://www.herreweb.nl).
|
||||
This website aims to bring the
|
||||
|
||||
## Getting Started
|
||||
To help contribute to the website, install dependencies in a ``Virtual Environment``:
|
||||
Enable buildkit for docker:
|
||||
|
||||
```
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
pip3 install -r requirements.txt
|
||||
```
|
||||
```sudo DOCKER_BUILDKIT=1 docker build .```
|
||||
```sudo docker-compose build```
|
||||
|
||||
## Project documentation
|
||||
As with all Herreweb projects, the docs are provided in their stand-alone ``ReadTheDocs`` environment.
|
||||
|
||||
When contributing to the project, make sure you write your documentation.
|
||||
|
||||
To view the documentation, navigate to **documentation/readthedocs** and run the following commands:
|
||||
|
||||
```
|
||||
make html
|
||||
cd build/html
|
||||
python3 -m http.server
|
||||
```
|
||||
The website can be accessed at **localhost:8000**
|
||||
|
||||
## Development
|
||||
To run the backend server navigate to ``herreweb_backend/`` and run:
|
||||
|
||||
> python3 manage.py runserver
|
||||
|
||||
And for the frontend, navigate to ``herreweb_frontend`` and run:
|
||||
|
||||
> npm start
|
||||
|
||||
The file servers are accessible on ports 8000 and 3000.
|
||||
Then run with:
|
||||
```sudo docker-compose up```
|
91
app.py
Normal file
@ -0,0 +1,91 @@
|
||||
from flask import Flask, render_template, redirect
|
||||
import subprocess, logging, os, shutil
|
||||
|
||||
app = Flask(__name__, static_folder='static/')
|
||||
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
|
||||
def _git_clone(repository_url, destination_folder):
|
||||
"""
|
||||
Clone a repository.
|
||||
"""
|
||||
try:
|
||||
subprocess.run(['git', 'clone', repository_url, destination_folder], check=True)
|
||||
logging.info(f"Git clone successful for {repository_url}")
|
||||
except subprocess.CalledProcessError as e:
|
||||
logging.error(f"Git clone unsuccessful for {repository_url}. Error: {e}")
|
||||
|
||||
|
||||
def _clone_repositories():
|
||||
"""
|
||||
Loop over all repositories in config/repositories.txt and clone them one by one.
|
||||
"""
|
||||
with open('config/repositories.txt', 'r') as f:
|
||||
repositories = f.readlines()
|
||||
for repository in repositories:
|
||||
repository_name = repository.split('/')[-1][:-4].rstrip('.')
|
||||
_git_clone(repository.strip(), f'repositories/{repository_name}')
|
||||
|
||||
|
||||
def _buid_docs():
|
||||
"""
|
||||
Run Makefile (currently not working).
|
||||
Move documentation to static to be served.
|
||||
"""
|
||||
for folder in os.listdir('repositories'):
|
||||
logging.debug(f'Found {folder}.')
|
||||
try:
|
||||
subprocess.run('documentation/Makefile', shell=True, check=True)
|
||||
except Exception as e:
|
||||
logging.error(f'Failed on {folder}. {e}')
|
||||
|
||||
try:
|
||||
if not os.path.exists(f'static/{folder}'):
|
||||
os.makedirs(f'static/{folder}')
|
||||
shutil.move(f'repositories/{folder}/documentation', f'static/{folder}')
|
||||
except Exception as e:
|
||||
logging.error(f'Failed to move {folder} to static folder. {e}')
|
||||
|
||||
|
||||
def _get_repository_folders():
|
||||
repository_path = 'repositories'
|
||||
if os.path.exists(repository_path) and os.path.isdir(repository_path):
|
||||
return [folder for folder in os.listdir(repository_path) if os.path.isdir(os.path.join(repository_path, folder))]
|
||||
else:
|
||||
return []
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def hello():
|
||||
"""
|
||||
Render homepage.
|
||||
"""
|
||||
repository_folders = _get_repository_folders()
|
||||
return render_template('index.html', repository_folders=repository_folders)
|
||||
|
||||
|
||||
@app.route('/<path:path>')
|
||||
def serve_sphinx_docs(path='index.html'):
|
||||
"""
|
||||
Serve static path to each repository included in config/repositories.txt
|
||||
"""
|
||||
return app.send_static_file(path)
|
||||
|
||||
|
||||
@app.route('/<folder>')
|
||||
def repository_page(folder):
|
||||
"""
|
||||
Create a button for each project and reroute to readthedocs of said project.
|
||||
"""
|
||||
documentation_path = os.path.join('static', folder, 'documentation', 'build')
|
||||
if os.path.exists(documentation_path):
|
||||
html_file_path = os.path.join(documentation_path, 'index.html')
|
||||
return redirect(html_file_path)
|
||||
else:
|
||||
return f"Documentation not found for repository folder: {folder}"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
_clone_repositories()
|
||||
_buid_docs()
|
||||
app.run(debug=True, host='0.0.0.0', port=5002)
|
2
config/repositories.txt
Normal file
@ -0,0 +1,2 @@
|
||||
https://git.herreweb.nl/JonathanHerrewijnen/HerrewebPy.git
|
||||
https://git.herreweb.nl/EljakimHerrewijnen/wifi-tally_Oostendam.git
|
8
docker-compose.yml
Normal file
@ -0,0 +1,8 @@
|
||||
version: '3.8'
|
||||
services:
|
||||
web:
|
||||
build:
|
||||
context: .
|
||||
target: dev # specify the build target if needed
|
||||
ports:
|
||||
- "5000:5000"
|
@ -1,5 +1,2 @@
|
||||
django
|
||||
sphinx
|
||||
djangorestframework
|
||||
django-cors-headers
|
||||
Pillow
|
||||
Flask==2.1.0 # or a later version
|
||||
Werkzeug==2.0.0
|
||||
|
3
static/wifi-tally_Oostendam/documentation/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"esbonio.sphinx.confDir": ""
|
||||
}
|
24
static/wifi-tally_Oostendam/documentation/Makefile
Normal file
@ -0,0 +1,24 @@
|
||||
# Minimal makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line, and also
|
||||
# from the environment for the first two.
|
||||
SPHINXOPTS ?=
|
||||
SPHINXBUILD ?= sphinx-build
|
||||
SPHINXAUTOBUILD = sphinx-autobuild
|
||||
SOURCEDIR = source
|
||||
BUILDDIR = build
|
||||
|
||||
# Put it first so that "make" without argument is like "make help".
|
||||
help:
|
||||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
|
||||
livehtml:
|
||||
@$(SPHINXAUTOBUILD) -b html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS)
|
||||
|
||||
.PHONY: help Makefile
|
||||
|
||||
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||
%: Makefile
|
||||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
35
static/wifi-tally_Oostendam/documentation/make.bat
Normal file
@ -0,0 +1,35 @@
|
||||
@ECHO OFF
|
||||
|
||||
pushd %~dp0
|
||||
|
||||
REM Command file for Sphinx documentation
|
||||
|
||||
if "%SPHINXBUILD%" == "" (
|
||||
set SPHINXBUILD=sphinx-build
|
||||
)
|
||||
set SOURCEDIR=source
|
||||
set BUILDDIR=build
|
||||
|
||||
%SPHINXBUILD% >NUL 2>NUL
|
||||
if errorlevel 9009 (
|
||||
echo.
|
||||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
||||
echo.installed, then set the SPHINXBUILD environment variable to point
|
||||
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
||||
echo.may add the Sphinx directory to PATH.
|
||||
echo.
|
||||
echo.If you don't have Sphinx installed, grab it from
|
||||
echo.https://www.sphinx-doc.org/
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if "%1" == "" goto help
|
||||
|
||||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||
goto end
|
||||
|
||||
:help
|
||||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||
|
||||
:end
|
||||
popd
|
31
static/wifi-tally_Oostendam/documentation/source/conf.py
Normal file
@ -0,0 +1,31 @@
|
||||
# Configuration file for the Sphinx documentation builder.
|
||||
#
|
||||
# For the full list of built-in configuration values, see the documentation:
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
||||
|
||||
# -- Project information -----------------------------------------------------
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
||||
|
||||
project = 'Oostendam Tallies'
|
||||
copyright = '2023, Eljakim'
|
||||
author = 'Eljakim'
|
||||
|
||||
# -- General configuration ---------------------------------------------------
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
||||
|
||||
extensions = [
|
||||
'sphinx_rtd_theme',
|
||||
'sphinx.ext.todo',
|
||||
"sphinxcontrib.drawio",
|
||||
]
|
||||
|
||||
templates_path = ['_templates']
|
||||
exclude_patterns = []
|
||||
|
||||
|
||||
|
||||
# -- Options for HTML output -------------------------------------------------
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
||||
|
||||
html_theme = 'sphinx_rtd_theme'
|
||||
html_static_path = ['_static']
|
@ -0,0 +1,16 @@
|
||||
============
|
||||
Dependencies
|
||||
============
|
||||
|
||||
Install the following Dependencies:
|
||||
|
||||
* luarocks : ``sudo apt install luarocks``
|
||||
* busted : ``sudo luarocks install busted``
|
||||
* python3 : ``sudo apt install python3``
|
||||
* esptool : ``pip3 install esptool``
|
||||
* nodemcu-uploader : ``pip3 install nodemcu-uploader``
|
||||
|
||||
Install on the Server PC:
|
||||
|
||||
* NodeJS : https://nodejs.org/
|
||||
* Next : ``npm install next``
|
@ -0,0 +1,91 @@
|
||||
==============
|
||||
Hardware Setup
|
||||
==============
|
||||
|
||||
This page describes the hardware setup for the tallies.
|
||||
How to build the tallies and how to build and flash new firmware to the tallies.
|
||||
|
||||
Build a Tally
|
||||
=============
|
||||
|
||||
For the tallies a classic ``RGB`` ledstrip is used instead of the more modern ``WS2812B`` standard. This ledstrip is connected as follows:
|
||||
|
||||
.. image:: tally-schematics-simple.png
|
||||
|
||||
Build the firmware
|
||||
==================
|
||||
|
||||
In order to build the firmware a ``Toolchain`` for cross compilation is required.
|
||||
This toolchain is provided in the repository in ``nodemcu-firmware/``.
|
||||
To build the code for the tallies, navigate to ``wifi-tally/tally/`` and run ``make``.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ make
|
||||
# if it compiles it is syntactically valid
|
||||
../../nodemcu-firmware/luac.cross -o /dev/null src/init.lua
|
||||
"busted"
|
||||
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
|
||||
91 successes / 0 failures / 0 errors / 0 pending : 0.23373 seconds
|
||||
|
||||
The resulting files are in the ``out/`` folder.
|
||||
|
||||
Flash the firmware
|
||||
==================
|
||||
To flash the firmware, first put the device in flash mode.
|
||||
You can do this by pressing and hodling the ``FLASH`` button and presing the ``RST`` button.
|
||||
After that you can release the ``FLASH`` button.
|
||||
Next, navigate to ``../wifi-tally/firmware`` and run ``install_firmware.sh``.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ ./install_firmware.sh
|
||||
esptool.py v4.4
|
||||
Serial port /dev/ttyUSB0
|
||||
Connecting....
|
||||
Detecting chip type... Unsupported detection protocol, switching and trying again...
|
||||
Connecting....
|
||||
Detecting chip type... ESP8266
|
||||
Chip is ESP8266EX
|
||||
Features: WiFi
|
||||
Crystal is 26MHz
|
||||
MAC: 50:02:91:fd:ca:0a
|
||||
Uploading stub...
|
||||
Running stub...
|
||||
Stub running...
|
||||
Configuring flash size...
|
||||
Flash will be erased from 0x00000000 to 0x00070fff...
|
||||
Flash params set to 0x0020
|
||||
Compressed 462848 bytes to 301339...
|
||||
Wrote 462848 bytes (301339 compressed) at 0x00000000 in 26.7 seconds (effective 138.9 kbit/s)...
|
||||
Hash of data verified.
|
||||
|
||||
Leaving...
|
||||
|
||||
|
||||
.. note::
|
||||
If you receive an error about permissions, run ``sudo -E ./install_firmware.sh`` to mitigate permissions for the USB device. Also look in the ``troubleshooting`` section if you keep having issues.
|
||||
|
||||
Flash the Application
|
||||
=====================
|
||||
Navigate to ``wifi-tally/tally`` and run ``install_application.sh``.
|
||||
|
||||
.. note::
|
||||
Make sure to edit the ``out/tally-settings.ini`` for the correct wifi SSID and password.
|
||||
|
||||
.. code:: console
|
||||
|
||||
$ ./install_application.sh
|
||||
opening port /dev/ttyUSB0 with 115200 baud
|
||||
Preparing esp for transfer.
|
||||
Transferring out/my-app.lc as out/my-app.lc
|
||||
Transferring out/my-led.lc as out/my-led.lc
|
||||
Transferring out/my-log-buffer.lc as out/my-log-buffer.lc
|
||||
Transferring out/my-log.lc as out/my-log.lc
|
||||
Transferring out/my-settings.lc as out/my-settings.lc
|
||||
Transferring out/my-tally.lc as out/my-tally.lc
|
||||
Transferring out/my-wifi.lc as out/my-wifi.lc
|
||||
Transferring out/tally-settings.ini as out/tally-settings.ini
|
||||
All done!
|
||||
|
||||
The tally is ready!
|
After Width: | Height: | Size: 89 KiB |
65
static/wifi-tally_Oostendam/documentation/source/index.rst
Normal file
@ -0,0 +1,65 @@
|
||||
.. Oostendam Tallies documentation master file, created by
|
||||
sphinx-quickstart on Mon Jan 23 22:14:59 2023.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
Tallies in Oostendam
|
||||
====================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:caption: Build:
|
||||
|
||||
overview.rst
|
||||
hardware/index.rst
|
||||
server/index.rst
|
||||
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:caption: Development:
|
||||
|
||||
patches.rst
|
||||
troubleshooting.rst
|
||||
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:caption: Migrating:
|
||||
|
||||
migration.rst
|
||||
|
||||
Introduction
|
||||
============
|
||||
|
||||
This document contains the documentation for the tallies used in the `Immanuelkapel in Oostendam <https://kerkdienstgemist.nl/stations/2112-Immanuelkapel>`_.
|
||||
The goal in this project is to provide *cheap* indicator lights to show which camera is active during the service.
|
||||
This way the minister knows which of the camera's is active and use it during the service.
|
||||
|
||||
This project relies heavily on an `existing project on github <https://github.com/wifi-tally/wifi-tally/>`_.
|
||||
The main difference between this code and the project on github is the behaviour of the tally lights.
|
||||
|
||||
Contact
|
||||
*******
|
||||
|
||||
To contact our church you can see our contact details below:
|
||||
|
||||
|
||||
+-------------+----------------------------+
|
||||
| | Immanuëlkapel (Oostendam) |
|
||||
+=============+============================+
|
||||
| Street | Pruimendijk 99 |
|
||||
+-------------+----------------------------+
|
||||
| Postal code | 2989 AH Ridderkerk |
|
||||
+-------------+----------------------------+
|
||||
| Phone | 078-6819880 |
|
||||
+-------------+----------------------------+
|
||||
|
||||
|
||||
.. include:: dependencies.rst
|
||||
|
||||
Result
|
||||
******
|
||||
The tally in our Church in Oostendam:
|
||||
|
||||
.. image:: kerk_tally.jpeg
|
BIN
static/wifi-tally_Oostendam/documentation/source/kerk_tally.jpeg
Normal file
After Width: | Height: | Size: 89 KiB |
@ -0,0 +1,26 @@
|
||||
=====================
|
||||
Migrating to a new PC
|
||||
=====================
|
||||
When migrating to a new computer, you need to do the following:
|
||||
|
||||
1. Configure the new computer to use the *same* IP address as the previous computer.
|
||||
2. Install `NodeJS and NPM <https://nodejs.org/en/download>`_
|
||||
3. Copy the config.json from the old PC (homedir + .wifi-tally.json) to the same location on the new PC.
|
||||
4. Run the server on the host PC(see below)
|
||||
|
||||
Run server
|
||||
==========
|
||||
To run the server, navigate to ``wifi-tally/hub`` and execute ``run_server.sh``
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ ./run_server.sh
|
||||
|
||||
> wifi-tally-hub@0.1.0 start
|
||||
> node server.js --env=production
|
||||
|
||||
Using mixer configuration "null"
|
||||
No video mixer connected.
|
||||
Listening for Tallies on 0.0.0.0:7411
|
||||
Web Server available on http://localhost:3000
|
||||
(node:117081) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
|
@ -0,0 +1 @@
|
||||
<mxfile host="0e0cvdn56dcks9nt6qpivljic1etrpgdss6lp7cimfo2r7gh3noq" modified="2023-01-23T22:01:55.348Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Code/1.72.2 Chrome/102.0.5005.167 Electron/19.0.17 Safari/537.36" etag="X6vB6Lweix4YWpz1sbGJ" version="12.2.4" pages="1"><diagram id="IYogmxu8KuVCkyEZh86n" name="Page-1">3Vffb5swEP5reK0IBkofm6TdJrXStExq92jgAK8GR8Zpkv71O+D4NdI22ppWW17i+3y2z9/dZxuLLfLdJ83X2a2KQVqOHe8strQcZ+ayGf5VyL5BPJc1QKpFTE49sBJPQKBN6EbEUI4cjVLSiPUYjFRRQGRGGNdabcduiZLjVdc8hQmwiriconciNlmDBp7d459BpFm78symnpy3zgSUGY/VdgCxK4sttFKmaeW7BciKvJaXZtz1M71dYBoKc8yA82bAI5cb2tudSATFZvbthiHG/ZOptMlUqgour3p0rtWmiKGa1Uar97lRao3gDMGfYMyeksk3RiGUmVxSL+yEuR+0f1RTnXlkLXc0c23sW6Mwen8/NJpRjtfa/bjaageWhmtzWVUCApHkZSmiFr4Wso2p4aHa/LP0ElSqjY7Iy6GK5DoF8nK71KImQOWAwaCLBsmNeBzPzqk4086vzx82KIWH0+lM0mk5vsQg5iE20qrxnUtZrb3gOWiOjW91oZIbLtB5TqpgnONtJgys1rze9haFPs5ngjQulFS6HstiDkHScKzVAwx6/CiAMOnWewRtYPcy31Mm2wGMdEUHS0DmtlfprJVeNlCoa/899/5/KaXzD5US+zgpsT+Q0g0kp1dSkoAfHVRSfH4R2vZplNTdWO8hpeBfV82HisadisZ7J9FcTERzDSbKEPpSJGqSVSxPM06ChlI88bB2qIhaK1GYOiBvbnlLRLgUaVGxhhQAFv68KnOBb7NL6shFHNcVIXkIcs6jh7SujZGEqt9LQqGXI0XSv9eG1AcvCsg+m/nMHWmI5j6adZr7a8XBwEUlSYmJ/T0tXQhHZcp9/XhbgUZmTv8y8CCI3UPnWeCEzPff5jxjvjfOhXvkeea/wXnmvU42Vmv0gD63PMWjwLEvDeSnv0qCCA5fJWHgud4bXSVeYL8b9Wj2H0+NLPpPUHb1Cw==</diagram></mxfile>
|
@ -0,0 +1,47 @@
|
||||
================
|
||||
Tallies Overview
|
||||
================
|
||||
|
||||
This page gives a short overview of how the tallies work in relation to the camera's. A simple overview of the tallies in correlation between the server and the streamer is shown below:
|
||||
|
||||
.. drawio-image:: overview.drawio
|
||||
|
||||
|
||||
|
||||
Hardware
|
||||
========
|
||||
|
||||
The hardware for the tallies is an ``esp8266`` microcontroller, as they can be found `on Amazon <https://www.amazon.nl/Diymore-ESP8266-WiFi-ontwikkelingskaart-NodeMCU-ESP-12E-module/dp/B09Z6T2XS4/ref=sr_1_2_sspa?__mk_nl_NL=%C3%85M%C3%85%C5%BD%C3%95%C3%91&crid=3DHTKU7SQKET9&keywords=esp8266&qid=1674509572&sprefix=esp8266%2Caps%2C135&sr=8-2-spons&sp_csd=d2lkZ2V0TmFtZT1zcF9hdGY&psc=1>`_.
|
||||
These microcontrollers are very cheap but are capable of using the ``802.11 b/g/n`` wifi standard(``IEEE``).
|
||||
|
||||
A quick overview of the hardware:
|
||||
|
||||
|
||||
+-------------------------+--------------------------------------+
|
||||
| Type | Value |
|
||||
+=========================+======================================+
|
||||
| CPU | 32Bit RISC based on ``Xtensa lx106`` |
|
||||
+-------------------------+--------------------------------------+
|
||||
| Instruction RAM | 32 KiB |
|
||||
+-------------------------+--------------------------------------+
|
||||
| Instruction Cache | 32 KiB |
|
||||
+-------------------------+--------------------------------------+
|
||||
| User Data RAM | 80 KiB |
|
||||
+-------------------------+--------------------------------------+
|
||||
| System Data RAM | 16 KiB |
|
||||
+-------------------------+--------------------------------------+
|
||||
| Flash Memory (External) | 4 MiB |
|
||||
+-------------------------+--------------------------------------+
|
||||
|
||||
Of the 17 GPIO pins available, only 3 are used for the RGB colouring.
|
||||
Wifi is used for communication between the tallies and a server that will tell the tally to turn on the lights.
|
||||
|
||||
Software
|
||||
========
|
||||
On the Host a ``NodeJS`` server is run that opens a websocket on port ``7411``.
|
||||
This websockets waits for tallies to connect and sends data to them when connected.
|
||||
The server also connects to the streamer, in our case a ``Black Magic ATEM`` that controls the camera's.
|
||||
The streamer gives information about which camera is active which is passed to the tallies.
|
||||
|
||||
|
||||
|
50
static/wifi-tally_Oostendam/documentation/source/patches.rst
Normal file
@ -0,0 +1,50 @@
|
||||
=============
|
||||
Tally Patches
|
||||
=============
|
||||
This section describes the patches made to the software. These patches are provided in the repository so no user interaction is needed when building the firmware.
|
||||
|
||||
LED patches
|
||||
===========
|
||||
The goal of the patches is to:
|
||||
|
||||
* Disable any signal leds on error, like no wifi connected or server not accessble
|
||||
* Disable green led when on preview
|
||||
|
||||
In order to add these patches the following code was edited in the firmware:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
_G.MyLed = {
|
||||
signal that nothing is being done
|
||||
initial = flashPattern("O", colors.BLUE),
|
||||
waitForWifiConnection = flashPattern("Oo", colors.GREEN),
|
||||
invalidSettingsFile = flashPattern("OoOoOooooooo", colors.BLUE, 2),
|
||||
waitForWifiIp = flashPattern("OoOo", colors.BLUE),
|
||||
waitForServerConnection = flashPattern("OoOooo", colors.BLUE),
|
||||
onPreview = flashPattern("O", colors.GREEN),
|
||||
onAir = flashPattern("O", colors.RED),
|
||||
onRelease = flashPattern(".", colors.GREEN, nil, false),
|
||||
onUnknown = flashPattern("Oooooooo", colors.BLUE, 2),
|
||||
onHighlight = flashPattern("OoOoOoOo", colors.WHITE),
|
||||
turnOff = flashPattern("O", colors.BLACK),
|
||||
}
|
||||
|
||||
This code block was replaced with the following:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
_G.MyLed = {
|
||||
initial = flashPattern("O", colors.BLACK),
|
||||
waitForWifiConnection = flashPattern("O", colors.BLACK),
|
||||
invalidSettingsFile = flashPattern("O", colors.BLACK),
|
||||
waitForWifiIp = flashPattern("O", colors.BLACK),
|
||||
waitForServerConnection = flashPattern("O", colors.BLACK),
|
||||
onPreview = flashPattern("O", colors.BLACK),
|
||||
onAir = flashPattern("O", colors.RED),
|
||||
onRelease = flashPattern("O", colors.BLACK),
|
||||
onUnknown = flashPattern("O", colors.BLACK),
|
||||
onHighlight = flashPattern("OoOoOoOo", colors.GREEN),
|
||||
turnOff = flashPattern("O", colors.BLACK),
|
||||
}
|
||||
|
||||
Upon each signal the leds will change, but into the BLACK color and into RED when the camera is active.
|
@ -0,0 +1,63 @@
|
||||
======
|
||||
Server
|
||||
======
|
||||
The tallies require a server that will direct the tallies and figure out the status of the ``BlackMagic ATEM``.
|
||||
|
||||
Build the server
|
||||
================
|
||||
Navigate to ``wifi-tally/hub`` and run the ``build_server.sh``.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ ./build_server.sh
|
||||
|
||||
> wifi-tally-hub@0.1.0 build
|
||||
> next build
|
||||
|
||||
Browserslist: caniuse-lite is outdated. Please run:
|
||||
npx browserslist@latest --update-db
|
||||
info - Creating an optimized production build
|
||||
info - Compiled successfully
|
||||
info - Collecting page data
|
||||
[== ] info - Generating static pages (0/1)info - Finalizing page optimizati
|
||||
info - Finalizing page optimization
|
||||
|
||||
Page Size First Load JS
|
||||
┌ λ / 4.55 kB 94.4 kB
|
||||
├ /_app 0 B 59.2 kB
|
||||
├ ○ /404 3.01 kB 62.2 kB
|
||||
├ λ /config 1.48 kB 91.3 kB
|
||||
└ λ /tally/[tallyName] 1.48 kB 91.3 kB
|
||||
+ First Load JS shared by all 59.2 kB
|
||||
├ chunks/07ed33f3.bca366.js 68 B
|
||||
├ chunks/commons.94f2cd.js 11 kB
|
||||
├ chunks/framework.9ec1f7.js 39.9 kB
|
||||
├ chunks/main.7e5158.js 7.2 kB
|
||||
├ chunks/pages/_app.627bfb.js 284 B
|
||||
├ chunks/webpack.e06743.js 751 B
|
||||
└ css/ba2fd543a36dbb3ceef1.css 25.9 kB
|
||||
|
||||
λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
|
||||
○ (Static) automatically rendered as static HTML (uses no initial props)
|
||||
● (SSG) automatically generated as static HTML + JSON (uses getStaticProps)
|
||||
(ISR) incremental static regeneration (uses revalidate in getStaticProps)
|
||||
|
||||
[ ===] info - Generating static pages (0/1)%
|
||||
|
||||
|
||||
To run the server, navigate to ``wifi-tally/hub`` and execute ``run_server.sh``
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ ./run_server.sh
|
||||
|
||||
> wifi-tally-hub@0.1.0 start
|
||||
> node server.js --env=production
|
||||
|
||||
Using mixer configuration "null"
|
||||
No video mixer connected.
|
||||
Listening for Tallies on 0.0.0.0:7411
|
||||
Web Server available on http://localhost:3000
|
||||
(node:117081) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
|
||||
|
||||
Depending on the OS of the stream PC you might need to create a new shell script to execute the **npm run start** command to run the server.
|
@ -0,0 +1,37 @@
|
||||
===============
|
||||
Troubleshooting
|
||||
===============
|
||||
|
||||
If you have issues with the ``esp8266`` not connecting on /dev/ttyUSB, but the device does show up in lsusb:
|
||||
|
||||
.. code:: console
|
||||
|
||||
$ lsusb
|
||||
[..]
|
||||
Bus 001 Device 019: ID 1a86:7523 QinHeng Electronics CH340 serial converter
|
||||
[..]
|
||||
|
||||
Then this might be related to a udev rule in Linux.
|
||||
Removing this rule will stop udev from hijacking the USB device.
|
||||
|
||||
.. code:: console
|
||||
|
||||
sudo rm /usr/lib/udev/rules.d/*-brltty-*.rules
|
||||
sudo udevadm control --reload-rules
|
||||
sudo systemctl mask brltty.path
|
||||
|
||||
ESPlorer
|
||||
========
|
||||
``ESPlorer`` is a tool that allows you to flash firmware to the ESP8266 using a GUI. This is example code on how to build and run it:
|
||||
|
||||
.. code-block:: consoleabap
|
||||
|
||||
git clone https://github.com/4refr0nt/ESPlorer.git
|
||||
|
||||
# Build it
|
||||
./mvnw clean package
|
||||
|
||||
# Run it
|
||||
java -jar target/ESPlorer.jar
|
||||
|
||||
The ``ESPlorer`` can be used to interact with the ``esp8266`` and flash binaries using a GUI.
|
14
templates/index.html
Normal file
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Repository Folders</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Repository Folders</h1>
|
||||
{% for folder in repository_folders %}
|
||||
<a href="{{ url_for('repository_page', folder=folder) }}"><button>{{ folder }}</button></a>
|
||||
{% endfor %}
|
||||
</body>
|
||||
</html>
|