diff --git a/config.gen3.h b/config.gen3.h index 14ff818..995b762 100644 --- a/config.gen3.h +++ b/config.gen3.h @@ -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 diff --git a/config.gen6.h b/config.gen6.h index a974ed7..f641454 100644 --- a/config.gen6.h +++ b/config.gen6.h @@ -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 diff --git a/config.h.dist b/config.h.dist index cb4d98a..f21069e 100644 --- a/config.h.dist +++ b/config.h.dist @@ -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 diff --git a/config.ramps.h b/config.ramps.h index 6041bf8..470621b 100644 --- a/config.ramps.h +++ b/config.ramps.h @@ -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 diff --git a/extruder/config.h.dist b/extruder/config.h.dist index 2706150..fa90030 100644 --- a/extruder/config.h.dist +++ b/extruder/config.h.dist @@ -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 diff --git a/extruder/heater.c b/extruder/heater.c index cb86f56..f2f057d 100644 --- a/extruder/heater.c +++ b/extruder/heater.c @@ -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); diff --git a/extruder/temp.c b/extruder/temp.c index 9e93f28..2d267f4 100644 --- a/extruder/temp.c +++ b/extruder/temp.c @@ -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++; } diff --git a/heater.c b/heater.c index 3faec61..3a68986 100644 --- a/heater.c +++ b/heater.c @@ -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); diff --git a/temp.c b/temp.c index 5d0095b..b978277 100644 --- a/temp.c +++ b/temp.c @@ -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++; }