From 79f559e9aff8f605b6ca20ba195eb8c41142fd48 Mon Sep 17 00:00:00 2001 From: David Ramiro Date: Wed, 13 Mar 2019 11:40:25 +0100 Subject: [PATCH] Implement heatbed cooldown routine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - M888: Cooldown routine for the Anycubic Ultrabase (EXPERIMENTAL): This is meant to be placed at the end Gcode of your slicer. It hovers over the print bed and does circular movements while running the fan. Works best with custom fan ducts. - T: Target bed temperature (min 15°C), 30°C if not specified - S: Fan speed between 0 and 255, full speed if not specified Thanks to @kulfuerst for the suggestion! --- Marlin/Marlin_main.cpp | 53 ++++++++++++++++++++++++++++++++++++++++++ Marlin/Version.h | 2 +- README.md | 7 ++++++ 3 files changed, 61 insertions(+), 1 deletion(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 7a82655..6611bc9 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -228,6 +228,7 @@ * M867 - Enable/disable or toggle error correction for position encoder modules. * M868 - Report or set position encoder module error correction threshold. * M869 - Report position encoder module error. + * M888 - Ultrabase cooldown: Let the parts cooling fan hover above the finished print to cool down the bed. EXPERIMENTAL FEATURE! * M900 - Get or Set Linear Advance K-factor. (Requires LIN_ADVANCE) * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. (Requires at least one _DRIVER_TYPE defined as TMC2130/TMC2208/TMC2660) * M907 - Set digital trimpot motor current using axis codes. (Requires a board with digital trimpots) @@ -11403,6 +11404,56 @@ inline void gcode_M502() { } #endif // MAX7219_GCODE + /** + * M888: Cooldown routine for the Anycubic Ultrabase (EXPERIMENTAL): + * This is meant to be placed at the end Gcode of your slicer. + * It hovers over the print bed and does circular movements while + * running the fan. Works best with custom fan ducts. + * + * T Target bed temperature (min 15°C), 30°C if not specified + * S Fan speed between 0 and 255, full speed if not specified + */ + inline void gcode_M888() { + // don't do this if the machine is not homed + if (axis_unhomed_error()) return; + + const float cooldown_arc[2] = { 50, 50 }; + const uint8_t cooldown_target = MAX((parser.ushortval('T', 30)), 15); + + // set hotbed temperate to zero + thermalManager.setTargetBed(0); + SERIAL_PROTOCOLLNPGM("Ultrabase cooldown started"); + + // set fan to speed , if undefined blast at full speed + uint8_t cooldown_fanspeed = parser.ushortval('S', 255); + fanSpeeds[0] = MIN(cooldown_fanspeed, 255U); + + // raise z by 2mm and move to X50, Y50 + do_blocking_move_to_z(MIN(current_position[Z_AXIS] + 2, Z_MAX_POS), 5); + do_blocking_move_to_xy(50, 50, 100); + + while ((thermalManager.degBed() > cooldown_target)) { + // queue arc movement + gcode_get_destination(); + plan_arc(destination, cooldown_arc, true); + SERIAL_PROTOCOLLNPGM("Target not reached, queued an arc"); + + // delay while arc is in progress + while (planner.movesplanned()) { + idle(); + } + idle(); + } + // the bed should be under now + fanSpeeds[0]=0; + do_blocking_move_to_xy(MAX(X_MIN_POS, 10), MIN(Y_MAX_POS, 190), 100); + BUZZ(100, 659); + BUZZ(150, 1318); + enqueue_and_echo_commands_P(PSTR("M84")); + SERIAL_PROTOCOLLNPGM("M888 cooldown routine done"); + } + + #if ENABLED(LIN_ADVANCE) /** * M900: Get or Set Linear Advance K-factor @@ -13138,6 +13189,8 @@ void process_parsed_command() { case 869: gcode_M869(); break; // M869: Report axis error #endif + case 888: gcode_M888(); break; // M888: Ultrabase cooldown (EXPERIMENTAL) + #if ENABLED(LIN_ADVANCE) case 900: gcode_M900(); break; // M900: Set Linear Advance K factor #endif diff --git a/Marlin/Version.h b/Marlin/Version.h index 8e949da..faa49fa 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -54,7 +54,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ - #define STRING_DISTRIBUTION_DATE "2019-03-11" + #define STRING_DISTRIBUTION_DATE "2019-03-13" /** * Required minimum Configuration.h and Configuration_adv.h file versions. diff --git a/README.md b/README.md index ffc3b3e..ef7c8d1 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,12 @@ While the i3 Mega is a great printer for its price and produces fantastic result - Easily start an auto PID tune or mesh bed leveling via the special menu (insert SD card, select special menu and press the round arrow) - Filament change feature enabled: Switch colors/material mid print (instructions below) and control it via display. - The filament runout, pause and stop functionality have been overhauled and improved: The hotend now parks and retracts (on pause or stop) and purges automatically (on resume). +- Added `M888` cooldown routine for the Anycubic Ultrabase (EXPERIMENTAL): This is meant to be placed at the end Gcode of your slicer. It hovers over the print bed and does circular movements while running the fan. Works best with custom fan ducts. + - Optional parameters: + - `T`: Target bed temperature (min 15°C), 30°C if not specified (do not set this under room temperature) + - `S`: Fan speed between 0 and 255, full speed if not specified + - e.g. `M888 S191 T25`: run the fan at 75% until the bed has cooled down to 25°C + ## Known issues: @@ -259,6 +265,7 @@ No worries. You can easily go back to the default firmware and restore the defau - Move nozzle to park position on runout - Prevent false positives by adding a small delay to the sensor - Pause and stop behaviour tweaked +- Added `M888` cooldown routine for the Anycubic Ultrabase ## Changes by [derhopp](https://github.com/derhopp/):