Skip to content

Commit db5e66a

Browse files
committed
playing with Fire2012
* speedup: add functions to only blur rows or columns (50% faster) * fire2012: tinkering with bur options. Vertical blur only when slider < 64 (faster); extra blur for slider values >192 (bush burn)
1 parent 7d7b7c1 commit db5e66a

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

wled00/FX.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,7 +2098,7 @@ uint16_t mode_fire_2012() {
20982098

20992099
// Step 4. Map from heat cells to LED colors
21002100
for (int j = 0; j < SEGLEN; j++) {
2101-
SEGMENT.setPixelColor(indexToVStrip(j, stripNr), ColorFromPalette(SEGPALETTE, MIN(heat[j],240), 255, NOBLEND));
2101+
SEGMENT.setPixelColor(indexToVStrip(j, stripNr), ColorFromPalette(SEGPALETTE, min(heat[j], byte(240)), 255, NOBLEND));
21022102
}
21032103
}
21042104
};
@@ -2108,7 +2108,9 @@ uint16_t mode_fire_2012() {
21082108

21092109
if (SEGMENT.is2D()) {
21102110
uint8_t blurAmount = SEGMENT.custom2 >> 2;
2111-
SEGMENT.blur(blurAmount);
2111+
if (blurAmount > 48) blurAmount += blurAmount-48; // extra blur when slider > 192 (bush burn)
2112+
if (blurAmount < 16) SEGMENT.blurCols(SEGMENT.custom2 >> 1); // no side-burn when slider < 64 (faster)
2113+
else SEGMENT.blur(blurAmount);
21122114
}
21132115

21142116
if (it != SEGENV.step)

wled00/FX.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,16 @@ typedef struct Segment {
602602
uint32_t color_from_palette(uint16_t, bool mapping, bool wrap, uint8_t mcol, uint8_t pbri = 255) const;
603603
uint32_t color_wheel(uint8_t pos) const;
604604

605+
// 2D Blur: shortcuts for bluring columns or rows only (50% faster than full 2D blur)
606+
inline void blurCols(fract8 blur_amount, bool smear = false) { // blur all columns
607+
const unsigned cols = virtualWidth();
608+
for (unsigned k = 0; k < cols; k++) blurCol(k, blur_amount, smear);
609+
}
610+
inline void blurRows(fract8 blur_amount, bool smear = false) { // blur all rows
611+
const unsigned rows = virtualHeight();
612+
for ( unsigned i = 0; i < rows; i++) blurRow(i, blur_amount, smear);
613+
}
614+
605615
// 2D matrix
606616
uint16_t virtualWidth(void) const; // segment width in virtual pixels (accounts for groupping and spacing)
607617
uint16_t virtualHeight(void) const; // segment height in virtual pixels (accounts for groupping and spacing)

0 commit comments

Comments
 (0)