diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 18fe5c864a1e4c81cdafaee24bf12aafb41d6034..15bfd5ef475548401d5ac7cd11c8eaec9eac5f63 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -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 diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 7fede1bba1f4e9817d38759f5106577556b9db1c..5416243f1d45cec9e7c96696cb84c5da77e85580 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -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,21 +4287,23 @@ inline void gcode_M104() { thermalManager.setTargetHotend(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset, 1); #endif - /** - * 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 - * the running print timer. - */ - if (temp <= (EXTRUDE_MINTEMP)/2) { - print_job_timer.stop(); - LCD_MESSAGEPGM(WELCOME_MSG); - } - /** - * We do not check if the timer is already running because this check will - * be done for us inside the Stopwatch::start() method thus a running timer - * will not restart. - */ - else print_job_timer.start(); + #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 + * the running print timer. + */ + if (temp <= (EXTRUDE_MINTEMP)/2) { + print_job_timer.stop(); + LCD_MESSAGEPGM(WELCOME_MSG); + } + /** + * We do not check if the timer is already running because this check will + * be done for us inside the Stopwatch::start() method thus a running timer + * will not restart. + */ + else print_job_timer.start(); + #endif if (temp > thermalManager.degHotend(target_extruder)) LCD_MESSAGEPGM(MSG_HEATING); } @@ -4443,21 +4442,23 @@ inline void gcode_M109() { thermalManager.setTargetHotend(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset, 1); #endif - /** - * 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 - * the running print timer. - */ - if (temp <= (EXTRUDE_MINTEMP)/2) { - print_job_timer.stop(); - LCD_MESSAGEPGM(WELCOME_MSG); - } - /** - * We do not check if the timer is already running because this check will - * be done for us inside the Stopwatch::start() method thus a running timer - * will not restart. - */ - else print_job_timer.start(); + #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 + * the running print timer. + */ + if (temp <= (EXTRUDE_MINTEMP)/2) { + print_job_timer.stop(); + LCD_MESSAGEPGM(WELCOME_MSG); + } + /** + * We do not check if the timer is already running because this check will + * be done for us inside the Stopwatch::start() method thus a running timer + * will not restart. + */ + else print_job_timer.start(); + #endif if (temp > thermalManager.degHotend(target_extruder)) LCD_MESSAGEPGM(MSG_HEATING); } diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h index 778ca60cb77af163a5151878c0b5c619eafd4ffe..36c1239da8397b0f404647821d48fbc5a8fd22ba 100644 --- a/Marlin/example_configurations/Felix/Configuration.h +++ b/Marlin/example_configurations/Felix/Configuration.h @@ -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 diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h index b8ea32cedc15be2e0ec9a9614df2a78591fcd260..d5b6ed0b2495a1b084433870b1c532638d6f6fdd 100644 --- a/Marlin/example_configurations/Hephestos/Configuration.h +++ b/Marlin/example_configurations/Hephestos/Configuration.h @@ -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 diff --git a/Marlin/example_configurations/Hephestos_2/Configuration.h b/Marlin/example_configurations/Hephestos_2/Configuration.h index eaf556f3e2916439265c8c3c0fbe5538fd9d7fa6..7b9849bacb6fc56dde111da5b8deed41cbcd8fe0 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration.h @@ -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 diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h index 8222877171bb071d9d76c41474a13c893bbb091f..e99d4dd01a62d53808350e34f37bcb2ea831d032 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -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 diff --git a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h index 341097e0db75e388bae15d338a4f676c9eefc1ec..2d3067c6d7dad4ef852bfb57a73a90db19bc4ec0 100644 --- a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h +++ b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h @@ -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 diff --git a/Marlin/example_configurations/RigidBot/Configuration.h b/Marlin/example_configurations/RigidBot/Configuration.h index ee68c80ad176faaeca5b4166ce970115c722076f..d1522c3fa7e49b18d440c0db8e798b841506d998 100644 --- a/Marlin/example_configurations/RigidBot/Configuration.h +++ b/Marlin/example_configurations/RigidBot/Configuration.h @@ -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 diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index 4394e5eabeb7066b7e9123d91520698e2df06b20..13c484ac1f09823b7dc974d026e53a9ba049da54 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -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 diff --git a/Marlin/example_configurations/TAZ4/Configuration.h b/Marlin/example_configurations/TAZ4/Configuration.h index 39c71527e8fb774770aeaaf33dc4277bb4e049fb..0da46efdd8ef064c60a25071fc5f95bee116693b 100644 --- a/Marlin/example_configurations/TAZ4/Configuration.h +++ b/Marlin/example_configurations/TAZ4/Configuration.h @@ -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 diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h index 1c48ddd18e9800e9a4f657a882f14ffaa1dab514..ae59c5d15c1f9ee9395c0a07666a8d851b10d9d8 100644 --- a/Marlin/example_configurations/WITBOX/Configuration.h +++ b/Marlin/example_configurations/WITBOX/Configuration.h @@ -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 diff --git a/Marlin/example_configurations/adafruit/ST7565/Configuration.h b/Marlin/example_configurations/adafruit/ST7565/Configuration.h index a115f3c138f65ad5c06bdd284a357e1c5ee6c762..638ce4032e3fea5a25cef613fd95d5f697a3426e 100644 --- a/Marlin/example_configurations/adafruit/ST7565/Configuration.h +++ b/Marlin/example_configurations/adafruit/ST7565/Configuration.h @@ -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 diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration.h b/Marlin/example_configurations/delta/biv2.5/Configuration.h index adc1b0d73997e2fd3782140f35c0a84b1976beb1..4560cd8b93be3058a7f345a88bc29832f776be11 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration.h @@ -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 diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h index 954854eb4e8c1bbd527d52a516e4c48b28198729..e2e9227b37f679954b78523ed7f8b251a10103d1 100644 --- a/Marlin/example_configurations/delta/generic/Configuration.h +++ b/Marlin/example_configurations/delta/generic/Configuration.h @@ -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 diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h index c4f3ffcd995a25ade8851d5b7b4ff1e413ed753f..4729e39be3e795054f2ab4cfd0ad7096960d8bfc 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h @@ -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 diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration.h b/Marlin/example_configurations/delta/kossel_pro/Configuration.h index c977b47c3a969358c6bf272a65321745bd83dbe2..a37bced783ea07695757e7f159a8a8909a83b353 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration.h @@ -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 diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration.h b/Marlin/example_configurations/delta/kossel_xl/Configuration.h index e2d277fa464ade09e7864bb64d6688f91fbcd22d..c23b546ab2d04cbda2a9429faf7c47ae30d589b3 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration.h @@ -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 diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h index 7da67eb8659e98e54c4dc15117be03cc495adc16..db34f1ab00b3e4804cc0bd1f9277db37f8c4c51c 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/Configuration.h @@ -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 diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index 83b64f70dae5415706adbc1c369aad77001e919c..9e85c919d8a986b243dae4c18a6aa395d1748315 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -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 diff --git a/Marlin/printcounter.cpp b/Marlin/printcounter.cpp index 945b4b09d06b675d59f34f55a7bd228554d8db5e..158356217144a080921f1e8755cbd4b2cb44a282 100644 --- a/Marlin/printcounter.cpp +++ b/Marlin/printcounter.cpp @@ -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();