BusManager static method.

This commit is contained in:
Blaž Kristan 2021-03-26 11:52:04 +01:00
parent 7a8ba7d47d
commit 23b5fd1c12
3 changed files with 3 additions and 3 deletions

View File

@ -335,7 +335,7 @@ class BusManager {
};
//utility to get the approx. memory usage of a given BusConfig
uint32_t memUsage(BusConfig &bc) {
static uint32_t memUsage(BusConfig &bc) {
uint8_t type = bc.type;
uint16_t len = bc.count;
if (type < 32) {

View File

@ -134,7 +134,7 @@ void deserializeConfig() {
s++;
lC += length;
BusConfig bc = BusConfig(ledType, pins, start, length, colorOrder, reversed, skipFirst);
mem += busses.memUsage(bc);
mem += BusManager::memUsage(bc);
if (mem <= MAX_LED_MEMORY) busses.add(bc);
}
if (lC > ledCount) ledCount = lC; // fix incorrect total length (honour analog setup)

View File

@ -226,7 +226,7 @@ void WLED::loop()
uint32_t mem = 0;
for (uint8_t i = 0; i < WLED_MAX_BUSSES; i++) {
if (busConfigs[i] == nullptr) break;
mem += busses.memUsage(*busConfigs[i]);
mem += BusManager::memUsage(*busConfigs[i]);
if (mem <= MAX_LED_MEMORY) busses.add(*busConfigs[i]);
delete busConfigs[i]; busConfigs[i] = nullptr;
}