Hi! I’m goofing around with a Particle Photon, an RGB light strip, and the FastLED library. One thing I noticed is that some animations that are based on a “bpm” seem super slow. For example, if I specify something to animate using a 60 “bpm” period, it actually animates much slower.
FastLED bases it’s bpm calculations off of the millis() function. So for debugging I added the following to my loop(): EVERY_N_SECONDS( 1 ) { Spark.publish("DEBUG", String(millis())); }
That’s generating logs like:
DEBUG 15001 February 2nd at 9:41:54 pm
DEBUG 14003 February 2nd at 9:41:50 pm
DEBUG 13008 February 2nd at 9:41:46 pm
DEBUG 12008 February 2nd at 9:41:42 pm
DEBUG 11005 February 2nd at 9:41:37 pm
DEBUG 10000 February 2nd at 9:41:33 pm
DEBUG 9000 February 2nd at 9:41:29 pm
DEBUG 8005 February 2nd at 9:41:25 pm
DEBUG 7002 February 2nd at 9:41:20 pm
DEBUG 6007 February 2nd at 9:41:16 pm
The “millisecond” values look great, about 1000 between each log as I’d expect. But, the timestamp on each one is about 4 or 5 seconds apart!
So, what the heck is going on here? My only guess is that FastLED is doing some magic that is causing the clock to run slow. But the docs for millis() don’t mention that anything like that is possible: it’s just milliseconds.