Browse Source

Added "auto fan" checks to PID_autotune

Greg Rebholz 10 years ago
parent
commit
7ecb7cbd46
2 changed files with 19 additions and 0 deletions
  1. 16
    0
      Marlin/temperature.cpp
  2. 3
    0
      Marlin/temperature.h

+ 16
- 0
Marlin/temperature.cpp View File

@@ -188,6 +188,12 @@ void PID_autotune(float temp, int extruder, int ncycles)
188 188
   float Kp, Ki, Kd;
189 189
   float max = 0, min = 10000;
190 190
 
191
+#if (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1) || \
192
+    (defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1) || \
193
+    (defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1)
194
+  unsigned long extruder_autofan_last_check = millis();
195
+#endif
196
+
191 197
   if ((extruder >= EXTRUDERS)
192 198
   #if (TEMP_BED_PIN <= -1)
193 199
        ||(extruder < 0)
@@ -224,6 +230,16 @@ void PID_autotune(float temp, int extruder, int ncycles)
224 230
 
225 231
       max=max(max,input);
226 232
       min=min(min,input);
233
+
234
+      #if (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1) || \
235
+          (defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1) || \
236
+          (defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1)
237
+      if(millis() - extruder_autofan_last_check > 2500) {
238
+        checkExtruderAutoFans();
239
+        extruder_autofan_last_check = millis();
240
+      }
241
+      #endif
242
+
227 243
       if(heating == true && input > temp) {
228 244
         if(millis() - t2 > 5000) { 
229 245
           heating=false;

+ 3
- 0
Marlin/temperature.h View File

@@ -186,5 +186,8 @@ FORCE_INLINE void autotempShutdown(){
186 186
 
187 187
 void PID_autotune(float temp, int extruder, int ncycles);
188 188
 
189
+void setExtruderAutoFanState(int pin, bool state);
190
+void checkExtruderAutoFans();
191
+
189 192
 #endif
190 193
 

Loading…
Cancel
Save