From 476c7193d843d78c4b234d187238a9bf1fb47282 Mon Sep 17 00:00:00 2001 From: David Forrest Date: Tue, 21 Jan 2014 16:49:03 -0500 Subject: [PATCH 1/2] temperature.cpp: Use OVERSAMPLENR in oversampling calculation. --- Marlin/temperature.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 29050b84f5..74c3684894 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -1187,7 +1187,7 @@ ISR(TIMER0_COMPB_vect) // break; } - if(temp_count >= 16) // 8 ms * 16 = 128ms. + if(temp_count >= OVERSAMPLENR) // 8 * 16 * 1/(16000000/64/256) = 131ms. { if (!temp_meas_ready) //Only update the raw values if they have been read. Else we could be updating them during reading. { From 76cf07c3f75708316f128f52d904115358cb8b23 Mon Sep 17 00:00:00 2001 From: David Forrest Date: Tue, 21 Jan 2014 23:25:51 -0500 Subject: [PATCH 2/2] Configuration.h: Use OVERSAMPLENR in dT_PID definition. --- Marlin/Configuration.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 33a1c3a160..1da62fc2ad 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -168,7 +168,7 @@ // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. #define PID_INTEGRAL_DRIVE_MAX 255 //limit for the integral term #define K1 0.95 //smoothing factor within the PID - #define PID_dT ((16.0 * 8.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine + #define PID_dT ((OVERSAMPLENR * 8.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine // If you are using a preconfigured hotend then you can use one of the value sets by uncommenting it // Ultimaker