Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option "Group_Leds" to group LEDs for increased performance. #35

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions Arduino/LEDstream_FastLED/LEDstream_FastLED.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ const uint16_t
const uint8_t
Brightness = 255; // maximum brightness

// Group LEDS for enhanced performance
// Group_Leds = 1; no grouping
// Group_Leds = 2; and higher: group this number of LEDs together (color is copied from 1st LED of each group)

// Tips:
// Set Num_Leds to the total Number of LEDs in your strip
// In the Software you use, adjust the number of LEDs to the total Number of LEDs divided by the grouping:
// For example for an 80 LED strip with Group_Leds = 2; you would set it to 40 LEDs in the Software.
// With Group_Leds = 4; you would set it to 20 LEDs.
// The higher the Group_Leds number, the better the performance / FPS will be.

const uint8_t
Group_Leds = 1; // Group x number of LEDs together

// --- FastLED Setings
#define LED_TYPE WS2812B // led strip type for FastLED
#define COLOR_ORDER GRB // color order for bitbang
Expand Down Expand Up @@ -203,8 +217,16 @@ void headerMode(){

void dataMode(){
// If LED data is not full
if (outPos < sizeof(leds)){
ledsRaw[outPos++] = c; // Issue next byte
if (outPos < sizeof(leds) / Group_Leds) {
if (Group_Leds == 1) { ledsRaw[outPos++] = c; } // Issue next byte, no grouping
else { // Group Leds
uint16_t outPosGroup = int( outPos * Group_Leds - outPos %3 * (Group_Leds-1) );
for(int i = 0; i < Group_Leds; i++) {
ledsRaw[outPosGroup] = c;
outPosGroup += 3;
}
outPos++;
}
}
bytesRemaining--;

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ There are additional settings to allow for adjusting:
- LED color order
- Serial speed
- Serial timeout length
- Grouping of LEDs to increase Performance

There are also optional settings to clear the LEDs on reset or flush the incoming serial buffer after every latch. This latter option is enabled by default to help with flickering when using WS2812B LEDs.

Expand Down