diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp
index 4437f9f2bd..f96ef14d80 100644
--- a/Marlin/src/Marlin.cpp
+++ b/Marlin/src/Marlin.cpp
@@ -370,14 +370,6 @@ bool pin_is_protected(const int8_t pin) {
return false;
}
-#include "gcode/stats/M75.h"
-#include "gcode/stats/M76.h"
-#include "gcode/stats/M77.h"
-
-#if ENABLED(PRINTCOUNTER)
- #include "gcode/stats/M78.h"
-#endif
-
#include "gcode/temperature/M105.h"
#if ENABLED(AUTO_REPORT_TEMPERATURES) && (HAS_TEMP_HOTEND || HAS_TEMP_BED)
diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp
index c30b21a669..15d3e80f69 100644
--- a/Marlin/src/gcode/gcode.cpp
+++ b/Marlin/src/gcode/gcode.cpp
@@ -117,10 +117,6 @@ void GcodeSuite::dwell(millis_t time) {
// Placeholders for non-migrated codes
//
extern void gcode_M18_M84();
-extern void gcode_M75();
-extern void gcode_M76();
-extern void gcode_M77();
-extern void gcode_M78();
extern void gcode_M80();
extern void gcode_M81();
extern void gcode_M82();
@@ -444,16 +440,12 @@ void GcodeSuite::process_next_command() {
case 49: M49(); break; // M49: Turn on or off G26 debug flag for verbose output
#endif
- case 75: // M75: Start print timer
- gcode_M75(); break;
- case 76: // M76: Pause print timer
- gcode_M76(); break;
- case 77: // M77: Stop print timer
- gcode_M77(); break;
+ case 75: M75(); break; // M75: Start print timer
+ case 76: M76(); break; // M76: Pause print timer
+ case 77: M77(); break; // M77: Stop print timer
#if ENABLED(PRINTCOUNTER)
- case 78: // M78: Show print statistics
- gcode_M78(); break;
+ case 78: M78(); break; // M78: Show print statistics
#endif
#if ENABLED(M100_FREE_MEMORY_WATCHER)
diff --git a/Marlin/src/gcode/stats/M75.h b/Marlin/src/gcode/stats/M75-M77.cpp
similarity index 75%
rename from Marlin/src/gcode/stats/M75.h
rename to Marlin/src/gcode/stats/M75-M77.cpp
index 14ea71723e..1f506d360e 100644
--- a/Marlin/src/gcode/stats/M75.h
+++ b/Marlin/src/gcode/stats/M75-M77.cpp
@@ -20,7 +20,20 @@
*
*/
+#include "../gcode.h"
+#include "../../module/printcounter.h"
+
/**
* M75: Start print timer
*/
-void gcode_M75() { print_job_timer.start(); }
+void GcodeSuite::M75() { print_job_timer.start(); }
+
+/**
+ * M76: Pause print timer
+ */
+void GcodeSuite::M76() { print_job_timer.pause(); }
+
+/**
+ * M77: Stop print timer
+ */
+void GcodeSuite::M77() { print_job_timer.stop(); }
diff --git a/Marlin/src/gcode/stats/M76.h b/Marlin/src/gcode/stats/M76.h
deleted file mode 100644
index bacbdd89e1..0000000000
--- a/Marlin/src/gcode/stats/M76.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Marlin 3D Printer Firmware
- * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
- *
- * Based on Sprinter and grbl.
- * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- */
-
-/**
- * M76: Pause print timer
- */
-void gcode_M76() { print_job_timer.pause(); }
diff --git a/Marlin/src/gcode/stats/M77.h b/Marlin/src/gcode/stats/M77.h
deleted file mode 100644
index 424d8498ef..0000000000
--- a/Marlin/src/gcode/stats/M77.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Marlin 3D Printer Firmware
- * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
- *
- * Based on Sprinter and grbl.
- * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- */
-
-/**
- * M77: Stop print timer
- */
-void gcode_M77() { print_job_timer.stop(); }
diff --git a/Marlin/src/gcode/stats/M78.h b/Marlin/src/gcode/stats/M78.cpp
similarity index 85%
rename from Marlin/src/gcode/stats/M78.h
rename to Marlin/src/gcode/stats/M78.cpp
index af1c0ddc92..9ea79572c2 100644
--- a/Marlin/src/gcode/stats/M78.h
+++ b/Marlin/src/gcode/stats/M78.cpp
@@ -20,12 +20,21 @@
*
*/
+#include "../../inc/MarlinConfig.h"
+
+#if ENABLED(PRINTCOUNTER)
+
+#include "../gcode.h"
+#include "../../module/printcounter.h"
+
/**
* M78: Show print statistics
*/
-void gcode_M78() {
+void GcodeSuite::M78() {
if (parser.intval('S') == 78) // "M78 S78" will reset the statistics
print_job_timer.initStats();
else
print_job_timer.showStats();
}
+
+#endif // PRINTCOUNTER