From ef0ad69571bf9e8ebe134280b1d584919790f878 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sat, 16 Jul 2011 11:57:42 +0200 Subject: Bugfix: smoothed temperature was initialized without respecting HEATER_USES_* --- Sprinter/Sprinter.pde | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Sprinter/Sprinter.pde') diff --git a/Sprinter/Sprinter.pde b/Sprinter/Sprinter.pde index b31a629..79c66e6 100644 --- a/Sprinter/Sprinter.pde +++ b/Sprinter/Sprinter.pde @@ -133,7 +133,7 @@ float tt = 0, bt = 0; int temp_iState_max = 100 * PID_INTEGRAL_DRIVE_MAX / PID_IGAIN; #endif #ifdef SMOOTHING - uint32_t nma = SMOOTHFACTOR * analogRead(TEMP_0_PIN); + uint32_t nma = 0; #endif #ifdef WATCHPERIOD int watch_raw = -1000; @@ -1268,6 +1268,7 @@ inline void manage_heater() current_raw = read_max6675(); #endif #ifdef SMOOTHING + if (!nma) nma = SMOOTHFACTOR * current_raw; nma = (nma + current_raw) - (nma / SMOOTHFACTOR); current_raw = nma / SMOOTHFACTOR; #endif -- cgit v1.2.1