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

OCTOWS2811 and DmxReceiver #4

Closed
ChrisLaurie opened this issue Oct 17, 2016 · 10 comments
Closed

OCTOWS2811 and DmxReceiver #4

ChrisLaurie opened this issue Oct 17, 2016 · 10 comments

Comments

@ChrisLaurie
Copy link

Hi Aaron

I am trying to use the LedMatrix, text and sprite libraries in my sketch together with the DmxReceiver library. I've got serious flickering problems when adding DMX data and was hoping to use the OCTOWS2811 library. FastLED has the feature to do this but it seems the the LedMatrix object does not inherit the correct templates.

To use the Teensy's OCTOWS2811 library with FastLED, one would add leds with this call:

FastLED.addLeds(leds, NUM_LEDS);

But if I do this inside the LEdMatrix sketch, I get this compile error:

no matching function for call to 'CFastLED::addLeds(cLEDMatrix<33, -7, (MatrixType_t)2u>&, int)'

and setting my CHIPSET to OCTOWS2811 with the standard LedMatrix call of:

FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds[0], leds.Size());

gives me this compile error:

no matching function for call to 'CFastLED::addLeds(CRGB*, int)'

I have tested the OCTOWS2811 example and added DMxReceiver to that and it seemed to work.

Can you please suggest how I can go about getting the OCTOWS2811 to wor with LedMatrix?

@AaronLiddiment
Copy link
Owner

AaronLiddiment commented Oct 17, 2016

I have used the Octo library with no issues, here is the top of one of my sketches....

#define USE_OCTOWS2811
#include <OctoWS2811.h>

#include <FastLED.h>

#include <LEDMatrix.h>

// Change the next 6 defines to match your matrix type and size

#define LED_PIN        2
#define COLOR_ORDER    GRB
#define CHIPSET        WS2812B

#define MATRIX_WIDTH   16  // Set this negative if physical led 0 is opposite to where you want logical 0
#define MATRIX_HEIGHT  512  // Set this negative if physical led 0 is opposite to where you want logical 0
#define MATRIX_TYPE    HORIZONTAL_ZIGZAG_MATRIX  // See top of LEDMatrix.h for matrix wiring types

cLEDMatrix<MATRIX_WIDTH, MATRIX_HEIGHT, MATRIX_TYPE> leds;


void setup()
{
  FastLED.addLeds<OCTOWS2811>(leds[0], (MATRIX_HEIGHT / 8) * MATRIX_WIDTH);

  FastLED.setDither(0);
  FastLED.setBrightness(255);
  FastLED.clear(true);
  delay(500);
  FastLED.showColor(CRGB::Red);
  delay(1000);
  FastLED.showColor(CRGB::Lime);
  delay(1000);
  FastLED.showColor(CRGB::Blue);
  delay(1000);
  FastLED.clear(true);
}

This was built using FastLED3.1.
I haven't been doing much LED stuff recently so am not sure if FastLED has been updated but they are usually good about not breaking older code.
What board are you using? Which compiler? What FastLED version?

@ChrisLaurie
Copy link
Author

Thanks for this, Aaron. It is a bit different, so I will give it a go and
see. How do I know that the OCTOWS2811 library is used? FastLED
specifically mentions that you must change the chipset to OCTOWS2811 and
you do not have to specify the pin, it hard coded inside FastLED.

On 17 Oct 2016 10:44 p.m., "Aaron Liddiment" notifications@github.com
wrote:

I have used the Octo library with no issues, here is the top of one of my
sketches....

#define USE_OCTOWS2811
#include

#include

#include

// Change the next 6 defines to match your matrix type and size

#define LED_PIN 2
#define COLOR_ORDER GRB
#define CHIPSET WS2812B

#define MATRIX_WIDTH 16 // Set this negative if physical led 0 is opposite
to where you want logical 0
#define MATRIX_HEIGHT 512 // Set this negative if physical led 0 is
opposite to where you want logical 0
#define MATRIX_TYPE HORIZONTAL_ZIGZAG_MATRIX // See top of LEDMatrix.h for
matrix wiring types

cLEDMatrix leds;

void setup()
{
FastLED.addLeds(leds[0], (MATRIX_HEIGHT / 8) * MATRIX_WIDTH);

FastLED.setDither(0);
FastLED.setBrightness(255);
FastLED.clear(true);
delay(500);
FastLED.showColor(CRGB::Red);
delay(1000);
FastLED.showColor(CRGB::Lime);
delay(1000);
FastLED.showColor(CRGB::Blue);
delay(1000);
FastLED.clear(true);
}

This was built using FastLED3.1.
I haven't been doing much LED stuff recently so am not sure if FastLED has
been updated but they are usually good about not breaking older code.
What board are you using? Which compiler? What FastLED version?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#4 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABwAle__QESQeDWeRm3aEOlmfaHxjCIdks5q094OgaJpZM4KY0vQ
.

@ChrisLaurie
Copy link
Author

I am afraid this does not work.

FastLED.addLeds(leds[0], MATRIX_HEIGHT * MATRIX_WIDTH);

returns the compile error:

no matching function for call to 'CFastLED::addLeds(CRGB*, int)'

On 17 October 2016 at 22:43, Aaron Liddiment notifications@github.com
wrote:

I have used the Octo library with no issues, here is the top of one of my
sketches....

#define USE_OCTOWS2811
#include

#include

#include

// Change the next 6 defines to match your matrix type and size

#define LED_PIN 2
#define COLOR_ORDER GRB
#define CHIPSET WS2812B

#define MATRIX_WIDTH 16 // Set this negative if physical led 0 is opposite
to where you want logical 0
#define MATRIX_HEIGHT 512 // Set this negative if physical led 0 is
opposite to where you want logical 0
#define MATRIX_TYPE HORIZONTAL_ZIGZAG_MATRIX // See top of LEDMatrix.h for
matrix wiring types

cLEDMatrix leds;

void setup()
{
FastLED.addLeds(leds[0], (MATRIX_HEIGHT / 8) * MATRIX_WIDTH);

FastLED.setDither(0);
FastLED.setBrightness(255);
FastLED.clear(true);
delay(500);
FastLED.showColor(CRGB::Red);
delay(1000);
FastLED.showColor(CRGB::Lime);
delay(1000);
FastLED.showColor(CRGB::Blue);
delay(1000);
FastLED.clear(true);
}

This was built using FastLED3.1.
I haven't been doing much LED stuff recently so am not sure if FastLED has
been updated but they are usually good about not breaking older code.
What board are you using? Which compiler? What FastLED version?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#4 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABwAle__QESQeDWeRm3aEOlmfaHxjCIdks5q094OgaJpZM4KY0vQ
.

@AaronLiddiment
Copy link
Owner

My bad, the LED_PIN, COLOR_ORDER and CHIPSET are just left over defines and are not used in the above code.
The code compiles for me and is currently controlling 8192 WS2812's in a series of ceiling panels.
I used FastLED V3.1, Arduino 1.6.6 & Teensyduino and have it running on a Teensy 3.1
What is your setup?

@ChrisLaurie
Copy link
Author

I am using a Teensy 3.1 on a matrix of 33 x 7 with LedText and LedSprites
via LedMatrix. As long as I am in demo mode (no dmx), this works fine using
FastLed to generate the signal.

When dmx signals arrive I think that the DmxReceivers interrupts clash with
FastLed's and I get massive flicker issues.

FastLed allows me to use the Teensy's OCTOWS2811 library (this library uses
DMA so there is very little impact on the rest of the code). FastLed does
this by changing the chipset to OCTOWS2811. Here is an extract from their
example sketch, OctoWS2811Demo.ino :

#define USE_OCTOWS2811
#include<OctoWS2811.h>
#include<FastLED.h>
#define NUM_LEDS_PER_STRIP 64
#define NUM_STRIPS 8
CRGB leds[NUM_STRIPS * NUM_LEDS_PER_STRIP];
// Pin layouts on the teensy 3:
// OctoWS2811: 2,14,7,8,6,20,21,5
void setup() {
LEDS.addLeds(leds, NUM_LEDS_PER_STRIP);
LEDS.setBrightness(32);
}

This example compiles and runs fine, even when I add dmxreceiver to it.

I want to use this but I cannot get a correct addLeds call when using the
LedMatrix library.

On 18 October 2016 at 10:59, Aaron Liddiment notifications@github.com
wrote:

My bad, the LED_PIN, COLOR_ORDER and CHIPSET are just left over defines
and are not used in the above code.
The code compiles for me and is currently controlling 8192 WS2812's in a
series of ceiling panels.
I used FastLED V3.1, Arduino 1.6.6 & Teensyduino and have it running on a
Teensy 3.1
What is your setup?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#4 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABwAldSwqVZtV2S7uZcKlToxtEy_FRnyks5q1IqBgaJpZM4KY0vQ
.

@AaronLiddiment
Copy link
Owner

I presume when using my matrix class your are defining an instance?

#define MATRIX_WIDTH   16  // Set this negative if physical led 0 is opposite to where you want logical 0
#define MATRIX_HEIGHT  512  // Set this negative if physical led 0 is opposite to where you want logical 0
#define MATRIX_TYPE    HORIZONTAL_ZIGZAG_MATRIX  // See top of LEDMatrix.h for matrix wiring types

cLEDMatrix<MATRIX_WIDTH, MATRIX_HEIGHT, MATRIX_TYPE> leds;

You then do not need the CRGB leds declare as the CRGB array is defined within the MatrixClass.
And in the addLeds call you would just use led[0] which in my matrix class returns the address of element 0 of the array.

@ChrisLaurie
Copy link
Author

Hi Aaron

Thanks for your indulgence! I have gotten somewhere! The problem is finding
the correct addleds call. So what seems to work is this (redacted a bit):

#define USE_OCTOWS2811
#include <OctoWS2811.h>
#define CHIPSET OCTOWS2811

cLEDMatrix < MATRIX_WIDTH, -MATRIX_HEIGHT, MATRIX_TYPE > leds;

FastLED.addLeds(leds[0], leds.Size());

or

FastLED.addLeds(leds[0], leds.Size());

also works

And I am displaying using the very fast OCTOWS2811 library and reading dmx
does not interfere! Whoohoo! Now I need to cleanup, check all functionality
and document for the lighting guys that will be setting up our show.

Thanks again - even though you are not that active with this stuff you
still found the time to help, kudos to you!

On 18 October 2016 at 19:58, Aaron Liddiment notifications@github.com
wrote:

I presume when using my matrix class your are defining an instance?

#define MATRIX_WIDTH 16 // Set this negative if physical led 0 is opposite to where you want logical 0
#define MATRIX_HEIGHT 512 // Set this negative if physical led 0 is opposite to where you want logical 0
#define MATRIX_TYPE HORIZONTAL_ZIGZAG_MATRIX // See top of LEDMatrix.h for matrix wiring types

cLEDMatrix<MATRIX_WIDTH, MATRIX_HEIGHT, MATRIX_TYPE> leds;

You then do not need the CRGB leds declare as the CRGB array is defined
within the MatrixClass.
And in the addLeds call you would just use led[0] which in my matrix class
returns the address of element 0 of the array.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#4 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABwAleZsqUUI5zufqqETFJTVxf3gLTtXks5q1Qi_gaJpZM4KY0vQ
.

@AaronLiddiment
Copy link
Owner

No problem :)
Good luck with the project.

@ChrisLaurie
Copy link
Author

Sorry to be a pain - but I am getting an unwanted column of leds when
writing static text (no scrolling); The sketch gets a dmx setting and then
calculates a year to display:. My code:

curFunction = _year;
char yeartxt[]={" "};
String str;
str = String(curYear);
str.toCharArray(yeartxt, ARRAY_SIZE(yeartxt));
ScrollingMsg.SetFont(RobotronFontData);
ScrollingMsg.SetText((unsigned char *)yeartxt, ARRAY_SIZE(yeartxt));
ScrollingMsg.SetTextColrOptions(COLR_HSV, patternHue, 255, 255);
ScrollingMsg.UpdateText();

I have tried various things but I get a single column of pixels at the far
left of the matrix.

On 18 October 2016 at 21:39, Aaron Liddiment notifications@github.com
wrote:

Closed #4 #4.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#4 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABwAlW6PvzAbLLg1vnaSO0RezutUrg6eks5q1SBVgaJpZM4KY0vQ
.

@AaronLiddiment
Copy link
Owner

I have never been a fan of string functions ;)
I would write it this way.

unsigned char yeartxt[5];
sprintf((char *)yeartxt, "%04.4d", _year);
ScrollingMsg.SetFont(RobotronFontData);
ScrollingMsg.SetText(yeartxt, strlen((char *)yeartxt));
ScrollingMsg.SetTextColrOptions(COLR_HSV, patternHue, 255, 255);
ScrollingMsg.UpdateText();

Of course it might not be a rogue character in the char array. Do you have the ERASE_BACKGROUND mode set or are you using LEAVE_BACKGROUND. And have you set the XY origin of the text area to be 0,0 and made it the full size of matrix area. Also you might want to make the Y origin -1 as if I remember correctly the Robotron font is 7 pixels high with a blank line along the bottom of the font.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants