Browse Source

Added new G-Code: M78

João Brázio 8 years ago
parent
commit
d6cfcc9c8b
No account linked to committer's email address
2 changed files with 33 additions and 3 deletions
  1. 10
    2
      Marlin/Marlin.h
  2. 23
    1
      Marlin/Marlin_main.cpp

+ 10
- 2
Marlin/Marlin.h View File

65
 
65
 
66
 #include "WString.h"
66
 #include "WString.h"
67
 
67
 
68
-#include "stopwatch.h"
68
+#if ENABLED(PRINTCOUNTER)
69
+  #include "printcounter.h"
70
+#else
71
+  #include "stopwatch.h"
72
+#endif
69
 
73
 
70
 #ifdef USBCON
74
 #ifdef USBCON
71
   #if ENABLED(BLUETOOTH)
75
   #if ENABLED(BLUETOOTH)
364
 #endif
368
 #endif
365
 
369
 
366
 // Print job timer
370
 // Print job timer
367
-extern Stopwatch print_job_timer;
371
+#if ENABLED(PRINTCOUNTER)
372
+  extern PrintCounter print_job_timer;
373
+#else
374
+  extern Stopwatch print_job_timer;
375
+#endif
368
 
376
 
369
 // Handling multiple extruders pins
377
 // Handling multiple extruders pins
370
 extern uint8_t active_extruder;
378
 extern uint8_t active_extruder;

+ 23
- 1
Marlin/Marlin_main.cpp View File

327
 static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL;
327
 static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL;
328
 
328
 
329
 // Print Job Timer
329
 // Print Job Timer
330
-Stopwatch print_job_timer = Stopwatch();
330
+#if ENABLED(PRINTCOUNTER)
331
+  PrintCounter print_job_timer = PrintCounter();
332
+#else
333
+  Stopwatch print_job_timer = Stopwatch();
334
+#endif
331
 
335
 
332
 static uint8_t target_extruder;
336
 static uint8_t target_extruder;
333
 
337
 
4252
   print_job_timer.stop();
4256
   print_job_timer.stop();
4253
 }
4257
 }
4254
 
4258
 
4259
+#if ENABLED(PRINTCOUNTER)
4260
+  /*+
4261
+   * M78: Show print statistics
4262
+   */
4263
+  inline void gcode_M78() {
4264
+    print_job_timer.showStats();
4265
+  }
4266
+#endif
4267
+
4255
 /**
4268
 /**
4256
  * M104: Set hot end temperature
4269
  * M104: Set hot end temperature
4257
  */
4270
  */
6636
         gcode_M77();
6649
         gcode_M77();
6637
         break;
6650
         break;
6638
 
6651
 
6652
+      #if ENABLED(PRINTCOUNTER)
6653
+        case 78: // Show print statistics
6654
+          gcode_M78();
6655
+          break;
6656
+      #endif
6657
+
6639
       #if ENABLED(M100_FREE_MEMORY_WATCHER)
6658
       #if ENABLED(M100_FREE_MEMORY_WATCHER)
6640
         case 100:
6659
         case 100:
6641
           gcode_M100();
6660
           gcode_M100();
7750
   );
7769
   );
7751
   host_keepalive();
7770
   host_keepalive();
7752
   lcd_update();
7771
   lcd_update();
7772
+  #if ENABLED(PRINTCOUNTER)
7773
+      print_job_timer.tick();
7774
+  #endif
7753
 }
7775
 }
7754
 
7776
 
7755
 /**
7777
 /**

Loading…
Cancel
Save