Skip to content

Commit e95ce53

Browse files
authored
Merge pull request #7 from rpitv/contribution
2 parents c88ea27 + e2e33ab commit e95ce53

25 files changed

+1470
-773
lines changed

.editorconfig

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
11+
[*.{js,py,ts}]
12+
charset = utf-8
13+
indent_style = space
14+
indent_size = 4
15+
16+
[{package.json,package-lock.json}]
17+
indent_style = space
18+
indent_size = 2

.eslintrc

+14-37
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,16 @@
11
{
2-
"root": true,
3-
"parser": "@typescript-eslint/parser",
4-
"plugins": [
5-
"@typescript-eslint"
6-
],
7-
"extends": [
8-
"eslint:recommended",
9-
"plugin:@typescript-eslint/eslint-recommended",
10-
"plugin:@typescript-eslint/recommended"
11-
],
12-
"rules": {
13-
"quotes": [
14-
"error",
15-
"single"
16-
],
17-
"no-console": "off",
18-
"semi": [
19-
"error",
20-
"always"
21-
],
22-
"max-len": [
23-
"warn",
24-
100
25-
],
26-
"@typescript-eslint/no-explicit-any": "off",
27-
"keyword-spacing": "error",
28-
"object-curly-spacing": [
29-
"error",
30-
"always"
31-
],
32-
"array-bracket-spacing": [
33-
"error",
34-
"always"
35-
],
36-
"@typescript-eslint/no-extra-semi": "off",
37-
"@typescript-eslint/ban-ts-comment": "off"
38-
}
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"plugins": ["@typescript-eslint"],
5+
"extends": [
6+
"eslint:recommended",
7+
"plugin:@typescript-eslint/eslint-recommended",
8+
"plugin:@typescript-eslint/recommended",
9+
"prettier"
10+
],
11+
"rules": {
12+
"@typescript-eslint/no-explicit-any": "off",
13+
"@typescript-eslint/no-extra-semi": "off",
14+
"@typescript-eslint/ban-ts-comment": "off"
15+
}
3916
}

.github/workflows/codeql-analysis.yml

+29-29
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ name: "CodeQL"
1313

1414
on:
1515
push:
16-
branches: [ master ]
16+
branches: [master]
1717
pull_request:
1818
# The branches below must be a subset of the branches above
19-
branches: [ master ]
19+
branches: [master]
2020
schedule:
21-
- cron: '45 20 * * 5'
21+
- cron: "45 20 * * 5"
2222

2323
jobs:
2424
analyze:
@@ -32,39 +32,39 @@ jobs:
3232
strategy:
3333
fail-fast: false
3434
matrix:
35-
language: [ 'javascript', 'typescript' ]
35+
language: ["javascript", "typescript"]
3636
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
3737
# Learn more about CodeQL language support at https://git.io/codeql-language-support
3838

3939
steps:
40-
- name: Checkout repository
41-
uses: actions/checkout@v2
40+
- name: Checkout repository
41+
uses: actions/checkout@v2
4242

43-
# Initializes the CodeQL tools for scanning.
44-
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@v1
46-
with:
47-
languages: ${{ matrix.language }}
48-
# If you wish to specify custom queries, you can do so here or in a config file.
49-
# By default, queries listed here will override any specified in a config file.
50-
# Prefix the list here with "+" to use these queries and those in the config file.
51-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v1
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
51+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
5252

53-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54-
# If this step fails, then you should remove it and run the build manually (see below)
55-
- name: Autobuild
56-
uses: github/codeql-action/autobuild@v1
53+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54+
# If this step fails, then you should remove it and run the build manually (see below)
55+
- name: Autobuild
56+
uses: github/codeql-action/autobuild@v1
5757

58-
# ℹ️ Command-line programs to run using the OS shell.
59-
# 📚 https://git.io/JvXDl
58+
# ℹ️ Command-line programs to run using the OS shell.
59+
# 📚 https://git.io/JvXDl
6060

61-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
62-
# and modify them (or add more) to build your code if your project
63-
# uses a compiled language
61+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
62+
# and modify them (or add more) to build your code if your project
63+
# uses a compiled language
6464

65-
#- run: |
66-
# make bootstrap
67-
# make release
65+
#- run: |
66+
# make bootstrap
67+
# make release
6868

69-
- name: Perform CodeQL Analysis
70-
uses: github/codeql-action/analyze@v1
69+
- name: Perform CodeQL Analysis
70+
uses: github/codeql-action/analyze@v1

.github/workflows/node.js.yml

+21-22
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ name: Node.js CI
55

66
on:
77
push:
8-
branches: [ master ]
8+
branches: [master]
99
pull_request:
10-
branches: [ master ]
10+
branches: [master]
1111

1212
jobs:
1313
build:
14-
1514
runs-on: ubuntu-latest
1615

1716
strategy:
@@ -20,22 +19,22 @@ jobs:
2019
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2120

2221
steps:
23-
- uses: actions/checkout@v2
24-
- name: Use Node.js ${{ matrix.node-version }}
25-
uses: actions/setup-node@v2
26-
with:
27-
node-version: ${{ matrix.node-version }}
28-
cache: 'npm'
29-
- run: npm ci
30-
- run: npm run lint
31-
- run: npm run build --if-present
32-
- run: npm test
33-
- name: Codecov
34-
# You may pin to the exact commit or the version.
35-
# uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b
36-
uses: codecov/[email protected]
37-
with:
38-
flags: unittests
39-
files: ./coverage/coverage-final.json
40-
fail_ci_if_error: true
41-
verbose: true
22+
- uses: actions/checkout@v2
23+
- name: Use Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v2
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
cache: "npm"
28+
- run: npm ci
29+
- run: npm run lint
30+
- run: npm run build --if-present
31+
- run: npm test
32+
- name: Codecov
33+
# You may pin to the exact commit or the version.
34+
# uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b
35+
uses: codecov/[email protected]
36+
with:
37+
flags: unittests
38+
files: ./coverage/coverage-final.json
39+
fail_ci_if_error: true
40+
verbose: true

.husky/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx lint-staged

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v16.13.2

.prettierignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
coverage

.prettierrc.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

README.md

+68-8
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,88 @@
1-
# ATEM Tally for Raspberry Pi
1+
# Atem Tally for Raspberry Pi ·
22

33
[![Node.js CI](https://github.com/rpitv/atem-tally/actions/workflows/node.js.yml/badge.svg)](https://github.com/rpitv/atem-tally/actions/workflows/node.js.yml)
44
[![codecov](https://codecov.io/gh/rpitv/atem-tally/branch/master/graph/badge.svg?token=doiWhO8Q1K)](https://codecov.io/gh/rpitv/atem-tally)
5+
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
56

67
This is a simple camera tally system built to work with Blackmagic Design ATEM 2 switchers on a Raspberry Pi over 3 pins. This allows for easy wired connection over an XLR cable.
78

89
## Necessary supplies
910

10-
* Raspberry Pi (any should do, as long as it has GPIO and network connectivity).
11-
* R/G/B LEDs or at least one RGB LED w/ necessary resistors.
12-
* Ethernet connection to your switcher.
13-
* Diodes for the ground connection.
11+
- Raspberry Pi (any should do, as long as it has GPIO and network connectivity).
12+
- R/G/B LEDs or at least one RGB LED w/ necessary resistors.
13+
- Ethernet connection to your switcher.
14+
- Diodes for the ground connection.
1415

1516
Hardware instructions coming sometime in the future.
1617

1718
## Usage
1819

20+
To install the software:
21+
1922
1. Connect your LED(s) to the appropriate GPIO pins and edit the config file to contain the right pin numbers.
2023
2. Configure your Raspberry Pi to be on the same network as your ATEM switcher, making sure the Raspberry Pi
21-
is able to ping and connect to the switcher.
24+
is able to ping and connect to the switcher.
2225
3. Edit the config file to contain the right IP of your switcher and the right input ID to listen to (more info for this step in the future).
2326
4. Install the dependencies with `npm install`.
2427
5. Start the program with `npm start` or your favorite process manager.
2528

26-
## Testing
29+
This will start the program, running `src/index.ts` and updating the tally lights until execution is stopped. The state of LEDs will be preserved when the process ends until it is overwritten.
30+
31+
## Configuration
32+
33+
Here you should write what are all of the configurations a user can enter when using the project.
34+
35+
## Development
36+
37+
### Prerequisites
38+
39+
You must install Node.js and NPM before beginning to develop or use this application. Currently, only Node LTS v12, v14, and v16 are tested. Any other version is not guaranteed to work.
40+
41+
It's recommended you install Node.js and NPM using [nvm](https://github.com/nvm-sh/nvm).
42+
43+
### Setting up Dev Environment
44+
45+
Run the following script in order to begin development:
46+
47+
```shell
48+
git clone https://github.com/rpitv/atem-tally.git
49+
cd atem-tally/
50+
npm install
51+
npm run prepare
52+
```
53+
54+
You are now ready to write code. All application code is located within [/src](./src). Begin writing in your `.ts` files. It is presumed you will not be developing on a Raspberry Pi. If you do, then you may run the application using `npm start`. Otherwise, use `npm test` to run unit tests on your code.
55+
56+
### Testing
57+
58+
A unit test suite is available for the internal API. Current plans are to eventually add an external API, allowing for arbitrary usage. You may run the test suite by executing:
59+
60+
```shell
61+
npm test
62+
```
63+
64+
Since you presumably will not be developing on a Raspberry Pi, it's important to have a complete testing suite, particularly for components which interact with the Raspberry Pi GPIO pins.
65+
66+
### Style guide
67+
68+
This project follows the guidelines found here: https://github.com/elsewhencode/project-guidelines
69+
70+
The main rule from these guidelines that we do not follow is commits do not necessarily have to go into a dev branch before master. It is up to your distrection to determine whether it would be appropriate to do so.
71+
72+
Code style is enforced using ESLint. Continuous Integration runs the linter before unit tests, however you may also run the linter yourself using:
73+
74+
```shell
75+
npm run lint
76+
```
77+
78+
Automatically fix style issues with:
79+
80+
```shell
81+
npm run fix
82+
```
83+
84+
This command will automatically run in a pre-commit Git hook.
85+
86+
## Licensing
2787

28-
A unit testing suite is available in [./test](./test). You can run it with `npm test`.
88+
[This project is licensed under the MIT license.](./LICENSE)

__mocks__/pigpio.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
class Gpio {
2-
32
pin: number;
43

54
constructor(pin: number) {
65
this.pin = pin;
76
}
87

9-
digitalWrite() { /* stub */ }
8+
digitalWrite() {
9+
/* stub */
10+
}
1011

11-
pwmWrite() { /* stub */ }
12+
pwmWrite() {
13+
/* stub */
14+
}
1215
}
1316

1417
export { Gpio };

0 commit comments

Comments
 (0)