chiark / gitweb /
watchdog,percent done,
authorBernhard Kubicek <kubicek@gmx.at>
Tue, 15 Nov 2011 19:54:40 +0000 (20:54 +0100)
committerBernhard Kubicek <kubicek@gmx.at>
Tue, 15 Nov 2011 19:54:40 +0000 (20:54 +0100)
Marlin/Configuration.h
Marlin/Marlin.h
Marlin/Marlin.pde
Marlin/cardreader.h
Marlin/ultralcd.h
Marlin/ultralcd.pde
Marlin/watchdog.pde

index 5b15dd0a47753687b24e022ea76a497bff765220..f0dbe6a6e7a66b385b626de4d2e0299ead6db762 100644 (file)
@@ -220,11 +220,12 @@ const bool ENDSTOPS_INVERTING = true; // set to true to invert the logic of the
 
 // The watchdog waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
 // this enables the watchdog interrupt.
-#define USE_WATCHDOG
-// you cannot reboot on a mega2560 due to a bug in he bootloader. Hence, you have to reset manually, and this is done hereby:
-#define RESET_MANUAL
-#define WATCHDOG_TIMEOUT 4  //seconds
-
+//#define USE_WATCHDOG
+#ifdef USE_WATCHDOG
+  // you cannot reboot on a mega2560 due to a bug in he bootloader. Hence, you have to reset manually, and this is done hereby:
+  #define RESET_MANUAL
+  #define WATCHDOG_TIMEOUT 4  //seconds
+#endif
 
 
 
index 440a44a579e484040c78c060383a49a2bfdd65a0..acfc3c2fa6ef16ecc90a1aeb4eb51c5208946ac5 100644 (file)
@@ -100,7 +100,7 @@ void prepare_move();
 void kill();
 
 void enquecommand(const char *cmd); //put an ascii command at the end of the current buffer.
-
+void prepare_arc_move(char isclockwise);
 
 #ifndef CRITICAL_SECTION_START
   #define CRITICAL_SECTION_START  unsigned char _sreg = SREG; cli();
index 84f07b3e68dcd5ef90db5e1cf6abd48cd72ac2e8..cacd728742167e6b845b457a1d52a9f6771fcc6f 100644 (file)
@@ -37,6 +37,7 @@
 #include "temperature.h"
 #include "motion_control.h"
 #include "cardreader.h"
+#include "watchdog.h"
 
 
 #define VERSION_STRING  "1.0.0 Alpha 1"
@@ -191,6 +192,36 @@ extern "C"{
 }
 
 
+
+inline void get_coordinates()
+{
+  for(int8_t i=0; i < NUM_AXIS; i++) {
+    if(code_seen(axis_codes[i])) destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i];
+    else destination[i] = current_position[i]; //Are these else lines really needed?
+  }
+  if(code_seen('F')) {
+    next_feedrate = code_value();
+    if(next_feedrate > 0.0) feedrate = next_feedrate;
+  }
+}
+
+inline void get_arc_coordinates()
+{
+   get_coordinates();
+   if(code_seen('I')) offset[0] = code_value();
+   if(code_seen('J')) offset[1] = code_value();
+}
+
+void prepare_move()
+{
+  plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60.0/100.0);
+  for(int8_t i=0; i < NUM_AXIS; i++) {
+    current_position[i] = destination[i];
+  }
+}
+
+
+
 //adds an command to the main command buffer
 //thats really done in a non-safe way.
 //needs overworking someday
@@ -234,6 +265,7 @@ void setup()
   plan_init();  // Initialize planner;
   st_init();    // Initialize stepper;
   tp_init();    // Initialize temperature loop
+  wd_init();
 }
 
 
@@ -656,7 +688,8 @@ inline void process_commands()
       break;
     case 105: // M105
       //SERIAL_ECHOLN(freeMemory());
-          
+       //test watchdog:
+       //delay(20000);
       #if (TEMP_0_PIN > -1) || defined (HEATER_USES_AD595)
         SERIAL_PROTOCOLPGM("ok T:");
         SERIAL_PROTOCOL( degHotend0()); 
@@ -975,32 +1008,7 @@ void ClearToSend()
   SERIAL_PROTOCOLLNPGM("ok"); 
 }
 
-inline void get_coordinates()
-{
-  for(int8_t i=0; i < NUM_AXIS; i++) {
-    if(code_seen(axis_codes[i])) destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i];
-    else destination[i] = current_position[i]; //Are these else lines really needed?
-  }
-  if(code_seen('F')) {
-    next_feedrate = code_value();
-    if(next_feedrate > 0.0) feedrate = next_feedrate;
-  }
-}
-
-inline void get_arc_coordinates()
-{
-   get_coordinates();
-   if(code_seen('I')) offset[0] = code_value();
-   if(code_seen('J')) offset[1] = code_value();
-}
 
-void prepare_move()
-{
-  plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60.0/100.0);
-  for(int8_t i=0; i < NUM_AXIS; i++) {
-    current_position[i] = destination[i];
-  }
-}
 
 void prepare_arc_move(char isclockwise) {
   float r = hypot(offset[X_AXIS], offset[Y_AXIS]); // Compute arc radius for mc_arc
index b3f514f61fa6093bdfc4c1950d31005d4ac3bcd8..d75f93a523d88bd39711d519cb35acdff5429758 100644 (file)
@@ -33,6 +33,7 @@ public:
   inline bool eof() { return sdpos>=filesize ;};
   inline int16_t get() {  sdpos = file.curPosition();return (int16_t)file.read();};
   inline void setIndex(long index) {sdpos = index;file.seekSet(index);};
+  inline uint8_t percentDone(){if(!sdprinting) return 0; if(filesize) return sdpos*100/filesize; else return 0;};
 
 public:
   bool saving;
index 4c725329df1f6cccacc084871c5e4166a2206eb9..c836757e1ce90092c7d13c5cbb0e99f894747190 100644 (file)
@@ -96,7 +96,7 @@
   #define BLOCK ;\r
 #endif \r
   \r
-  \r
+void lcd_statuspgm(const char* message);\r
   \r
 #endif //ULTRALCD\r
 \r
index d95167166d43c1f902ad9c14291f29c7138b1a09..1bf225641afe44af25a5a3812f11aebd9fb546d8 100644 (file)
@@ -374,6 +374,16 @@ void MainMenu::showStatus()
     lcd.print(fillto(LCD_WIDTH,messagetext));\r
     messagetext[0]='\0';\r
   }\r
+  \r
+  static uint8_t oldpercent=101;\r
+  uint8_t percent=card.percentDone();\r
+  if(oldpercent!=percent)\r
+  {\r
+     lcd.setCursor(6,3);\r
+    lcd.print(oldpercent);\r
+    lcdprintPGM("done");\r
+  }\r
+  \r
 #else //smaller LCDS----------------------------------\r
   static int olddegHotEnd0=-1;\r
   static int oldtargetHotEnd0=-1;\r
index 9cf710a0c7e6c312b6f70a4e160c6cacec8e2356..6c883c9d40b5d1dfbbd42cbe4b66ffc7c22d2433 100644 (file)
@@ -42,10 +42,12 @@ ISR(WDT_vect)
  
     #ifdef RESET_MANUAL
       LCD_MESSAGEPGM("Please Reset!");
+      LCD_STATUS;
       SERIAL_ERROR_START;
       SERIAL_ERRORLNPGM("Something is wrong, please turn off the printer.");
     #else
       LCD_MESSAGEPGM("Timeout, resetting!");
+      LCD_STATUS;
     #endif 
     //disable watchdog, it will survife reboot.
     WDTCSR |= (1<<WDCE) | (1<<WDE);