Merge pull request #3759 from thinkyhead/rc_more_printcounter
Printcounter bugfix and some new features
This commit is contained in:
		
						commit
						c8a40f06a6
					
				| @ -755,6 +755,19 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l | ||||
| #define ABS_PREHEAT_HPB_TEMP 110 | ||||
| #define ABS_PREHEAT_FAN_SPEED 0   // Insert Value between 0 and 255
 | ||||
| 
 | ||||
| //
 | ||||
| // Print job timer
 | ||||
| //
 | ||||
| // Enable this option to automatically start and stop the
 | ||||
| // print job timer when M104 and M109 commands are received.
 | ||||
| //
 | ||||
| // In all cases the timer can be started and stopped using
 | ||||
| // the following commands:
 | ||||
| //
 | ||||
| // - M75  - Start the print job timer
 | ||||
| // - M76  - Pause the print job timer
 | ||||
| // - M77  - Stop the print job timer
 | ||||
| #define PRINTJOB_TIMER_AUTOSTART | ||||
| 
 | ||||
| //
 | ||||
| // Print Counter
 | ||||
|  | ||||
| @ -4248,30 +4248,27 @@ inline void gcode_M42() { | ||||
| /**
 | ||||
|  * M75: Start print timer | ||||
|  */ | ||||
| inline void gcode_M75() { | ||||
|   print_job_timer.start(); | ||||
| } | ||||
| inline void gcode_M75() { print_job_timer.start(); } | ||||
| 
 | ||||
| /**
 | ||||
|  * M76: Pause print timer | ||||
|  */ | ||||
| inline void gcode_M76() { | ||||
|   print_job_timer.pause(); | ||||
| } | ||||
| inline void gcode_M76() { print_job_timer.pause(); } | ||||
| 
 | ||||
| /**
 | ||||
|  * M77: Stop print timer | ||||
|  */ | ||||
| inline void gcode_M77() { | ||||
|   print_job_timer.stop(); | ||||
| } | ||||
| inline void gcode_M77() { print_job_timer.stop(); } | ||||
| 
 | ||||
| #if ENABLED(PRINTCOUNTER) | ||||
|   /*+
 | ||||
|    * M78: Show print statistics | ||||
|    */ | ||||
|   inline void gcode_M78() { | ||||
|     print_job_timer.showStats(); | ||||
|     // "M78 S78" will reset the statistics
 | ||||
|     if (code_seen('S') && code_value_short() == 78) | ||||
|       print_job_timer.initStats(); | ||||
|     else print_job_timer.showStats(); | ||||
|   } | ||||
| #endif | ||||
| 
 | ||||
| @ -4290,6 +4287,7 @@ inline void gcode_M104() { | ||||
|         thermalManager.setTargetHotend(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset, 1); | ||||
|     #endif | ||||
| 
 | ||||
|     #if ENABLED(PRINTJOB_TIMER_AUTOSTART) | ||||
|       /**
 | ||||
|        * We use half EXTRUDE_MINTEMP here to allow nozzles to be put into hot | ||||
|        * stand by mode, for instance in a dual extruder setup, without affecting | ||||
| @ -4305,6 +4303,7 @@ inline void gcode_M104() { | ||||
|        * will not restart. | ||||
|        */ | ||||
|       else print_job_timer.start(); | ||||
|     #endif | ||||
| 
 | ||||
|     if (temp > thermalManager.degHotend(target_extruder)) LCD_MESSAGEPGM(MSG_HEATING); | ||||
|   } | ||||
| @ -4443,6 +4442,7 @@ inline void gcode_M109() { | ||||
|         thermalManager.setTargetHotend(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset, 1); | ||||
|     #endif | ||||
| 
 | ||||
|     #if ENABLED(PRINTJOB_TIMER_AUTOSTART) | ||||
|       /**
 | ||||
|        * We use half EXTRUDE_MINTEMP here to allow nozzles to be put into hot | ||||
|        * stand by mode, for instance in a dual extruder setup, without affecting | ||||
| @ -4458,6 +4458,7 @@ inline void gcode_M109() { | ||||
|        * will not restart. | ||||
|        */ | ||||
|       else print_job_timer.start(); | ||||
|     #endif | ||||
| 
 | ||||
|     if (temp > thermalManager.degHotend(target_extruder)) LCD_MESSAGEPGM(MSG_HEATING); | ||||
|   } | ||||
|  | ||||
| @ -738,6 +738,19 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l | ||||
| #define ABS_PREHEAT_HPB_TEMP 100 | ||||
| #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
 | ||||
| 
 | ||||
| //
 | ||||
| // Print job timer
 | ||||
| //
 | ||||
| // Enable this option to automatically start and stop the
 | ||||
| // print job timer when M104 and M109 commands are received.
 | ||||
| //
 | ||||
| // In all cases the timer can be started and stopped using
 | ||||
| // the following commands:
 | ||||
| //
 | ||||
| // - M75  - Start the print job timer
 | ||||
| // - M76  - Pause the print job timer
 | ||||
| // - M77  - Stop the print job timer
 | ||||
| #define PRINTJOB_TIMER_AUTOSTART | ||||
| 
 | ||||
| //
 | ||||
| // Print Counter
 | ||||
|  | ||||
| @ -747,6 +747,19 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo | ||||
| #define ABS_PREHEAT_HPB_TEMP 100 | ||||
| #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
 | ||||
| 
 | ||||
| //
 | ||||
| // Print job timer
 | ||||
| //
 | ||||
| // Enable this option to automatically start and stop the
 | ||||
| // print job timer when M104 and M109 commands are received.
 | ||||
| //
 | ||||
| // In all cases the timer can be started and stopped using
 | ||||
| // the following commands:
 | ||||
| //
 | ||||
| // - M75  - Start the print job timer
 | ||||
| // - M76  - Pause the print job timer
 | ||||
| // - M77  - Stop the print job timer
 | ||||
| #define PRINTJOB_TIMER_AUTOSTART | ||||
| 
 | ||||
| //
 | ||||
| // Print Counter
 | ||||
|  | ||||
| @ -749,6 +749,19 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l | ||||
| #define ABS_PREHEAT_HPB_TEMP    110 | ||||
| #define ABS_PREHEAT_FAN_SPEED   0   // Insert Value between 0 and 255
 | ||||
| 
 | ||||
| //
 | ||||
| // Print job timer
 | ||||
| //
 | ||||
| // Enable this option to automatically start and stop the
 | ||||
| // print job timer when M104 and M109 commands are received.
 | ||||
| //
 | ||||
| // In all cases the timer can be started and stopped using
 | ||||
| // the following commands:
 | ||||
| //
 | ||||
| // - M75  - Start the print job timer
 | ||||
| // - M76  - Pause the print job timer
 | ||||
| // - M77  - Stop the print job timer
 | ||||
| #define PRINTJOB_TIMER_AUTOSTART | ||||
| 
 | ||||
| //
 | ||||
| // Print Counter
 | ||||
|  | ||||
| @ -772,6 +772,19 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l | ||||
| #define ABS_PREHEAT_HPB_TEMP 60 // K8200: set back to 110 if you have an upgraded heatbed power supply
 | ||||
| #define ABS_PREHEAT_FAN_SPEED 0   // Insert Value between 0 and 255
 | ||||
| 
 | ||||
| //
 | ||||
| // Print job timer
 | ||||
| //
 | ||||
| // Enable this option to automatically start and stop the
 | ||||
| // print job timer when M104 and M109 commands are received.
 | ||||
| //
 | ||||
| // In all cases the timer can be started and stopped using
 | ||||
| // the following commands:
 | ||||
| //
 | ||||
| // - M75  - Start the print job timer
 | ||||
| // - M76  - Pause the print job timer
 | ||||
| // - M77  - Stop the print job timer
 | ||||
| #define PRINTJOB_TIMER_AUTOSTART | ||||
| 
 | ||||
| //
 | ||||
| // Print Counter
 | ||||
|  | ||||
| @ -755,6 +755,19 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l | ||||
| #define ABS_PREHEAT_HPB_TEMP 110 | ||||
| #define ABS_PREHEAT_FAN_SPEED 0   // Insert Value between 0 and 255
 | ||||
| 
 | ||||
| //
 | ||||
| // Print job timer
 | ||||
| //
 | ||||
| // Enable this option to automatically start and stop the
 | ||||
| // print job timer when M104 and M109 commands are received.
 | ||||
| //
 | ||||
| // In all cases the timer can be started and stopped using
 | ||||
| // the following commands:
 | ||||
| //
 | ||||
| // - M75  - Start the print job timer
 | ||||
| // - M76  - Pause the print job timer
 | ||||
| // - M77  - Stop the print job timer
 | ||||
| #define PRINTJOB_TIMER_AUTOSTART | ||||
| 
 | ||||
| //
 | ||||
| // Print Counter
 | ||||
|  | ||||
| @ -750,6 +750,19 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l | ||||
| #define ABS_PREHEAT_HPB_TEMP 110 | ||||
| #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
 | ||||
| 
 | ||||
| //
 | ||||
| // Print job timer
 | ||||
| //
 | ||||
| // Enable this option to automatically start and stop the
 | ||||
| // print job timer when M104 and M109 commands are received.
 | ||||
| //
 | ||||
| // In all cases the timer can be started and stopped using
 | ||||
| // the following commands:
 | ||||
| //
 | ||||
| // - M75  - Start the print job timer
 | ||||
| // - M76  - Pause the print job timer
 | ||||
| // - M77  - Stop the print job timer
 | ||||
| #define PRINTJOB_TIMER_AUTOSTART | ||||
| 
 | ||||
| //
 | ||||
| // Print Counter
 | ||||
|  | ||||
| @ -763,6 +763,19 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l | ||||
| #define ABS_PREHEAT_HPB_TEMP 100 | ||||
| #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
 | ||||
| 
 | ||||
| //
 | ||||
| // Print job timer
 | ||||
| //
 | ||||
| // Enable this option to automatically start and stop the
 | ||||
| // print job timer when M104 and M109 commands are received.
 | ||||
| //
 | ||||
| // In all cases the timer can be started and stopped using
 | ||||
| // the following commands:
 | ||||
| //
 | ||||
| // - M75  - Start the print job timer
 | ||||
| // - M76  - Pause the print job timer
 | ||||
| // - M77  - Stop the print job timer
 | ||||
| #define PRINTJOB_TIMER_AUTOSTART | ||||
| 
 | ||||
| //
 | ||||
| // Print Counter
 | ||||
|  | ||||
| @ -776,6 +776,19 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l | ||||
| #define ABS_PREHEAT_HPB_TEMP 110 | ||||
| #define ABS_PREHEAT_FAN_SPEED 0   // Insert Value between 0 and 255
 | ||||
| 
 | ||||
| //
 | ||||
| // Print job timer
 | ||||
| //
 | ||||
| // Enable this option to automatically start and stop the
 | ||||
| // print job timer when M104 and M109 commands are received.
 | ||||
| //
 | ||||
| // In all cases the timer can be started and stopped using
 | ||||
| // the following commands:
 | ||||
| //
 | ||||
| // - M75  - Start the print job timer
 | ||||
| // - M76  - Pause the print job timer
 | ||||
| // - M77  - Stop the print job timer
 | ||||
| #define PRINTJOB_TIMER_AUTOSTART | ||||
| 
 | ||||
| //
 | ||||
| // Print Counter
 | ||||
|  | ||||
| @ -747,6 +747,19 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo | ||||
| #define ABS_PREHEAT_HPB_TEMP 100 | ||||
| #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
 | ||||
| 
 | ||||
| //
 | ||||
| // Print job timer
 | ||||
| //
 | ||||
| // Enable this option to automatically start and stop the
 | ||||
| // print job timer when M104 and M109 commands are received.
 | ||||
| //
 | ||||
| // In all cases the timer can be started and stopped using
 | ||||
| // the following commands:
 | ||||
| //
 | ||||
| // - M75  - Start the print job timer
 | ||||
| // - M76  - Pause the print job timer
 | ||||
| // - M77  - Stop the print job timer
 | ||||
| #define PRINTJOB_TIMER_AUTOSTART | ||||
| 
 | ||||
| //
 | ||||
| // Print Counter
 | ||||
|  | ||||
| @ -755,6 +755,19 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l | ||||
| #define ABS_PREHEAT_HPB_TEMP 110 | ||||
| #define ABS_PREHEAT_FAN_SPEED 0   // Insert Value between 0 and 255
 | ||||
| 
 | ||||
| //
 | ||||
| // Print job timer
 | ||||
| //
 | ||||
| // Enable this option to automatically start and stop the
 | ||||
| // print job timer when M104 and M109 commands are received.
 | ||||
| //
 | ||||
| // In all cases the timer can be started and stopped using
 | ||||
| // the following commands:
 | ||||
| //
 | ||||
| // - M75  - Start the print job timer
 | ||||
| // - M76  - Pause the print job timer
 | ||||
| // - M77  - Stop the print job timer
 | ||||
| #define PRINTJOB_TIMER_AUTOSTART | ||||
| 
 | ||||
| //
 | ||||
| // Print Counter
 | ||||
|  | ||||
| @ -884,6 +884,19 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo | ||||
| #define ABS_PREHEAT_HPB_TEMP 100 | ||||
| #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
 | ||||
| 
 | ||||
| //
 | ||||
| // Print job timer
 | ||||
| //
 | ||||
| // Enable this option to automatically start and stop the
 | ||||
| // print job timer when M104 and M109 commands are received.
 | ||||
| //
 | ||||
| // In all cases the timer can be started and stopped using
 | ||||
| // the following commands:
 | ||||
| //
 | ||||
| // - M75  - Start the print job timer
 | ||||
| // - M76  - Pause the print job timer
 | ||||
| // - M77  - Stop the print job timer
 | ||||
| #define PRINTJOB_TIMER_AUTOSTART | ||||
| 
 | ||||
| //
 | ||||
| // Print Counter
 | ||||
|  | ||||
| @ -884,6 +884,19 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo | ||||
| #define ABS_PREHEAT_HPB_TEMP 100 | ||||
| #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
 | ||||
| 
 | ||||
| //
 | ||||
| // Print job timer
 | ||||
| //
 | ||||
| // Enable this option to automatically start and stop the
 | ||||
| // print job timer when M104 and M109 commands are received.
 | ||||
| //
 | ||||
| // In all cases the timer can be started and stopped using
 | ||||
| // the following commands:
 | ||||
| //
 | ||||
| // - M75  - Start the print job timer
 | ||||
| // - M76  - Pause the print job timer
 | ||||
| // - M77  - Stop the print job timer
 | ||||
| #define PRINTJOB_TIMER_AUTOSTART | ||||
| 
 | ||||
| //
 | ||||
| // Print Counter
 | ||||
|  | ||||
| @ -888,6 +888,19 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l | ||||
| #define ABS_PREHEAT_HPB_TEMP 100 | ||||
| #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
 | ||||
| 
 | ||||
| //
 | ||||
| // Print job timer
 | ||||
| //
 | ||||
| // Enable this option to automatically start and stop the
 | ||||
| // print job timer when M104 and M109 commands are received.
 | ||||
| //
 | ||||
| // In all cases the timer can be started and stopped using
 | ||||
| // the following commands:
 | ||||
| //
 | ||||
| // - M75  - Start the print job timer
 | ||||
| // - M76  - Pause the print job timer
 | ||||
| // - M77  - Stop the print job timer
 | ||||
| #define PRINTJOB_TIMER_AUTOSTART | ||||
| 
 | ||||
| //
 | ||||
| // Print Counter
 | ||||
|  | ||||
| @ -881,6 +881,19 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l | ||||
| #define ABS_PREHEAT_HPB_TEMP 100 | ||||
| #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
 | ||||
| 
 | ||||
| //
 | ||||
| // Print job timer
 | ||||
| //
 | ||||
| // Enable this option to automatically start and stop the
 | ||||
| // print job timer when M104 and M109 commands are received.
 | ||||
| //
 | ||||
| // In all cases the timer can be started and stopped using
 | ||||
| // the following commands:
 | ||||
| //
 | ||||
| // - M75  - Start the print job timer
 | ||||
| // - M76  - Pause the print job timer
 | ||||
| // - M77  - Stop the print job timer
 | ||||
| #define PRINTJOB_TIMER_AUTOSTART | ||||
| 
 | ||||
| //
 | ||||
| // Print Counter
 | ||||
|  | ||||
| @ -889,6 +889,19 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l | ||||
| #define ABS_PREHEAT_HPB_TEMP 100 | ||||
| #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
 | ||||
| 
 | ||||
| //
 | ||||
| // Print job timer
 | ||||
| //
 | ||||
| // Enable this option to automatically start and stop the
 | ||||
| // print job timer when M104 and M109 commands are received.
 | ||||
| //
 | ||||
| // In all cases the timer can be started and stopped using
 | ||||
| // the following commands:
 | ||||
| //
 | ||||
| // - M75  - Start the print job timer
 | ||||
| // - M76  - Pause the print job timer
 | ||||
| // - M77  - Stop the print job timer
 | ||||
| #define PRINTJOB_TIMER_AUTOSTART | ||||
| 
 | ||||
| //
 | ||||
| // Print Counter
 | ||||
|  | ||||
| @ -758,6 +758,19 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l | ||||
| #define ABS_PREHEAT_HPB_TEMP 100 | ||||
| #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
 | ||||
| 
 | ||||
| //
 | ||||
| // Print job timer
 | ||||
| //
 | ||||
| // Enable this option to automatically start and stop the
 | ||||
| // print job timer when M104 and M109 commands are received.
 | ||||
| //
 | ||||
| // In all cases the timer can be started and stopped using
 | ||||
| // the following commands:
 | ||||
| //
 | ||||
| // - M75  - Start the print job timer
 | ||||
| // - M76  - Pause the print job timer
 | ||||
| // - M77  - Stop the print job timer
 | ||||
| #define PRINTJOB_TIMER_AUTOSTART | ||||
| 
 | ||||
| //
 | ||||
| // Print Counter
 | ||||
|  | ||||
| @ -749,6 +749,19 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo | ||||
| #define ABS_PREHEAT_HPB_TEMP 100 | ||||
| #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
 | ||||
| 
 | ||||
| //
 | ||||
| // Print job timer
 | ||||
| //
 | ||||
| // Enable this option to automatically start and stop the
 | ||||
| // print job timer when M104 and M109 commands are received.
 | ||||
| //
 | ||||
| // In all cases the timer can be started and stopped using
 | ||||
| // the following commands:
 | ||||
| //
 | ||||
| // - M75  - Start the print job timer
 | ||||
| // - M76  - Pause the print job timer
 | ||||
| // - M77  - Stop the print job timer
 | ||||
| #define PRINTJOB_TIMER_AUTOSTART | ||||
| 
 | ||||
| //
 | ||||
| // Print Counter
 | ||||
|  | ||||
| @ -149,7 +149,9 @@ void PrintCounter::stop() { | ||||
|     PrintCounter::debug(PSTR("stop")); | ||||
|   #endif | ||||
| 
 | ||||
|   if (!this->isRunning()) return; | ||||
|   super::stop(); | ||||
| 
 | ||||
|   this->data.finishedPrints++; | ||||
|   this->data.printTime += this->deltaDuration(); | ||||
|   this->saveStats(); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user