Skip to content

Commit

Permalink
Fix min function deduction on ESP platforms
Browse files Browse the repository at this point in the history
Having the calculation as part of the function argument was apparently confusing the template. Casting the result of the uint16 - uint16 math to a uint16 fixes the problem and it can find the template just fine.

This wasn't previously an issue on the AVR platforms because the min function is done using a macro there.
  • Loading branch information
dmadison committed Jul 7, 2023
1 parent 3064baf commit a30e8fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/FastLED_NeoPixel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void FastLED_NeoPixel_Variant::fill(uint32_t c, uint16_t first, uint16_t count)

if (first == 0 && count == 0) count = numLEDs; // if auto, fill from start to end
else if (first != 0 && count == 0) count = numLEDs - first; // if only first is set, fill from first to end
else count = min(count, numLEDs - first); // if both are set, fill from first to end without overrunning buffer
else count = min(count, static_cast<uint16_t>(numLEDs - first)); // if both are set, fill from first to end without overrunning buffer

fill_solid(leds + first, count, packedToColor(c));
}
Expand Down

0 comments on commit a30e8fc

Please sign in to comment.