flow effect bugfix
effect was showing blak when using default palette
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user