|
|
|
@ -99,8 +99,8 @@ static void timerCallback() |
|
|
|
|
cels_t tout = act_temp2(); |
|
|
|
|
|
|
|
|
|
uint16_t old_tempSerial = gState.tempSerial; |
|
|
|
|
float old_tin = gState.t_actual_in; |
|
|
|
|
float old_tout = gState.t_actual_out; |
|
|
|
|
// float old_tin = gState.t_actual_in;
|
|
|
|
|
// float old_tout = gState.t_actual_out;
|
|
|
|
|
|
|
|
|
|
gState.tempSerial = act_temps_serial(); |
|
|
|
|
gState.t_actual_in = tin; |
|
|
|
@ -108,6 +108,18 @@ static void timerCallback() |
|
|
|
|
|
|
|
|
|
gState.valid_t_actual_in = gState.valid_t_actual_out = tempSensorsOk; |
|
|
|
|
|
|
|
|
|
if (gState.tempSerial != old_tempSerial) { |
|
|
|
|
// measuring speed of temp change
|
|
|
|
|
for (int i = NUM_PREVIOUS_T_INS - 1; i > 0; i--) { |
|
|
|
|
gState.previous_t_ins[i] = gState.previous_t_ins[i - 1]; |
|
|
|
|
} |
|
|
|
|
if (gState.real_direction == MOTOR_DIR_IN) { |
|
|
|
|
gState.previous_t_ins[0] = tin; |
|
|
|
|
} else { |
|
|
|
|
gState.previous_t_ins[0] = tout; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// posun rolety
|
|
|
|
|
if (gAct.blind) { |
|
|
|
|
if (gState.blind_position < gSettings.blind_time) { |
|
|
|
@ -218,14 +230,9 @@ static void timerCallback() |
|
|
|
|
// Max time elapsed, switch even if the condition was not reached
|
|
|
|
|
do_switch = true; |
|
|
|
|
} else { |
|
|
|
|
if (!gSettings.summer_mode && gState.tempSerial != old_tempSerial) { |
|
|
|
|
if (!gSettings.summer_mode) { |
|
|
|
|
// expecting some change in temps
|
|
|
|
|
float speed; |
|
|
|
|
if (gState.real_direction == MOTOR_DIR_IN) { |
|
|
|
|
speed = absf(tin - old_tin); |
|
|
|
|
} else { |
|
|
|
|
speed = absf(tout - old_tout); |
|
|
|
|
} |
|
|
|
|
float speed = absf(gState.previous_t_ins[NUM_PREVIOUS_T_INS - 1] - gState.previous_t_ins[0]) / (float)NUM_PREVIOUS_T_INS; |
|
|
|
|
|
|
|
|
|
if (speed < gSettings.t_stop_speed) { |
|
|
|
|
ESP_LOGW(TAG, "Near-equilibrium reached, change dir!"); |
|
|
|
|