temp.c: explicitely cast the EMWA algorithm result.
Contribution by DaveX, see: http://forums.reprap.org/read.php?147,33082,160633#msg-160633
This commit is contained in:
parent
86e89dbac6
commit
a2185a4154
4
temp.c
4
temp.c
|
|
@ -297,9 +297,9 @@ void temp_sensor_tick() {
|
||||||
#endif
|
#endif
|
||||||
#define EWMA_SCALE 1024L
|
#define EWMA_SCALE 1024L
|
||||||
#define EWMA_ALPHA ((long) (TEMP_EWMA * EWMA_SCALE))
|
#define EWMA_ALPHA ((long) (TEMP_EWMA * EWMA_SCALE))
|
||||||
temp_sensors_runtime[i].last_read_temp = (EWMA_ALPHA * temp +
|
temp_sensors_runtime[i].last_read_temp = (uint16_t) ((EWMA_ALPHA * temp +
|
||||||
(EWMA_SCALE-EWMA_ALPHA) * temp_sensors_runtime[i].last_read_temp
|
(EWMA_SCALE-EWMA_ALPHA) * temp_sensors_runtime[i].last_read_temp
|
||||||
) / EWMA_SCALE;
|
) / EWMA_SCALE);
|
||||||
}
|
}
|
||||||
if (labs((int16_t)(temp_sensors_runtime[i].last_read_temp - temp_sensors_runtime[i].target_temp)) < (TEMP_HYSTERESIS*4)) {
|
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*120))
|
if (temp_sensors_runtime[i].temp_residency < (TEMP_RESIDENCY_TIME*120))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue