Change virtual bus type range
This commit is contained in:
parent
cf87da0ef3
commit
7d6d9eddc4
@ -37,7 +37,7 @@ struct BusConfig {
|
||||
type = busType; count = len; start = pstart;
|
||||
colorOrder = pcolorOrder; reversed = rev; skipAmount = skip;
|
||||
uint8_t nPins = 1;
|
||||
if (type >= 10 && type <= 15) nPins = 4; //virtual network bus. 4 "pins" store IP address
|
||||
if (type >= TYPE_NET_DDP_RGB && type < 96) nPins = 4; //virtual network bus. 4 "pins" store IP address
|
||||
else if (type > 47) nPins = 2;
|
||||
else if (type > 40 && type < 46) nPins = NUM_PWM_PINS(type);
|
||||
for (uint8_t i = 0; i < nPins; i++) pins[i] = ppins[i];
|
||||
@ -150,7 +150,7 @@ class BusDigital : public Bus {
|
||||
_busPtr = PolyBus::create(_iType, _pins, _len, nr);
|
||||
_valid = (_busPtr != nullptr);
|
||||
_colorOrder = bc.colorOrder;
|
||||
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);
|
||||
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);
|
||||
};
|
||||
|
||||
inline void show() {
|
||||
@ -319,6 +319,7 @@ class BusPwm : public Bus {
|
||||
}
|
||||
|
||||
uint8_t getPins(uint8_t* pinArray) {
|
||||
if (!_valid) return 0;
|
||||
uint8_t numPins = NUM_PWM_PINS(_type);
|
||||
for (uint8_t i = 0; i < numPins; i++) pinArray[i] = _pins[i];
|
||||
return numPins;
|
||||
@ -389,7 +390,7 @@ class BusNetwork : public Bus {
|
||||
if (_data == nullptr) return;
|
||||
memset(_data, 0, bc.count * _UDPchannels);
|
||||
_len = bc.count;
|
||||
_colorOrder = bc.colorOrder;
|
||||
//_colorOrder = bc.colorOrder;
|
||||
_client = IPAddress(bc.pins[0],bc.pins[1],bc.pins[2],bc.pins[3]);
|
||||
_broadcastLock = false;
|
||||
_valid = true;
|
||||
@ -460,7 +461,7 @@ class BusNetwork : public Bus {
|
||||
private:
|
||||
IPAddress _client;
|
||||
uint16_t _len = 0;
|
||||
uint8_t _colorOrder;
|
||||
//uint8_t _colorOrder;
|
||||
uint8_t _bri = 255;
|
||||
uint8_t _UDPtype;
|
||||
uint8_t _UDPchannels;
|
||||
@ -480,7 +481,7 @@ class BusManager {
|
||||
static uint32_t memUsage(BusConfig &bc) {
|
||||
uint8_t type = bc.type;
|
||||
uint16_t len = bc.count;
|
||||
if (type > 15 && type < 32) {
|
||||
if (type < 32) {
|
||||
#ifdef ESP8266
|
||||
if (bc.pins[0] == 3) { //8266 DMA uses 5x the mem
|
||||
if (type > 29) return len*20; //RGBW
|
||||
@ -500,7 +501,7 @@ class BusManager {
|
||||
|
||||
int add(BusConfig &bc) {
|
||||
if (numBusses >= WLED_MAX_BUSSES) return -1;
|
||||
if (bc.type>=10 && bc.type<=15) {
|
||||
if (bc.type >= TYPE_NET_DDP_RGB && bc.type < 96) {
|
||||
busses[numBusses] = new BusNetwork(bc);
|
||||
} else if (IS_DIGITAL(bc.type)) {
|
||||
busses[numBusses] = new BusDigital(bc, numBusses);
|
||||
|
@ -112,20 +112,20 @@
|
||||
#define DMX_MODE_MULTIPLE_DRGB 5 //every LED is addressed with its own RGB and share a master dimmer (ledCount * 3 + 1 channels)
|
||||
#define DMX_MODE_MULTIPLE_RGBW 6 //every LED is addressed with its own RGBW (ledCount * 4 channels)
|
||||
|
||||
//Light capability byte (unused) 0bRRCCTTTT
|
||||
//Light capability byte (unused) 0bRCCCTTTT
|
||||
//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
|
||||
//bits 4/5: specifies the class of LED driver - 0b00 (dec. 0-15) unconfigured/reserved
|
||||
// - 0b01 (dec. 16-31) digital (data pin only)
|
||||
// - 0b10 (dec. 32-47) analog (PWM)
|
||||
// - 0b11 (dec. 48-63) digital (data + clock / SPI)
|
||||
//bits 6/7 are reserved and set to 0b00
|
||||
//bits 4/5/6: specifies the class of LED driver - 0b000 (dec. 0-15) unconfigured/reserved
|
||||
// - 0b001 (dec. 16-31) digital (data pin only)
|
||||
// - 0b010 (dec. 32-47) analog (PWM)
|
||||
// - 0b011 (dec. 48-63) digital (data + clock / SPI)
|
||||
// - 0b100 (dec. 64-79) unused/reserved
|
||||
// - 0b101 (dec. 80-95) digital (data + clock / SPI)
|
||||
// - 0b110 (dec. 96-111) unused/reserved
|
||||
// - 0b111 (dec. 112-127) unused/reserved
|
||||
//bit 7 is reserved and set to 0
|
||||
|
||||
#define TYPE_NONE 0 //light is not configured
|
||||
#define TYPE_RESERVED 1 //unused. Might indicate a "virtual" light
|
||||
//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
|
||||
@ -146,6 +146,10 @@
|
||||
#define TYPE_APA102 51
|
||||
#define TYPE_LPD8806 52
|
||||
#define TYPE_P9813 53
|
||||
//Network types (master broadcast) (80-95)
|
||||
#define TYPE_NET_DDP_RGB 80 //network DDP RGB bus (master broadcast bus)
|
||||
#define TYPE_NET_E131_RGB 81 //network E131 RGB bus (master broadcast bus)
|
||||
#define TYPE_NET_ARTNET_RGB 82 //network ArtNet RGB bus (master broadcast bus)
|
||||
|
||||
#define IS_DIGITAL(t) ((t) & 0x10) //digital are 16-31 and 48-63
|
||||
#define IS_PWM(t) ((t) > 40 && (t) < 46)
|
||||
|
@ -40,7 +40,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<16) continue;
|
||||
if (t>=80) continue;
|
||||
}
|
||||
//check for pin conflicts
|
||||
if (nm=="L0" || nm=="L1" || nm=="L2" || nm=="L3" || nm=="L4" || nm=="RL" || nm=="BT" || nm=="IR")
|
||||
@ -105,7 +105,7 @@
|
||||
}
|
||||
//returns mem usage
|
||||
function getMem(t, len, p0) {
|
||||
if (t > 15 && t < 32) {
|
||||
if (t < 32) {
|
||||
if (maxM < 10000 && p0==3) { //8266 DMA uses 5x the mem
|
||||
if (t > 29) return len*20; //RGBW
|
||||
return len*15;
|
||||
@ -137,8 +137,8 @@
|
||||
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>=10 && t<=15) ? "IP address:" : (t > 49) ? "Data GPIO:" : (t >41) ? "GPIOs:" : "GPIO:";
|
||||
gId("p1d"+n).innerHTML = (t > 49) ? "Clk GPIO:" : "";
|
||||
gId("p0d"+n).innerHTML = (t>=80 && t<96) ? "IP address:" : (t > 49) ? "Data GPIO:" : (t >41) ? "GPIOs:" : "GPIO:";
|
||||
gId("p1d"+n).innerHTML = (t> 49 && t<64) ? "Clk GPIO:" : "";
|
||||
var LK = d.getElementsByName("L1"+n)[0]; // clock pin
|
||||
|
||||
memu += getMem(t, d.getElementsByName("LC"+n)[0].value, d.getElementsByName("L0"+n)[0].value); // calc memory
|
||||
@ -147,7 +147,7 @@
|
||||
for (p=1; p<5; p++) {
|
||||
var LK = d.getElementsByName("L"+p+n)[0]; // secondary pins
|
||||
if (!LK) continue;
|
||||
if (((t>=10 && t<=15) && p<4) || (t>49 && p==1) || (t>41 && t < 50 && (p+40 < t))) // TYPE_xxxx values from const.h
|
||||
if (((t>=80 && t<96) && 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";
|
||||
@ -163,10 +163,10 @@
|
||||
if (t > 31 && t < 48) d.getElementsByName("LC"+n)[0].value = 1; // for sanity change analog count just to 1 LED
|
||||
}
|
||||
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<16 || t == 41 || t == 42) ? "none":"inline"; // hide color order for PWM W & WW/CW
|
||||
gId("co"+n).style.display = ((t>=80 && t<96) || 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<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("dig"+n+"r").style.display = (t>=80 && t<96) ? "none":"inline"; // hide reversed for virtual
|
||||
gId("dig"+n+"s").style.display = ((t>=80 && t<96) || (t > 40 && t < 48)) ? "none":"inline"; // hide skip 1st for virtual & analog
|
||||
gId("rev"+n).innerHTML = (t > 40 && t < 48) ? "Inverted output":"Reversed (rotated 180°)"; // change reverse text for analog
|
||||
gId("psd"+n).innerHTML = (t > 40 && t < 48) ? "Index:":"Start:"; // change analog start description
|
||||
}
|
||||
@ -193,7 +193,7 @@
|
||||
if (s+c > sLC) sLC = s+c;
|
||||
if(c>maxLC)maxLC=c;
|
||||
var t = parseInt(d.getElementsByName("LT"+n)[0].value); // LED type SELECT
|
||||
if (t>16) sPC+=c; //virtual out busses do not count towards physical LEDs
|
||||
if (t<80) sPC+=c; //virtual out busses do not count towards physical LEDs
|
||||
} // increase led count
|
||||
continue;
|
||||
}
|
||||
@ -205,7 +205,7 @@
|
||||
// ignore IP address (stored in pins for virtual busses)
|
||||
if (nm=="L0" || nm=="L1" || nm=="L2" || nm=="L3") {
|
||||
var t = parseInt(d.getElementsByName("LT"+n)[0].value); // LED type SELECT
|
||||
if (t<16) {
|
||||
if (t>=80) {
|
||||
LCs[i].max = 255;
|
||||
LCs[i].min = 0;
|
||||
continue; // do not check conflicts
|
||||
@ -226,7 +226,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<16) continue;
|
||||
if (t2>=80) continue;
|
||||
}
|
||||
if (LCs[j].value!="" && LCs[j].value!="-1") p.push(parseInt(LCs[j].value,10)); // add current pin
|
||||
}
|
||||
@ -278,10 +278,8 @@
|
||||
if (isNaN(v)) return 0;
|
||||
return v;
|
||||
}
|
||||
function addLEDs(n)
|
||||
function addLEDs(n,init=true)
|
||||
{
|
||||
if (n>1) {maxB=n; gId("+").style.display="inline"; return;}
|
||||
|
||||
var o = d.getElementsByClassName("iST");
|
||||
var i = o.length;
|
||||
|
||||
@ -307,9 +305,9 @@ ${i+1}:
|
||||
<option value="43">PWM RGB</option>
|
||||
<option value="44">PWM RGBW</option>
|
||||
<option value="45">PWM RGBWC</option>
|
||||
<option value="10">DDP RGB (network)</option>
|
||||
<!--option value="11">E1.31 RGB (network)</option-->
|
||||
<!--option value="12">ArtNet RGB (network)</option-->
|
||||
<option value="80">DDP RGB (network)</option>
|
||||
<!--option value="81">E1.31 RGB (network)</option-->
|
||||
<!--option value="82">ArtNet RGB (network)</option-->
|
||||
</select>
|
||||
<div id="co${i}" style="display:inline">Color Order:
|
||||
<select name="CO${i}">
|
||||
@ -342,7 +340,7 @@ ${i+1}:
|
||||
gId("+").style.display = (i<maxB-1) ? "inline":"none";
|
||||
gId("-").style.display = (i>0) ? "inline":"none";
|
||||
|
||||
UI();
|
||||
if (!init) UI();
|
||||
}
|
||||
function addBtn(i,p,t) {
|
||||
var c = gId("btns").innerHTML;
|
||||
@ -393,7 +391,7 @@ ${i+1}:
|
||||
function GetV()
|
||||
{
|
||||
//values injected by server while sending HTML
|
||||
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;
|
||||
//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;
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
@ -437,8 +435,8 @@ ${i+1}:
|
||||
<h3>Hardware setup</h3>
|
||||
<div id="mLC">LED outputs:</div>
|
||||
<hr style="width:260px">
|
||||
<button type="button" id="+" onclick="addLEDs(1)" style="display:none;border-radius:20px;height:36px;">+</button>
|
||||
<button type="button" id="-" onclick="addLEDs(-1)" style="display:none;border-radius:20px;width:36px;height:36px;">-</button><br>
|
||||
<button type="button" id="+" onclick="addLEDs(1,false)" style="display:none;border-radius:20px;height:36px;">+</button>
|
||||
<button type="button" id="-" onclick="addLEDs(-1,false)" style="display:none;border-radius:20px;width:36px;height:36px;">-</button><br>
|
||||
LED Memory Usage: <span id="m0">0</span> / <span id="m1">?</span> B<br>
|
||||
<div id="dbar" style="display:inline-block; width: 100px; height: 10px; border-radius: 20px;"></div><br>
|
||||
<div id="ledwarning" style="color: orange; display: none;">
|
||||
|
File diff suppressed because one or more lines are too long
@ -617,7 +617,7 @@ uint8_t realtimeBroadcast(uint8_t type, IPAddress client, uint16_t length, uint8
|
||||
}
|
||||
|
||||
if (!ddpUdp.endPacket()) {
|
||||
DEBUG_PRINTLN("WiFiUDP.endPacket returned an error");
|
||||
DEBUG_PRINTLN(F("WiFiUDP.endPacket returned an error"));
|
||||
return 1; // problem
|
||||
}
|
||||
|
||||
|
@ -366,7 +366,7 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
oappend(itoa(WLED_MAX_BUSSES,nS,10)); oappend(",");
|
||||
oappend(itoa(MAX_LEDS_PER_BUS,nS,10)); oappend(",");
|
||||
oappend(itoa(MAX_LED_MEMORY,nS,10)); oappend(",");
|
||||
oappend(itoa(MAX_LEDS,nS,10)); oappend(",");
|
||||
oappend(itoa(MAX_LEDS,nS,10));
|
||||
oappend(SET_F(");"));
|
||||
|
||||
sappend('c',SET_F("MS"),autoSegments);
|
||||
@ -385,7 +385,7 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
uint8_t nPins = bus->getPins(pins);
|
||||
for (uint8_t i = 0; i < nPins; i++) {
|
||||
lp[1] = 48+i;
|
||||
if (pinManager.isPinOk(pins[i]) || bus->getType()<=15) sappend('v',lp,pins[i]);
|
||||
if (pinManager.isPinOk(pins[i]) || bus->getType()>=TYPE_NET_DDP_RGB) sappend('v',lp,pins[i]);
|
||||
}
|
||||
sappend('v',lc,bus->getLength());
|
||||
sappend('v',lt,bus->getType());
|
||||
|
Loading…
Reference in New Issue
Block a user