Skip to content

Commit 34c566b

Browse files
committed
Simplifications
1 parent 124d807 commit 34c566b

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

wled00/FX_fcn.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,14 +1345,14 @@ void WS2812FX::blendSegment(const Segment &topSegment) const {
13451345
_stencil, _hue, _sat, _val
13461346
};
13471347

1348-
const size_t blendMode = topSegment.blendMode < (sizeof(funcs) / sizeof(FuncType)) ? topSegment.blendMode : 0;
1348+
const size_t blendMode = topSegment.blendMode < countof(funcs) ? topSegment.blendMode : 0;
13491349
const auto func = funcs[blendMode]; // blendMode % (sizeof(funcs) / sizeof(FuncType))
13501350
const auto blend = [&](uint32_t t, uint32_t b){
13511351
// handle special modes first
13521352
switch (blendMode) {
1353-
case 0 : return t; // top (faster than lambda)
1354-
case 1 : return b; // bottom (faster than lambda)
1355-
case 2 : return color_add(t,b); // add (faster than lambda)
1353+
case 0 : return t; // top (faster than channel lambda)
1354+
case 1 : return b; // bottom (faster than channel lambda)
1355+
case 2 : return color_add(t,b); // add (faster than channel lambda)
13561356
case 16: return t ? t : b; // stencil (use top layer if not black, else bottom)
13571357
case 17: { // hue (uses top hue, bottom saturation & value)
13581358
CHSV32 ht = CHSV32(t), hb = CHSV32(b);

wled00/util.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ void *d_calloc(size_t count, size_t size) {
615615
// ensures that a contiguous block of MIN_HEAP_SIZE remains to keep the UI working, otherwise returns nullptr
616616
void *allocate_buffer(size_t size, uint32_t type) {
617617
void *buffer = nullptr;
618-
#if defined(ESP8266) // ESP8266 does not support PSRAM
618+
#if defined(ESP8266) || defined(CONFIG_IDF_TARGET_ESP32C3) // ESP8266 & C3 do not support PSRAM
619619
if (getContiguousFreeHeap() > MIN_HEAP_SIZE + size) buffer = malloc(size); // use malloc for ESP8266 and ESP32-C3
620620
#else
621621
if (type & BFRALLOC_ENFORCE_DRAM) {

0 commit comments

Comments
 (0)