Skip to content

Commit 79f559e

Browse files
committed
Implement heatbed cooldown routine
- 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<int>: Target bed temperature (min 15°C), 30°C if not specified - S<int>: Fan speed between 0 and 255, full speed if not specified Thanks to @kulfuerst for the suggestion!
1 parent c1c2743 commit 79f559e

File tree

3 files changed

+61
-1
lines changed

3 files changed

+61
-1
lines changed

Marlin/Marlin_main.cpp

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@
228228
* M867 - Enable/disable or toggle error correction for position encoder modules.
229229
* M868 - Report or set position encoder module error correction threshold.
230230
* M869 - Report position encoder module error.
231+
* M888 - Ultrabase cooldown: Let the parts cooling fan hover above the finished print to cool down the bed. EXPERIMENTAL FEATURE!
231232
* M900 - Get or Set Linear Advance K-factor. (Requires LIN_ADVANCE)
232233
* 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)
233234
* M907 - Set digital trimpot motor current using axis codes. (Requires a board with digital trimpots)
@@ -11403,6 +11404,56 @@ inline void gcode_M502() {
1140311404
}
1140411405
#endif // MAX7219_GCODE
1140511406

11407+
/**
11408+
* M888: Cooldown routine for the Anycubic Ultrabase (EXPERIMENTAL):
11409+
* This is meant to be placed at the end Gcode of your slicer.
11410+
* It hovers over the print bed and does circular movements while
11411+
* running the fan. Works best with custom fan ducts.
11412+
*
11413+
* T<int> Target bed temperature (min 15°C), 30°C if not specified
11414+
* S<int> Fan speed between 0 and 255, full speed if not specified
11415+
*/
11416+
inline void gcode_M888() {
11417+
// don't do this if the machine is not homed
11418+
if (axis_unhomed_error()) return;
11419+
11420+
const float cooldown_arc[2] = { 50, 50 };
11421+
const uint8_t cooldown_target = MAX((parser.ushortval('T', 30)), 15);
11422+
11423+
// set hotbed temperate to zero
11424+
thermalManager.setTargetBed(0);
11425+
SERIAL_PROTOCOLLNPGM("Ultrabase cooldown started");
11426+
11427+
// set fan to speed <S>, if undefined blast at full speed
11428+
uint8_t cooldown_fanspeed = parser.ushortval('S', 255);
11429+
fanSpeeds[0] = MIN(cooldown_fanspeed, 255U);
11430+
11431+
// raise z by 2mm and move to X50, Y50
11432+
do_blocking_move_to_z(MIN(current_position[Z_AXIS] + 2, Z_MAX_POS), 5);
11433+
do_blocking_move_to_xy(50, 50, 100);
11434+
11435+
while ((thermalManager.degBed() > cooldown_target)) {
11436+
// queue arc movement
11437+
gcode_get_destination();
11438+
plan_arc(destination, cooldown_arc, true);
11439+
SERIAL_PROTOCOLLNPGM("Target not reached, queued an arc");
11440+
11441+
// delay while arc is in progress
11442+
while (planner.movesplanned()) {
11443+
idle();
11444+
}
11445+
idle();
11446+
}
11447+
// the bed should be under <T> now
11448+
fanSpeeds[0]=0;
11449+
do_blocking_move_to_xy(MAX(X_MIN_POS, 10), MIN(Y_MAX_POS, 190), 100);
11450+
BUZZ(100, 659);
11451+
BUZZ(150, 1318);
11452+
enqueue_and_echo_commands_P(PSTR("M84"));
11453+
SERIAL_PROTOCOLLNPGM("M888 cooldown routine done");
11454+
}
11455+
11456+
1140611457
#if ENABLED(LIN_ADVANCE)
1140711458
/**
1140811459
* M900: Get or Set Linear Advance K-factor
@@ -13138,6 +13189,8 @@ void process_parsed_command() {
1313813189
case 869: gcode_M869(); break; // M869: Report axis error
1313913190
#endif
1314013191

13192+
case 888: gcode_M888(); break; // M888: Ultrabase cooldown (EXPERIMENTAL)
13193+
1314113194
#if ENABLED(LIN_ADVANCE)
1314213195
case 900: gcode_M900(); break; // M900: Set Linear Advance K factor
1314313196
#endif

Marlin/Version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
* here we define this default string as the date where the latest release
5555
* version was tagged.
5656
*/
57-
#define STRING_DISTRIBUTION_DATE "2019-03-11"
57+
#define STRING_DISTRIBUTION_DATE "2019-03-13"
5858

5959
/**
6060
* Required minimum Configuration.h and Configuration_adv.h file versions.

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ While the i3 Mega is a great printer for its price and produces fantastic result
3232
- 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)
3333
- Filament change feature enabled: Switch colors/material mid print (instructions below) and control it via display.
3434
- 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).
35+
- 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.
36+
- Optional parameters:
37+
- `T<temperature>`: Target bed temperature (min 15°C), 30°C if not specified (do not set this under room temperature)
38+
- `S<fan speed>`: Fan speed between 0 and 255, full speed if not specified
39+
- e.g. `M888 S191 T25`: run the fan at 75% until the bed has cooled down to 25°C
40+
3541

3642
## Known issues:
3743

@@ -259,6 +265,7 @@ No worries. You can easily go back to the default firmware and restore the defau
259265
- Move nozzle to park position on runout
260266
- Prevent false positives by adding a small delay to the sensor
261267
- Pause and stop behaviour tweaked
268+
- Added `M888` cooldown routine for the Anycubic Ultrabase
262269

263270

264271
## Changes by [derhopp](https://github.com/derhopp/):

0 commit comments

Comments
 (0)