Merge pull request #727 from drf5n/oversampling

temperature.cpp: Actually use OVERSAMPLENR in the oversampling calculation.
master
ErikZalm 11 years ago
commit 0d81ae77bc

@ -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. // 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 PID_INTEGRAL_DRIVE_MAX 255 //limit for the integral term
#define K1 0.95 //smoothing factor within the PID #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 // If you are using a preconfigured hotend then you can use one of the value sets by uncommenting it
// Ultimaker // Ultimaker

@ -1190,7 +1190,7 @@ ISR(TIMER0_COMPB_vect)
// break; // 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. if (!temp_meas_ready) //Only update the raw values if they have been read. Else we could be updating them during reading.
{ {

Loading…
Cancel
Save