diff --git a/extruder/temp.c b/extruder/temp.c index 2d267f4..07dc1b1 100644 --- a/extruder/temp.c +++ b/extruder/temp.c @@ -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; diff --git a/temp.c b/temp.c index b978277..0e5ef96 100644 --- a/temp.c +++ b/temp.c @@ -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;