temp: TEMP_RESIDENCY_TIME is in seconds not in temp_ticks (=10ms)

This commit is contained in:
Markus Amsler 2011-03-25 20:41:33 +01:00 committed by Michael Moon
parent 95e7cda9db
commit 57a75ecbfb
2 changed files with 6 additions and 6 deletions

View File

@ -49,7 +49,7 @@ struct {
uint16_t last_read_temp; ///< last received reading
uint16_t target_temp; ///< manipulate attached heater to attempt to achieve this value
uint8_t temp_residency; ///< how long have we been close to target temperature?
uint16_t temp_residency; ///< how long have we been close to target temperature in temp ticks?
uint16_t next_read_time; ///< how long until we can read this sensor again?
} temp_sensors_runtime[NUM_TEMP_SENSORS];
@ -270,7 +270,7 @@ void temp_sensor_tick() {
temp_sensors_runtime[i].last_read_temp = temp;
if (labs((int16_t)(temp - temp_sensors_runtime[i].target_temp)) < (TEMP_HYSTERESIS*4)) {
if (temp_sensors_runtime[i].temp_residency < TEMP_RESIDENCY_TIME)
if (temp_sensors_runtime[i].temp_residency < (TEMP_RESIDENCY_TIME*100))
temp_sensors_runtime[i].temp_residency++;
}
else {
@ -291,7 +291,7 @@ uint8_t temp_achieved() {
uint8_t all_ok = 255;
for (i = 0; i < NUM_TEMP_SENSORS; i++) {
if (temp_sensors_runtime[i].temp_residency < TEMP_RESIDENCY_TIME)
if (temp_sensors_runtime[i].temp_residency < (TEMP_RESIDENCY_TIME*100))
all_ok = 0;
}
return all_ok;

6
temp.c
View File

@ -49,7 +49,7 @@ struct {
uint16_t last_read_temp; ///< last received reading
uint16_t target_temp; ///< manipulate attached heater to attempt to achieve this value
uint8_t temp_residency; ///< how long have we been close to target temperature?
uint16_t temp_residency; ///< how long have we been close to target temperature in temp ticks?
uint16_t next_read_time; ///< how long until we can read this sensor again?
} temp_sensors_runtime[NUM_TEMP_SENSORS];
@ -270,7 +270,7 @@ void temp_sensor_tick() {
temp_sensors_runtime[i].last_read_temp = temp;
if (labs((int16_t)(temp - temp_sensors_runtime[i].target_temp)) < (TEMP_HYSTERESIS*4)) {
if (temp_sensors_runtime[i].temp_residency < TEMP_RESIDENCY_TIME)
if (temp_sensors_runtime[i].temp_residency < (TEMP_RESIDENCY_TIME*100))
temp_sensors_runtime[i].temp_residency++;
}
else {
@ -291,7 +291,7 @@ uint8_t temp_achieved() {
uint8_t all_ok = 255;
for (i = 0; i < NUM_TEMP_SENSORS; i++) {
if (temp_sensors_runtime[i].temp_residency < TEMP_RESIDENCY_TIME)
if (temp_sensors_runtime[i].temp_residency < (TEMP_RESIDENCY_TIME*100))
all_ok = 0;
}
return all_ok;