smoother transition
This commit is contained in:
parent
ae854e8de1
commit
3efc3b1974
1 changed files with 2 additions and 2 deletions
|
|
@ -171,8 +171,8 @@ fn int main()
|
||||||
{|
|
{|
|
||||||
int brightness_now = read_int(ACTUAL_BRIGHTNESS_DEV) ?? brightness_adjusted;
|
int brightness_now = read_int(ACTUAL_BRIGHTNESS_DEV) ?? brightness_adjusted;
|
||||||
if (brightness_now == brightness_adjusted) { return; }
|
if (brightness_now == brightness_adjusted) { return; }
|
||||||
int step = (brightness_adjusted-brightness_now)/(SMOOTH_SAMPLES-1);
|
int step = (brightness_adjusted-brightness_now)/(SMOOTH_SAMPLES);
|
||||||
for (int i; i < SMOOTH_SAMPLES-1; i++) {
|
for (int i; i < SMOOTH_SAMPLES; i++) {
|
||||||
write_brightness(brightness_now + step*i);
|
write_brightness(brightness_now + step*i);
|
||||||
thread::sleep_ms(SMOOTH_DURATION/SMOOTH_SAMPLES);
|
thread::sleep_ms(SMOOTH_DURATION/SMOOTH_SAMPLES);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue