Skip to content

New PlatformIO listener client #358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 66 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 61 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
b320c61
Add generic embedded listener
MatteoGheza Dec 29, 2021
e49f26b
Fix platformio.ini lib_deps
MatteoGheza Jan 13, 2022
ddce289
Implement event handler
MatteoGheza Jan 13, 2022
3f67e54
Fix MDNS device name
MatteoGheza Jan 13, 2022
f9c8c64
Add default env
MatteoGheza Jan 13, 2022
c1de91d
fix default_envs
MatteoGheza Jan 14, 2022
3155a6e
bus_options, devices and device_states as global
MatteoGheza Jan 14, 2022
3de3e0f
Reduce memory allocation
MatteoGheza Jan 14, 2022
e20555e
Load server connection info from preferences
MatteoGheza Jan 17, 2022
db54ef4
WiP build config support
MatteoGheza Jan 17, 2022
232444c
Save deviceId in preferences
MatteoGheza Jan 20, 2022
07ce198
Implement color conversion and fix pref. load
MatteoGheza Jan 20, 2022
0ede376
Fix color converter, split into multiple files
MatteoGheza Jan 21, 2022
4aafa8c
Move getSettingsPageParam
MatteoGheza Jan 21, 2022
0880012
Add more buggy code to fix later
MatteoGheza Jan 21, 2022
f3d889a
Fix tally status output and improve mem usage
MatteoGheza Jan 23, 2022
fa8d7d1
Support multiple state and check last state
MatteoGheza Jan 24, 2022
35e6823
Initial ESP8266 support
MatteoGheza Jan 24, 2022
4b00219
Remove esp01 support and add build_flags doc
MatteoGheza Jan 24, 2022
22ef220
Use PLATFORM_NAME in listenerType
MatteoGheza Jan 24, 2022
bb8ac80
Merge branch 'master' into feat_embedded_listener
MatteoGheza Jan 24, 2022
229ead6
Support Adafruit NeoPixel
MatteoGheza Jan 26, 2022
8a01d54
Flash led on errors
MatteoGheza Jan 27, 2022
f903927
Add M5Stickc and M5StickC-Plus support
MatteoGheza Jan 27, 2022
114c088
Add menu navigation
MatteoGheza Jan 28, 2022
2854dd8
Implement menu screens for M5StickC
MatteoGheza Jan 28, 2022
eae8830
Fix ip addr display
MatteoGheza Jan 28, 2022
35f08c7
Add hostname and captive portal ap name
MatteoGheza Jan 28, 2022
b2b44ce
Move resetDevice() into utils.h
MatteoGheza Jan 28, 2022
9a484c5
Revert "Move resetDevice() into utils.h"
MatteoGheza Jan 28, 2022
d32f1fc
Update TTGO build_flags
MatteoGheza Jan 28, 2022
7f69f23
Fix color conversion
MatteoGheza Jan 28, 2022
b7959f3
Initial TTGO support
MatteoGheza Jan 28, 2022
92d3d0f
Support menu in TTGO and add sleep mode
MatteoGheza Jan 30, 2022
ea58f54
Update reset logic
MatteoGheza Jan 30, 2022
64c9b96
Display error messages on TTGO
MatteoGheza Feb 1, 2022
696a869
Replace loading screen
MatteoGheza Feb 1, 2022
c4c57c5
Replace hard-coded values
MatteoGheza Feb 1, 2022
a0b9bd7
Fix reassign and flash
MatteoGheza Feb 1, 2022
34a8ab4
Move message logo up
MatteoGheza Feb 1, 2022
33ec179
Fix minor bugs and prevent screen screen flicker
MatteoGheza Feb 1, 2022
b59ed0c
Initial M5Atom support
MatteoGheza Feb 4, 2022
a211f5b
Save preferences on ESP8266 :tada:
MatteoGheza Feb 4, 2022
ca0710d
Re-organize platformio.ini
MatteoGheza Feb 4, 2022
0a7ee28
Github Actions for platformio
MatteoGheza Feb 5, 2022
593111e
Fix env
MatteoGheza Feb 5, 2022
1a6a36c
Fix working dir
MatteoGheza Feb 5, 2022
428cf57
Enable verbose mode
MatteoGheza Feb 5, 2022
854e563
ls "listener_clients/embedded-listener"
MatteoGheza Feb 5, 2022
21772f9
include test
MatteoGheza Feb 5, 2022
ef35960
test2
MatteoGheza Feb 5, 2022
a1f528b
lib_ldf_mode = deep+
MatteoGheza Feb 5, 2022
84cda07
Revert last test
MatteoGheza Feb 5, 2022
048845a
Change dir before pio run
MatteoGheza Feb 5, 2022
b3485a5
Try to run on Windows
MatteoGheza Feb 5, 2022
19d0f3f
update about improvements/suggestions
josephdadams Feb 1, 2022
e70b4a5
Disable relay listener test on Github Actions
MatteoGheza Feb 5, 2022
a6071dc
Update build-listener-clients.yaml
MatteoGheza Feb 5, 2022
ebb0b2d
Upload image and run build only on listener update
MatteoGheza Feb 6, 2022
9a7c200
Enable sleep mode for the M5Stickc
MatteoGheza Feb 8, 2022
1f41e7d
Add RESET_DURING_BOOT_IF_BUTTON_PRESSED
MatteoGheza Feb 8, 2022
2eda18a
Merge remote-tracking branch 'origin' into feat_embedded_listener
MatteoGheza May 7, 2022
649b6c1
Update embedded listener README
MatteoGheza May 11, 2022
46082f0
Merge branch 'master' of https://github.com/josephdadams/TallyArbiter…
MatteoGheza May 12, 2022
1788b49
Add MENU_BUTTON_PIN and SLEEP_BUTTON_PIN to README
MatteoGheza May 13, 2022
e58d03d
Minor README improvements
MatteoGheza May 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
183 changes: 42 additions & 141 deletions .github/workflows/build-listener-clients.yaml
Original file line number Diff line number Diff line change
@@ -1,145 +1,46 @@
name: Build Listener Clients

on: [push, pull_request, workflow_dispatch]
on:
push:
paths:
- '.github/**'
- 'listener_clients/**'
pull_request:
paths:
- '.github/**'
- 'listener_clients/**'
workflow_dispatch:

jobs:
build_m5stickc-listener:
name: Build M5StickC Listener
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: arduino/compile-sketches@v1
with:
platforms: |
- name: esp32:esp32
source-url: https://dl.espressif.com/dl/package_esp32_index.json
fqbn: 'esp32:esp32:m5stick-c'
libraries: |
- source-url: https://github.com/m5stack/M5StickC/archive/refs/tags/0.2.4.zip
- source-url: https://github.com/m5stack/M5StickC-Plus/archive/refs/tags/0.0.4.zip
- name: WebSockets
- name: WiFiManager
- name: MultiButton
- name: Arduino_JSON
cli-compile-flags: |
- --export-binaries
sketch-paths: |
- listener_clients/m5stickc-listener
enable-deltas-report: true
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: 'TallyArbiter-Listener-M5StickC'
path: 'listener_clients/m5stickc-listener/build/esp32.esp32.m5stick-c'

build_m5atom-listener:
name: Build M5Atom Listener
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: arduino/compile-sketches@v1
with:
platforms: |
- name: esp32:esp32
source-url: https://dl.espressif.com/dl/package_esp32_index.json
fqbn: 'esp32:esp32:m5stack-atom'
libraries: |
- source-url: https://github.com/m5stack/M5Atom/archive/refs/tags/0.0.6.zip
- name: WebSockets
- name: WiFiManager
- name: MultiButton
- name: Arduino_JSON
- name: FastLED
cli-compile-flags: |
- --export-binaries
sketch-paths: |
- listener_clients/M5AtomMatrix-listener/tallyarbiter-m5atom
enable-deltas-report: true
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: 'TallyArbiter-Listener-M5Atom'
path: 'listener_clients/M5AtomMatrix-listener/tallyarbiter-m5atom/build/esp32.esp32.m5stack-atom'

build_esp32-neopixel-listener:
name: Build ESP32 NeoPixel Listener
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: arduino/compile-sketches@v1
with:
platforms: |
- name: esp32:esp32
source-url: https://dl.espressif.com/dl/package_esp32_index.json
fqbn: 'esp32:esp32:esp32'
libraries: |
- name: WebSockets
- name: WiFiManager
- name: MultiButton
- name: Arduino_JSON
- name: Adafruit NeoPixel
cli-compile-flags: |
- --export-binaries
sketch-paths: |
- listener_clients/esp32-neopixel-listener
enable-deltas-report: true
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: 'TallyArbiter-Listener-ESP32-NeoPixel'
path: 'listener_clients/esp32-neopixel-listener/build/esp32.esp32.esp32'

build_TTGO-listener:
build_embedded-listener:
name: Build Embedded Listener ${{ matrix.env }}
strategy:
fail-fast: false
matrix:
board:
- fqbn: esp32:esp32:ttgo-t1
name: TTGO T1
- fqbn: esp32:esp32:ttgo-t7-v13-mini32
name: TTGO T7 v13 Mini32
- fqbn: esp32:esp32:ttgo-t7-v14-mini32
name: TTGO T7 v14 Mini32
- fqbn: esp32:esp32:twatch
name: TTGO T-Watch
name: Build ${{ matrix.board.name }} Listener
runs-on: ubuntu-latest
env: [m5atom, m5stack-core-esp32, m5stick-c, m5stick-c-plus, ttgo-t7-v13-mini32, ttgo-t7-v14-mini32, esp32dev, esp12e, nodemcu, esp01_1m, esp07]
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- name: Setup TFT_eSPI and select User Setup
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2

- name: Install PlatformIO
run: |
git clone https://github.com/Bodmer/TFT_eSPI/
cd TFT_eSPI
sed -i 's/#include <User_Setup.h>/\/\/#include <User_Setup.h>/g' User_Setup_Select.h
sed -i 's/\/\/#include <User_Setups\/Setup22_TTGO_T4.h>/#include <User_Setups\/Setup22_TTGO_T4.h>/g' User_Setup_Select.h
- uses: arduino/compile-sketches@v1
with:
platforms: |
- name: esp32:esp32
source-url: https://dl.espressif.com/dl/package_esp32_index.json
fqbn: ${{ matrix.board.fqbn }}
libraries: |
- name: WebSockets
- name: WiFiManager
- name: MultiButton
- name: Arduino_JSON
- source-path: TFT_eSPI
cli-compile-flags: |
- --export-binaries
sketch-paths: |
- listener_clients/TTGO_T-listener
enable-deltas-report: true
- name: Get FQBN build dir for ${{ matrix.board.name }}
python -m pip install --upgrade pip
pip install --upgrade platformio
pio system info

- name: Run PlatformIO
run: |
RAW_FQBN="${{ matrix.board.fqbn }}"
FQBN_REPLACED=$(echo $RAW_FQBN | sed 's/:/./g')
echo "FQBN_REPLACED=$FQBN_REPLACED" >> $GITHUB_ENV
- name: Upload Artifact
uses: actions/upload-artifact@v2
cd listener_clients/embedded-listener
pio run -e "${{ matrix.env }}" -v

- name: Upload a Build Artifact
uses: actions/upload-artifact@v2.3.1
with:
name: 'TallyArbiter-Listener-${{ matrix.board.name }}'
path: 'listener_clients/TTGO_T-listener/build/${{ env.FQBN_REPLACED }}'

name: embedded-listener_${{ matrix.env }}
path: listener_clients/embedded-listener/.pio/build/${{ matrix.env }}/firmware.bin
analyse_blink1-listener:
name: Analyse Blink1 Listener
runs-on: ubuntu-latest
Expand Down Expand Up @@ -178,12 +79,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install dependencies
working-directory: listener_clients/relay-listener
run: |
sudo apt install libudev-dev libusb-1.0-0 libusb-1.0-0-dev
npm install
npm install --global eslint
- name: Run eslint
working-directory: listener_clients/relay-listener
run: eslint index.js || exit 0
#- name: Install dependencies
# working-directory: listener_clients/relay-listener
# run: |
# sudo apt install libudev-dev libusb-1.0-0 libusb-1.0-0-dev
# npm install
# npm install --global eslint
#- name: Run eslint
# working-directory: listener_clients/relay-listener
# run: eslint index.js || exit 0
4 changes: 4 additions & 0 deletions listener_clients/embedded-listener/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.pio
.vscode/*
!.vscode/extensions.json
src/user_config_override.h
7 changes: 7 additions & 0 deletions listener_clients/embedded-listener/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}
26 changes: 26 additions & 0 deletions listener_clients/embedded-listener/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Embedded listener client

# Development

## Configuring platformio.ini

Used build flags here:
| FLAG NAME | DESCRIPTION | EXAMPLE VALUE |
|:--------------------------------------------:|:----------------------------------------------------------:|:-------------:|
| PLATFORM_ARCH_ESP32<br>PLATFORM_ARCH_ESP8266 | Determine if the processor is ESP32-based or ESP8266-based | |
| PLATFORM_NAME | Listener client name added in TallyArbiter | |
| | | |

We use the following flags to enable platform-specific features (like displays and custom hardware peripherals):
| FLAG NAME | DESCRIPTION | EXAMPLE VALUE |
|:-----------------:|:------------------------:|:-------------:|
| PLATFORM_M5ATOM | Enable M5Atom features | |
| PLATFORM_M5STACK | Enable M5Stack features | |
| PLATFORM_M5STICKC | Enable M5StickC features | |
| PLATFORM_TTGO | Enable TTGO features | |

> If a device has no other internal peripherals (like esp32dev, esp12e, esp1_1m, esp07), you can add it without other "PLATFORM_ABCDEF" flag
Doing this, it's required to edit your personal user_config_override.h file to enable platform-agnostic features, like tally status output or NeoPixel.



39 changes: 39 additions & 0 deletions listener_clients/embedded-listener/include/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

This directory is intended for project header files.

A header file is a file containing C declarations and macro definitions
to be shared between several project source files. You request the use of a
header file in your project source file (C, C++, etc) located in `src` folder
by including it, with the C preprocessing directive `#include'.

```src/main.c

#include "header.h"

int main (void)
{
...
}
```

Including a header file produces the same results as copying the header file
into each source file that needs it. Such copying would be time-consuming
and error-prone. With a header file, the related declarations appear
in only one place. If they need to be changed, they can be changed in one
place, and programs that include the header file will automatically use the
new version when next recompiled. The header file eliminates the labor of
finding and changing all the copies as well as the risk that a failure to
find one copy will result in inconsistencies within a program.

In C, the usual convention is to give header files names that end with `.h'.
It is most portable to use only letters, digits, dashes, and underscores in
header file names, and at most one dot.

Read more about using header files in official GCC documentation:

* Include Syntax
* Include Operation
* Once-Only Headers
* Computed Includes

https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
46 changes: 46 additions & 0 deletions listener_clients/embedded-listener/lib/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

This directory is intended for project specific (private) libraries.
PlatformIO will compile them to static libraries and link into executable file.

The source code of each library should be placed in a an own separate directory
("lib/your_library_name/[here are source files]").

For example, see a structure of the following two libraries `Foo` and `Bar`:

|--lib
| |
| |--Bar
| | |--docs
| | |--examples
| | |--src
| | |- Bar.c
| | |- Bar.h
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
| |
| |--Foo
| | |- Foo.c
| | |- Foo.h
| |
| |- README --> THIS FILE
|
|- platformio.ini
|--src
|- main.c

and a contents of `src/main.c`:
```
#include <Foo.h>
#include <Bar.h>

int main (void)
{
...
}

```

PlatformIO Library Dependency Finder will find automatically dependent
libraries scanning project source files.

More information about PlatformIO Library Dependency Finder
- https://docs.platformio.org/page/librarymanager/ldf.html
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading