Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: [OctoWS2811 lib] dynamic strip length

  1. #1

    [OctoWS2811 lib] dynamic strip length

    Hello,

    I'd like to know if there is a way to dynamically set the length of the strips in the OctoWS2811 library?

    Also, what are the impacts of not having the same count of leds on each outputs? And when only using, let's say, only the first 4 outputs?

    Best regards and thanks for this great library!

    Xavier

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,036
    OctoWS2811 doesn't support changing the strip lengths at runtime. Perhaps you could edit the code to do so, but is that actually useful?

    Maybe this recent conversation can also help? Many details about how the LED chips work are discussed, and also on the FastLED thread on Google+

    https://forum.pjrc.com/threads/51790...p-in-Real-Time

  3. #3
    Hello Paul, thanks for your answer.

    The idea here is to have a configurable pixel controller via Art-Net. In the Art-Net specification you have what we call "ArtCommand" messages to control your Art-Net node. So I'd like to send this kind of message to configure what are the pixel strips attached.

    Here are the common use cases:
    - change the strip, so maybe less or more leds
    - strips of different size on each outputs (8 outputs at most)
    - only use X out of the 8 outputs
    - change the kind of strips, e.g. passing from RGB to RGBW (I want to stick with WS2812/13 and SK6812 for now)

    My idea is to define the max values my board will handle, and it will be:
    Code:
    #define MAX_OUTPUTS 8 // max of outputs
    #define MAX_CHANNELS_PER_LED 4  // max channels per leds
    #define MAX_LEDS_PER_OUTPUTS 300  // max leds per output
    So the max outputSize would be the following and I'll use if for the buffers:
    Code:
    const int outputSize = MAX_LEDS_PER_OUTPUTS * MAX_CHANNELS_PER_LED * 2; // 2400
    DMAMEM int displayMemory[outputSize];
    int drawingMemory[outputSize];
    OctoWS2811 leds(MAX_NUM_LED_PER_OUTPUT, displayMemory, drawingMemory, ledConfig);
    After that I could have variables defining how many outputs, how many leds per outputs and how many channel per leds are used. So the buffers won't be filled at their max but the data would be there. After that it would be just a matter of using the "leds.setPixel()" wisely?

    I know I would have some unused sections of the buffers, but the teensy is fast enough so that wouldn't be a problem.

    Something like this:
    Code:
    int currentOutput = 1;
    int channelsPerLeds = 4;
    int offset = 220; // number of leds on the previous strips
    int ledCountOnThisOutput = 125;
    byte *data = (byte *)dmx->Data;
    for (int i = 0; i < ledCountOnThisOutput; i++) {
      if (channelsPerLeds == 3) {
        leds.setPixel(
          i + offset,
          data[i * 3],
          data[i * 3 + 1],
          data[i * 3 + 2]
        );
      }
      else if (channelsPerLeds == 4) {
        leds.setPixel(
          i + offset,
          data[i * 4],
          data[i * 4 + 1],
          data[i * 4 + 2],
          data[i * 4 + 3]
        );
      }
    }
    It's pseudo code untested, but it will bring you the idea.

    So my questions are:
    - is it possible at all? (I don't have the hardware in front of me for now)
    - what would be the performance impact on a such approach?

    FIY here is the prototype of my board


    And a link to a project I realised with:
    https://www.instagram.com/p/Bep1HxNhoiV/

    Best regards

  4. #4
    And here is the new version of the board

    Click image for larger version. 

Name:	WVsYwMk.jpg 
Views:	60 
Size:	126.6 KB 
ID:	13712

    This is a 4 outputs version.

    As you might notice I forgot to order some 10k ohms smd resistors so I put classic ones for now to test

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •