TEMP_RESIDENCY now in units of 10ms rather than next_read_time

Signed-off-by: Michael Moon <triffid.hunter@gmail.com>
This commit is contained in:
Sergey Batalov 2011-05-10 14:10:56 +10:00 committed by Michael Moon
parent 7a57b69cc1
commit 03cebb5a82
1 changed files with 10 additions and 11 deletions

21
temp.c
View File

@ -271,18 +271,17 @@ void temp_sensor_tick() {
break;
}
temp_sensors_runtime[i].last_read_temp = temp;
}
if (labs((int16_t)(temp_sensors_runtime[i].last_read_temp - temp_sensors_runtime[i].target_temp)) < (TEMP_HYSTERESIS*4)) {
if (temp_sensors_runtime[i].temp_residency < (TEMP_RESIDENCY_TIME*100))
temp_sensors_runtime[i].temp_residency++;
}
else {
temp_sensors_runtime[i].temp_residency = 0;
}
if (labs((int16_t)(temp - temp_sensors_runtime[i].target_temp)) < (TEMP_HYSTERESIS*4)) {
if (temp_sensors_runtime[i].temp_residency < (TEMP_RESIDENCY_TIME*100))
temp_sensors_runtime[i].temp_residency++;
}
else {
temp_sensors_runtime[i].temp_residency = 0;
}
if (temp_sensors[i].heater < NUM_HEATERS) {
heater_tick(temp_sensors[i].heater, i, temp_sensors_runtime[i].last_read_temp, temp_sensors_runtime[i].target_temp);
}
if (temp_sensors[i].heater < NUM_HEATERS) {
heater_tick(temp_sensors[i].heater, i, temp_sensors_runtime[i].last_read_temp, temp_sensors_runtime[i].target_temp);
}
}
}