GithubHelp home page GithubHelp logo

fairylights's People

Contributors

corinm avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

fairylights's Issues

When fading a colour out it's hue can change

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.

Effect: Rainbow cycle

  • Fade out consistently to stop (currently some bulbs reach 0 lum before others)
  • Convert so it's independent of tick rate

Can set a pattern AND cycle

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

Add more colours

  • Red and yellow
  • Red, yellow, green, blue (like off-the-shelf lights)
  • Pink, green, cyan, orange (?)

When generating colours, some look more similar than others

  • When generating a spread of analagous colours (e.g. yellow-orange-red or cyan-blue-), the effect varies depending on where in the spectrum the colour is.
  • Blues and purples and harder to differentiate and look much more similar
  • It may therefore look nicer to adjust how colours are selected based on where they are in the spectrum

Tidy up API

  • Tidy up the API so that it's clearer what it does
  • Update page so that it uses the new requests

Improve how cycle effect starts and stops

Problem

  • Currently the cycle effect starts with all bulbs on, however this is quite jarring when transitioning from other effects.

Possible solution

  • Try out starting with all bulbs off then adding bulbs in one at a time, in time with the cycle. This will give an effect of the colours falling until all bulbs are on.
  • When the effect is stopping it should continue to cycle but without looping the colours around, giving the effect of the colours falling until all bulbs are off.

Test performance to find bottlenecks

  • The current code works fine with up to ~300 LEDs, however with 1000 it becomes very slow
  • Use the line_profiler tool to identify bottlenecks and investigate possible improvements

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.