|
|
@ -5,15 +5,15 @@ breath_compute() {
|
|
|
|
// This code is adapted from FastLED lib8tion.h as of dd5d96c6b289cb6b4b891748a4aeef3ddceaf0e6
|
|
|
|
// This code is adapted from FastLED lib8tion.h as of dd5d96c6b289cb6b4b891748a4aeef3ddceaf0e6
|
|
|
|
// Eventually, we should consider just using FastLED
|
|
|
|
// Eventually, we should consider just using FastLED
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t i = (uint16_t)millis()/12;
|
|
|
|
uint8_t i = (uint16_t)millis() / 12;
|
|
|
|
|
|
|
|
|
|
|
|
if (i & 0x80) {
|
|
|
|
if (i & 0x80) {
|
|
|
|
i = 255 - i;
|
|
|
|
i = 255 - i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
i = i << 1;
|
|
|
|
i = i << 1;
|
|
|
|
uint8_t ii = (i*i)>>8;
|
|
|
|
uint8_t ii = (i * i) >> 8;
|
|
|
|
uint8_t iii = (ii*i)>>8;
|
|
|
|
uint8_t iii = (ii * i) >> 8;
|
|
|
|
|
|
|
|
|
|
|
|
i = (((3 * (uint16_t)(ii)) - (2 * (uint16_t)(iii))) / 2) + 2;
|
|
|
|
i = (((3 * (uint16_t)(ii)) - (2 * (uint16_t)(iii))) / 2) + 2;
|
|
|
|
|
|
|
|
|
|
|
@ -38,9 +38,9 @@ hsv_to_rgb(uint16_t h, uint16_t s, uint16_t v) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* make hue 0-5 */
|
|
|
|
/* make hue 0-5 */
|
|
|
|
region = (h *6) >> 8;
|
|
|
|
region = (h * 6) >> 8;
|
|
|
|
/* find remainder part, make it from 0-255 */
|
|
|
|
/* find remainder part, make it from 0-255 */
|
|
|
|
fpart = (h*6) - (region <<8);
|
|
|
|
fpart = (h * 6) - (region << 8);
|
|
|
|
|
|
|
|
|
|
|
|
/* calculate temp vars, doing integer multiplication */
|
|
|
|
/* calculate temp vars, doing integer multiplication */
|
|
|
|
p = (v * (255 - s)) >> 8;
|
|
|
|
p = (v * (255 - s)) >> 8;
|
|
|
|