Here's a thing I wanted to do for a long time and the idea that actually made me think of creating GEX. The firmware is still in super-early alpha, not even published yet, but I got Pin and Neopixel units working and put together some hacky screengrabber script, so here we go!!
I wanted to have nice ambient lighting for watching movies that e.g. turns dark in dark scenes, blue underwater etc. This has been done a million times before, so, uh, i++.
You can see (most of) the source code here: source gist
GEX is still a work in progress and, at the time of writing this, not ready for public testing
This script was put together while watching Wonder Woman, which btw is pretty good!, and you could probably tell from how messy the code is. I also fixed some issues in GEX where it would put random glitches on the Neopixel strip due to interrupts firing despite it being inside a critical section ?? (or maybe it was something else)—anyways the bug is gone.
I'll make a repo for this project later when I have more time to also improve the algorithm. At the moment it grabs some colors from the X11 screen buffer (which was a great fun to figure out), sends them through a simple averaging filter and dumps them to TinyFrame.
Here's the grabber code being tested separately in Xterm
I'm using the "NEOPIXEL" GEX unit instance sitting at callsign
2 and load it with command
0x02 which is "Set all pixels, no packing, little-endian". Of course the "NEOPIXEL" unit (or the protocol itself, for that matter) has no documentation yet because it's all very experimental and prone to change as I add more units and fix any potential friction.
here's the whole thing in action:
There's still a lot of room for improvement, for instance:
- Use some color averaging / interpolation instead of point samples
- Add support for multiple strips (top, bottom, left, right)
- Clean up the horrible code
- There'll be a proper tidy GEX API available later, so use that instead of hacking the protocol by hand.
- Make a repo for this thing