Set pixel limit by bus type

This commit is contained in:
Will Tatam
2024-02-25 17:00:41 +00:00
parent 3162579f8e
commit c463d5179d
3 changed files with 14 additions and 4 deletions

View File

@@ -127,6 +127,7 @@ class Bus {
inline bool isOk() { return _valid; }
inline bool isOffRefreshRequired() { return _needsRefresh; }
bool containsPixel(uint16_t pix) { return pix >= _start && pix < _start+_len; }
virtual uint16_t getMaxPixels() { return MAX_LEDS_PER_BUS; };
virtual bool hasRGB() {
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 {
public:
BusNetwork(BusConfig &bc);
uint16_t getMaxPixels() override { return 4096; };
bool hasRGB() { return true; }
bool hasWhite() { return _rgbw; }

View File

@@ -60,10 +60,14 @@
x.style.animation = 'none';
timeout = setTimeout(function(){ x.className = x.className.replace("show", ""); }, 2900);
}
function bLimits(b,v,p,m,l) {
maxB = b; maxV = v; maxM = m; maxPB = p; maxL = l;
function bLimits(b,v,m,l) {
maxB = b; maxV = v; maxM = m; maxL = l;
}
function pinsOK() {
function setPixelLimit(i, max) {
var lc = d.getElementsByName("LC"+i)[0];
lc.max = max;
}
function pinsOK() {
var LCs = d.getElementsByTagName("input");
for (i=0; i<LCs.length; i++) {
var nm = LCs[i].name.substring(0,2);

View File

@@ -411,7 +411,6 @@ void getSettingsJS(AsyncWebServerRequest* request, byte subPage, char* dest) //W
oappend(SET_F("bLimits("));
oappend(itoa(WLED_MAX_BUSSES,nS,10)); oappend(",");
oappend(itoa(WLED_MIN_VIRTUAL_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(SET_F(");"));
@@ -475,6 +474,11 @@ void getSettingsJS(AsyncWebServerRequest* request, byte subPage, char* dest) //W
}
}
sappend('v',sp,speed);
oappend(SET_F("setPixelLimit("));
oappendi(s); oappend(SET_F(","));
oappendi(bus->getMaxPixels()); oappend(SET_F(");"));
}
sappend('v',SET_F("MA"),strip.ablMilliampsMax);
sappend('v',SET_F("LA"),strip.milliampsPerLed);