Browse Source

watchdog,percent done,

Bernhard Kubicek 13 years ago
parent
commit
7919a40d06
7 changed files with 55 additions and 33 deletions
  1. 6
    5
      Marlin/Configuration.h
  2. 1
    1
      Marlin/Marlin.h
  3. 34
    26
      Marlin/Marlin.pde
  4. 1
    0
      Marlin/cardreader.h
  5. 1
    1
      Marlin/ultralcd.h
  6. 10
    0
      Marlin/ultralcd.pde
  7. 2
    0
      Marlin/watchdog.pde

+ 6
- 5
Marlin/Configuration.h View File

@@ -220,11 +220,12 @@ const bool ENDSTOPS_INVERTING = true; // set to true to invert the logic of the
220 220
 
221 221
 // The watchdog waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
222 222
 // this enables the watchdog interrupt.
223
-#define USE_WATCHDOG
224
-// you cannot reboot on a mega2560 due to a bug in he bootloader. Hence, you have to reset manually, and this is done hereby:
225
-#define RESET_MANUAL
226
-#define WATCHDOG_TIMEOUT 4  //seconds
227
-
223
+//#define USE_WATCHDOG
224
+#ifdef USE_WATCHDOG
225
+  // you cannot reboot on a mega2560 due to a bug in he bootloader. Hence, you have to reset manually, and this is done hereby:
226
+  #define RESET_MANUAL
227
+  #define WATCHDOG_TIMEOUT 4  //seconds
228
+#endif
228 229
 
229 230
 
230 231
 

+ 1
- 1
Marlin/Marlin.h View File

@@ -100,7 +100,7 @@ void prepare_move();
100 100
 void kill();
101 101
 
102 102
 void enquecommand(const char *cmd); //put an ascii command at the end of the current buffer.
103
-
103
+void prepare_arc_move(char isclockwise);
104 104
 
105 105
 #ifndef CRITICAL_SECTION_START
106 106
   #define CRITICAL_SECTION_START  unsigned char _sreg = SREG; cli();

+ 34
- 26
Marlin/Marlin.pde View File

@@ -37,6 +37,7 @@
37 37
 #include "temperature.h"
38 38
 #include "motion_control.h"
39 39
 #include "cardreader.h"
40
+#include "watchdog.h"
40 41
 
41 42
 
42 43
 #define VERSION_STRING  "1.0.0 Alpha 1"
@@ -191,6 +192,36 @@ extern "C"{
191 192
 }
192 193
 
193 194
 
195
+
196
+inline void get_coordinates()
197
+{
198
+  for(int8_t i=0; i < NUM_AXIS; i++) {
199
+    if(code_seen(axis_codes[i])) destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i];
200
+    else destination[i] = current_position[i]; //Are these else lines really needed?
201
+  }
202
+  if(code_seen('F')) {
203
+    next_feedrate = code_value();
204
+    if(next_feedrate > 0.0) feedrate = next_feedrate;
205
+  }
206
+}
207
+
208
+inline void get_arc_coordinates()
209
+{
210
+   get_coordinates();
211
+   if(code_seen('I')) offset[0] = code_value();
212
+   if(code_seen('J')) offset[1] = code_value();
213
+}
214
+
215
+void prepare_move()
216
+{
217
+  plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60.0/100.0);
218
+  for(int8_t i=0; i < NUM_AXIS; i++) {
219
+    current_position[i] = destination[i];
220
+  }
221
+}
222
+
223
+
224
+
194 225
 //adds an command to the main command buffer
195 226
 //thats really done in a non-safe way.
196 227
 //needs overworking someday
@@ -234,6 +265,7 @@ void setup()
234 265
   plan_init();  // Initialize planner;
235 266
   st_init();    // Initialize stepper;
236 267
   tp_init();    // Initialize temperature loop
268
+  wd_init();
237 269
 }
238 270
 
239 271
 
@@ -656,7 +688,8 @@ inline void process_commands()
656 688
       break;
657 689
     case 105: // M105
658 690
       //SERIAL_ECHOLN(freeMemory());
659
-          
691
+       //test watchdog:
692
+       //delay(20000);
660 693
       #if (TEMP_0_PIN > -1) || defined (HEATER_USES_AD595)
661 694
         SERIAL_PROTOCOLPGM("ok T:");
662 695
         SERIAL_PROTOCOL( degHotend0()); 
@@ -975,32 +1008,7 @@ void ClearToSend()
975 1008
   SERIAL_PROTOCOLLNPGM("ok"); 
976 1009
 }
977 1010
 
978
-inline void get_coordinates()
979
-{
980
-  for(int8_t i=0; i < NUM_AXIS; i++) {
981
-    if(code_seen(axis_codes[i])) destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i];
982
-    else destination[i] = current_position[i]; //Are these else lines really needed?
983
-  }
984
-  if(code_seen('F')) {
985
-    next_feedrate = code_value();
986
-    if(next_feedrate > 0.0) feedrate = next_feedrate;
987
-  }
988
-}
989
-
990
-inline void get_arc_coordinates()
991
-{
992
-   get_coordinates();
993
-   if(code_seen('I')) offset[0] = code_value();
994
-   if(code_seen('J')) offset[1] = code_value();
995
-}
996 1011
 
997
-void prepare_move()
998
-{
999
-  plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60.0/100.0);
1000
-  for(int8_t i=0; i < NUM_AXIS; i++) {
1001
-    current_position[i] = destination[i];
1002
-  }
1003
-}
1004 1012
 
1005 1013
 void prepare_arc_move(char isclockwise) {
1006 1014
   float r = hypot(offset[X_AXIS], offset[Y_AXIS]); // Compute arc radius for mc_arc

+ 1
- 0
Marlin/cardreader.h View File

@@ -33,6 +33,7 @@ public:
33 33
   inline bool eof() { return sdpos>=filesize ;};
34 34
   inline int16_t get() {  sdpos = file.curPosition();return (int16_t)file.read();};
35 35
   inline void setIndex(long index) {sdpos = index;file.seekSet(index);};
36
+  inline uint8_t percentDone(){if(!sdprinting) return 0; if(filesize) return sdpos*100/filesize; else return 0;};
36 37
 
37 38
 public:
38 39
   bool saving;

+ 1
- 1
Marlin/ultralcd.h View File

@@ -96,7 +96,7 @@
96 96
   #define BLOCK ;
97 97
 #endif 
98 98
   
99
-  
99
+void lcd_statuspgm(const char* message);
100 100
   
101 101
 #endif //ULTRALCD
102 102
 

+ 10
- 0
Marlin/ultralcd.pde View File

@@ -374,6 +374,16 @@ void MainMenu::showStatus()
374 374
     lcd.print(fillto(LCD_WIDTH,messagetext));
375 375
     messagetext[0]='\0';
376 376
   }
377
+  
378
+  static uint8_t oldpercent=101;
379
+  uint8_t percent=card.percentDone();
380
+  if(oldpercent!=percent)
381
+  {
382
+     lcd.setCursor(6,3);
383
+    lcd.print(oldpercent);
384
+    lcdprintPGM("done");
385
+  }
386
+  
377 387
 #else //smaller LCDS----------------------------------
378 388
   static int olddegHotEnd0=-1;
379 389
   static int oldtargetHotEnd0=-1;

+ 2
- 0
Marlin/watchdog.pde View File

@@ -42,10 +42,12 @@ ISR(WDT_vect)
42 42
  
43 43
     #ifdef RESET_MANUAL
44 44
       LCD_MESSAGEPGM("Please Reset!");
45
+      LCD_STATUS;
45 46
       SERIAL_ERROR_START;
46 47
       SERIAL_ERRORLNPGM("Something is wrong, please turn off the printer.");
47 48
     #else
48 49
       LCD_MESSAGEPGM("Timeout, resetting!");
50
+      LCD_STATUS;
49 51
     #endif 
50 52
     //disable watchdog, it will survife reboot.
51 53
     WDTCSR |= (1<<WDCE) | (1<<WDE);

Loading…
Cancel
Save