Move RGBW activation to wled.cpp

This commit is contained in:
cschwinne 2021-03-28 17:31:05 +02:00
parent 4264c2a173
commit 806221bc3f
2 changed files with 5 additions and 2 deletions

View File

@ -88,7 +88,6 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
uint8_t colorOrder, type;
uint16_t length, start;
uint8_t pins[5] = {255, 255, 255, 255, 255};
useRGBW = false;
for (uint8_t s = 0; s < WLED_MAX_BUSSES; s++) {
char lp[4] = "L0"; lp[2] = 48+s; lp[3] = 0; //ascii 0-9 //strip data pin
@ -106,7 +105,8 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
pins[i] = (request->arg(lp).length() > 0) ? request->arg(lp).toInt() : 255;
}
type = request->arg(lt).toInt();
//if (BusManager::isRgbw(type)) useRGBW = true; //30fps
//if (isRgbw(type)) useRGBW = true; //30fps
//useRGBW = true;
if (request->hasArg(lc) && request->arg(lc).toInt() > 0) {
length = request->arg(lc).toInt();
@ -120,6 +120,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
if (busConfigs[s] != nullptr) delete busConfigs[s];
busConfigs[s] = new BusConfig(type, pins, start, length, colorOrder, request->hasArg(cv));
//if (BusManager::isRgbw(type)) useRGBW = true; //20fps
//useRGBW = true;
doInitBusses = true;
}

View File

@ -241,10 +241,12 @@ void WLED::loop()
doInitBusses = false;
busses.removeAll();
uint32_t mem = 0;
//useRGBW = false;
for (uint8_t i = 0; i < WLED_MAX_BUSSES; i++) {
if (busConfigs[i] == nullptr) break;
mem += busses.memUsage(*busConfigs[i]);
if (mem <= MAX_LED_MEMORY) busses.add(*busConfigs[i]);
//if (BusManager::isRgbw(busConfigs[i]->type)) useRGBW = true;
delete busConfigs[i]; busConfigs[i] = nullptr;
}
strip.finalizeInit(useRGBW, ledCount, skipFirstLed);