Skip to content

Commit 7d6d9ed

Browse files
committed
Change virtual bus type range
1 parent cf87da0 commit 7d6d9ed

File tree

6 files changed

+46
-43
lines changed

6 files changed

+46
-43
lines changed

wled00/bus_manager.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct BusConfig {
3737
type = busType; count = len; start = pstart;
3838
colorOrder = pcolorOrder; reversed = rev; skipAmount = skip;
3939
uint8_t nPins = 1;
40-
if (type >= 10 && type <= 15) nPins = 4; //virtual network bus. 4 "pins" store IP address
40+
if (type >= TYPE_NET_DDP_RGB && type < 96) nPins = 4; //virtual network bus. 4 "pins" store IP address
4141
else if (type > 47) nPins = 2;
4242
else if (type > 40 && type < 46) nPins = NUM_PWM_PINS(type);
4343
for (uint8_t i = 0; i < nPins; i++) pins[i] = ppins[i];
@@ -150,7 +150,7 @@ class BusDigital : public Bus {
150150
_busPtr = PolyBus::create(_iType, _pins, _len, nr);
151151
_valid = (_busPtr != nullptr);
152152
_colorOrder = bc.colorOrder;
153-
DEBUG_PRINTF("Successfully inited strip %u (len %u) with type %u and pins %u,%u (itype %u)\n",nr, len, type, pins[0],pins[1],_iType);
153+
DEBUG_PRINTF("Successfully inited strip %u (len %u) with type %u and pins %u,%u (itype %u)\n",nr, _len, bc.type, _pins[0],_pins[1],_iType);
154154
};
155155

156156
inline void show() {
@@ -319,6 +319,7 @@ class BusPwm : public Bus {
319319
}
320320

321321
uint8_t getPins(uint8_t* pinArray) {
322+
if (!_valid) return 0;
322323
uint8_t numPins = NUM_PWM_PINS(_type);
323324
for (uint8_t i = 0; i < numPins; i++) pinArray[i] = _pins[i];
324325
return numPins;
@@ -389,7 +390,7 @@ class BusNetwork : public Bus {
389390
if (_data == nullptr) return;
390391
memset(_data, 0, bc.count * _UDPchannels);
391392
_len = bc.count;
392-
_colorOrder = bc.colorOrder;
393+
//_colorOrder = bc.colorOrder;
393394
_client = IPAddress(bc.pins[0],bc.pins[1],bc.pins[2],bc.pins[3]);
394395
_broadcastLock = false;
395396
_valid = true;
@@ -460,7 +461,7 @@ class BusNetwork : public Bus {
460461
private:
461462
IPAddress _client;
462463
uint16_t _len = 0;
463-
uint8_t _colorOrder;
464+
//uint8_t _colorOrder;
464465
uint8_t _bri = 255;
465466
uint8_t _UDPtype;
466467
uint8_t _UDPchannels;
@@ -480,7 +481,7 @@ class BusManager {
480481
static uint32_t memUsage(BusConfig &bc) {
481482
uint8_t type = bc.type;
482483
uint16_t len = bc.count;
483-
if (type > 15 && type < 32) {
484+
if (type < 32) {
484485
#ifdef ESP8266
485486
if (bc.pins[0] == 3) { //8266 DMA uses 5x the mem
486487
if (type > 29) return len*20; //RGBW
@@ -500,7 +501,7 @@ class BusManager {
500501

501502
int add(BusConfig &bc) {
502503
if (numBusses >= WLED_MAX_BUSSES) return -1;
503-
if (bc.type>=10 && bc.type<=15) {
504+
if (bc.type >= TYPE_NET_DDP_RGB && bc.type < 96) {
504505
busses[numBusses] = new BusNetwork(bc);
505506
} else if (IS_DIGITAL(bc.type)) {
506507
busses[numBusses] = new BusDigital(bc, numBusses);

wled00/const.h

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,20 +112,20 @@
112112
#define DMX_MODE_MULTIPLE_DRGB 5 //every LED is addressed with its own RGB and share a master dimmer (ledCount * 3 + 1 channels)
113113
#define DMX_MODE_MULTIPLE_RGBW 6 //every LED is addressed with its own RGBW (ledCount * 4 channels)
114114

115-
//Light capability byte (unused) 0bRRCCTTTT
115+
//Light capability byte (unused) 0bRCCCTTTT
116116
//bits 0/1/2/3: specifies a type of LED driver. A single "driver" may have different chip models but must have the same protocol/behavior
117-
//bits 4/5: specifies the class of LED driver - 0b00 (dec. 0-15) unconfigured/reserved
118-
// - 0b01 (dec. 16-31) digital (data pin only)
119-
// - 0b10 (dec. 32-47) analog (PWM)
120-
// - 0b11 (dec. 48-63) digital (data + clock / SPI)
121-
//bits 6/7 are reserved and set to 0b00
117+
//bits 4/5/6: specifies the class of LED driver - 0b000 (dec. 0-15) unconfigured/reserved
118+
// - 0b001 (dec. 16-31) digital (data pin only)
119+
// - 0b010 (dec. 32-47) analog (PWM)
120+
// - 0b011 (dec. 48-63) digital (data + clock / SPI)
121+
// - 0b100 (dec. 64-79) unused/reserved
122+
// - 0b101 (dec. 80-95) digital (data + clock / SPI)
123+
// - 0b110 (dec. 96-111) unused/reserved
124+
// - 0b111 (dec. 112-127) unused/reserved
125+
//bit 7 is reserved and set to 0
122126

123127
#define TYPE_NONE 0 //light is not configured
124128
#define TYPE_RESERVED 1 //unused. Might indicate a "virtual" light
125-
//network types (master broadcast) (10-15)
126-
#define TYPE_NET_DDP_RGB 10 //network DDP RGB bus (master broadcast bus)
127-
#define TYPE_NET_E131_RGB 11 //network E131 RGB bus (master broadcast bus)
128-
#define TYPE_NET_ARTNET_RGB 12 //network ArtNet RGB bus (master broadcast bus)
129129
//Digital types (data pin only) (16-31)
130130
#define TYPE_WS2812_1CH 20 //white-only chips
131131
#define TYPE_WS2812_WWA 21 //amber + warm + cold white
@@ -146,6 +146,10 @@
146146
#define TYPE_APA102 51
147147
#define TYPE_LPD8806 52
148148
#define TYPE_P9813 53
149+
//Network types (master broadcast) (80-95)
150+
#define TYPE_NET_DDP_RGB 80 //network DDP RGB bus (master broadcast bus)
151+
#define TYPE_NET_E131_RGB 81 //network E131 RGB bus (master broadcast bus)
152+
#define TYPE_NET_ARTNET_RGB 82 //network ArtNet RGB bus (master broadcast bus)
149153

150154
#define IS_DIGITAL(t) ((t) & 0x10) //digital are 16-31 and 48-63
151155
#define IS_PWM(t) ((t) > 40 && (t) < 46)

wled00/data/settings_leds.htm

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
if (nm=="L0" || nm=="L1" || nm=="L2" || nm=="L3") {
4141
var n = LCs[i].name.substring(2);
4242
var t = parseInt(d.getElementsByName("LT"+n)[0].value, 10); // LED type SELECT
43-
if (t<16) continue;
43+
if (t>=80) continue;
4444
}
4545
//check for pin conflicts
4646
if (nm=="L0" || nm=="L1" || nm=="L2" || nm=="L3" || nm=="L4" || nm=="RL" || nm=="BT" || nm=="IR")
@@ -105,7 +105,7 @@
105105
}
106106
//returns mem usage
107107
function getMem(t, len, p0) {
108-
if (t > 15 && t < 32) {
108+
if (t < 32) {
109109
if (maxM < 10000 && p0==3) { //8266 DMA uses 5x the mem
110110
if (t > 29) return len*20; //RGBW
111111
return len*15;
@@ -137,8 +137,8 @@
137137
if (s[i].name.substring(0,2)=="LT") {
138138
var n = s[i].name.substring(2);
139139
var t = parseInt(s[i].value,10);
140-
gId("p0d"+n).innerHTML = (t>=10 && t<=15) ? "IP address:" : (t > 49) ? "Data GPIO:" : (t >41) ? "GPIOs:" : "GPIO:";
141-
gId("p1d"+n).innerHTML = (t > 49) ? "Clk GPIO:" : "";
140+
gId("p0d"+n).innerHTML = (t>=80 && t<96) ? "IP address:" : (t > 49) ? "Data GPIO:" : (t >41) ? "GPIOs:" : "GPIO:";
141+
gId("p1d"+n).innerHTML = (t> 49 && t<64) ? "Clk GPIO:" : "";
142142
var LK = d.getElementsByName("L1"+n)[0]; // clock pin
143143

144144
memu += getMem(t, d.getElementsByName("LC"+n)[0].value, d.getElementsByName("L0"+n)[0].value); // calc memory
@@ -147,7 +147,7 @@
147147
for (p=1; p<5; p++) {
148148
var LK = d.getElementsByName("L"+p+n)[0]; // secondary pins
149149
if (!LK) continue;
150-
if (((t>=10 && t<=15) && p<4) || (t>49 && p==1) || (t>41 && t < 50 && (p+40 < t))) // TYPE_xxxx values from const.h
150+
if (((t>=80 && t<96) && p<4) || (t>49 && p==1) || (t>41 && t < 50 && (p+40 < t))) // TYPE_xxxx values from const.h
151151
{
152152
// display pin field
153153
LK.style.display = "inline";
@@ -163,10 +163,10 @@
163163
if (t > 31 && t < 48) d.getElementsByName("LC"+n)[0].value = 1; // for sanity change analog count just to 1 LED
164164
}
165165
isRGBW |= (t == 30 || t == 31 || (t > 40 && t < 46 && t != 43)); // RGBW checkbox, TYPE_xxxx values from const.h
166-
gId("co"+n).style.display = (t<16 || t == 41 || t == 42) ? "none":"inline"; // hide color order for PWM W & WW/CW
166+
gId("co"+n).style.display = ((t>=80 && t<96) || t == 41 || t == 42) ? "none":"inline"; // hide color order for PWM W & WW/CW
167167
gId("dig"+n+"c").style.display = (t > 40 && t < 48) ? "none":"inline"; // hide count for analog
168-
gId("dig"+n+"r").style.display = (t<16) ? "none":"inline"; // hide reversed for virtual
169-
gId("dig"+n+"s").style.display = (t<16 || (t > 40 && t < 48)) ? "none":"inline"; // hide skip 1st for virtual & analog
168+
gId("dig"+n+"r").style.display = (t>=80 && t<96) ? "none":"inline"; // hide reversed for virtual
169+
gId("dig"+n+"s").style.display = ((t>=80 && t<96) || (t > 40 && t < 48)) ? "none":"inline"; // hide skip 1st for virtual & analog
170170
gId("rev"+n).innerHTML = (t > 40 && t < 48) ? "Inverted output":"Reversed (rotated 180°)"; // change reverse text for analog
171171
gId("psd"+n).innerHTML = (t > 40 && t < 48) ? "Index:":"Start:"; // change analog start description
172172
}
@@ -193,7 +193,7 @@
193193
if (s+c > sLC) sLC = s+c;
194194
if(c>maxLC)maxLC=c;
195195
var t = parseInt(d.getElementsByName("LT"+n)[0].value); // LED type SELECT
196-
if (t>16) sPC+=c; //virtual out busses do not count towards physical LEDs
196+
if (t<80) sPC+=c; //virtual out busses do not count towards physical LEDs
197197
} // increase led count
198198
continue;
199199
}
@@ -205,7 +205,7 @@
205205
// ignore IP address (stored in pins for virtual busses)
206206
if (nm=="L0" || nm=="L1" || nm=="L2" || nm=="L3") {
207207
var t = parseInt(d.getElementsByName("LT"+n)[0].value); // LED type SELECT
208-
if (t<16) {
208+
if (t>=80) {
209209
LCs[i].max = 255;
210210
LCs[i].min = 0;
211211
continue; // do not check conflicts
@@ -226,7 +226,7 @@
226226
if (n2.substring(0,1)==="L") {
227227
var m = LCs[j].name.substring(2);
228228
var t2 = parseInt(d.getElementsByName("LT"+m)[0].value, 10);
229-
if (t2<16) continue;
229+
if (t2>=80) continue;
230230
}
231231
if (LCs[j].value!="" && LCs[j].value!="-1") p.push(parseInt(LCs[j].value,10)); // add current pin
232232
}
@@ -278,10 +278,8 @@
278278
if (isNaN(v)) return 0;
279279
return v;
280280
}
281-
function addLEDs(n)
281+
function addLEDs(n,init=true)
282282
{
283-
if (n>1) {maxB=n; gId("+").style.display="inline"; return;}
284-
285283
var o = d.getElementsByClassName("iST");
286284
var i = o.length;
287285

@@ -307,9 +305,9 @@
307305
<option value="43">PWM RGB</option>
308306
<option value="44">PWM RGBW</option>
309307
<option value="45">PWM RGBWC</option>
310-
<option value="10">DDP RGB (network)</option>
311-
<!--option value="11">E1.31 RGB (network)</option-->
312-
<!--option value="12">ArtNet RGB (network)</option-->
308+
<option value="80">DDP RGB (network)</option>
309+
<!--option value="81">E1.31 RGB (network)</option-->
310+
<!--option value="82">ArtNet RGB (network)</option-->
313311
</select>&nbsp;
314312
<div id="co${i}" style="display:inline">Color Order:
315313
<select name="CO${i}">
@@ -342,7 +340,7 @@
342340
gId("+").style.display = (i<maxB-1) ? "inline":"none";
343341
gId("-").style.display = (i>0) ? "inline":"none";
344342

345-
UI();
343+
if (!init) UI();
346344
}
347345
function addBtn(i,p,t) {
348346
var c = gId("btns").innerHTML;
@@ -393,7 +391,7 @@
393391
function GetV()
394392
{
395393
//values injected by server while sending HTML
396-
d.um_p=[6,7,8,9,10,11];bLimits(3,4096,4000,1664);d.Sf.MS.checked=0;addLEDs(1);d.Sf.L00.value=2;d.Sf.LC0.value=29;d.Sf.LT0.value=22;d.Sf.CO0.value=0;d.Sf.LS0.value=0;d.Sf.CV0.checked=0;d.Sf.SL0.checked=0;d.Sf.MA.value=850;d.Sf.LA.value=0;d.Sf.CA.value=56;d.Sf.AW.value=3;d.Sf.BO.checked=1;d.Sf.BP.value=80;d.Sf.GB.checked=0;d.Sf.GC.checked=1;d.Sf.TF.checked=1;d.Sf.TD.value=700;d.Sf.PF.checked=0;d.Sf.BF.value=100;d.Sf.TB.value=0;d.Sf.TL.value=60;d.Sf.TW.value=0;d.Sf.PB.selectedIndex=0;d.Sf.RL.value=12;d.Sf.RM.checked=1;addBtn(0,0,0);addBtn(1,-1,0);d.Sf.TT.value=32;d.Sf.IR.value=-1;d.Sf.IT.value=0;
394+
//d.um_p=[6,7,8,9,10,11,1];bLimits(3,4096,4000,1664);d.Sf.MS.checked=1;addLEDs(1);d.Sf.L00.value=2;d.Sf.LC0.value=30;d.Sf.LT0.value=22;d.Sf.CO0.value=0;d.Sf.LS0.value=15;d.Sf.CV0.checked=1;d.Sf.SL0.checked=0;addLEDs(1);d.Sf.L01.value=10;d.Sf.L11.value=10;d.Sf.L21.value=1;d.Sf.L31.value=10;d.Sf.LC1.value=60;d.Sf.LT1.value=80;d.Sf.CO1.value=1;d.Sf.LS1.value=0;d.Sf.CV1.checked=0;d.Sf.SL1.checked=0;d.Sf.MA.value=850;d.Sf.LA.value=0;d.Sf.CA.value=56;d.Sf.AW.value=3;d.Sf.BO.checked=1;d.Sf.BP.value=80;d.Sf.GB.checked=0;d.Sf.GC.checked=1;d.Sf.TF.checked=1;d.Sf.TD.value=700;d.Sf.PF.checked=0;d.Sf.BF.value=100;d.Sf.TB.value=0;d.Sf.TL.value=60;d.Sf.TW.value=0;d.Sf.PB.selectedIndex=0;d.Sf.RL.value=12;d.Sf.RM.checked=1;addBtn(0,0,0);addBtn(1,-1,0);d.Sf.TT.value=32;d.Sf.IR.value=-1;d.Sf.IT.value=0;
397395
}
398396
</script>
399397
<style>
@@ -437,8 +435,8 @@ <h2>LED &amp; Hardware setup</h2>
437435
<h3>Hardware setup</h3>
438436
<div id="mLC">LED outputs:</div>
439437
<hr style="width:260px">
440-
<button type="button" id="+" onclick="addLEDs(1)" style="display:none;border-radius:20px;height:36px;">+</button>
441-
<button type="button" id="-" onclick="addLEDs(-1)" style="display:none;border-radius:20px;width:36px;height:36px;">-</button><br>
438+
<button type="button" id="+" onclick="addLEDs(1,false)" style="display:none;border-radius:20px;height:36px;">+</button>
439+
<button type="button" id="-" onclick="addLEDs(-1,false)" style="display:none;border-radius:20px;width:36px;height:36px;">-</button><br>
442440
LED Memory Usage: <span id="m0">0</span> / <span id="m1">?</span> B<br>
443441
<div id="dbar" style="display:inline-block; width: 100px; height: 10px; border-radius: 20px;"></div><br>
444442
<div id="ledwarning" style="color: orange; display: none;">

0 commit comments

Comments
 (0)