Browse Source

Merge pull request #3759 from thinkyhead/rc_more_printcounter

Printcounter bugfix and some new features
Scott Lahteine 9 years ago
parent
commit
c8a40f06a6

+ 13
- 0
Marlin/Configuration.h View File

755
 #define ABS_PREHEAT_HPB_TEMP 110
755
 #define ABS_PREHEAT_HPB_TEMP 110
756
 #define ABS_PREHEAT_FAN_SPEED 0   // Insert Value between 0 and 255
756
 #define ABS_PREHEAT_FAN_SPEED 0   // Insert Value between 0 and 255
757
 
757
 
758
+//
759
+// Print job timer
760
+//
761
+// Enable this option to automatically start and stop the
762
+// print job timer when M104 and M109 commands are received.
763
+//
764
+// In all cases the timer can be started and stopped using
765
+// the following commands:
766
+//
767
+// - M75  - Start the print job timer
768
+// - M76  - Pause the print job timer
769
+// - M77  - Stop the print job timer
770
+#define PRINTJOB_TIMER_AUTOSTART
758
 
771
 
759
 //
772
 //
760
 // Print Counter
773
 // Print Counter

+ 41
- 40
Marlin/Marlin_main.cpp View File

4248
 /**
4248
 /**
4249
  * M75: Start print timer
4249
  * M75: Start print timer
4250
  */
4250
  */
4251
-inline void gcode_M75() {
4252
-  print_job_timer.start();
4253
-}
4251
+inline void gcode_M75() { print_job_timer.start(); }
4254
 
4252
 
4255
 /**
4253
 /**
4256
  * M76: Pause print timer
4254
  * M76: Pause print timer
4257
  */
4255
  */
4258
-inline void gcode_M76() {
4259
-  print_job_timer.pause();
4260
-}
4256
+inline void gcode_M76() { print_job_timer.pause(); }
4261
 
4257
 
4262
 /**
4258
 /**
4263
  * M77: Stop print timer
4259
  * M77: Stop print timer
4264
  */
4260
  */
4265
-inline void gcode_M77() {
4266
-  print_job_timer.stop();
4267
-}
4261
+inline void gcode_M77() { print_job_timer.stop(); }
4268
 
4262
 
4269
 #if ENABLED(PRINTCOUNTER)
4263
 #if ENABLED(PRINTCOUNTER)
4270
   /*+
4264
   /*+
4271
    * M78: Show print statistics
4265
    * M78: Show print statistics
4272
    */
4266
    */
4273
   inline void gcode_M78() {
4267
   inline void gcode_M78() {
4274
-    print_job_timer.showStats();
4268
+    // "M78 S78" will reset the statistics
4269
+    if (code_seen('S') && code_value_short() == 78)
4270
+      print_job_timer.initStats();
4271
+    else print_job_timer.showStats();
4275
   }
4272
   }
4276
 #endif
4273
 #endif
4277
 
4274
 
4290
         thermalManager.setTargetHotend(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset, 1);
4287
         thermalManager.setTargetHotend(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset, 1);
4291
     #endif
4288
     #endif
4292
 
4289
 
4293
-    /**
4294
-     * We use half EXTRUDE_MINTEMP here to allow nozzles to be put into hot
4295
-     * stand by mode, for instance in a dual extruder setup, without affecting
4296
-     * the running print timer.
4297
-     */
4298
-    if (temp <= (EXTRUDE_MINTEMP)/2) {
4299
-      print_job_timer.stop();
4300
-      LCD_MESSAGEPGM(WELCOME_MSG);
4301
-    }
4302
-    /**
4303
-     * We do not check if the timer is already running because this check will
4304
-     * be done for us inside the Stopwatch::start() method thus a running timer
4305
-     * will not restart.
4306
-     */
4307
-    else print_job_timer.start();
4290
+    #if ENABLED(PRINTJOB_TIMER_AUTOSTART)
4291
+      /**
4292
+       * We use half EXTRUDE_MINTEMP here to allow nozzles to be put into hot
4293
+       * stand by mode, for instance in a dual extruder setup, without affecting
4294
+       * the running print timer.
4295
+       */
4296
+      if (temp <= (EXTRUDE_MINTEMP)/2) {
4297
+        print_job_timer.stop();
4298
+        LCD_MESSAGEPGM(WELCOME_MSG);
4299
+      }
4300
+      /**
4301
+       * We do not check if the timer is already running because this check will
4302
+       * be done for us inside the Stopwatch::start() method thus a running timer
4303
+       * will not restart.
4304
+       */
4305
+      else print_job_timer.start();
4306
+    #endif
4308
 
4307
 
4309
     if (temp > thermalManager.degHotend(target_extruder)) LCD_MESSAGEPGM(MSG_HEATING);
4308
     if (temp > thermalManager.degHotend(target_extruder)) LCD_MESSAGEPGM(MSG_HEATING);
4310
   }
4309
   }
4443
         thermalManager.setTargetHotend(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset, 1);
4442
         thermalManager.setTargetHotend(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset, 1);
4444
     #endif
4443
     #endif
4445
 
4444
 
4446
-    /**
4447
-     * We use half EXTRUDE_MINTEMP here to allow nozzles to be put into hot
4448
-     * stand by mode, for instance in a dual extruder setup, without affecting
4449
-     * the running print timer.
4450
-     */
4451
-    if (temp <= (EXTRUDE_MINTEMP)/2) {
4452
-      print_job_timer.stop();
4453
-      LCD_MESSAGEPGM(WELCOME_MSG);
4454
-    }
4455
-    /**
4456
-     * We do not check if the timer is already running because this check will
4457
-     * be done for us inside the Stopwatch::start() method thus a running timer
4458
-     * will not restart.
4459
-     */
4460
-    else print_job_timer.start();
4445
+    #if ENABLED(PRINTJOB_TIMER_AUTOSTART)
4446
+      /**
4447
+       * We use half EXTRUDE_MINTEMP here to allow nozzles to be put into hot
4448
+       * stand by mode, for instance in a dual extruder setup, without affecting
4449
+       * the running print timer.
4450
+       */
4451
+      if (temp <= (EXTRUDE_MINTEMP)/2) {
4452
+        print_job_timer.stop();
4453
+        LCD_MESSAGEPGM(WELCOME_MSG);
4454
+      }
4455
+      /**
4456
+       * We do not check if the timer is already running because this check will
4457
+       * be done for us inside the Stopwatch::start() method thus a running timer
4458
+       * will not restart.
4459
+       */
4460
+      else print_job_timer.start();
4461
+    #endif
4461
 
4462
 
4462
     if (temp > thermalManager.degHotend(target_extruder)) LCD_MESSAGEPGM(MSG_HEATING);
4463
     if (temp > thermalManager.degHotend(target_extruder)) LCD_MESSAGEPGM(MSG_HEATING);
4463
   }
4464
   }

+ 13
- 0
Marlin/example_configurations/Felix/Configuration.h View File

738
 #define ABS_PREHEAT_HPB_TEMP 100
738
 #define ABS_PREHEAT_HPB_TEMP 100
739
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
739
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
740
 
740
 
741
+//
742
+// Print job timer
743
+//
744
+// Enable this option to automatically start and stop the
745
+// print job timer when M104 and M109 commands are received.
746
+//
747
+// In all cases the timer can be started and stopped using
748
+// the following commands:
749
+//
750
+// - M75  - Start the print job timer
751
+// - M76  - Pause the print job timer
752
+// - M77  - Stop the print job timer
753
+#define PRINTJOB_TIMER_AUTOSTART
741
 
754
 
742
 //
755
 //
743
 // Print Counter
756
 // Print Counter

+ 13
- 0
Marlin/example_configurations/Hephestos/Configuration.h View File

747
 #define ABS_PREHEAT_HPB_TEMP 100
747
 #define ABS_PREHEAT_HPB_TEMP 100
748
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
748
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
749
 
749
 
750
+//
751
+// Print job timer
752
+//
753
+// Enable this option to automatically start and stop the
754
+// print job timer when M104 and M109 commands are received.
755
+//
756
+// In all cases the timer can be started and stopped using
757
+// the following commands:
758
+//
759
+// - M75  - Start the print job timer
760
+// - M76  - Pause the print job timer
761
+// - M77  - Stop the print job timer
762
+#define PRINTJOB_TIMER_AUTOSTART
750
 
763
 
751
 //
764
 //
752
 // Print Counter
765
 // Print Counter

+ 13
- 0
Marlin/example_configurations/Hephestos_2/Configuration.h View File

749
 #define ABS_PREHEAT_HPB_TEMP    110
749
 #define ABS_PREHEAT_HPB_TEMP    110
750
 #define ABS_PREHEAT_FAN_SPEED   0   // Insert Value between 0 and 255
750
 #define ABS_PREHEAT_FAN_SPEED   0   // Insert Value between 0 and 255
751
 
751
 
752
+//
753
+// Print job timer
754
+//
755
+// Enable this option to automatically start and stop the
756
+// print job timer when M104 and M109 commands are received.
757
+//
758
+// In all cases the timer can be started and stopped using
759
+// the following commands:
760
+//
761
+// - M75  - Start the print job timer
762
+// - M76  - Pause the print job timer
763
+// - M77  - Stop the print job timer
764
+#define PRINTJOB_TIMER_AUTOSTART
752
 
765
 
753
 //
766
 //
754
 // Print Counter
767
 // Print Counter

+ 13
- 0
Marlin/example_configurations/K8200/Configuration.h View File

772
 #define ABS_PREHEAT_HPB_TEMP 60 // K8200: set back to 110 if you have an upgraded heatbed power supply
772
 #define ABS_PREHEAT_HPB_TEMP 60 // K8200: set back to 110 if you have an upgraded heatbed power supply
773
 #define ABS_PREHEAT_FAN_SPEED 0   // Insert Value between 0 and 255
773
 #define ABS_PREHEAT_FAN_SPEED 0   // Insert Value between 0 and 255
774
 
774
 
775
+//
776
+// Print job timer
777
+//
778
+// Enable this option to automatically start and stop the
779
+// print job timer when M104 and M109 commands are received.
780
+//
781
+// In all cases the timer can be started and stopped using
782
+// the following commands:
783
+//
784
+// - M75  - Start the print job timer
785
+// - M76  - Pause the print job timer
786
+// - M77  - Stop the print job timer
787
+#define PRINTJOB_TIMER_AUTOSTART
775
 
788
 
776
 //
789
 //
777
 // Print Counter
790
 // Print Counter

+ 13
- 0
Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h View File

755
 #define ABS_PREHEAT_HPB_TEMP 110
755
 #define ABS_PREHEAT_HPB_TEMP 110
756
 #define ABS_PREHEAT_FAN_SPEED 0   // Insert Value between 0 and 255
756
 #define ABS_PREHEAT_FAN_SPEED 0   // Insert Value between 0 and 255
757
 
757
 
758
+//
759
+// Print job timer
760
+//
761
+// Enable this option to automatically start and stop the
762
+// print job timer when M104 and M109 commands are received.
763
+//
764
+// In all cases the timer can be started and stopped using
765
+// the following commands:
766
+//
767
+// - M75  - Start the print job timer
768
+// - M76  - Pause the print job timer
769
+// - M77  - Stop the print job timer
770
+#define PRINTJOB_TIMER_AUTOSTART
758
 
771
 
759
 //
772
 //
760
 // Print Counter
773
 // Print Counter

+ 13
- 0
Marlin/example_configurations/RigidBot/Configuration.h View File

750
 #define ABS_PREHEAT_HPB_TEMP 110
750
 #define ABS_PREHEAT_HPB_TEMP 110
751
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
751
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
752
 
752
 
753
+//
754
+// Print job timer
755
+//
756
+// Enable this option to automatically start and stop the
757
+// print job timer when M104 and M109 commands are received.
758
+//
759
+// In all cases the timer can be started and stopped using
760
+// the following commands:
761
+//
762
+// - M75  - Start the print job timer
763
+// - M76  - Pause the print job timer
764
+// - M77  - Stop the print job timer
765
+#define PRINTJOB_TIMER_AUTOSTART
753
 
766
 
754
 //
767
 //
755
 // Print Counter
768
 // Print Counter

+ 13
- 0
Marlin/example_configurations/SCARA/Configuration.h View File

763
 #define ABS_PREHEAT_HPB_TEMP 100
763
 #define ABS_PREHEAT_HPB_TEMP 100
764
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
764
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
765
 
765
 
766
+//
767
+// Print job timer
768
+//
769
+// Enable this option to automatically start and stop the
770
+// print job timer when M104 and M109 commands are received.
771
+//
772
+// In all cases the timer can be started and stopped using
773
+// the following commands:
774
+//
775
+// - M75  - Start the print job timer
776
+// - M76  - Pause the print job timer
777
+// - M77  - Stop the print job timer
778
+#define PRINTJOB_TIMER_AUTOSTART
766
 
779
 
767
 //
780
 //
768
 // Print Counter
781
 // Print Counter

+ 13
- 0
Marlin/example_configurations/TAZ4/Configuration.h View File

776
 #define ABS_PREHEAT_HPB_TEMP 110
776
 #define ABS_PREHEAT_HPB_TEMP 110
777
 #define ABS_PREHEAT_FAN_SPEED 0   // Insert Value between 0 and 255
777
 #define ABS_PREHEAT_FAN_SPEED 0   // Insert Value between 0 and 255
778
 
778
 
779
+//
780
+// Print job timer
781
+//
782
+// Enable this option to automatically start and stop the
783
+// print job timer when M104 and M109 commands are received.
784
+//
785
+// In all cases the timer can be started and stopped using
786
+// the following commands:
787
+//
788
+// - M75  - Start the print job timer
789
+// - M76  - Pause the print job timer
790
+// - M77  - Stop the print job timer
791
+#define PRINTJOB_TIMER_AUTOSTART
779
 
792
 
780
 //
793
 //
781
 // Print Counter
794
 // Print Counter

+ 13
- 0
Marlin/example_configurations/WITBOX/Configuration.h View File

747
 #define ABS_PREHEAT_HPB_TEMP 100
747
 #define ABS_PREHEAT_HPB_TEMP 100
748
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
748
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
749
 
749
 
750
+//
751
+// Print job timer
752
+//
753
+// Enable this option to automatically start and stop the
754
+// print job timer when M104 and M109 commands are received.
755
+//
756
+// In all cases the timer can be started and stopped using
757
+// the following commands:
758
+//
759
+// - M75  - Start the print job timer
760
+// - M76  - Pause the print job timer
761
+// - M77  - Stop the print job timer
762
+#define PRINTJOB_TIMER_AUTOSTART
750
 
763
 
751
 //
764
 //
752
 // Print Counter
765
 // Print Counter

+ 13
- 0
Marlin/example_configurations/adafruit/ST7565/Configuration.h View File

755
 #define ABS_PREHEAT_HPB_TEMP 110
755
 #define ABS_PREHEAT_HPB_TEMP 110
756
 #define ABS_PREHEAT_FAN_SPEED 0   // Insert Value between 0 and 255
756
 #define ABS_PREHEAT_FAN_SPEED 0   // Insert Value between 0 and 255
757
 
757
 
758
+//
759
+// Print job timer
760
+//
761
+// Enable this option to automatically start and stop the
762
+// print job timer when M104 and M109 commands are received.
763
+//
764
+// In all cases the timer can be started and stopped using
765
+// the following commands:
766
+//
767
+// - M75  - Start the print job timer
768
+// - M76  - Pause the print job timer
769
+// - M77  - Stop the print job timer
770
+#define PRINTJOB_TIMER_AUTOSTART
758
 
771
 
759
 //
772
 //
760
 // Print Counter
773
 // Print Counter

+ 13
- 0
Marlin/example_configurations/delta/biv2.5/Configuration.h View File

884
 #define ABS_PREHEAT_HPB_TEMP 100
884
 #define ABS_PREHEAT_HPB_TEMP 100
885
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
885
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
886
 
886
 
887
+//
888
+// Print job timer
889
+//
890
+// Enable this option to automatically start and stop the
891
+// print job timer when M104 and M109 commands are received.
892
+//
893
+// In all cases the timer can be started and stopped using
894
+// the following commands:
895
+//
896
+// - M75  - Start the print job timer
897
+// - M76  - Pause the print job timer
898
+// - M77  - Stop the print job timer
899
+#define PRINTJOB_TIMER_AUTOSTART
887
 
900
 
888
 //
901
 //
889
 // Print Counter
902
 // Print Counter

+ 13
- 0
Marlin/example_configurations/delta/generic/Configuration.h View File

884
 #define ABS_PREHEAT_HPB_TEMP 100
884
 #define ABS_PREHEAT_HPB_TEMP 100
885
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
885
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
886
 
886
 
887
+//
888
+// Print job timer
889
+//
890
+// Enable this option to automatically start and stop the
891
+// print job timer when M104 and M109 commands are received.
892
+//
893
+// In all cases the timer can be started and stopped using
894
+// the following commands:
895
+//
896
+// - M75  - Start the print job timer
897
+// - M76  - Pause the print job timer
898
+// - M77  - Stop the print job timer
899
+#define PRINTJOB_TIMER_AUTOSTART
887
 
900
 
888
 //
901
 //
889
 // Print Counter
902
 // Print Counter

+ 13
- 0
Marlin/example_configurations/delta/kossel_mini/Configuration.h View File

888
 #define ABS_PREHEAT_HPB_TEMP 100
888
 #define ABS_PREHEAT_HPB_TEMP 100
889
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
889
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
890
 
890
 
891
+//
892
+// Print job timer
893
+//
894
+// Enable this option to automatically start and stop the
895
+// print job timer when M104 and M109 commands are received.
896
+//
897
+// In all cases the timer can be started and stopped using
898
+// the following commands:
899
+//
900
+// - M75  - Start the print job timer
901
+// - M76  - Pause the print job timer
902
+// - M77  - Stop the print job timer
903
+#define PRINTJOB_TIMER_AUTOSTART
891
 
904
 
892
 //
905
 //
893
 // Print Counter
906
 // Print Counter

+ 13
- 0
Marlin/example_configurations/delta/kossel_pro/Configuration.h View File

881
 #define ABS_PREHEAT_HPB_TEMP 100
881
 #define ABS_PREHEAT_HPB_TEMP 100
882
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
882
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
883
 
883
 
884
+//
885
+// Print job timer
886
+//
887
+// Enable this option to automatically start and stop the
888
+// print job timer when M104 and M109 commands are received.
889
+//
890
+// In all cases the timer can be started and stopped using
891
+// the following commands:
892
+//
893
+// - M75  - Start the print job timer
894
+// - M76  - Pause the print job timer
895
+// - M77  - Stop the print job timer
896
+#define PRINTJOB_TIMER_AUTOSTART
884
 
897
 
885
 //
898
 //
886
 // Print Counter
899
 // Print Counter

+ 13
- 0
Marlin/example_configurations/delta/kossel_xl/Configuration.h View File

889
 #define ABS_PREHEAT_HPB_TEMP 100
889
 #define ABS_PREHEAT_HPB_TEMP 100
890
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
890
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
891
 
891
 
892
+//
893
+// Print job timer
894
+//
895
+// Enable this option to automatically start and stop the
896
+// print job timer when M104 and M109 commands are received.
897
+//
898
+// In all cases the timer can be started and stopped using
899
+// the following commands:
900
+//
901
+// - M75  - Start the print job timer
902
+// - M76  - Pause the print job timer
903
+// - M77  - Stop the print job timer
904
+#define PRINTJOB_TIMER_AUTOSTART
892
 
905
 
893
 //
906
 //
894
 // Print Counter
907
 // Print Counter

+ 13
- 0
Marlin/example_configurations/makibox/Configuration.h View File

758
 #define ABS_PREHEAT_HPB_TEMP 100
758
 #define ABS_PREHEAT_HPB_TEMP 100
759
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
759
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
760
 
760
 
761
+//
762
+// Print job timer
763
+//
764
+// Enable this option to automatically start and stop the
765
+// print job timer when M104 and M109 commands are received.
766
+//
767
+// In all cases the timer can be started and stopped using
768
+// the following commands:
769
+//
770
+// - M75  - Start the print job timer
771
+// - M76  - Pause the print job timer
772
+// - M77  - Stop the print job timer
773
+#define PRINTJOB_TIMER_AUTOSTART
761
 
774
 
762
 //
775
 //
763
 // Print Counter
776
 // Print Counter

+ 13
- 0
Marlin/example_configurations/tvrrug/Round2/Configuration.h View File

749
 #define ABS_PREHEAT_HPB_TEMP 100
749
 #define ABS_PREHEAT_HPB_TEMP 100
750
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
750
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
751
 
751
 
752
+//
753
+// Print job timer
754
+//
755
+// Enable this option to automatically start and stop the
756
+// print job timer when M104 and M109 commands are received.
757
+//
758
+// In all cases the timer can be started and stopped using
759
+// the following commands:
760
+//
761
+// - M75  - Start the print job timer
762
+// - M76  - Pause the print job timer
763
+// - M77  - Stop the print job timer
764
+#define PRINTJOB_TIMER_AUTOSTART
752
 
765
 
753
 //
766
 //
754
 // Print Counter
767
 // Print Counter

+ 2
- 0
Marlin/printcounter.cpp View File

149
     PrintCounter::debug(PSTR("stop"));
149
     PrintCounter::debug(PSTR("stop"));
150
   #endif
150
   #endif
151
 
151
 
152
+  if (!this->isRunning()) return;
152
   super::stop();
153
   super::stop();
154
+
153
   this->data.finishedPrints++;
155
   this->data.finishedPrints++;
154
   this->data.printTime += this->deltaDuration();
156
   this->data.printTime += this->deltaDuration();
155
   this->saveStats();
157
   this->saveStats();

Loading…
Cancel
Save