Reduce EyeData size by a few bytes
This commit is contained in:
parent
2c1fbe103b
commit
3b6f499fc5
@ -2615,10 +2615,11 @@ uint16_t mode_halloween_eyes()
|
|||||||
eyeState state;
|
eyeState state;
|
||||||
uint8 color;
|
uint8 color;
|
||||||
uint16_t startPos;
|
uint16_t startPos;
|
||||||
|
// duration + endTime could theoretically be replaced by a single endTime, however we would lose
|
||||||
|
// the ability to end the animation early when the user reduces the animation time.
|
||||||
uint16_t duration;
|
uint16_t duration;
|
||||||
uint32_t startTime;
|
uint32_t startTime;
|
||||||
uint8_t blinkDuration;
|
uint32_t blinkEndTime;
|
||||||
uint32_t blinkStartTime;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (SEGLEN == 1) return mode_static();
|
if (SEGLEN == 1) return mode_static();
|
||||||
@ -2667,8 +2668,7 @@ uint16_t mode_halloween_eyes()
|
|||||||
{
|
{
|
||||||
c = backgroundColor;
|
c = backgroundColor;
|
||||||
data.state = eyeState::blink;
|
data.state = eyeState::blink;
|
||||||
data.blinkDuration = random8(8, 128);
|
data.blinkEndTime = strip.now + random8(8, 128);
|
||||||
data.blinkStartTime = strip.now;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2687,8 +2687,7 @@ uint16_t mode_halloween_eyes()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case eyeState::blink: {
|
case eyeState::blink: {
|
||||||
const uint32_t elapsedBlinkTime = strip.now - data.blinkStartTime;
|
if (strip.now >= data.blinkEndTime) {
|
||||||
if (elapsedBlinkTime >= data.blinkDuration) {
|
|
||||||
data.state = eyeState::on;
|
data.state = eyeState::on;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user