@@ -62,12 +62,6 @@ uint8_t FastLEDController::getLEDCount(uint8_t channel)
62
62
return channelData[channel].ledCount ;
63
63
}
64
64
65
- void FastLEDController::addColors (CRGB* leds, const CRGB& color, const uint8_t * values, uint8_t length) {
66
- for (int i = 0 ; i < length; i++) {
67
- leds[i] += color % values[i];
68
- }
69
- }
70
-
71
65
int FastLEDController::applySpeed (int duration, byte speed) {
72
66
switch (speed)
73
67
{
@@ -82,16 +76,11 @@ int FastLEDController::applySpeed(int duration, byte speed) {
82
76
}
83
77
}
84
78
85
- /*
86
- returns the current step of the animation
87
- */
88
79
int FastLEDController::animation_step (int duration, int steps) {
89
80
int currentStep = ((currentUpdate % duration) / ((float )duration)) * steps;
90
81
return currentStep;
91
82
}
92
- /*
93
- returns the number of steps since the last update
94
- */
83
+
95
84
int FastLEDController::animation_step_count (int duration, int steps) {
96
85
long lastAnimationNumber = lastUpdate / duration;
97
86
long currentAnimationNumber = currentUpdate / duration;
@@ -140,7 +129,7 @@ bool FastLEDController::updateLEDs()
140
129
int step = animation_step (duration, 256 );
141
130
int move = group.direction == GROUP_DIRECTION_FORWARD ? -3 : 3 ;
142
131
for (int i = 0 ; i < groupLedCount; i++) {
143
- channelData[channelId].leds [group.ledIndex + i] = CHSV (step + (i * move), 255 , 255 ) % channel. brightness ;
132
+ channelData[channelId].leds [group.ledIndex + i] = CHSV (step + (i * move), 255 , 255 );
144
133
}
145
134
updated = true ;
146
135
}
@@ -174,7 +163,7 @@ bool FastLEDController::updateLEDs()
174
163
scale = 255 ;
175
164
}
176
165
177
- fill_solid (&channelData[channelId].leds [group.ledIndex ], groupLedCount, group.color1 .lerp8 (group.color2 , scale) % channel. brightness );
166
+ fill_solid (&channelData[channelId].leds [group.ledIndex ], groupLedCount, group.color1 .lerp8 (group.color2 , scale));
178
167
updated = true ;
179
168
}
180
169
break ;
@@ -200,7 +189,7 @@ bool FastLEDController::updateLEDs()
200
189
scale = 255 - scale;
201
190
}
202
191
203
- fill_solid (&channelData[channelId].leds [group.ledIndex ], groupLedCount, group.color1 % scale % channel. brightness );
192
+ fill_solid (&channelData[channelId].leds [group.ledIndex ], groupLedCount, group.color1 % scale);
204
193
updated = true ;
205
194
}
206
195
break ;
@@ -245,15 +234,15 @@ bool FastLEDController::updateLEDs()
245
234
else {
246
235
scale = 255 - ease8InOutApprox ((distanceWave * 4 ) * 256 );
247
236
}
248
- channelData[channelId].leds [group.ledIndex + i] = (color % scale) % channel. brightness ;
237
+ channelData[channelId].leds [group.ledIndex + i] = (color % scale);
249
238
}
250
239
updated = true ;
251
240
}
252
241
break ;
253
242
}
254
243
case GROUP_MODE_Static:
255
244
{
256
- fill_solid (&channelData[channelId].leds [group.ledIndex ], groupLedCount, group.color1 % channel. brightness );
245
+ fill_solid (&channelData[channelId].leds [group.ledIndex ], groupLedCount, group.color1 );
257
246
updated = true ;
258
247
break ;
259
248
}
@@ -282,7 +271,7 @@ bool FastLEDController::updateLEDs()
282
271
color = group.color3 ;
283
272
}
284
273
285
- fill_solid (&channelData[channelId].leds [group.ledIndex ], groupLedCount, color % channel. brightness );
274
+ fill_solid (&channelData[channelId].leds [group.ledIndex ], groupLedCount, color);
286
275
updated = true ;
287
276
break ;
288
277
}
@@ -309,7 +298,7 @@ bool FastLEDController::updateLEDs()
309
298
if (led >= groupLedCount) {
310
299
led = steps - led - 1 ;
311
300
}
312
- channelData[channelId].leds [group.ledIndex + led] = group.color1 % channel. brightness ;
301
+ channelData[channelId].leds [group.ledIndex + led] = group.color1 ;
313
302
}
314
303
updated = true ;
315
304
}
@@ -322,7 +311,7 @@ bool FastLEDController::updateLEDs()
322
311
if (count > 0 ) {
323
312
int step = animation_step (duration, 3 );
324
313
for (int i = 0 ; i < groupLedCount; i++) {
325
- channelData[channelId].leds [group.ledIndex + i] = (i + step) % 3 > 0 ? group.color1 % channel. brightness : CRGB::Black;
314
+ channelData[channelId].leds [group.ledIndex + i] = (i + step) % 3 > 0 ? group.color1 : CRGB::Black;
326
315
}
327
316
updated = true ;
328
317
}
@@ -345,7 +334,7 @@ bool FastLEDController::updateLEDs()
345
334
}
346
335
}
347
336
348
- fill_solid (&channelData[channelId].leds [group.ledIndex ], groupLedCount, step == 0 ? group.color1 % channel. brightness : CRGB::Black);
337
+ fill_solid (&channelData[channelId].leds [group.ledIndex ], groupLedCount, step == 0 ? group.color1 : CRGB::Black);
349
338
updated = true ;
350
339
}
351
340
break ;
@@ -365,12 +354,12 @@ bool FastLEDController::updateLEDs()
365
354
}
366
355
367
356
if (group.direction == GROUP_DIRECTION_FORWARD) {
368
- fill_solid (&channelData[channelId].leds [group.ledIndex ], step + 1 , group.color1 % channel. brightness );
369
- fill_solid (&channelData[channelId].leds [group.ledIndex + step + 1 ], groupLedCount - (step + 1 ), group.color2 % channel. brightness );
357
+ fill_solid (&channelData[channelId].leds [group.ledIndex ], step + 1 , group.color1 );
358
+ fill_solid (&channelData[channelId].leds [group.ledIndex + step + 1 ], groupLedCount - (step + 1 ), group.color2 );
370
359
}
371
360
else {
372
- fill_solid (&channelData[channelId].leds [group.ledIndex + groupLedCount - (step + 1 )], step + 1 , group.color1 % channel. brightness );
373
- fill_solid (&channelData[channelId].leds [group.ledIndex ], groupLedCount - (step + 1 ), group.color2 % channel. brightness );
361
+ fill_solid (&channelData[channelId].leds [group.ledIndex + groupLedCount - (step + 1 )], step + 1 , group.color1 );
362
+ fill_solid (&channelData[channelId].leds [group.ledIndex ], groupLedCount - (step + 1 ), group.color2 );
374
363
}
375
364
updated = true ;
376
365
}
@@ -382,7 +371,7 @@ bool FastLEDController::updateLEDs()
382
371
int count = animation_step_count (duration, 256 );
383
372
if (count > 0 ) {
384
373
int step = animation_step (duration, 256 );
385
- fill_solid (&channelData[channelId].leds [group.ledIndex ], groupLedCount, CHSV (step, 255 , 255 ) % channel. brightness );
374
+ fill_solid (&channelData[channelId].leds [group.ledIndex ], groupLedCount, CHSV (step, 255 , 255 ));
386
375
updated = true ;
387
376
}
388
377
break ;
@@ -396,6 +385,7 @@ bool FastLEDController::updateLEDs()
396
385
#endif
397
386
break ;
398
387
}
388
+ nscale8_video (&channelData[channelId].leds [group.ledIndex ], groupLedCount, channel.brightness );
399
389
}
400
390
}
401
391
break ;
@@ -404,10 +394,9 @@ bool FastLEDController::updateLEDs()
404
394
{
405
395
if (trigger_update) {
406
396
auto & data = channelData[channelId];
407
- fill_solid (data.leds , data.ledCount , CRGB::Black);
408
- addColors (data.leds , CRGB::Red, data.valuesBuffer [0 ], data.ledCount );
409
- addColors (data.leds , CRGB::Green, data.valuesBuffer [1 ], data.ledCount );
410
- addColors (data.leds , CRGB::Blue, data.valuesBuffer [2 ], data.ledCount );
397
+ for (int i = 0 ; i < data.ledCount ; i++) {
398
+ data.leds [i] = CRGB (data.valuesBuffer [0 ][i], data.valuesBuffer [1 ][i], data.valuesBuffer [2 ][i]);
399
+ }
411
400
updated = true ;
412
401
}
413
402
break ;
0 commit comments