Skip to content

Commit c463d51

Browse files
committed
Set pixel limit by bus type
1 parent 3162579 commit c463d51

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

wled00/bus_manager.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ class Bus {
127127
inline bool isOk() { return _valid; }
128128
inline bool isOffRefreshRequired() { return _needsRefresh; }
129129
bool containsPixel(uint16_t pix) { return pix >= _start && pix < _start+_len; }
130+
virtual uint16_t getMaxPixels() { return MAX_LEDS_PER_BUS; };
130131

131132
virtual bool hasRGB() {
132133
if ((_type >= TYPE_WS2812_1CH && _type <= TYPE_WS2812_WWA) || _type == TYPE_ANALOG_1CH || _type == TYPE_ANALOG_2CH || _type == TYPE_ONOFF) return false;
@@ -296,6 +297,7 @@ class BusNetwork : public Bus {
296297
public:
297298
BusNetwork(BusConfig &bc);
298299

300+
uint16_t getMaxPixels() override { return 4096; };
299301
bool hasRGB() { return true; }
300302
bool hasWhite() { return _rgbw; }
301303

wled00/data/settings_leds.htm

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,14 @@
6060
x.style.animation = 'none';
6161
timeout = setTimeout(function(){ x.className = x.className.replace("show", ""); }, 2900);
6262
}
63-
function bLimits(b,v,p,m,l) {
64-
maxB = b; maxV = v; maxM = m; maxPB = p; maxL = l;
63+
function bLimits(b,v,m,l) {
64+
maxB = b; maxV = v; maxM = m; maxL = l;
6565
}
66-
function pinsOK() {
66+
function setPixelLimit(i, max) {
67+
var lc = d.getElementsByName("LC"+i)[0];
68+
lc.max = max;
69+
}
70+
function pinsOK() {
6771
var LCs = d.getElementsByTagName("input");
6872
for (i=0; i<LCs.length; i++) {
6973
var nm = LCs[i].name.substring(0,2);

wled00/xml.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,6 @@ void getSettingsJS(AsyncWebServerRequest* request, byte subPage, char* dest) //W
411411
oappend(SET_F("bLimits("));
412412
oappend(itoa(WLED_MAX_BUSSES,nS,10)); oappend(",");
413413
oappend(itoa(WLED_MIN_VIRTUAL_BUSSES,nS,10)); oappend(",");
414-
oappend(itoa(MAX_LEDS_PER_BUS,nS,10)); oappend(",");
415414
oappend(itoa(MAX_LED_MEMORY,nS,10)); oappend(",");
416415
oappend(itoa(MAX_LEDS,nS,10));
417416
oappend(SET_F(");"));
@@ -475,6 +474,11 @@ void getSettingsJS(AsyncWebServerRequest* request, byte subPage, char* dest) //W
475474
}
476475
}
477476
sappend('v',sp,speed);
477+
478+
oappend(SET_F("setPixelLimit("));
479+
oappendi(s); oappend(SET_F(","));
480+
oappendi(bus->getMaxPixels()); oappend(SET_F(");"));
481+
478482
}
479483
sappend('v',SET_F("MA"),strip.ablMilliampsMax);
480484
sappend('v',SET_F("LA"),strip.milliampsPerLed);

0 commit comments

Comments
 (0)