Convert TEMP_HYSTERESIS to Celsius.

This commit is contained in:
Markus Amsler 2011-03-25 19:46:27 +01:00 committed by Michael Moon
parent 093d20481e
commit be18eb90b8
9 changed files with 17 additions and 17 deletions

View File

@ -221,9 +221,9 @@
/**
TEMP_HYSTERESIS: actual temperature must be target +/- hysteresis before target temperature can be achieved.
NOTE: format is 30.2 fixed point, so value of 20 actually means +/- 5 degrees
Unit is degree Celsius.
*/
#define TEMP_HYSTERESIS 20
#define TEMP_HYSTERESIS 5
/**
TEMP_RESIDENCY_TIME: actual temperature must be close to target for this long before target is achieved

View File

@ -213,9 +213,9 @@
/**
TEMP_HYSTERESIS: actual temperature must be target +/- hysteresis before target temperature can be achieved.
NOTE: format is 30.2 fixed point, so value of 20 actually means +/- 5 degrees
Unit is degree Celsius.
*/
#define TEMP_HYSTERESIS 20
#define TEMP_HYSTERESIS 5
/**
TEMP_RESIDENCY_TIME: actual temperature must be close to target for this long before target is achieved

View File

@ -215,9 +215,9 @@
/**
TEMP_HYSTERESIS: actual temperature must be target +/- hysteresis before target temperature can be achieved.
NOTE: format is 30.2 fixed point, so value of 20 actually means +/- 5 degrees
Unit is degree Celsius.
*/
#define TEMP_HYSTERESIS 20
#define TEMP_HYSTERESIS 5
/**
TEMP_RESIDENCY_TIME: actual temperature must be close to target for this long before target is achieved

View File

@ -224,9 +224,9 @@
/**
TEMP_HYSTERESIS: actual temperature must be target +/- hysteresis before target temperature can be achieved.
NOTE: format is 30.2 fixed point, so value of 20 actually means +/- 5 degrees
Unit is degree Celsius.
*/
#define TEMP_HYSTERESIS 20
#define TEMP_HYSTERESIS 5
/**
TEMP_RESIDENCY_TIME: actual temperature must be close to target for this long before target is achieved

View File

@ -62,7 +62,7 @@
#define FAN_PIN DIO12
// extruder settings
#define TEMP_HYSTERESIS 20
#define TEMP_HYSTERESIS 5
#define TEMP_RESIDENCY_TIME 60
#ifdef DEFINE_TEMP_SENSOR

View File

@ -223,7 +223,7 @@ void heater_tick(heater_t h, temp_sensor_t t, uint16_t current_temp, uint16_t ta
#ifdef HEATER_SANITY_CHECK
// check heater sanity
// implementation is a moving window with some slow-down to compensate for thermal mass
if (target_temp > (current_temp + TEMP_HYSTERESIS)) {
if (target_temp > (current_temp + (TEMP_HYSTERESIS*4))) {
// heating
if (current_temp > heaters_runtime[h].sane_temperature)
// hotter than sane- good since we're heating unless too hot
@ -241,7 +241,7 @@ void heater_tick(heater_t h, temp_sensor_t t, uint16_t current_temp, uint16_t ta
if (heaters_runtime[h].sane_temperature > target_temp)
heaters_runtime[h].sane_temperature = target_temp;
}
else if (target_temp < (current_temp - TEMP_HYSTERESIS)) {
else if (target_temp < (current_temp - (TEMP_HYSTERESIS*4))) {
// cooling
if (current_temp < heaters_runtime[h].sane_temperature)
// cooler than sane- good since we're cooling
@ -269,7 +269,7 @@ void heater_tick(heater_t h, temp_sensor_t t, uint16_t current_temp, uint16_t ta
}
// compare where we're at to where we should be
if (labs((int16_t)(current_temp - heaters_runtime[h].sane_temperature)) > TEMP_HYSTERESIS) {
if (labs((int16_t)(current_temp - heaters_runtime[h].sane_temperature)) > (TEMP_HYSTERESIS*4)) {
// no change, or change in wrong direction for a long time- heater is broken!
pid_output = 0;
sersendf_P(PSTR("!! heater %d or temp sensor %d broken- temp is %d.%dC, target is %d.%dC, didn't reach %d.%dC in %d0 milliseconds\n"), h, t, current_temp >> 2, (current_temp & 3) * 25, target_temp >> 2, (target_temp & 3) * 25, heaters_runtime[h].sane_temperature >> 2, (heaters_runtime[h].sane_temperature & 3) * 25, heaters_runtime[h].sanity_counter);

View File

@ -269,7 +269,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) {
if (labs((int16_t)(temp - temp_sensors_runtime[i].target_temp)) < (TEMP_HYSTERESIS*4)) {
if (temp_sensors_runtime[i].temp_residency < TEMP_RESIDENCY_TIME)
temp_sensors_runtime[i].temp_residency++;
}

View File

@ -223,7 +223,7 @@ void heater_tick(heater_t h, temp_sensor_t t, uint16_t current_temp, uint16_t ta
#ifdef HEATER_SANITY_CHECK
// check heater sanity
// implementation is a moving window with some slow-down to compensate for thermal mass
if (target_temp > (current_temp + TEMP_HYSTERESIS)) {
if (target_temp > (current_temp + (TEMP_HYSTERESIS*4))) {
// heating
if (current_temp > heaters_runtime[h].sane_temperature)
// hotter than sane- good since we're heating unless too hot
@ -241,7 +241,7 @@ void heater_tick(heater_t h, temp_sensor_t t, uint16_t current_temp, uint16_t ta
if (heaters_runtime[h].sane_temperature > target_temp)
heaters_runtime[h].sane_temperature = target_temp;
}
else if (target_temp < (current_temp - TEMP_HYSTERESIS)) {
else if (target_temp < (current_temp - (TEMP_HYSTERESIS*4))) {
// cooling
if (current_temp < heaters_runtime[h].sane_temperature)
// cooler than sane- good since we're cooling
@ -269,7 +269,7 @@ void heater_tick(heater_t h, temp_sensor_t t, uint16_t current_temp, uint16_t ta
}
// compare where we're at to where we should be
if (labs((int16_t)(current_temp - heaters_runtime[h].sane_temperature)) > TEMP_HYSTERESIS) {
if (labs((int16_t)(current_temp - heaters_runtime[h].sane_temperature)) > (TEMP_HYSTERESIS*4)) {
// no change, or change in wrong direction for a long time- heater is broken!
pid_output = 0;
sersendf_P(PSTR("!! heater %d or temp sensor %d broken- temp is %d.%dC, target is %d.%dC, didn't reach %d.%dC in %d0 milliseconds\n"), h, t, current_temp >> 2, (current_temp & 3) * 25, target_temp >> 2, (target_temp & 3) * 25, heaters_runtime[h].sane_temperature >> 2, (heaters_runtime[h].sane_temperature & 3) * 25, heaters_runtime[h].sanity_counter);

2
temp.c
View File

@ -269,7 +269,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) {
if (labs((int16_t)(temp - temp_sensors_runtime[i].target_temp)) < (TEMP_HYSTERESIS*4)) {
if (temp_sensors_runtime[i].temp_residency < TEMP_RESIDENCY_TIME)
temp_sensors_runtime[i].temp_residency++;
}