From 082117c4bb30d8f2e5b2edeccaa8d59ad6126940 Mon Sep 17 00:00:00 2001
From: Gaston Dombiak <gdombiak@gmail.com>
Date: Thu, 13 Feb 2020 16:43:47 -0800
Subject: [PATCH] Ping the job timer in M140 (#16849)

---
 Marlin/src/gcode/temperature/M140_M190.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Marlin/src/gcode/temperature/M140_M190.cpp b/Marlin/src/gcode/temperature/M140_M190.cpp
index 8e9778f7f0..ad7608705a 100644
--- a/Marlin/src/gcode/temperature/M140_M190.cpp
+++ b/Marlin/src/gcode/temperature/M140_M190.cpp
@@ -51,6 +51,15 @@
 void GcodeSuite::M140() {
   if (DEBUGGING(DRYRUN)) return;
   if (parser.seenval('S')) thermalManager.setTargetBed(parser.value_celsius());
+
+  #if ENABLED(PRINTJOB_TIMER_AUTOSTART)
+    /**
+     * Stop the timer at the end of print. Both hotend and bed target
+     * temperatures need to be set below mintemp. Order of M140 and M104
+     * at the end of the print does not matter.
+     */
+    thermalManager.check_timer_autostart(false, true);
+  #endif
 }
 
 /**