GEQ speedup
use drawLine() to draw a complete bar at once. Only possible if _not_ doing colored bars.
This commit is contained in:
@@ -7914,13 +7914,17 @@ uint16_t mode_2DGEQ(void) { // By Will Tatam. Code reduction by Ewoud Wijma.
|
||||
if (barHeight > previousBarHeight[x]) previousBarHeight[x] = barHeight; //drive the peak up
|
||||
|
||||
uint32_t ledColor = BLACK;
|
||||
if ((! SEGMENT.check1) && (barHeight > 0)) { // use faster drawLine when single-color bars are needed
|
||||
ledColor = SEGMENT.color_from_palette(colorIndex, false, PALETTE_SOLID_WRAP, 0);
|
||||
SEGMENT.drawLine(int(x), max(0,int(rows)-barHeight-1), int(x), int(rows-1), ledColor, false); // max(0, ...) to prevent negative Y
|
||||
} else {
|
||||
for (int y=0; y < barHeight; y++) {
|
||||
if (SEGMENT.check1) //color_vertical / color bars toggle
|
||||
colorIndex = map(y, 0, rows-1, 0, 255);
|
||||
|
||||
ledColor = SEGMENT.color_from_palette(colorIndex, false, PALETTE_SOLID_WRAP, 0);
|
||||
SEGMENT.setPixelColorXY(x, rows-1 - y, ledColor);
|
||||
}
|
||||
} }
|
||||
if ((SEGMENT.intensity < 255) && (previousBarHeight[x] > 0) && (previousBarHeight[x] < rows)) // WLEDMM avoid "overshooting" into other segments
|
||||
SEGMENT.setPixelColorXY(x, rows - previousBarHeight[x], (SEGCOLOR(2) != BLACK) ? SEGCOLOR(2) : ledColor);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user