Chase: Use CRGB when setting colors

When not using the `CRGB()` macro, colors may end up being different than
intended if the board we're running on implements RGB order differently.

Fixes #548.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/550/head
Gergely Nagy 6 years ago
parent 5fe12de4dd
commit e7a48497e7
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

@ -37,9 +37,9 @@ void LEDChaseEffect::update(void) {
// the first few updates, `pos2` will be out of bounds. Since it's an unsigned integer,
// even when it would have a value below zero, it underflows and so one test is good for
// both ends of the range.
::LEDControl.setCrgbAt(pos, {0, 0, 0});
::LEDControl.setCrgbAt(pos, CRGB(0, 0, 0));
if (pos2 < LED_COUNT)
::LEDControl.setCrgbAt(pos2, {0, 0, 0});
::LEDControl.setCrgbAt(pos2, CRGB(0, 0, 0));
// Next, we adjust the red light's position. If the direction hasn't changed (the red
// light isn't out of bounds), we also adjust the blue light's position to match the red
@ -58,9 +58,9 @@ void LEDChaseEffect::update(void) {
// Last, we turn on the LEDs at their new positions. As before, the blue light (pos2) is
// only set if it's in the valid LED range.
::LEDControl.setCrgbAt(pos, {0, 0, 255});
::LEDControl.setCrgbAt(pos, CRGB(255, 0, 0));
if (pos2 < LED_COUNT)
::LEDControl.setCrgbAt(pos2, {255, 0, 0});
::LEDControl.setCrgbAt(pos2, CRGB(0, 0, 255));
}
}

Loading…
Cancel
Save