Handle sun times ahead of wallclock
parent
ef117f0a1f
commit
c7e004c65b
8
main.c
8
main.c
|
@ -244,6 +244,9 @@ static void update_temperature(struct context *ctx) {
|
||||||
}
|
}
|
||||||
ctx->state = ANIMATING_TO_LOW;
|
ctx->state = ANIMATING_TO_LOW;
|
||||||
ctx->animation_start = ctx->stop_time;
|
ctx->animation_start = ctx->stop_time;
|
||||||
|
if (ctx->animation_start > now) {
|
||||||
|
ctx->animation_start -= 86400;
|
||||||
|
}
|
||||||
// fallthrough
|
// fallthrough
|
||||||
case ANIMATING_TO_LOW:
|
case ANIMATING_TO_LOW:
|
||||||
if (now > ctx->animation_start + ctx->duration) {
|
if (now > ctx->animation_start + ctx->duration) {
|
||||||
|
@ -259,7 +262,10 @@ static void update_temperature(struct context *ctx) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ctx->state = ANIMATING_TO_HIGH;
|
ctx->state = ANIMATING_TO_HIGH;
|
||||||
ctx->animation_start = now;
|
ctx->animation_start = ctx->start_time;
|
||||||
|
if (ctx->animation_start > now) {
|
||||||
|
ctx->animation_start -= 86400;
|
||||||
|
}
|
||||||
// fallthrough
|
// fallthrough
|
||||||
case ANIMATING_TO_HIGH:
|
case ANIMATING_TO_HIGH:
|
||||||
if (now > ctx->animation_start + ctx->duration) {
|
if (now > ctx->animation_start + ctx->duration) {
|
||||||
|
|
Loading…
Reference in New Issue