From 69b664b6fe4db25ffe45b1b872373bd64c1ff0c9 Mon Sep 17 00:00:00 2001
From: Scott Lahteine <github@thinkyhead.com>
Date: Sat, 16 Sep 2017 03:32:16 -0500
Subject: [PATCH] Move M31 to cpp

---
 Marlin/src/Marlin.cpp                     | 2 --
 Marlin/src/gcode/gcode.cpp                | 4 +---
 Marlin/src/gcode/stats/{M31.h => M31.cpp} | 8 +++++++-
 3 files changed, 8 insertions(+), 6 deletions(-)
 rename Marlin/src/gcode/stats/{M31.h => M31.cpp} (85%)

diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp
index 65cafbcc30..1d25ee8f06 100644
--- a/Marlin/src/Marlin.cpp
+++ b/Marlin/src/Marlin.cpp
@@ -360,8 +360,6 @@ void suicide() {
  ***************** GCode Handlers *****************
  **************************************************/
 
-#include "gcode/stats/M31.h"              // M31: Get the time since the start of SD Print (or last M109)
-
 /**
  * Sensitive pin test for M42, M226
  */
diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp
index 799a5df58a..8b886593ee 100644
--- a/Marlin/src/gcode/gcode.cpp
+++ b/Marlin/src/gcode/gcode.cpp
@@ -117,7 +117,6 @@ void GcodeSuite::dwell(millis_t time) {
 // Placeholders for non-migrated codes
 //
 extern void gcode_M18_M84();
-extern void gcode_M31();
 extern void gcode_M42();
 extern void gcode_M43();
 extern void gcode_M48();
@@ -432,8 +431,7 @@ void GcodeSuite::process_next_command() {
         case 928: M928(); break;  // M928: Start SD write
       #endif // SDSUPPORT
 
-      case 31: // M31: Report time since the start of SD print or last M109
-        gcode_M31(); break;
+      case 31: M31(); break;      // M31: Report time since the start of SD print or last M109
 
       case 42: // M42: Change pin state
         gcode_M42(); break;
diff --git a/Marlin/src/gcode/stats/M31.h b/Marlin/src/gcode/stats/M31.cpp
similarity index 85%
rename from Marlin/src/gcode/stats/M31.h
rename to Marlin/src/gcode/stats/M31.cpp
index 06cf783560..327ff8c37d 100644
--- a/Marlin/src/gcode/stats/M31.h
+++ b/Marlin/src/gcode/stats/M31.cpp
@@ -20,10 +20,16 @@
  *
  */
 
+#include "../gcode.h"
+#include "../../core/serial.h"
+#include "../../module/printcounter.h"
+#include "../../libs/duration_t.h"
+#include "../../lcd/ultralcd.h"
+
 /**
  * M31: Get the time since the start of SD Print (or last M109)
  */
-void gcode_M31() {
+void GcodeSuite::M31() {
   char buffer[21];
   duration_t elapsed = print_job_timer.duration();
   elapsed.toString(buffer);
-- 
GitLab