瀏覽代碼

Merge pull request #727 from drf5n/oversampling

temperature.cpp: Actually use OVERSAMPLENR in the oversampling calculation.
ErikZalm 11 年之前
父節點
當前提交
0d81ae77bc
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1
    1
      Marlin/Configuration.h
  2. 1
    1
      Marlin/temperature.cpp

+ 1
- 1
Marlin/Configuration.h 查看文件

168
                                   // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
168
                                   // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
169
   #define PID_INTEGRAL_DRIVE_MAX 255  //limit for the integral term
169
   #define PID_INTEGRAL_DRIVE_MAX 255  //limit for the integral term
170
   #define K1 0.95 //smoothing factor within the PID
170
   #define K1 0.95 //smoothing factor within the PID
171
-  #define PID_dT ((16.0 * 8.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine
171
+  #define PID_dT ((OVERSAMPLENR * 8.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine
172
 
172
 
173
 // If you are using a preconfigured hotend then you can use one of the value sets by uncommenting it
173
 // If you are using a preconfigured hotend then you can use one of the value sets by uncommenting it
174
 // Ultimaker
174
 // Ultimaker

+ 1
- 1
Marlin/temperature.cpp 查看文件

1190
 //      break;
1190
 //      break;
1191
   }
1191
   }
1192
     
1192
     
1193
-  if(temp_count >= 16) // 8 ms * 16 = 128ms.
1193
+  if(temp_count >= OVERSAMPLENR) // 8 * 16 * 1/(16000000/64/256)  = 131ms.
1194
   {
1194
   {
1195
     if (!temp_meas_ready) //Only update the raw values if they have been read. Else we could be updating them during reading.
1195
     if (!temp_meas_ready) //Only update the raw values if they have been read. Else we could be updating them during reading.
1196
     {
1196
     {

Loading…
取消
儲存