|
@@ -290,42 +290,41 @@ void setup() {
|
|
|
#ifdef __AVR_ATtiny85__ // Trinket, Gemma, etc.
|
|
|
if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
|
|
|
#endif
|
|
|
Rings.begin();
|
|
|
Rings.setBrightness(BRIGHTNESS);
|
|
|
Rings.RainbowCycle(random(RAINBOW_CYCLE_MIN_INTERVAL, RAINBOW_CYCLE_MAX_INTERVAL + 1));
|
|
|
prev_time = millis();
|
|
|
}
|
|
|
|
|
|
void loop() {
|
|
|
Rings.Update();
|
|
|
/*
|
|
|
* We could store the return of the first millis call in a variable.
|
|
|
* But this routine is fast, so we only loose some milliseconds (if even)
|
|
|
* and we are not that time critical, that the MODE changes extacly after
|
|
|
* MODE_CHANGE_TIME. Calling millis twice, saves us 8 bytes, which is critical
|
|
|
* for the small storage space we have.
|
|
|
*/
|
|
|
We could store the return of the first millis call in a variable.
|
|
|
But this routine is fast, so we only loose some milliseconds (if even)
|
|
|
and we are not that time critical, that the MODE changes extacly after
|
|
|
MODE_CHANGE_TIME. Calling millis twice, saves us 8 bytes, which is critical
|
|
|
for the small storage space we have.
|
|
|
*/
|
|
|
if ((millis() - prev_time) >= MODE_CHANGE_TIME) {
|
|
|
mode = random(0, 9);
|
|
|
prev_time = millis();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void RingsComplete()
|
|
|
{
|
|
|
void RingsComplete() {
|
|
|
uint16_t slow_interval = random(SLOW_INTERVAL_MIN, SLOW_INTERVAL_MAX + 1);
|
|
|
uint16_t steps = random(STEPS_MIN, STEPS_MAX + 1);
|
|
|
uint32_t color = Rings.Wheel(random(COLOR_MIN, COLOR_MAX + 1));
|
|
|
|
|
|
|
|
|
switch (mode) {
|
|
|
case 0:
|
|
|
Rings.RainbowCycle(random(RAINBOW_CYCLE_MIN_INTERVAL, RAINBOW_CYCLE_MAX_INTERVAL + 1));
|
|
|
break;
|
|
|
case 1:
|
|
|
Rings.ColorWipe(color, slow_interval);
|
|
|
break;
|
|
|
case 2:
|
|
|
Rings.DoubleColorWipe(color, slow_interval);
|
|
|
break;
|
|
|
case 3:
|
|
|
Rings.Scanner(color, slow_interval);
|