Skip to content

Commit 3f46c14

Browse files
committed
Update RGB.h
1 parent 6f52c11 commit 3f46c14

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/RGB.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,7 @@ class RGB::Fader {
426426
steps >>= 1;
427427
}
428428

429-
steps = 1 << _n;
430-
_prd = durationMs / steps;
429+
_prd = durationMs / (1 << _n);
431430
return true;
432431
}
433432

@@ -436,11 +435,12 @@ class RGB::Fader {
436435
if (!_prd || uint16_t(uint16_t(millis()) - _tmr) < _prd) return false;
437436
_tmr += _prd;
438437

439-
if (++_step == (1 << _n)) {
438+
if (_step + 1 == (1 << _n)) {
440439
_prd = 0;
441440
_rgb.setFrom(_to);
442441
return true;
443442
}
443+
++_step;
444444

445445
_rgb.setRGB(
446446
_from.R + ((((int32_t)_to.R - _from.R) * _step) >> _n),

0 commit comments

Comments
 (0)