FastLED/Conceptinetics errors

Hey all,

Got my APA104 strip running nicely so Also added some pots and switches to control pallettes, brightness, speed, etc. All of that was working. I went to add DMX control. I have a CTC-DRA-10-1 and got it fired up and running with an Uno and a USB to DMX interface. Simple turn on the led when a controller is above a value. I want to assign 8 DMX channels to use my working code. So I wrote what I needed into the code I was using for the 104 strip. When I flipped the switch to go from manual to DMX control, nothing. I've spent the better part of 2 days changing code, jumpers, reading all I could find of docs. Still won't work. If I comment out the manual side the DMX side (using the same led to verify DMS is working) will communicate with DMX but not take any of the control branches in the code. Comment out the DMX side and the manual side works as it should. So my question is this; Can a DMX board (in straight Slave Mode) work concurrently with FastLed? If so can anyone point me at some example code. Also running into this error:

core.a(HardwareSerial.cpp.o): In function __vector_18': /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/HardwareSerial.cpp:115: multiple definition of __vector_18'
Conceptinetics/Conceptinetics.cpp.o:/Users/jbanko/Documents/Arduino/libraries/Conceptinetics/Conceptinetics.cpp:1162: first defined here

If I comment out the Serial.begin(57600); the error goes away..... And I thought I was getting somewhere, NOT!
Sorry for the length here but I do REALLY appreciate any help!!

Thanks again,

Joe B
code follows:

#include <Conceptinetics.h>
#include "FastLED.h" // FastLED library. Preferably the latest copy of FastLED 2.1.

#define LED_DT 5 // Serial data pin for WS2812 or WS2801.
#define ledPin 13
#define DMX_SLAVE_CHANNELS 8
#define COLOR_ORDER GRB // Are they GRB for WS2812 and GBR for APA102
#define LED_TYPE WS2811 // What kind of strip are you using? WS2812, APA102. . .
#define NUM_LEDS 120 // Number of LED's.

#define qsubd(x, b) ((x>b)?wavebright:0) // Digital unsigned subtraction macro. if result <0, then => 0. Otherwise, take on fixed value.
#define qsuba(x, b) ((x>b)?x-b:0) // Analog Unsigned subtraction macro. if result <0, then => 0

struct CRGB leds[NUM_LEDS]; // Initialize our LED array.

uint8_t max_bright = 64; // Overall brightness definition. It can be changed on the fly.
int CurPatt = 0;
int CurSpeed = 4;
int CurBright = 4;
int UPDATES_PER_SECOND = 1000;
int DMX_mode = 1;

// Palette definitions
CRGBPalette16 currentPalette;
TBlendType currentBlending;
const TProgmemRGBPalette16 SALS_p PROGMEM =
{
CRGB::Orange,
CRGB::DarkRed,
CRGB::DarkRed,
CRGB::Orange,

CRGB::Orange,
CRGB::Orange,
CRGB::Orange,
CRGB::Orange,

CRGB::Orange,
CRGB::DarkRed,
CRGB::DarkRed,
CRGB::Orange,

CRGB::Black,
CRGB::Black,
CRGB::Black,
CRGB::Black

};
const TProgmemPalette16 RWB_p PROGMEM =
{
CRGB::Red,
CRGB::Gray, // 'white' is too bright compared to red and blue
CRGB::Blue,
CRGB::Black,

CRGB::Red,
CRGB::Gray,
CRGB::Blue,
CRGB::Black,

CRGB::Red,
CRGB::Red,
CRGB::Gray,
CRGB::Gray,
CRGB::Blue,
CRGB::Blue,
CRGB::Black,
CRGB::Black
};

//DMX definitions
DMX_Slave dmx_slave ( DMX_SLAVE_CHANNELS );

void setup() {
//Serial.begin(57600);
dmx_slave.enable ();
dmx_slave.setStartAddress (169);
pinMode ( ledPin, OUTPUT );
LEDS.addLeds<LED_TYPE, LED_DT,COLOR_ORDER>(leds, NUM_LEDS); // WS2812
FastLED.setBrightness(max_bright);
currentPalette = RainbowColors_p;
currentBlending = BLEND;
} // setup()

void loop()
{
if ( dmx_slave.getChannelValue (1) > 127 )
{
DMX_mode = 1;
digitalWrite ( ledPin, HIGH );
RunDMX();
}
else
{
DMX_mode = 0;
digitalWrite ( ledPin, LOW );
RunManual();
}
static uint8_t startIndex = 0;
startIndex = startIndex + CurSpeed; /* motion speed */
FillLEDsFromPaletteColors( startIndex);
FastLED.show();
FastLED.delay(30);

}

void RunDMX()
{
if (CurBright != dmx_slave.getChannelValue (3)) //DMX Channel 171
{
CurBright = dmx_slave.getChannelValue (3);
};

if (CurSpeed != dmx_slave.getChannelValue (4)) //DMX Channel 172
{
CurSpeed = dmx_slave.getChannelValue (4);
};
if (CurPatt != map(dmx_slave.getChannelValue (2),0,255,0,11)) //DMX Channel 170
{
CurPatt = map(dmx_slave.getChannelValue (2),0,255,0,11);
switch (CurPatt)
{
case 0:
currentPalette = SALS_p;
break;
case 1:
currentPalette = RainbowColors_p;
break;
case 2:
currentPalette = RainbowStripeColors_p;
break;
case 3:
currentPalette = PartyColors_p;
break;
case 4:
currentPalette = HeatColors_p;
break;
case 5:
currentPalette = OceanColors_p;
break;
case 6:
currentPalette = ForestColors_p;
break;
case 7:
currentPalette = LavaColors_p;
break;
case 8:
currentPalette = CloudColors_p;
break;
case 9:
currentPalette = RWB_p;
break;
case 10:
SetupPurpleAndGreenPalette();
break;
case 11:
SetupBlackAndWhiteStripedPalette();
break;
}
}
}//end dmx communications

void RunManual()
{
if (CurBright != map(analogRead(A5),0,1023,1,150))
{
CurBright = map(analogRead(A5),0,1023,1,150);
};

if (CurSpeed != map(analogRead(A4),0,1023,1,20))
{
CurSpeed = map(analogRead(A4),0,1023,1,20);
};

if (CurPatt != map(analogRead(A3),0,1023,0,11))
{
CurPatt = map(analogRead(A3),0,1023,0,11);
switch (CurPatt)
{
case 0:
currentPalette = SALS_p;
break;
case 1:
currentPalette = RainbowColors_p;
break;
case 2:
currentPalette = RainbowStripeColors_p;
break;
case 3:
currentPalette = PartyColors_p;
break;
case 4:
currentPalette = HeatColors_p;
break;
case 5:
currentPalette = OceanColors_p;
break;
case 6:
currentPalette = ForestColors_p;
break;
case 7:
currentPalette = LavaColors_p;
break;
case 8:
currentPalette = CloudColors_p;
break;
case 9:
currentPalette = RWB_p;
break;
case 10:
SetupPurpleAndGreenPalette();
break;
case 11:
SetupBlackAndWhiteStripedPalette();
break;
}
}
}// end manual

void FillLEDsFromPaletteColors( uint8_t colorIndex)
{
uint8_t brightness = CurBright;

for( int i = 0; i < NUM_LEDS; i++) {
leds = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);

  • colorIndex += 3;*

  • }*
    }
    void SetupPurpleAndGreenPalette()
    {

  • CRGB purple = CHSV( HUE_PURPLE, 255, 255);*

  • CRGB green = CHSV( HUE_GREEN, 255, 255);*

  • CRGB black = CRGB::Black;*

  • currentPalette = CRGBPalette16(*

  • green, green, black, black,*

  • purple, purple, black, black,*

  • green, green, black, black,*

  • purple, purple, black, black );*
    }
    void SetupBlackAndWhiteStripedPalette()
    {

  • // 'black out' all 16 palette entries...*

  • fill_solid( currentPalette, 16, CRGB::Black);*

  • // and set every fourth one to white.*

  • currentPalette[0] = CRGB::White;*

  • currentPalette[4] = CRGB::White;*

  • currentPalette[8] = CRGB::White;*

  • currentPalette[12] = CRGB::White;*
    }

(FastLED maintainer here) - unfortunately the DMX libraries require the ability to handle interrupts in order to correctly process the incoming DMX data and the APA104 leds require the disabling of interrupts in order to handle the rigid timing requirements of the data line for the APA104.

Best recommendation is to switch to an LED chipset that is based on a clock/data pair of lines (instead of a single data) line, for example the APA102 (Adafruit sells them as DotStars) or the LPD8806. Writing data to these chipsets doesn't require any disabling of interrupts, and will play far more nicely with something like DMX coming in.