Tune animation and brightness

This commit is contained in:
Thomas Kolb 2024-05-19 21:46:16 +02:00
parent c82a54b06c
commit c1b0c2322d

View file

@ -133,14 +133,16 @@ static void update_countdown_fsm(uint32_t time_ms)
}
{ // animation block
uint32_t modtime = time_in_state % 3000;
const uint32_t SEGMENT_TIME = 1000;
if(modtime < 500) {
sseg_set_pwm_percent(0, 100 - 75 * modtime / 500);
} else if(modtime < 1000) {
sseg_set_pwm_percent(1, 100 - 75 * (modtime - 500) / 500);
} else if(modtime < 1500) {
sseg_set_pwm_percent(2, 100 - 75 * (modtime - 1000) / 500);
uint32_t modtime = time_in_state % 5000;
if(modtime < SEGMENT_TIME) {
sseg_set_pwm_percent(0, 100 - 75 * modtime / SEGMENT_TIME);
} else if(modtime < 2*SEGMENT_TIME) {
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(2, ' ', false);
sseg_set_pwm_percent(0, 100);
sseg_set_pwm_percent(1, 100);
sseg_set_pwm_percent(2, 100);
// maximum brightness while on
sseg_set_pwm_times(0, 255, 0);
sseg_set_pwm_times(1, 255, 0);
sseg_set_pwm_times(2, 255, 0);
break;
case 500: