Added missing DMX effect options and 3rd color
This commit is contained in:
parent
87fa14b281
commit
8c5f9b4501
@ -172,14 +172,14 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){
|
||||
return;
|
||||
break;
|
||||
|
||||
case DMX_MODE_EFFECT: // 11 channels [bri,effectCurrent,effectSpeed,effectIntensity,effectPalette,R,G,B,R2,G2,B2]
|
||||
case DMX_MODE_EFFECT_W: // 13 channels, same as above but with extra +2 white channels [..,W,W2]
|
||||
case DMX_MODE_EFFECT_SEGMENT: // 11 channels per segment; max[#] = floor[512/(11+DMXSegmentSpacing)] = 46,42,39, ..
|
||||
case DMX_MODE_EFFECT_SEGMENT_W: // 13 Channels per segment; max[#] = floor[512/(13+DMXSegmentSpacing)] = 39,36,34,32, ..
|
||||
case DMX_MODE_EFFECT: // 15 channels [bri,effectCurrent,effectSpeed,effectIntensity,effectPalette,effectOption,R,G,B,R2,G2,B2,R3,G3,B3]
|
||||
case DMX_MODE_EFFECT_W: // 18 channels, same as above but with extra +3 white channels [..,W,W2,W3]
|
||||
case DMX_MODE_EFFECT_SEGMENT: // 15 channels per segment; max[#] = floor[512/(11+DMXSegmentSpacing)] = 46,42,39, ..
|
||||
case DMX_MODE_EFFECT_SEGMENT_W: // 18 Channels per segment; max[#] = floor[512/(13+DMXSegmentSpacing)] = 39,36,34,32, ..
|
||||
{
|
||||
if (uni != e131Universe) return;
|
||||
bool isSegmentMode = DMXMode == DMX_MODE_EFFECT_SEGMENT || DMXMode == DMX_MODE_EFFECT_SEGMENT_W;
|
||||
uint8_t dmxEffectChannels = (DMXMode == DMX_MODE_EFFECT || DMXMode == DMX_MODE_EFFECT_SEGMENT) ? 11 : 13;
|
||||
uint8_t dmxEffectChannels = (DMXMode == DMX_MODE_EFFECT || DMXMode == DMX_MODE_EFFECT_SEGMENT) ? 15 : 18;
|
||||
for (uint8_t id = 0; id < strip.getSegmentsNum(); id++) {
|
||||
Segment& seg = strip.getSegment(id);
|
||||
if (isSegmentMode)
|
||||
@ -194,25 +194,34 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){
|
||||
return;
|
||||
|
||||
if (e131_data[dataOffset+1] < strip.getModeCount())
|
||||
if (e131_data[dataOffset+1] != seg.mode) {strip.setMode(id, e131_data[dataOffset+1]); stateChanged = true;}
|
||||
if (e131_data[dataOffset+2] != seg.speed) {seg.speed = e131_data[dataOffset+2]; stateChanged = true;}
|
||||
if (e131_data[dataOffset+3] != seg.intensity) {seg.intensity = e131_data[dataOffset+3]; stateChanged = true;}
|
||||
if (e131_data[dataOffset+4] != seg.palette) {seg.palette = e131_data[dataOffset+4]; stateChanged = true;}
|
||||
if (e131_data[dataOffset+1] != seg.mode) seg.setMode( e131_data[dataOffset+1]);
|
||||
if (e131_data[dataOffset+2] != seg.speed) seg.speed = e131_data[dataOffset+2];
|
||||
if (e131_data[dataOffset+3] != seg.intensity) seg.intensity = e131_data[dataOffset+3];
|
||||
if (e131_data[dataOffset+4] != seg.palette) seg.setPalette(e131_data[dataOffset+4]);
|
||||
|
||||
uint32_t colors[2];
|
||||
byte whites[2] = {0,0};
|
||||
if (dmxEffectChannels == 13) {
|
||||
whites[0] = e131_data[dataOffset+11];
|
||||
whites[1] = e131_data[dataOffset+12];
|
||||
uint8_t segOption = (uint8_t)floor(e131_data[dataOffset+5]/64.0);
|
||||
if (segOption == 0 && (seg.mirror || seg.reverse )) {seg.setOption(SEG_OPTION_MIRROR, false); seg.setOption(SEG_OPTION_REVERSED, false);}
|
||||
if (segOption == 1 && (seg.mirror || !seg.reverse)) {seg.setOption(SEG_OPTION_MIRROR, false); seg.setOption(SEG_OPTION_REVERSED, true);}
|
||||
if (segOption == 2 && (!seg.mirror || seg.reverse )) {seg.setOption(SEG_OPTION_MIRROR, true); seg.setOption(SEG_OPTION_REVERSED, false);}
|
||||
if (segOption == 3 && (!seg.mirror || !seg.reverse)) {seg.setOption(SEG_OPTION_MIRROR, true); seg.setOption(SEG_OPTION_REVERSED, true);}
|
||||
|
||||
uint32_t colors[3];
|
||||
byte whites[3] = {0,0,0};
|
||||
if (dmxEffectChannels == 18) {
|
||||
whites[0] = e131_data[dataOffset+15];
|
||||
whites[1] = e131_data[dataOffset+16];
|
||||
whites[2] = e131_data[dataOffset+17];
|
||||
}
|
||||
colors[0] = RGBW32(e131_data[dataOffset+5], e131_data[dataOffset+6], e131_data[dataOffset+ 7], whites[0]);
|
||||
colors[1] = RGBW32(e131_data[dataOffset+8], e131_data[dataOffset+9], e131_data[dataOffset+10], whites[1]);
|
||||
if (colors[0] != seg.colors[0]) {seg.setColor(0, colors[0]); stateChanged = true;}
|
||||
if (colors[1] != seg.colors[1]) {seg.setColor(1, colors[1]); stateChanged = true;}
|
||||
colors[0] = RGBW32(e131_data[dataOffset+ 6], e131_data[dataOffset+ 7], e131_data[dataOffset+ 8], whites[0]);
|
||||
colors[1] = RGBW32(e131_data[dataOffset+ 9], e131_data[dataOffset+10], e131_data[dataOffset+11], whites[1]);
|
||||
colors[2] = RGBW32(e131_data[dataOffset+12], e131_data[dataOffset+13], e131_data[dataOffset+14], whites[2]);
|
||||
if (colors[0] != seg.colors[0]) seg.setColor(0, colors[0]);
|
||||
if (colors[1] != seg.colors[1]) seg.setColor(1, colors[1]);
|
||||
if (colors[2] != seg.colors[2]) seg.setColor(2, colors[2]);
|
||||
|
||||
// Set segment opacity or global brightness
|
||||
if (isSegmentMode) {
|
||||
if (e131_data[dataOffset] != seg.opacity) {seg.opacity = e131_data[dataOffset]; stateChanged = true;}
|
||||
if (e131_data[dataOffset] != seg.opacity) seg.setOpacity(e131_data[dataOffset]);
|
||||
} else if ( id == strip.getSegmentsNum()-1 ) {
|
||||
if (bri != e131_data[dataOffset]) {
|
||||
bri = e131_data[dataOffset];
|
||||
@ -220,11 +229,7 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){
|
||||
}
|
||||
}
|
||||
}
|
||||
if (stateChanged) {
|
||||
transitionDelayTemp = 0; // act fast
|
||||
stateUpdated(CALL_MODE_NOTIFICATION); // don't send UDP
|
||||
return; // don't activate realtime live mode
|
||||
}
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user