Account when forcing high/low state
parent
71f0f904e2
commit
940cf08226
4
main.c
4
main.c
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue