![]() |
HitLib 1.5.0
VEX V5 LED animation library for PROS
|
A LedGroup owns a set of LedStrand pointers and fans every animation command out to all of them simultaneously. Each group runs its own PROS task, multiple independent groups are fully supported. All of them share the V5's ADI link, one frame at a time, as described under refresh rate below.
Adding strands before init() is the usual order, but not a requirement: a strand added later is initialized on the way in and picks up the group's refresh interval, and one added after start() is ticked from the next cycle. Adding a strand the group already has does nothing, and so does a second start().
Every animation method on LedGroup calls the same method on each strand in order. All strands receive the command before any of them tick, so they stay in sync.
Use the subscript operator to reach a specific strand when you need different animations within the same group:
init() accepts an optional refresh interval in milliseconds (default 20 ms = 50 Hz).
The group ticks every strand at this one interval, so it is also the interval each strand counts its durations in - flash times, Speed::everyMs() and the rest - whatever the strand itself was constructed with. Pass 0 to use the first strand's own interval for the whole group.
Every frame a strand sends holds the V5's ADI link for 12 ms, one strand at a time across every group; the link falls behind if it is written any faster. A strand whose frame has not changed since its last write sends nothing (apart from a resend once a second, which brings back a strip that was unplugged or browned out), so static colors and idle meters cost nothing. A cycle cannot take less than 12 ms per strand whose frame did change, though. Four strands that all animate on every tick cannot cycle faster than about 48 ms, and anything timed in ticks on them runs slower than the interval says.