mirror of
https://github.com/wled/WLED.git
synced 2025-04-23 22:37:18 +00:00
Pre-allocate COM vector
This commit is contained in:
parent
b4315152e2
commit
5df1a223c2
@ -35,6 +35,7 @@ struct ColorOrderMap {
|
||||
bool add(uint16_t start, uint16_t len, uint8_t colorOrder);
|
||||
|
||||
inline uint8_t count() const { return _mappings.size(); }
|
||||
inline void reserve(size_t num) { _mappings.reserve(num); }
|
||||
|
||||
void reset() {
|
||||
_mappings.clear();
|
||||
|
@ -244,6 +244,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
||||
// read color order map configuration
|
||||
JsonArray hw_com = hw[F("com")];
|
||||
if (!hw_com.isNull()) {
|
||||
BusManager::getColorOrderMap().reserve(std::min(hw_com.size(), (size_t)WLED_MAX_COLOR_ORDER_MAPPINGS));
|
||||
for (JsonObject entry : hw_com) {
|
||||
uint16_t start = entry["start"] | 0;
|
||||
uint16_t len = entry["len"] | 0;
|
||||
|
@ -215,6 +215,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
||||
}
|
||||
//doInitBusses = busesChanged; // we will do that below to ensure all input data is processed
|
||||
|
||||
// we will not bother with pre-allocating ColorOrderMappings vector
|
||||
for (int s = 0; s < WLED_MAX_COLOR_ORDER_MAPPINGS; s++) {
|
||||
int offset = s < 10 ? 48 : 55;
|
||||
char xs[4] = "XS"; xs[2] = offset+s; xs[3] = 0; //start LED
|
||||
|
Loading…
x
Reference in New Issue
Block a user