Skip to content

Commit 972257a

Browse files
committed
minor code cleanup
* removed dead code * prevent promotion to double * made constants constexpr * made some methods const * fixed a few typo's
1 parent 102d098 commit 972257a

File tree

4 files changed

+46
-76
lines changed

4 files changed

+46
-76
lines changed

wled00/FX.cpp

Lines changed: 45 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static int8_t tristate_square8(uint8_t x, uint8_t pulsewidth, uint8_t attdec) {
7575
return 0;
7676
}
7777

78-
// float version of map() // WLEDMM moved here so its available for all effects
78+
// float version of map() // WLEDMM moved here so it is available for all effects
7979
static float mapf(float x, float in_min, float in_max, float out_min, float out_max){
8080
if (in_max == in_min) return (out_min); // WLEDMM avoid div/0
8181
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
@@ -795,7 +795,7 @@ static const char _data_FX_MODE_MULTI_STROBE[] PROGMEM = "Strobe Mega@!,!;!,!;!;
795795
* Android loading circle
796796
*/
797797
uint16_t mode_android(void) {
798-
798+
if (SEGLEN <= 1) return mode_static(); // WLEDMM to prevent division by zero
799799
for (int i = 0; i < SEGLEN; i++) {
800800
SEGMENT.setPixelColor(i, SEGMENT.color_from_palette(i, true, PALETTE_SOLID_WRAP, 1));
801801
}
@@ -1043,7 +1043,7 @@ static const char _data_FX_MODE_TRAFFIC_LIGHT[] PROGMEM = "Traffic Light@!,US st
10431043
*/
10441044
#define FLASH_COUNT 4
10451045
uint16_t mode_chase_flash(void) {
1046-
if (SEGLEN == 1) return mode_static();
1046+
if (SEGLEN <= 1) return mode_static();
10471047
uint8_t flash_step = SEGENV.call % ((FLASH_COUNT * 2) + 1);
10481048

10491049
for (int i = 0; i < SEGLEN; i++) {
@@ -2091,7 +2091,7 @@ uint16_t mode_partyjerk() {
20912091

20922092
CRGB rgb(CHSV(SEGENV.aux1, 255, activeColor));
20932093
SEGMENT.setPixelColor((uint16_t)i, rgb.r, rgb.g, rgb.b);
2094-
};
2094+
}
20952095

20962096
return FRAMETIME;
20972097
} // mode_partyjerk()
@@ -3012,7 +3012,7 @@ uint16_t mode_bouncing_balls(void) {
30123012
if (SEGLEN == 1) return mode_static();
30133013
//allocate segment data
30143014
const uint16_t strips = SEGMENT.nrOfVStrips(); // adapt for 2D
3015-
const size_t maxNumBalls = 16;
3015+
constexpr size_t maxNumBalls = 16;
30163016
uint16_t dataSize = sizeof(ball) * maxNumBalls;
30173017
if (!SEGENV.allocateData(dataSize * strips)) return mode_static(); //allocation failed
30183018

@@ -3165,7 +3165,7 @@ static uint16_t rolling_balls(void) {
31653165

31663166
if (thisHeight < 0.0f) thisHeight = 0.0f;
31673167
if (thisHeight > 1.0f) thisHeight = 1.0f;
3168-
uint16_t pos = round(thisHeight * (SEGLEN - 1));
3168+
uint16_t pos = roundf(thisHeight * (SEGLEN - 1));
31693169
SEGMENT.setPixelColor(pos, color);
31703170
balls[i].lastBounceUpdate = strip.now;
31713171
balls[i].height = thisHeight;
@@ -3808,7 +3808,7 @@ uint16_t mode_drip(void)
38083808
if (SEGLEN == 1) return mode_static();
38093809
//allocate segment data
38103810
uint16_t strips = SEGMENT.nrOfVStrips();
3811-
const int maxNumDrops = 4;
3811+
constexpr int maxNumDrops = 4;
38123812
uint16_t dataSize = sizeof(sparkdrop) * maxNumDrops;
38133813
if (!SEGENV.allocateData(dataSize * strips)) return mode_static(); //allocation failed
38143814
SparkDrop* drops = reinterpret_cast<SparkDrop*>(SEGENV.data);
@@ -4034,8 +4034,8 @@ uint16_t mode_percent(void) {
40344034

40354035
uint8_t percent = SEGMENT.intensity;
40364036
percent = constrain(percent, 0, 200);
4037-
uint16_t active_leds = (percent < 100) ? SEGLEN * percent / 100.0
4038-
: SEGLEN * (200 - percent) / 100.0;
4037+
uint16_t active_leds = (percent < 100) ? SEGLEN * percent / 100.0f
4038+
: SEGLEN * (200 - percent) / 100.0f;
40394039

40404040
uint8_t size = (1 + ((SEGMENT.speed * SEGLEN) >> 11));
40414041
if (SEGMENT.speed == 255) size = 255;
@@ -4137,7 +4137,7 @@ static const char _data_FX_MODE_HEARTBEAT[] PROGMEM = "Heartbeat@!,!;!,!;!;01;m1
41374137
// Modified for WLED, based on https://github.com/FastLED/FastLED/blob/master/examples/Pacifica/Pacifica.ino
41384138
//
41394139
// Add one layer of waves into the led array
4140-
CRGB pacifica_one_layer(uint16_t i, CRGBPalette16& p, uint16_t cistart, uint16_t wavescale, uint8_t bri, uint16_t ioff)
4140+
CRGB pacifica_one_layer(uint16_t i, const CRGBPalette16& p, uint16_t cistart, uint16_t wavescale, uint8_t bri, uint16_t ioff)
41414141
{
41424142
uint16_t ci = cistart;
41434143
uint16_t waveangle = ioff;
@@ -4294,7 +4294,7 @@ uint16_t phased_base(uint8_t moder) { // We're making sine wave
42944294
uint8_t modVal = 5;//SEGMENT.fft1/8+1; // You can change the modulus. AKA FFT1 (was 5).
42954295

42964296
uint8_t index = strip.now/64; // Set color rotation speed
4297-
*phase += SEGMENT.speed/32.0; // You can change the speed of the wave. AKA SPEED (was .4)
4297+
*phase += SEGMENT.speed/32.0f; // You can change the speed of the wave. AKA SPEED (was .4)
42984298

42994299
for (int i = 0; i < SEGLEN; i++) {
43004300
if (moder == 1) modVal = (inoise8(i*10 + i*10) /16); // Let's randomize our mod length with some Perlin noise.
@@ -4518,7 +4518,7 @@ uint16_t mode_dancing_shadows(void)
45184518
if (!initialize) {
45194519
// advance the position of the spotlight
45204520
int16_t delta = (float)(time - spotlights[i].lastUpdateTime) *
4521-
(spotlights[i].speed * ((1.0 + SEGMENT.speed)/100.0));
4521+
(spotlights[i].speed * ((1.0f + SEGMENT.speed)/100.0f));
45224522

45234523
if (abs(delta) >= 1) {
45244524
spotlights[i].position += delta;
@@ -4533,15 +4533,15 @@ uint16_t mode_dancing_shadows(void)
45334533
spotlights[i].colorIdx = random8();
45344534
spotlights[i].width = random8(1, 10);
45354535

4536-
spotlights[i].speed = 1.0/random8(4, 50);
4536+
spotlights[i].speed = 1.0f/random8(4, 50);
45374537

45384538
if (initialize) {
45394539
spotlights[i].position = random16(SEGLEN);
4540-
spotlights[i].speed *= random8(2) ? 1.0 : -1.0;
4540+
spotlights[i].speed *= random8(2) > 0 ? 1.0 : -1.0;
45414541
} else {
45424542
if (random8(2)) {
45434543
spotlights[i].position = SEGLEN + spotlights[i].width;
4544-
spotlights[i].speed *= -1.0;
4544+
spotlights[i].speed *= -1.0f;
45454545
}else {
45464546
spotlights[i].position = -spotlights[i].width;
45474547
}
@@ -5038,7 +5038,7 @@ uint16_t mode_2DBlackHole(void) { // By: Stepko https://editor.soulma
50385038
}
50395039

50405040
SEGMENT.fadeToBlackBy(16 + (SEGMENT.speed>>3)); // create fading trails
5041-
const unsigned long ratio = 128; // rotation speed
5041+
constexpr unsigned long ratio = 128; // rotation speed
50425042
unsigned long t = strip.now; // timebase
50435043
// outer stars
50445044
for (unsigned i = 0; i < 8; i++) {
@@ -5342,7 +5342,7 @@ class GameOfLifeGrid {
53425342
const int8_t offsetY[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
53435343
public:
53445344
GameOfLifeGrid(Cell* data, int c, int r) : cells(data), cols(c), rows(r), maxIndex(r * c) {}
5345-
void getNeighborIndexes(unsigned neighbors[9], unsigned cIndex, unsigned x, unsigned y, bool wrap) {
5345+
void getNeighborIndexes(unsigned neighbors[9], unsigned cIndex, unsigned x, unsigned y, bool wrap) const {
53465346
unsigned neighborCount = 0;
53475347
bool edgeCell = x == 0 || x == cols-1 || y == 0 || y == rows-1;
53485348
for (unsigned i = 0; i < 8; ++i) {
@@ -5363,7 +5363,7 @@ class GameOfLifeGrid {
53635363
}
53645364
neighbors[0] = neighborCount;
53655365
}
5366-
void setCell(unsigned cIndex, unsigned x, unsigned y, bool alive, bool wrap) {
5366+
void setCell(unsigned cIndex, unsigned x, unsigned y, bool alive, bool wrap) const {
53675367
Cell* cell = &cells[cIndex];
53685368
if (alive == cell->alive) return; // No change
53695369
cell->alive = alive;
@@ -5372,7 +5372,7 @@ class GameOfLifeGrid {
53725372
int val = alive ? 1 : -1;
53735373
for (unsigned i = 1; i <= neighbors[0]; ++i) cells[neighbors[i]].neighbors += val;
53745374
}
5375-
void recalculateEdgeNeighbors(bool wrap) {
5375+
void recalculateEdgeNeighbors(bool wrap) const {
53765376
unsigned cIndex = 0;
53775377
for (unsigned y = 0; y < rows; ++y) for (unsigned x = 0; x < cols; ++x, ++cIndex) {
53785378
Cell* cell = &cells[cIndex];
@@ -5811,7 +5811,7 @@ uint16_t mode_2DJulia(void) { // An animated Julia set
58115811
maxIterations = SEGMENT.intensity/2;
58125812

58135813

5814-
// Resize section on the fly for some animaton.
5814+
// Resize section on the fly for some animation.
58155815
reAl = -0.94299f; // PixelBlaze example
58165816
imAg = 0.3162f;
58175817

@@ -5820,8 +5820,8 @@ uint16_t mode_2DJulia(void) { // An animated Julia set
58205820
reAl += (float)sin16_t(strip.now * 34) / 655340.f;
58215821
imAg += (float)sin16_t(strip.now * 26) / 655340.f;
58225822

5823-
dx = (xmax - xmin) / (cols); // Scale the delta x and y values to our matrix size.
5824-
dy = (ymax - ymin) / (rows);
5823+
dx = (xmax - xmin) / cols; // Scale the delta x and y values to our matrix size.
5824+
dy = (ymax - ymin) / rows;
58255825

58265826
// Start y
58275827
float y = ymin;
@@ -5867,8 +5867,8 @@ uint16_t mode_2DJulia(void) { // An animated Julia set
58675867
if(SEGMENT.check2)
58685868
SEGMENT.blur(64, true); // strong blurr
58695869
if(SEGMENT.check3) { // draw crosshair
5870-
int screenX = lround((0.5f / maxCenter) * (julias->xcen + maxCenter) * float(cols));
5871-
int screenY = lround((0.5f / maxCenter) * (julias->ycen + maxCenter) * float(rows));
5870+
int screenX = lroundf((0.5f / maxCenter) * (julias->xcen + maxCenter) * float(cols));
5871+
int screenY = lroundf((0.5f / maxCenter) * (julias->ycen + maxCenter) * float(rows));
58725872
int hair = min(min(cols-1, rows-1)/2, 3);
58735873
SEGMENT.drawLine(screenX, screenY-hair, screenX, screenY+hair, GREEN, true);
58745874
SEGMENT.drawLine(screenX-hair, screenY, screenX+hair, screenY, GREEN, true);
@@ -6039,7 +6039,7 @@ uint16_t mode_2Dmetaballs(void) { // Metaballs by Stefan Petrick. Cannot have
60396039
byte color = dist ? 1000 / dist : 255;
60406040

60416041
// map color between thresholds
6042-
if (color > 0 and color < 60) {
6042+
if (color > 0 && color < 60) {
60436043
SEGMENT.setPixelColorXY(x, y, SEGMENT.color_from_palette(map(color * 9, 9, 531, 0, 255), false, PALETTE_SOLID_WRAP, 0));
60446044
} else {
60456045
SEGMENT.setPixelColorXY(x, y, SEGMENT.color_from_palette(0, false, PALETTE_SOLID_WRAP, 0));
@@ -6458,8 +6458,6 @@ uint16_t mode_2Dcrazybees(void) {
64586458
int8_t signX, signY;
64596459
int16_t deltaX, deltaY, error;
64606460
void aimed(uint_fast16_t w, uint_fast16_t h) {
6461-
if (!true) //WLEDMM SuperSync
6462-
random16_set_seed(strip.now);
64636461
aimX = random8(0, min(UINT8_MAX, int(w)));
64646462
aimY = random8(0, min(UINT8_MAX, int(h)));
64656463
hue = random8();
@@ -6475,8 +6473,7 @@ uint16_t mode_2Dcrazybees(void) {
64756473
bee_t *bee = reinterpret_cast<bee_t*>(SEGENV.data);
64766474

64776475
if (SEGENV.call == 0) {
6478-
if (true) //WLEDMM SuperSync
6479-
random16_set_seed(strip.now);
6476+
random16_set_seed(strip.now); //WLEDMM SuperSync
64806477
SEGMENT.setUpLeds();
64816478
SEGMENT.fill(BLACK);
64826479
for (size_t i = 0; i < n; i++) {
@@ -7017,7 +7014,7 @@ uint16_t mode_2DSwirl(void) {
70177014
SEGMENT.fill(BLACK);
70187015
}
70197016

7020-
const uint8_t borderWidth = 2;
7017+
constexpr uint8_t borderWidth = 2;
70217018

70227019
SEGMENT.blur(SEGMENT.custom1);
70237020

@@ -7106,7 +7103,7 @@ typedef struct Gravity {
71067103
///////////////////////
71077104
uint16_t mode_gravcenter(void) { // Gravcenter. By Andrew Tuline.
71087105

7109-
const uint16_t dataSize = sizeof(gravity);
7106+
constexpr uint16_t dataSize = sizeof(gravity);
71107107
if (!SEGENV.allocateData(dataSize)) return mode_static(); //allocation failed
71117108
Gravity* gravcen = reinterpret_cast<Gravity*>(SEGENV.data);
71127109
if (SEGENV.call == 0) {
@@ -7123,7 +7120,7 @@ uint16_t mode_gravcenter(void) { // Gravcenter. By Andrew Tuline.
71237120
float segmentSampleAvg = volumeSmth * (float)SEGMENT.intensity / 255.0f;
71247121
segmentSampleAvg *= 0.125; // divide by 8, to compensate for later "sensitivity" upscaling
71257122

7126-
float mySampleAvg = mapf(segmentSampleAvg*2.0, 0, 32, 0, (float)SEGLEN/2.0); // map to pixels available in current segment
7123+
float mySampleAvg = mapf(segmentSampleAvg*2.0f, 0, 32, 0, (float)SEGLEN/2.0f); // map to pixels available in current segment
71277124
uint16_t tempsamp = constrain(mySampleAvg, 0, SEGLEN/2); // Keep the sample from overflowing.
71287125
uint8_t gravity = 8 - SEGMENT.speed/32;
71297126

@@ -7171,10 +7168,10 @@ uint16_t mode_gravcentric(void) { // Gravcentric. By Andrew
71717168
//SEGMENT.fade_out(240); // twice? really?
71727169
SEGMENT.fade_out(253); // 50%
71737170

7174-
float segmentSampleAvg = volumeSmth * (float)SEGMENT.intensity / 255.0;
7171+
float segmentSampleAvg = volumeSmth * (float)SEGMENT.intensity / 255.0f;
71757172
segmentSampleAvg *= 0.125f; // divide by 8, to compensate for later "sensitivity" upscaling
71767173

7177-
float mySampleAvg = mapf(segmentSampleAvg*2.0, 0.0f, 32.0f, 0.0f, (float)SEGLEN/2.0); // map to pixels availeable in current segment
7174+
float mySampleAvg = mapf(segmentSampleAvg*2.0f, 0.0f, 32.0f, 0.0f, (float)SEGLEN/2.0f); // map to pixels availeable in current segment
71787175
int tempsamp = constrain(mySampleAvg, 0, SEGLEN/2); // Keep the sample from overflowing.
71797176
uint8_t gravity = 8 - SEGMENT.speed/32;
71807177

@@ -7226,7 +7223,7 @@ uint16_t mode_gravimeter(void) { // Gravmeter. By Andrew Tuline.
72267223
float realVolume = volumeSmth;
72277224
if (SEGENV.check3 && SEGENV.check2) SEGENV.check2 = false; // only one option
72287225
if (SEGENV.check2) volumeSmth = soundPressure;
7229-
if (SEGENV.check3) volumeSmth = 255.0 - agcSensitivity;
7226+
if (SEGENV.check3) volumeSmth = 255.0f - agcSensitivity;
72307227

72317228
SEGMENT.fade_out(253);
72327229
float sensGain = (float)(SEGMENT.intensity+2) / 257.0f; // min gain = 1/128
@@ -7287,7 +7284,7 @@ uint16_t mode_juggles(void) { // Juggles. By Andrew Tuline.
72877284
if (SEGENV.call == 0) {SEGENV.setUpLeds(); SEGMENT.fill(BLACK);} // WLEDMM use lossless getPixelColor()
72887285

72897286
SEGMENT.fade_out(224); // 6.25%
7290-
uint16_t my_sampleAgc = fmax(fmin(volumeSmth, 255.0), 0);
7287+
uint16_t my_sampleAgc = max(min(volumeSmth, 255.0f), 0.0f);
72917288

72927289
for (size_t i=0; i<SEGMENT.intensity/32+1U; i++) {
72937290
// if SEGLEN equals 1, we will always set color to the first and only pixel, but the effect is still good looking
@@ -7367,8 +7364,8 @@ uint16_t mode_midnoise(void) { // Midnoise. By Andrew Tuline.
73677364
SEGMENT.fadeToBlackBy(SEGMENT.speed/2);
73687365
//SEGMENT.fade_out(SEGMENT.speed);
73697366

7370-
float tmpSound2 = volumeSmth * (float)SEGMENT.intensity / 256.0; // Too sensitive.
7371-
tmpSound2 *= (float)SEGMENT.intensity / 128.0; // Reduce sensitivity/length.
7367+
float tmpSound2 = volumeSmth * (float)SEGMENT.intensity / 256.0f; // Too sensitive.
7368+
tmpSound2 *= (float)SEGMENT.intensity / 128.0f; // Reduce sensitivity/length.
73727369

73737370
int maxLen = mapf(tmpSound2, 0, 127, 0, SEGLEN/2);
73747371
if (maxLen >SEGLEN/2) maxLen = SEGLEN/2;
@@ -7429,7 +7426,7 @@ uint16_t mode_noisemeter(void) { // Noisemeter. By Andrew Tuline.
74297426
uint8_t fadeRate = map2(SEGMENT.speed,0,255,200,254);
74307427
SEGMENT.fade_out(fadeRate);
74317428

7432-
float tmpSound2 = volumeRaw * 2.0 * (float)SEGMENT.intensity / 255.0;
7429+
float tmpSound2 = volumeRaw * 2.0f * (float)SEGMENT.intensity / 255.0f;
74337430
int maxLen = mapf(tmpSound2, 0, 255, 0, SEGLEN); // map to pixels availeable in current segment // Still a bit too sensitive.
74347431
if (maxLen <0) maxLen = 0;
74357432
if (maxLen >SEGLEN) maxLen = SEGLEN;
@@ -7974,14 +7971,14 @@ uint16_t mode_freqwave(void) { // Freqwave. By Andreas Pleschun
79747971
int lowerLimit = 80 + 3 * SEGMENT.custom1; // min 80hz-850hz
79757972
i = lowerLimit!=upperLimit ? mapf(FFT_MajorPeak, lowerLimit, upperLimit, 0, 255) : FFT_MajorPeak; // may under/overflow - so we enforce uint8_t
79767973
} else {
7977-
// Musical Scale (logarythmic scaling)
7974+
// Musical Scale (logarithmic scaling)
79787975
float upperLimit = logf(80 + 42 * SEGMENT.custom2); // max 80hz-10Khz
79797976
float lowerLimit = logf(80 + 3 * SEGMENT.custom1); // min 80hz-850hz
79807977
float peakMapped = fabsf(lowerLimit - upperLimit)>0.05f ? mapf(logf(FFT_MajorPeak), lowerLimit, upperLimit, 0, 255) : FFT_MajorPeak; // may under/overflow
79817978
if (peakMapped > 255) intensity = constrain((320-peakMapped), 0, intensity*100) / 100.0f; // too high: fade away
79827979
i = constrain(peakMapped, 0, 255); // fix over / underflow
79837980
}
7984-
uint16_t b = 255.0 * intensity;
7981+
uint16_t b = 255.0f * intensity;
79857982
if (b > 255) b=255;
79867983
color = CHSV(i, 176+(uint8_t)b/4, (uint8_t)b); // implicit conversion to RGB supplied by FastLED
79877984
}
@@ -8023,7 +8020,7 @@ uint16_t mode_gravfreq(void) { // Gravfreq. By Andrew Tuline.
80238020
float segmentSampleAvg = volumeSmth * (float)SEGMENT.intensity / 255.0f;
80248021
segmentSampleAvg *= 0.125f; // divide by 8, to compensate for later "sensitivity" upscaling
80258022

8026-
float mySampleAvg = mapf(segmentSampleAvg*2.0f, 0,32, 0, (float)SEGLEN/2.0); // map to pixels availeable in current segment
8023+
float mySampleAvg = mapf(segmentSampleAvg*2.0f, 0,32, 0, (float)SEGLEN/2.0f); // map to pixels available in current segment
80278024
int tempsamp = constrain(mySampleAvg,0,SEGLEN/2); // Keep the sample from overflowing.
80288025
uint8_t gravity = 8 - SEGMENT.speed/32;
80298026

@@ -8542,33 +8539,23 @@ uint16_t mode_2Dsoap() {
85428539

85438540
// init
85448541
if (SEGENV.call == 0) {
8545-
if (true) {//WLEDMM SuperSync
8546-
random16_set_seed(535);
8547-
USER_PRINTF("SuperSync\n");
8548-
}
8542+
random16_set_seed(535); //WLEDMM SuperSync
85498543
SEGENV.setUpLeds();
85508544
SEGMENT.fill(BLACK);
85518545
*noise32_x = random16();
85528546
*noise32_y = random16();
85538547
*noise32_z = random16();
8554-
} else {
8555-
if (!true) { //WLEDMM SuperSync
8556-
*noise32_x += mov;
8557-
*noise32_y += mov;
8558-
*noise32_z += mov;
8559-
}
85608548
}
85618549

85628550
//WLEDMM: changing noise calculation for SuperSync to make it deterministic using strip.now
85638551
uint32_t noise32_x_MM = *noise32_x;
85648552
uint32_t noise32_y_MM = *noise32_y;
85658553
uint32_t noise32_z_MM = *noise32_z;
85668554

8567-
if (true) { //WLEDMM SuperSync
8568-
noise32_x_MM = *noise32_x + mov * strip.now / 100; //10 fps (original 20-40 fps, depending on realized fps)
8569-
noise32_y_MM = *noise32_y + mov * strip.now / 100;
8570-
noise32_z_MM = *noise32_z + mov * strip.now / 100;
8571-
}
8555+
//WLEDMM SuperSync
8556+
noise32_x_MM = *noise32_x + mov * strip.now / 100; //10 fps (original 20-40 fps, depending on realized fps)
8557+
noise32_y_MM = *noise32_y + mov * strip.now / 100;
8558+
noise32_z_MM = *noise32_z + mov * strip.now / 100;
85728559

85738560
for (int i = 0; i < cols; i++) {
85748561
int32_t ioffset = scale32_x * (i - cols / 2);
@@ -8689,8 +8676,6 @@ uint16_t mode_2Doctopus() {
86898676

86908677
// re-init if SEGMENT dimensions or offset changed
86918678
if (SEGENV.call == 0 || SEGENV.aux0 != cols || SEGENV.aux1 != rows || SEGMENT.custom1 != *offsX || SEGMENT.custom2 != *offsY) {
8692-
if (!true) //WLEDMM SuperSync
8693-
SEGENV.step = 0; // t
86948679
SEGENV.aux0 = cols;
86958680
SEGENV.aux1 = rows;
86968681
*offsX = SEGMENT.custom1;
@@ -8968,7 +8953,7 @@ uint16_t mode_2DPaintbrush() {
89688953
byte y1 = beatsin8_t(max(16,int(SEGMENT.speed))/16*3 + fftResult[0]/16, 0, (rows-1), fftResult[bin], SEGENV.aux1);
89698954
byte y2 = beatsin8_t(max(16,int(SEGMENT.speed))/16*4 + fftResult[0]/16, 0, (rows-1), fftResult[bin], SEGENV.aux1);
89708955

8971-
int length = sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
8956+
int length = sqrtf((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
89728957
length = map8(fftResult[bin],0,length);
89738958

89748959
if (length > max(1,int(SEGMENT.custom3))) {

wled00/FX.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,6 @@ typedef struct Segment {
429429
// WLEDMM cache some values that won't change while drawing a frame
430430
bool _isValid2D = false;
431431
uint8_t _brightness = 255; // final pixel brightness - including transitions and segment opacity
432-
bool _firstFill = true; // dirty HACK support
433432
uint16_t _2dWidth = 0; // virtualWidth
434433
uint16_t _2dHeight = 0; // virtualHeight
435434
uint16_t _virtuallength = 0; // virtualLength

0 commit comments

Comments
 (0)