Account when forcing high/low state

master
Kenny Levinsen 2020-09-20 03:50:47 +02:00
parent 71f0f904e2
commit 940cf08226
1 changed files with 3 additions and 3 deletions

4
main.c
View File

@ -238,7 +238,7 @@ static void update_temperature(struct context *ctx) {
switch (ctx->state) { switch (ctx->state) {
case HIGH_TEMP: case HIGH_TEMP:
if (now < ctx->stop_time && now > ctx->start_time) { if (now <= ctx->stop_time && now > ctx->start_time + ctx->duration) {
temp = ctx->high_temp; temp = ctx->high_temp;
break; break;
} }
@ -257,7 +257,7 @@ static void update_temperature(struct context *ctx) {
temp = ctx->high_temp - temp_pos; temp = ctx->high_temp - temp_pos;
break; break;
case LOW_TEMP: case LOW_TEMP:
if (now > ctx->stop_time || now < ctx->start_time) { if (now > ctx->stop_time + ctx->duration || now <= ctx->start_time) {
temp = ctx->low_temp; temp = ctx->low_temp;
break; break;
} }