flow effect bugfix

effect was showing blak when using default palette
This commit is contained in:
Frank
2026-03-03 23:13:34 +01:00
parent a0c0a31480
commit 7f889763d1
2 changed files with 3 additions and 3 deletions

View File

@@ -4488,14 +4488,14 @@ uint16_t mode_flow(void)
int zoneLen = SEGLEN / zones;
zones += 2; //add two extra zones to cover beginning and end of segment (compensate integer truncation)
int offset = ((int)SEGLEN - (zones * zoneLen)) / 2; // center the zones on the segment (can not use bit shift on negative number)
//SEGMENT.fill(SEGMENT.color_from_palette(-counter, false, true, 255));
SEGMENT.fill(SEGMENT.color_from_palette(-counter, false, true, 255));
for (int z = 0; z < zones; z++)
{
int pos = offset + z * zoneLen;
for (int i = 0; i < zoneLen; i++)
{
unsigned colorIndex = (i * 255 / zoneLen) - counter;
uint8_t colorIndex = (i * 255 / zoneLen) - counter;
int led = (z & 0x01) ? i : (zoneLen -1) -i;
if (SEGMENT.reverse) led = (zoneLen -1) -led;
SEGMENT.setPixelColor(pos + led, SEGMENT.color_from_palette(colorIndex, false, true, 255));

View File

@@ -725,7 +725,7 @@ typedef struct Segment {
uint8_t get_random_wheel_index(uint8_t pos) const;
// WLEDMM function moved here (from FX_fcn.cpp) for better optimization by the compiler
inline uint32_t __attribute__((hot)) color_from_palette(uint_fast16_t i, bool mapping, bool wrap, uint8_t mcol, uint8_t pbri = 255) const {
inline uint32_t __attribute__((hot)) color_from_palette(uint_fast16_t i, bool mapping, bool wrap, uint8_t mcol=0, uint8_t pbri = 255) const {
uint32_t color = gamma32(currentColor(mcol, colors[mcol]));
// default palette or no RGB support on segment
if ((palette == 0 && mcol < NUM_COLORS) || !_isRGB) {