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:
Markus Hitter 2012-10-14 22:52:04 +02:00
parent 86e89dbac6
commit a2185a4154
1 changed files with 2 additions and 2 deletions

4
temp.c
View File

@ -297,9 +297,9 @@ void temp_sensor_tick() {
#endif
#define EWMA_SCALE 1024L
#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_SCALE);
}
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))