Tune animation and brightness
This commit is contained in:
parent
c82a54b06c
commit
c1b0c2322d
23
src/main.c
23
src/main.c
|
@ -133,14 +133,16 @@ static void update_countdown_fsm(uint32_t time_ms)
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // animation block
|
{ // animation block
|
||||||
uint32_t modtime = time_in_state % 3000;
|
const uint32_t SEGMENT_TIME = 1000;
|
||||||
|
|
||||||
if(modtime < 500) {
|
uint32_t modtime = time_in_state % 5000;
|
||||||
sseg_set_pwm_percent(0, 100 - 75 * modtime / 500);
|
|
||||||
} else if(modtime < 1000) {
|
if(modtime < SEGMENT_TIME) {
|
||||||
sseg_set_pwm_percent(1, 100 - 75 * (modtime - 500) / 500);
|
sseg_set_pwm_percent(0, 100 - 75 * modtime / SEGMENT_TIME);
|
||||||
} else if(modtime < 1500) {
|
} else if(modtime < 2*SEGMENT_TIME) {
|
||||||
sseg_set_pwm_percent(2, 100 - 75 * (modtime - 1000) / 500);
|
sseg_set_pwm_percent(1, 100 - 75 * (modtime - SEGMENT_TIME) / SEGMENT_TIME);
|
||||||
|
} else if(modtime < 3*SEGMENT_TIME) {
|
||||||
|
sseg_set_pwm_percent(2, 100 - 75 * (modtime - 2*SEGMENT_TIME) / SEGMENT_TIME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,9 +163,10 @@ static void update_countdown_fsm(uint32_t time_ms)
|
||||||
sseg_set_char(1, ' ', false);
|
sseg_set_char(1, ' ', false);
|
||||||
sseg_set_char(2, ' ', false);
|
sseg_set_char(2, ' ', false);
|
||||||
|
|
||||||
sseg_set_pwm_percent(0, 100);
|
// maximum brightness while on
|
||||||
sseg_set_pwm_percent(1, 100);
|
sseg_set_pwm_times(0, 255, 0);
|
||||||
sseg_set_pwm_percent(2, 100);
|
sseg_set_pwm_times(1, 255, 0);
|
||||||
|
sseg_set_pwm_times(2, 255, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 500:
|
case 500:
|
||||||
|
|
Loading…
Reference in a new issue