corinm / fairylights Goto Github PK
View Code? Open in Web Editor NEWNo more boring Christmas tree lights! ๐โจ
No more boring Christmas tree lights! ๐โจ
Most of the patterns involve fading a bulb from black/off to a colour and back again. I've found a warm white is RGB 90, 60, 9.
When fading this colour, as it gets closer to black, it becomes impossible to maintain the ratio of red:green:blue because there isn't much blue to play with.
At full the ratio of R:B is 10:1
Close to black, if R was 5 B would need to be either 1 or 0 - a ratio of 5:1 (too much blue) or 5:0 (no blue at all, making it more yellow).
This is only noticeable for the warm white, so not a big problem.
Currently using the webpage UI you can set the lights to either cycle or a specific pattern for it to stay on. This feature would decouple choosing a pattern from whether it should cycle or stay on that pattern
while True
infinite loop. This means the speed of the fairy light animation varies based on CPU speed / contentionCurrently the patterns FSM transitions through every state in turn, however it should skip the off/stopped state.
Problem
Possible solution
https://stackoverflow.com/questions/23885147/how-do-i-use-line-profiler-from-robert-kern
Total time: 0.003424 s
File: /home/pi/fairylights/src/patterns/twinkle/Twinkle.py
Function: tick at line 39
Line # Hits Time Per Hit % Time Line Contents
==============================================================
39 def tick(self) -> List[Color]:
40 1 10.0 10.0 0.3 now = time()
41 1 13.0 13.0 0.4 timeDelta = self._getTimeDelta(now)
42
43 1 6.0 6.0 0.2 if not self._stopping and now > self._timeToNextTwinkle:
44 1 645.0 645.0 18.8 self._nextTwinkle()
45 1 8.0 8.0 0.2 self._timeToNextTwinkle = now + self._timeBetweenTwinkles / self._numberOfBulbs / 50
46
47 1 6.0 6.0 0.2 self._count += 1
48
49 151 680.0 4.5 19.9 for bulb in self.shuffledBulbs.getBulbs():
50 150 1501.0 10.0 43.8 bulb.incrementTimeDelta(timeDelta)
51
52 1 536.0 536.0 15.7 colours: List[Color] = [bulb.getColour() for bulb in self.shuffledBulbs.getBulbs()]
53
54 1 6.0 6.0 0.2 if self._stopping:
55 self._checkIfStopped(now, colours)
56
57 1 8.0 8.0 0.2 self._time = time()
58
59 1 5.0 5.0 0.1 return colours
When using the webpage to change the pattern it transitions but doesn't appear to change to the pattern chosen
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.