소스 검색

heating up santity, formarly knows as "watchdog", but renamed due to the existance of the real watchdog, works now.

Bernhard 13 년 전
부모
커밋
88ee053af0
3개의 변경된 파일25개의 추가작업 그리고 12개의 파일을 삭제
  1. 5
    5
      Marlin/Configuration.h
  2. 16
    3
      Marlin/temperature.cpp
  3. 4
    4
      Marlin/temperature.h

+ 5
- 5
Marlin/Configuration.h 파일 보기

@@ -58,11 +58,11 @@
58 58
 
59 59
 #define BED_CHECK_INTERVAL 5000 //ms
60 60
 
61
-//// Experimental watchdog and minimal temp
62
-// The watchdog waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
63
-// If the temperature has not increased at the end of that period, the target temperature is set to zero. It can be reset with another M104/M109
64
-/// CURRENTLY NOT IMPLEMENTED AND UNUSEABLE
65
-//#define WATCHPERIOD 5000 //5 seconds
61
+//// Heating sanity check:
62
+// This waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
63
+// If the temperature has not increased at the end of that period, the target temperature is set to zero. 
64
+// It can be reset with another M104/M109
65
+//#define WATCHPERIOD 20000 //20 seconds
66 66
 
67 67
 // Actual temperature must be close to target for this long before M109 returns success
68 68
 //#define TEMP_RESIDENCY_TIME 20  // (seconds)

+ 16
- 3
Marlin/temperature.cpp 파일 보기

@@ -88,7 +88,7 @@ static unsigned long  previous_millis_bed_heater;
88 88
 #endif //PIDTEMP
89 89
   
90 90
 #ifdef WATCHPERIOD
91
-  static int watch_raw[3] = {-1000,-1000,-1000};
91
+  static int watch_oldtemp[3] = {0,0,0};
92 92
   static unsigned long watchmillis = 0;
93 93
 #endif //WATCHPERIOD
94 94
 
@@ -186,7 +186,20 @@ void manage_heater()
186 186
       WRITE(HEATER_0_PIN,LOW);
187 187
     }    
188 188
   #endif
189
-    
189
+  
190
+  #ifdef WATCHPERIOD
191
+    if(watchmillis && millis() - watchmillis > WATCHPERIOD){
192
+        if(watch_oldtemp[TEMPSENSOR_HOTEND_0] >= degHotend(active_extruder)){
193
+            setTargetHotend(0,active_extruder);
194
+            LCD_MESSAGEPGM("Heating failed");
195
+            SERIAL_ECHO_START;
196
+            SERIAL_ECHOLN("Heating failed");
197
+        }else{
198
+            watchmillis = 0;
199
+        }
200
+    }
201
+  #endif
202
+  
190 203
   if(millis() - previous_millis_bed_heater < BED_CHECK_INTERVAL)
191 204
     return;
192 205
   previous_millis_bed_heater = millis();
@@ -426,7 +439,7 @@ void setWatch()
426 439
   if(isHeatingHotend0())
427 440
   {
428 441
     watchmillis = max(1,millis());
429
-    watch_raw[TEMPSENSOR_HOTEND_0] = current_raw[TEMPSENSOR_HOTEND_0];
442
+    watch_oldtemp[TEMPSENSOR_HOTEND_0] = degHotend(0);
430 443
   }
431 444
   else
432 445
   {

+ 4
- 4
Marlin/temperature.h 파일 보기

@@ -49,10 +49,10 @@ extern float Kp,Ki,Kd,Kc;
49 49
   extern float pid_setpoint ;
50 50
 #endif
51 51
   
52
-#ifdef WATCHPERIOD
53
-  extern int watch_raw[3] ;
54
-  extern unsigned long watchmillis;
55
-#endif
52
+// #ifdef WATCHPERIOD
53
+//   extern int watch_raw[3] ;
54
+//   extern unsigned long watchmillis;
55
+// #endif
56 56
 
57 57
 
58 58
 

Loading…
취소
저장