TallyArbiter
TallyArbiter copied to clipboard
New PlatformIO listener client
I wrote this new listener client to migrate every ESP32/ESP8266-based listener client to the same codebase, and for using PlatformIO. It's compatible with the Arduino IDE (currently, renaming a file is needed, fixing this soon), and it support build configuration.
Every feature/piece of code is configurable (WiP), so you can enable or disable certain features on a custom build, for example, enabling tally light status output on the M5Atom (turning on a GPIO pin on bus status).
Why did I do this?
There are 4 different firmwares for M5Atom and similar devices, and maintaining them is becoming a nightmare. There are a lot of PR, and when a listener is uupdated we should apply the same patch (or similar) to the other 3. Using PlatformIO, configuring build flags and running tests, or even emulations, is easier. PlatformIO has a build cache, and it uses them when you re-compile the code after a change. With this cache, compiling requires only a few seconds.
TODOs:
- [x] Connect to server and handle device status change
- [x] Save preferences and display settings into the WiFi selection page
- [x] Implement tally status GPIO output
- [x] Add settings reset support
- [x] Add settings and info page (and button navigation)
- [x] Replace old logo with the new logo (and update the TTGO platform code)
- [x] Display errors with icons and message on devices with a screen (for example when the WiFi connection fails, when the device needs to be configured, etc)
- [x] Support ESP8266 data saving
- [x] "Porting" PRs-added features here
- [x] Add documentation
- [x] Static code analysis and firmware compiling on Github Actions Workflow
Implement M5Stick and similar platforms looking at the old listeners:
- [x] Adafruit NeoPixel
- [x] M5AtomMatrix
- [x] TTGO_T
- [x] m5stickc
Cool! Look forward to trying it out.
Amazing as always, @MatteoGheza !
Looks awesome! Hit me up when you need testing on the clients.
How do you plan on adding all the features of the different clients without the 'main' file getting complicated to work in?
How do you plan on adding all the features of the different clients without the 'main' file getting complicated to work in?
IDK. I tried to split the code into different files. Functions in main.cpp currently:
-
setAdafruitNeoPixelColor
if Adafruit NeoPixel is enabled (since you should be able to use NeoPixel on a TTGO or an M5Stack, for example) -
event_*
for every WebSocket event -
socketIOEvent
for parsing Socket.IO events andsocketIOConnEvent
for Websocket connection -
saveParamCallback
since it's used only in main.cpp -
setup
andloop
I think that I should add more comments in the code.
Looks like a good start.
I see that you are putting listener specific code in a separate file. And then calling listener specific 'initialise' and 'process tally data' from the main file if they are enabled?
Smart! Good to also document how to add listener clients with maybe an example client?
I flashed the listener to one of my M5 Stick c Pluses and it get stuck in booting because WiFi manager still has stored settings from the other version of the software.
I think that it needs to have a way of having its WiFi credentials and other settings reset to keep it from getting stuck in a boot loop.
I implemented a reset menu, but it works only when the device is configured (no WiFi configuration). I tested it a lot on the TTGO. Currently, if you click the button (M5 button) once, it opens the info page. If you click it twice, it opens a page with the IP Address of the device and you can go to the settings web page (for configuring WiFi, TA server and updating the device OTA). If you long-press it, then you long-press it again, the device will reset.
What do you think about enabling this menu when the device is not configured (eg. reset the device if button pressed while turning on the device, like opening BIOS page on a computer).
What do you think about changing the M5StickC configuration to use the Action button instead of the M5 button for this (and using the M5 button for enabling sleep mode like on the TTGO)?
Both option sound like a solid idea.
I flashed the listener to one of my M5 Stick c Pluses and it get stuck in booting because WiFi manager still has stored settings from the other version of the software.
I think that it needs to have a way of having its WiFi credentials and other settings reset to keep it from getting stuck in a boot loop.
Done. Now, for resetting the device if it isn't configured, you should press (without releasing) the menu button (M5 button in this case) while turning on the device.
I love this, thank you for taking this on @MatteoGheza! I'll bring in my initial discussion #269 here for context. Let me take a look at this and see if I can yield any suggestions.
Sorry it took a month to get this review in. Life got super busy and I'm just getting back to TA
Sorry it took a month to get this review in. Life got super busy and I'm just getting back to TA
@JTF4 I know the feeling! 😅
Sorry it took a month to get this review in. Life got super busy and I'm just getting back to TA
It's the same for me...
Can someone help me testing this and writing documentation (I only documented the build flags)? This should be prod-ready.
@MatteoGheza I may have some time to look into testing/documentation. I'm still currently working on my custom tally PCB (working on v2), so I'm hoping to adapt this to it and test this PR in the process.
@MatteoGheza I may have some time to look into testing/documentation. I'm still currently working on my custom tally PCB (working on v2), so I'm hoping to adapt this to it and test this PR in the process.
Thanks. When everythings works well, we should implement an update system.
Hey, I just discovered this program today and I am a big fan of PlatformIO. I decided to clone the repo and try and build code and got some errors. After doing some digging I found the issue is due to a breaking change in ArduinoJSON
https://arduinojson.org/news/2022/12/26/arduinojson-6-20-0/#removed-support-for-char-and-char
I am still learning my way around the source so I am not sure of where all this effects but the fix I used in the short term to get the code to build is to modify platformio.ini to force version 6.18.5
bblanchon/ArduinoJson@=6.18.5
I think it should be a relatively easy fix. I'll have to see if I've got time to look into it.
What is the status of this PR? Trying to understand if there is something that I can help with.