Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for fade_time #15

Open
mmorrisontx opened this issue Jan 18, 2014 · 5 comments
Open

Documentation for fade_time #15

mmorrisontx opened this issue Jan 18, 2014 · 5 comments

Comments

@mmorrisontx
Copy link

I spent a while working with the fade_time parameter today, trying to figure out its quirkiness (because it certainly is not milliseconds or seconds). At least on the two kickstarter bulbs I received a few weeks ago, the following formula seems to apply:

(fade_time parameter) = ((seconds)*225)^2

I have tested this, and it seems to work appropriately for all fade times large and small (less than a second up to several minutes). The 225 value is estimated based on testing, but the formula definitely seem to be quadratic.

See this graph for my test results: http://i.imgur.com/sbUEkGi.png

It may be worth including this formula in the docs, or even accepting "seconds" as the parameter in code, and converting it with this formula before sending it to the bulb. Additional testing is probably required to make sure this works on other shipments of the bulb as well.

@riverar
Copy link
Contributor

riverar commented Jan 18, 2014

Excellent sleuthing! I re-visited the Android application and you're right, the seconds description is wrong. They handle the value as if it's milliseconds but that could be one of many bugs.

@mmorrisontx
Copy link
Author

Seems there may be even more to it than that. Usually, my bulbs seem to follow the formula above, but occasionally they seem to flip into some other mode where fade_time means something entirely different. No idea what's going on at this point. Hopefully an official api will clear some things up at some point.

@PhilWheat
Copy link

Yeah - fade seems to work great on brightness and kelvin, but do something different when moving from color to color.

@mmorrisontx
Copy link
Author

Had another chance to play with this today. I've been using this code with acceptable results:
https://gist.github.com/sonicsnes/8648212

It seems that any fades involving kelvin (either going to kelvin, or if the bulb was using kelvin BEFORE you called lightsColour), fadeTime represents milliseconds -- otherwise, it is calculated with the formula above.

Don't ask me why. Sounds like a firmware bug.

@r9k
Copy link

r9k commented Feb 23, 2014

Today I got the formula switch without even using Kelvins.

I found that calling setColor with a fadeTime of 0 resets it back to ((seconds)*225)^2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants