From 7479ff98b7e3c95b4a90176fe62397f77e1a9552 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 16 Sep 2017 22:13:32 -0500 Subject: [PATCH] Move M140, M190 to cpp --- Marlin/src/Marlin.cpp | 6 ----- Marlin/src/gcode/gcode.cpp | 16 +++--------- Marlin/src/gcode/gcode.h | 7 ++---- .../gcode/temperature/{M140.h => M140.cpp} | 11 +++++++- .../gcode/temperature/{M190.h => M190.cpp} | 25 ++++++++++++++++--- 5 files changed, 38 insertions(+), 27 deletions(-) rename Marlin/src/gcode/temperature/{M140.h => M140.cpp} (83%) rename Marlin/src/gcode/temperature/{M190.h => M190.cpp} (89%) diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index ede4653aed..fb647284cf 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -374,10 +374,6 @@ bool pin_is_protected(const int8_t pin) { return false; } -#if HAS_TEMP_BED - #include "gcode/temperature/M190.h" -#endif - #include "gcode/host/M110.h" #include "gcode/control/M111.h" @@ -397,8 +393,6 @@ bool pin_is_protected(const int8_t pin) { #endif #endif -#include "gcode/temperature/M140.h" - #if ENABLED(ULTIPANEL) #include "gcode/lcd/M145.h" #endif diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 6f18733ef3..c02c2f1e51 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -138,14 +138,12 @@ extern void gcode_M126(); extern void gcode_M127(); extern void gcode_M128(); extern void gcode_M129(); -extern void gcode_M140(); extern void gcode_M145(); extern void gcode_M149(); extern void gcode_M150(); extern void gcode_M163(); extern void gcode_M164(); extern void gcode_M165(); -extern void gcode_M190(); extern void gcode_M201(); extern void gcode_M203(); extern void gcode_M204(); @@ -470,10 +468,10 @@ void GcodeSuite::process_next_command() { break; #endif - case 140: // M140: Set bed temperature - gcode_M140(); - break; - + #if HAS_HEATER_BED && HAS_TEMP_BED + case 140: M140(); break; // M140: Set bed temperature + case 190: M190(); break; // M190: Wait for bed temperature to reach target + #endif case 105: // M105: Report current temperature M105(); @@ -484,12 +482,6 @@ void GcodeSuite::process_next_command() { case 155: M155(); break; // M155: Set temperature auto-report interval #endif - #if HAS_TEMP_BED - case 190: // M190: Wait for bed temperature to reach target - gcode_M190(); - break; - #endif // HAS_TEMP_BED - #if FAN_COUNT > 0 case 106: M106(); break; // M106: Fan On case 107: M107(); break; // M107: Fan Off diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 26ff734429..f74ccef26f 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -502,8 +502,9 @@ private: #endif #endif - #if HAS_TEMP_BED + #if HAS_HEATER_BED && HAS_TEMP_BED static void M140(); + static void M190(); #endif #if ENABLED(ULTIPANEL) @@ -532,10 +533,6 @@ private: #endif #endif - #if HAS_TEMP_BED - static void M190(); - #endif - static void M200(); static void M201(); diff --git a/Marlin/src/gcode/temperature/M140.h b/Marlin/src/gcode/temperature/M140.cpp similarity index 83% rename from Marlin/src/gcode/temperature/M140.h rename to Marlin/src/gcode/temperature/M140.cpp index 3cf7d42bce..f30d04c163 100644 --- a/Marlin/src/gcode/temperature/M140.h +++ b/Marlin/src/gcode/temperature/M140.cpp @@ -20,10 +20,19 @@ * */ +#include "../../inc/MarlinConfig.h" + +#if HAS_HEATER_BED && HAS_TEMP_BED + +#include "../gcode.h" +#include "../../module/temperature.h" + /** * M140: Set bed temperature */ -void gcode_M140() { +void GcodeSuite::M140() { if (DEBUGGING(DRYRUN)) return; if (parser.seenval('S')) thermalManager.setTargetBed(parser.value_celsius()); } + +#endif // HAS_HEATER_BED && HAS_TEMP_BED diff --git a/Marlin/src/gcode/temperature/M190.h b/Marlin/src/gcode/temperature/M190.cpp similarity index 89% rename from Marlin/src/gcode/temperature/M190.h rename to Marlin/src/gcode/temperature/M190.cpp index c80ccc3f05..ef18a50ebe 100644 --- a/Marlin/src/gcode/temperature/M190.h +++ b/Marlin/src/gcode/temperature/M190.cpp @@ -20,7 +20,24 @@ * */ +#include "../../inc/MarlinConfig.h" + +#if HAS_HEATER_BED && HAS_TEMP_BED + #include "../gcode.h" +#include "../../module/motion.h" +#include "../../module/temperature.h" +#include "../../lcd/ultralcd.h" + +#if ENABLED(PRINTJOB_TIMER_AUTOSTART) + #include "../../module/printcounter.h" +#endif + +#if ENABLED(PRINTER_EVENT_LEDS) + #include "../../feature/leds/leds.h" +#endif + +#include "../../Marlin.h" // for wait_for_heatup and idle() #ifndef MIN_COOLING_SLOPE_DEG_BED #define MIN_COOLING_SLOPE_DEG_BED 1.50 @@ -33,7 +50,7 @@ * M190: Sxxx Wait for bed current temp to reach target temp. Waits only when heating * Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling */ -void gcode_M190() { +void GcodeSuite::M190() { if (DEBUGGING(DRYRUN)) return; LCD_MESSAGEPGM(MSG_BED_HEATING); @@ -65,7 +82,7 @@ void gcode_M190() { KEEPALIVE_STATE(NOT_BUSY); #endif - gcode.target_extruder = active_extruder; // for print_heaterstates + target_extruder = active_extruder; // for print_heaterstates #if ENABLED(PRINTER_EVENT_LEDS) const float start_temp = thermalManager.degBed(); @@ -97,7 +114,7 @@ void gcode_M190() { } idle(); - gcode.refresh_cmd_timeout(); // to prevent stepper_inactive_time from running out + refresh_cmd_timeout(); // to prevent stepper_inactive_time from running out const float temp = thermalManager.degBed(); @@ -149,3 +166,5 @@ void gcode_M190() { KEEPALIVE_STATE(IN_HANDLER); #endif } + +#endif // HAS_HEATER_BED && HAS_TEMP_BED