Closed securelyfitz closed 1 year ago
Dilemma: in order for patterns to cycle while other stuff is happening, this has to be non-blocking and essentially generate led state based on timestamps. This goes against the though of it being an easy place for beginners to tinker with code.
@kcreyts you put your name on this one, but some of my brainstorming might be helpful - don't hesitate to ignore it and do what works.
there are two pins, NEOPIXEL and NEO_PWR. NEO_PWR is connected to a mosfet that grounds the neopixels when high, to save power when they're off.
variables:
init:
update(self, newpattern=None)
power_on() and power_off(): set/clear the NEO_PWR I/O
Actually, looks like there's a library that already does this: https://github.com/adafruit/Adafruit_CircuitPython_LED_Animation
FYI - running the neopixel rainbow pattern: full brightness, 1.5v: 330mA, 500mW full brightness, 1.0v: 190mA, 190mW .8 brightness, 1.5v: 200mA, 300mW .8 brightness, 1.0v: 240mA, 240mW .5 brightness, 1.5v: 150mA, 225mW .5 brightness, 1.0v: 210mA, 210mW .1 brightness, 1.5v: 86mA, 130mW .1 brightness, 1.0v: 140mA, 140mW
.8 brightness = 4 hours/AAA .1 brightness = 8 hours/AAA
the rainbow pattern cycles through colors, the average is 1/3 power on any given LED. All white should be about 3x power consumption of rainbow.
The boost regulator is rated at 200mA, so sticking to .5 brightness or less would avoid straining it too much.
Bless you for all the extra thoughts. Not having a neopixeled badge to test with meant i was doing a lot of guesswork on power budget.
Well the defaults in the animation lib also look very sane and within our power budget (brightness starts at .5 in the examples).
I noticed the gc was interrupting the animation (I know it'll go away once done but for now just re-ordering it smooths out animations) and I also split up the animation style and color into two settings.
awesome - i added excessive gc in an unsuccesful attempt to resolve the RX issue which at first i though was running out of memory, but now i think is memory corruption related.
Added brightness setting, cleaned up the sparkle pattern which wasn't really working and added chase.
Probably can close this one out at this point, lights are pretty full featured.
thanks again. I moved gc to the gamedata class after a new clue is added, since that's where the most memory collection happens.
likely plenty of open source examples to choose from. Should probably include at least:
these patterns should be contained in a separate .py file with comments to tell end users how to modify them The current pattern should be selectable from the settings menu.