Hello Everybody.
I really need RGBW strips for a show (I'm a light designer for theater).
So I use Teensy 3.2 + OctoWS2811 Adaptor + WIZ820io Adaptor. (I've already use this with WS2811 and APA102 projects with no difficulties).
I use Madmapper to drive 4 ledstrips of 280 leds on 4 outputs of OctoWS2811 Adaptor
I tried OctoSK6812Test and everything's ok.
But with Artnet, i've got a problem:
384 first leds are OK (Universe 0,1 and 2) but leds of universe 3 (4th universe) are lagging (refresh every 20s) and leds of universes 4 to 8 are off....
Here is my code:
Thank you.
I really need RGBW strips for a show (I'm a light designer for theater).
So I use Teensy 3.2 + OctoWS2811 Adaptor + WIZ820io Adaptor. (I've already use this with WS2811 and APA102 projects with no difficulties).
I use Madmapper to drive 4 ledstrips of 280 leds on 4 outputs of OctoWS2811 Adaptor
I tried OctoSK6812Test and everything's ok.
But with Artnet, i've got a problem:
384 first leds are OK (Universe 0,1 and 2) but leds of universe 3 (4th universe) are lagging (refresh every 20s) and leds of universes 4 to 8 are off....
Here is my code:
Code:
// Receive multiple universes via Artnet and control a strip of ws2811 leds via OctoWS2811
//
// This example may be copied under the terms of the MIT license, see the LICENSE file for details
// https://github.com/natcl/Artnet
//
// http://forum.pjrc.com/threads/24688-Artnet-to-OctoWS2811?p=55589&viewfull=1#post55589
/*11 192.168.0.121 0x90, 0xA2, 0xDA, 0x00, 0x44, 0xCB
12 192.168.0.122 0x90, 0xA2, 0xDA, 0x00, 0x44, 0xCC
*/
#include <Artnet.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
#include <SPI.h>
#include <OctoSK6812.h>
// OctoWS2811 settings
const int ledsPerStrip = 280; // change for your setup
const byte numStrips= 4; // change for your setup
DMAMEM int displayMemory[ledsPerStrip*8];
int drawingMemory[ledsPerStrip*8];
OctoSK6812 leds(ledsPerStrip, displayMemory, drawingMemory, SK6812_GRBW);
// Artnet settings
Artnet artnet;
const int startUniverse = 0; // CHANGE FOR YOUR SETUP most software this is 1, some software send out artnet first universe as zero.
const int numberOfChannels = ledsPerStrip * numStrips * 4; // Total number of channels you want to receive (1 led = 4 channels)
byte channelBuffer[numberOfChannels]; // Combined universes into a single array
// Check if we got all universes
const int maxUniverses = numberOfChannels / 512 + ((numberOfChannels % 512) ? 1 : 0);
bool universesReceived[maxUniverses];
bool sendFrame = 1;
// Change ip and mac address for your setup
byte ip[] = {192, 168, 0, 121};
byte mac[] = {0x90, 0xA2, 0xDA, 0x00, 0x44, 0xCB};
void setup()
{
// Serial.begin(115200);
artnet.begin(mac, ip);
leds.begin();
initTest();
// this will be called for each packet received
artnet.setArtDmxCallback(onDmxFrame);
}
void loop()
{
// we call the read function inside the loop
artnet.read();
}
void onDmxFrame(uint16_t universe, uint16_t length, uint8_t sequence, uint8_t* data)
{
sendFrame = 1;
// Store which universe has got in
//NOT WORKING WITH MADMAPPER because MadMapper won't pollute the network with network packets for universes
//that have not changed (except one packet each 4 seconds as defined in official ArtNet spec).
/*if (universe < maxUniverses)
universesReceived[universe] = 1;
for (int i = 0 ; i < maxUniverses ; i++)
{
if (universesReceived[i] == 0)
{
//Serial.println("Broke");
sendFrame = 0;
break;
}
}
*/
// read universe and put into the right part of the display buffer
for (int i = 0 ; i < length ; i++)
{
int bufferIndex = i + ((universe - startUniverse) * length);
if (bufferIndex < numberOfChannels) // to verify
channelBuffer[bufferIndex] = byte(data[i]);
}
// send to leds
for (int i = 0; i < ledsPerStrip * numStrips; i++)
{
leds.setPixel(i, channelBuffer[(i) * 4], channelBuffer[(i * 4) + 1], channelBuffer[(i * 4) + 2], channelBuffer[(i * 4) + 3]);
}
if (sendFrame)
{
leds.show();
// Reset universeReceived to 0
memset(universesReceived, 0, maxUniverses);
}
}
void initTest()
{
for (int i = 0 ; i < ledsPerStrip * numStrips ; i++)
leds.setPixel(i, 127, 0, 0, 0);
leds.show();
delay(500);
for (int i = 0 ; i < ledsPerStrip * numStrips ; i++)
leds.setPixel(i, 0, 127, 0, 0);
leds.show();
delay(500);
for (int i = 0 ; i < ledsPerStrip * numStrips ; i++)
leds.setPixel(i, 0, 0, 127,0);
leds.show();
delay(500);
for (int i = 0 ; i < ledsPerStrip * numStrips ; i++)
leds.setPixel(i, 0, 0, 0, 127);
leds.show();
delay(500);
for (int i = 0 ; i < ledsPerStrip * numStrips ; i++)
leds.setPixel(i, 0, 0, 0, 0);
leds.show();
}
Thank you.