Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust wait_for_cooling slope #4250

Merged
merged 1 commit into from
Jul 11, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions Marlin/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4488,6 +4488,13 @@ inline void gcode_M105() {

#endif

#ifndef MIN_COOLING_SLOPE_DEG
#define MIN_COOLING_SLOPE_DEG 1.50
#endif
#ifndef MIN_COOLING_SLOPE_TIME
#define MIN_COOLING_SLOPE_TIME 60
#endif

/**
* M109: Sxxx Wait for extruder(s) to reach temperature. Waits only when heating.
* Rxxx Wait for extruder(s) to reach temperature. Waits when heating and cooling.
Expand Down Expand Up @@ -4600,11 +4607,11 @@ inline void gcode_M109() {

// Prevent a wait-forever situation if R is misused i.e. M109 R0
if (wants_to_cool) {
if (temp < (EXTRUDE_MINTEMP) / 2) break; // always break at (default) 85°
// break after 20 seconds if cooling stalls
// break after MIN_COOLING_SLOPE_TIME seconds
// if the temperature did not drop at least MIN_COOLING_SLOPE_DEG
if (!next_cool_check_ms || ELAPSED(now, next_cool_check_ms)) {
if (old_temp - temp < 1.0) break;
next_cool_check_ms = now + 20000;
if (old_temp - temp < MIN_COOLING_SLOPE_DEG) break;
next_cool_check_ms = now + 1000UL * MIN_COOLING_SLOPE_TIME;
old_temp = temp;
}
}
Expand All @@ -4617,6 +4624,13 @@ inline void gcode_M109() {

#if HAS_TEMP_BED

#ifndef MIN_COOLING_SLOPE_DEG_BED
#define MIN_COOLING_SLOPE_DEG_BED 1.50
#endif
#ifndef MIN_COOLING_SLOPE_TIME_BED
#define MIN_COOLING_SLOPE_TIME_BED 60
#endif

/**
* 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
Expand Down Expand Up @@ -4709,11 +4723,11 @@ inline void gcode_M109() {

// Prevent a wait-forever situation if R is misused i.e. M190 R0
if (wants_to_cool) {
if (temp < 30.0) break; // always break at 30°
// break after 20 seconds if cooling stalls
// break after MIN_COOLING_SLOPE_TIME_BED seconds
// if the temperature did not drop at least MIN_COOLING_SLOPE_DEG_BED
if (!next_cool_check_ms || ELAPSED(now, next_cool_check_ms)) {
if (old_temp - temp < 1.0) break;
next_cool_check_ms = now + 20000;
if (old_temp - temp < MIN_COOLING_SLOPE_DEG_BED) break;
next_cool_check_ms = now + 1000UL * MIN_COOLING_SLOPE_TIME_BED;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thinkyhead
No, not a variable. Just a constant. For some reason 1000UL * MIN_COOLING_SLOPE_TIME_BED is done in int if we don't us UL. Worked great for times up to 32 seconds, but not for 60.

old_temp = temp;
}
}
Expand Down