Преглед на файлове

correcting commit errors.

Bernhard Kubicek преди 12 години
родител
ревизия
1740a83e11
променени са 8 файла, в които са добавени 48 реда и са изтрити 106 реда
  1. 1
    13
      Marlin/Marlin.h
  2. 15
    0
      Marlin/Marlin.pde
  3. 23
    0
      Marlin/temperature.cpp
  4. 4
    33
      Marlin/temperature.h
  5. 4
    1
      Marlin/watchdog.h
  6. 1
    1
      Marlin/watchdog.pde
  7. 0
    48
      watchdog.cpp
  8. 0
    10
      watchdog.h

+ 1
- 13
Marlin/Marlin.h Целия файл

79
 extern bool axis_relative_modes[];
79
 extern bool axis_relative_modes[];
80
 
80
 
81
 
81
 
82
-inline void kill()
83
-{
84
-  disable_heater();
85
-
86
-  disable_x();
87
-  disable_y();
88
-  disable_z();
89
-  disable_e();
90
-  
91
-  if(PS_ON_PIN > -1) pinMode(PS_ON_PIN,INPUT);
92
-  Serial.println("!! Printer halted. kill() called !!");
93
-  while(1); // Wait for reset
94
-}
82
+void kill();
95
 
83
 
96
 #endif
84
 #endif

+ 15
- 0
Marlin/Marlin.pde Целия файл

1278
   check_axes_activity();
1278
   check_axes_activity();
1279
 }
1279
 }
1280
 
1280
 
1281
+void kill()
1282
+{
1283
+  disable_heater();
1284
+
1285
+  disable_x();
1286
+  disable_y();
1287
+  disable_z();
1288
+  disable_e();
1289
+  
1290
+  if(PS_ON_PIN > -1) pinMode(PS_ON_PIN,INPUT);
1291
+  Serial.println("!! Printer halted. kill() called !!");
1292
+  while(1); // Wait for reset
1293
+}
1294
+
1295
+

+ 23
- 0
Marlin/temperature.cpp Целия файл

36
 #include "ultralcd.h"
36
 #include "ultralcd.h"
37
 #include "streaming.h"
37
 #include "streaming.h"
38
 #include "temperature.h"
38
 #include "temperature.h"
39
+#include "watchdog.h"
39
 
40
 
40
 
41
 
41
 int target_raw[3] = {0, 0, 0};
42
 int target_raw[3] = {0, 0, 0};
350
 }
351
 }
351
 
352
 
352
 
353
 
354
+void disable_heater()
355
+{
356
+   #if TEMP_0_PIN > -1
357
+  target_raw[0]=0;
358
+   #if HEATER_0_PIN > -1  
359
+     WRITE(HEATER_0_PIN,LOW);
360
+   #endif
361
+  #endif
362
+  #if TEMP_1_PIN > -1
363
+  target_raw[1]=0;
364
+  #if HEATER_1_PIN > -1 
365
+    WRITE(HEATER_1_PIN,LOW);
366
+  #endif
367
+  #endif
368
+  #if TEMP_2_PIN > -1
369
+  target_raw[2]=0;
370
+  #if HEATER_2_PIN > -1  
371
+    WRITE(HEATER_2_PIN,LOW);
372
+  #endif
373
+  #endif 
374
+}
375
+
353
 // Timer 0 is shared with millies
376
 // Timer 0 is shared with millies
354
 ISR(TIMER0_COMPB_vect)
377
 ISR(TIMER0_COMPB_vect)
355
 {
378
 {

+ 4
- 33
Marlin/temperature.h Целия файл

42
 extern int current_raw[3];
42
 extern int current_raw[3];
43
 extern float Kp,Ki,Kd,Kc;
43
 extern float Kp,Ki,Kd,Kc;
44
 #ifdef PIDTEMP
44
 #ifdef PIDTEMP
45
-  float pid_setpoint = 0.0;
45
+  extern float pid_setpoint ;
46
 #endif
46
 #endif
47
 #ifdef WATCHPERIOD
47
 #ifdef WATCHPERIOD
48
   extern int watch_raw[3] ;
48
   extern int watch_raw[3] ;
81
 inline bool isCoolingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] < current_raw[TEMPSENSOR_HOTEND_1];};
81
 inline bool isCoolingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] < current_raw[TEMPSENSOR_HOTEND_1];};
82
 inline bool isCoolingBed() {return target_raw[TEMPSENSOR_BED] < current_raw[TEMPSENSOR_BED];};
82
 inline bool isCoolingBed() {return target_raw[TEMPSENSOR_BED] < current_raw[TEMPSENSOR_BED];};
83
 
83
 
84
-inline void disable_heater()
85
-{
86
-   #if TEMP_0_PIN > -1
87
-  target_raw[0]=0;
88
-   #if HEATER_0_PIN > -1  
89
-     WRITE(HEATER_0_PIN,LOW);
90
-   #endif
91
-  #endif
92
-  #if TEMP_1_PIN > -1
93
-  target_raw[1]=0;
94
-  #if HEATER_1_PIN > -1 
95
-    WRITE(HEATER_1_PIN,LOW);
96
-  #endif
97
-  #endif
98
-  #if TEMP_2_PIN > -1
99
-  target_raw[2]=0;
100
-  #if HEATER_2_PIN > -1  
101
-    WRITE(HEATER_2_PIN,LOW);
102
-  #endif
103
-  #endif 
104
-}
105
-void setWatch() {  
106
-  if(isHeatingHotend0())
107
-  {
108
-    watchmillis = max(1,millis());
109
-    watch_raw[TEMPSENSOR_HOTEND_0] = current_raw[TEMPSENSOR_HOTEND_0];
110
-  }
111
-  else
112
-  {
113
-    watchmillis = 0;
114
-  } 
115
-}
84
+void disable_heater();
85
+void setWatch();
86
+
116
 #ifdef HEATER_0_USES_THERMISTOR
87
 #ifdef HEATER_0_USES_THERMISTOR
117
     #define HEATERSOURCE 1
88
     #define HEATERSOURCE 1
118
 #endif
89
 #endif

+ 4
- 1
Marlin/watchdog.h Целия файл

1
 #ifndef __WATCHDOGH
1
 #ifndef __WATCHDOGH
2
 #define __WATCHDOGH
2
 #define __WATCHDOGH
3
-#ifdef
3
+#include "Configuration.h"
4
+//#ifdef USE_WATCHDOG
5
+
4
 /// intialise watch dog with a 1 sec interrupt time
6
 /// intialise watch dog with a 1 sec interrupt time
5
 void wd_init();
7
 void wd_init();
6
 /// pad the dog/reset watchdog. MUST be called at least every second after the first wd_init or avr will go into emergency procedures..
8
 /// pad the dog/reset watchdog. MUST be called at least every second after the first wd_init or avr will go into emergency procedures..
7
 void wd_reset();
9
 void wd_reset();
8
 
10
 
11
+//#endif
9
 
12
 
10
 #endif
13
 #endif

Marlin/watchdog.cpp → Marlin/watchdog.pde Целия файл

1
 #ifdef USE_WATCHDOG
1
 #ifdef USE_WATCHDOG
2
-
2
+#include "watchdog.h"
3
 #include  <avr/wdt.h>
3
 #include  <avr/wdt.h>
4
 #include  <avr/interrupt.h>
4
 #include  <avr/interrupt.h>
5
 
5
 

+ 0
- 48
watchdog.cpp Целия файл

1
-#ifdef USE_WATCHDOG
2
-
3
-#include  <avr/wdt.h>
4
-#include  <avr/interrupt.h>
5
-
6
-volatile uint8_t timeout_seconds=0;
7
-
8
-void(* ctrlaltdelete) (void) = 0; //does not work on my atmega2560
9
-
10
-//Watchdog timer interrupt, called if main program blocks >1sec
11
-ISR(WDT_vect) 
12
-{ 
13
-  if(timeout_seconds++ >= WATCHDOG_TIMEOUT)
14
-  {
15
- 
16
-    #ifdef RESET_MANUAL
17
-      LCD_MESSAGE("Please Reset!");
18
-      ECHOLN("echo_: Something is wrong, please turn off the printer.");
19
-    #else
20
-      LCD_MESSAGE("Timeout, resetting!");
21
-    #endif 
22
-    //disable watchdog, it will survife reboot.
23
-    WDTCSR |= (1<<WDCE) | (1<<WDE);
24
-    WDTCSR = 0;
25
-    #ifdef RESET_MANUAL
26
-      kill(); //kill blocks
27
-      while(1); //wait for user or serial reset
28
-    #else
29
-      ctrlaltdelete();
30
-    #endif
31
-  }
32
-}
33
-
34
-/// intialise watch dog with a 1 sec interrupt time
35
-void wd_init() 
36
-{
37
-  WDTCSR = (1<<WDCE )|(1<<WDE ); //allow changes
38
-  WDTCSR = (1<<WDIF)|(1<<WDIE)| (1<<WDCE )|(1<<WDE )|  (1<<WDP2 )|(1<<WDP1)|(0<<WDP0);
39
-}
40
-
41
-/// reset watchdog. MUST be called every 1s after init or avr will reset.
42
-void wd_reset() 
43
-{
44
-  wdt_reset();
45
-  timeout_seconds=0; //reset counter for resets
46
-}
47
-
48
-#endif /* USE_WATCHDOG */

+ 0
- 10
watchdog.h Целия файл

1
-#ifndef __WATCHDOGH
2
-#define __WATCHDOGH
3
-#ifdef
4
-/// intialise watch dog with a 1 sec interrupt time
5
-void wd_init();
6
-/// pad the dog/reset watchdog. MUST be called at least every second after the first wd_init or avr will go into emergency procedures..
7
-void wd_reset();
8
-
9
-
10
-#endif

Loading…
Отказ
Запис