From 2c1eda9e00d37ae420df98617a0c5dd90144b32c Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 16 Sep 2017 04:27:45 -0500 Subject: [PATCH] Move M75-M78 to cpp --- Marlin/src/Marlin.cpp | 8 ------ Marlin/src/gcode/gcode.cpp | 16 +++--------- Marlin/src/gcode/stats/{M75.h => M75-M77.cpp} | 15 ++++++++++- Marlin/src/gcode/stats/M76.h | 26 ------------------- Marlin/src/gcode/stats/M77.h | 26 ------------------- Marlin/src/gcode/stats/{M78.h => M78.cpp} | 11 +++++++- 6 files changed, 28 insertions(+), 74 deletions(-) rename Marlin/src/gcode/stats/{M75.h => M75-M77.cpp} (75%) delete mode 100644 Marlin/src/gcode/stats/M76.h delete mode 100644 Marlin/src/gcode/stats/M77.h rename Marlin/src/gcode/stats/{M78.h => M78.cpp} (85%) diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index 4437f9f2b..f96ef14d8 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 c30b21a66..15d3e80f6 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 14ea71723..1f506d360 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 bacbdd89e..000000000 --- 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 424d8498e..000000000 --- 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 af1c0ddc9..9ea79572c 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