diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index e329c4e8..ca3e39eb 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -369,16 +369,16 @@ class BusPwm : public Bus { }; -class BusVirtual : public Bus { +class BusNetwork : public Bus { public: - BusVirtual(BusConfig &bc) : Bus(bc.type, bc.start) { + BusNetwork(BusConfig &bc) : Bus(bc.type, bc.start) { _valid = false; _data = (byte *)malloc(bc.count * (_rgbw ? 4 : 3)); if (_data == nullptr) return; memset(_data, 0, bc.count * (_rgbw ? 4 : 3)); _len = bc.count; + _rgbw = false; //_rgbw = bc.rgbwOverride; // RGBW override in bit 7 or can have a special type - _rgbw = _type == TYPE_VIRTUAL_RGBW; _colorOrder = bc.colorOrder; _client = IPAddress(bc.pins[0],bc.pins[1],bc.pins[2],bc.pins[3]); _broadcastLock = false; @@ -399,9 +399,16 @@ class BusVirtual : public Bus { } void show() { + uint8_t type; if (!_valid || _broadcastLock) return; _broadcastLock = true; - realtimeBroadcast(_client, _len, _data, _rgbw); + switch (_type) { + case TYPE_NET_ARTNET_RGB: type = 2; break; + case TYPE_NET_E131_RGB: type = 1; break; + case TYPE_NET_DDP_RGB: + default: type = 0; break; + } + realtimeBroadcast(type, _client, _len, _data, _rgbw); _broadcastLock = false; } @@ -441,7 +448,7 @@ class BusVirtual : public Bus { _data = nullptr; } - ~BusVirtual() { + ~BusNetwork() { cleanup(); } @@ -465,9 +472,7 @@ class BusManager { static uint32_t memUsage(BusConfig &bc) { uint8_t type = bc.type; uint16_t len = bc.count; - if (type < 4) { - return len * (type+1); - } else if (type < 32) { + if (type > 15 && type < 32) { #ifdef ESP8266 if (bc.pins[0] == 3) { //8266 DMA uses 5x the mem if (type > 29) return len*20; //RGBW @@ -483,13 +488,13 @@ class BusManager { if (type > 31 && type < 48) return 5; if (type == 44 || type == 45) return len*4; //RGBW - return len*3; + return len*3; //RGB } int add(BusConfig &bc) { if (numBusses >= WLED_MAX_BUSSES) return -1; - if (bc.type>1 && bc.type<4) { - busses[numBusses] = new BusVirtual(bc); + if (bc.type>=10 && bc.type<=15) { + busses[numBusses] = new BusNetwork(bc); } else if (IS_DIGITAL(bc.type)) { busses[numBusses] = new BusDigital(bc, numBusses); } else { diff --git a/wled00/const.h b/wled00/const.h index 27eff968..eb3edd1b 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -122,8 +122,10 @@ #define TYPE_NONE 0 //light is not configured #define TYPE_RESERVED 1 //unused. Might indicate a "virtual" light -#define TYPE_VIRTUAL_RGB 2 //virtual RGB bus (master broadcast bus) -#define TYPE_VIRTUAL_RGBW 3 //virtual RGBW bus (master broadcast bus) +//network types (master broadcast) (10-15) +#define TYPE_NET_DDP_RGB 10 //network DDP RGB bus (master broadcast bus) +#define TYPE_NET_E131_RGB 11 //network E131 RGB bus (master broadcast bus) +#define TYPE_NET_ARTNET_RGB 12 //network ArtNet RGB bus (master broadcast bus) //Digital types (data pin only) (16-31) #define TYPE_WS2812_1CH 20 //white-only chips #define TYPE_WS2812_WWA 21 //amber + warm + cold white diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm index 0c892c6e..95ac482f 100644 --- a/wled00/data/settings_leds.htm +++ b/wled00/data/settings_leds.htm @@ -39,7 +39,7 @@ if (nm=="L0" || nm=="L1" || nm=="L2" || nm=="L3") { var n = LCs[i].name.substring(2); var t = parseInt(d.getElementsByName("LT"+n)[0].value, 10); // LED type SELECT - if (t==2 || t==3) continue; + if (t<16) continue; } //check for pin conflicts if (nm=="L0" || nm=="L1" || nm=="L2" || nm=="L3" || nm=="L4" || nm=="RL" || nm=="BT" || nm=="IR") @@ -54,7 +54,7 @@ if (n2.substring(0,1)==="L") { var m = LCs[j].name.substring(2); var t2 = parseInt(d.getElementsByName("LT"+m)[0].value, 10); - if (t2==2 || t2==3) continue; + if (t2<16) continue; } if (LCs[j].value!="" && LCs[i].value==LCs[j].value) {alert(`Pin conflict between ${LCs[i].name}/${LCs[j].name}!`);LCs[j].value="";LCs[j].focus();return false;} } @@ -107,7 +107,7 @@ if (t==2 || t==3) { return len*(t+1); } - if (t < 32) { + if (t > 15 && t < 32) { if (maxM < 10000 && p0==3) { //8266 DMA uses 5x the mem if (t > 29) return len*20; //RGBW return len*15; @@ -139,7 +139,7 @@ if (s[i].name.substring(0,2)=="LT") { var n = s[i].name.substring(2); var t = parseInt(s[i].value,10); - gId("p0d"+n).innerHTML = (t == 2 || t == 3) ? "IP address:" : (t > 49) ? "Data GPIO:" : (t >41) ? "GPIOs:" : "GPIO:"; + gId("p0d"+n).innerHTML = (t>=10 && t<=15) ? "IP address:" : (t > 49) ? "Data GPIO:" : (t >41) ? "GPIOs:" : "GPIO:"; gId("p1d"+n).innerHTML = (t > 49) ? "Clk GPIO:" : ""; var LK = d.getElementsByName("L1"+n)[0]; // clock pin @@ -149,7 +149,7 @@ for (p=1; p<5; p++) { var LK = d.getElementsByName("L"+p+n)[0]; // secondary pins if (!LK) continue; - if (((t == 2 || t == 3) && p<4) || (t>49 && p==1) || (t>41 && t < 50 && (p+40 < t))) // TYPE_xxxx values from const.h + if (((t>=10 && t<=15) && p<4) || (t>49 && p==1) || (t>41 && t < 50 && (p+40 < t))) // TYPE_xxxx values from const.h { // display pin field LK.style.display = "inline"; @@ -171,10 +171,10 @@ // gId("ew"+n).onclick = (t > 31 && t < 48) ? (function(){return false}) : (function(){}); // prevent change for analog // isRGBW |= gId("ew"+n).checked; isRGBW |= (t == 30 || t == 31 || (t > 40 && t < 46 && t != 43)); // RGBW checkbox, TYPE_xxxx values from const.h - gId("co"+n).style.display = (t == 2 || t == 3 || t == 41 || t == 42) ? "none":"inline"; // hide color order for PWM W & WW/CW + gId("co"+n).style.display = (t<16 || t == 41 || t == 42) ? "none":"inline"; // hide color order for PWM W & WW/CW gId("dig"+n+"c").style.display = (t > 40 && t < 48) ? "none":"inline"; // hide count for analog - gId("dig"+n+"r").style.display = (t == 2 || t == 3) ? "none":"inline"; // hide reversed for virtual - gId("dig"+n+"s").style.display = (t == 2 || t == 3 || (t > 40 && t < 48)) ? "none":"inline"; // hide skip 1st for virtual & analog + gId("dig"+n+"r").style.display = (t<16) ? "none":"inline"; // hide reversed for virtual + gId("dig"+n+"s").style.display = (t<16 || (t > 40 && t < 48)) ? "none":"inline"; // hide skip 1st for virtual & analog gId("rev"+n).innerHTML = (t > 40 && t < 48) ? "Inverted":"Reverse (rotated 180°)"; // change reverse text for analog gId("psd"+n).innerHTML = (t > 40 && t < 48) ? "Index:":"Start:"; // change analog start description } @@ -206,10 +206,10 @@ // ignore IP address if (nm=="L0" || nm=="L1" || nm=="L2" || nm=="L3") { var t = parseInt(d.getElementsByName("LT"+n)[0].value, 10); // LED type SELECT - if (t==2 || t==3) { + if (t<16) { LCs[i].max = 255; LCs[i].min = 0; - continue; + continue; // do not check conflicts } else { LCs[i].max = 33; LCs[i].min = -1; @@ -227,7 +227,7 @@ if (n2.substring(0,1)==="L") { var m = LCs[j].name.substring(2); var t2 = parseInt(d.getElementsByName("LT"+m)[0].value, 10); - if (t2==2 || t2==3) continue; + if (t2<16) continue; } if (LCs[j].value!="" && LCs[j].value!="-1") p.push(parseInt(LCs[j].value,10)); // add current pin } @@ -312,8 +312,9 @@ ${i+1}: - - + + +