✨ BED_ANNEALING_GCODE (#26341)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
parent
d159ec5c90
commit
884a3249fe
|
@ -779,6 +779,9 @@
|
|||
//#define BED_LIMIT_SWITCHING // Keep the bed temperature within BED_HYSTERESIS of the target
|
||||
#endif
|
||||
|
||||
// Add 'M190 R T' for more gradual M190 R bed cooling.
|
||||
//#define BED_ANNEALING_GCODE
|
||||
|
||||
//===========================================================================
|
||||
//==================== PID > Chamber Temperature Control ====================
|
||||
//===========================================================================
|
||||
|
|
|
@ -54,6 +54,16 @@
|
|||
*
|
||||
* With PRINTJOB_TIMER_AUTOSTART turning on heaters will start the print job timer
|
||||
* (used by printingIsActive, etc.) and turning off heaters will stop the timer.
|
||||
*
|
||||
* With BED_ANNEALING_GCODE:
|
||||
*
|
||||
* M190 Parameters
|
||||
* T<seconds>: Cooldown time, for more gradual cooling. Use with R parameter.
|
||||
* M190 R T - Cool the bed down over a given period of time.
|
||||
*
|
||||
* Examples
|
||||
* M190 R70 T600: Cool down to 70°C over a period of ten minutes.
|
||||
*
|
||||
*/
|
||||
void GcodeSuite::M140_M190(const bool isM190) {
|
||||
|
||||
|
@ -81,19 +91,47 @@ void GcodeSuite::M140_M190(const bool isM190) {
|
|||
|
||||
if (!got_temp) return;
|
||||
|
||||
#if ENABLED(BED_ANNEALING_GCODE)
|
||||
const bool anneal = isM190 && !no_wait_for_cooling && parser.seenval('T');
|
||||
const millis_t anneal_ms = anneal ? millis() + parser.value_millis_from_seconds() : 0UL;
|
||||
#else
|
||||
constexpr bool anneal = false;
|
||||
#endif
|
||||
|
||||
if (!anneal) {
|
||||
thermalManager.setTargetBed(temp);
|
||||
thermalManager.isHeatingBed() ? LCD_MESSAGE(MSG_BED_HEATING) : LCD_MESSAGE(MSG_BED_COOLING);
|
||||
}
|
||||
|
||||
// With PRINTJOB_TIMER_AUTOSTART, M190 can start the timer, and M140 can stop it
|
||||
TERN_(PRINTJOB_TIMER_AUTOSTART, thermalManager.auto_job_check_timer(isM190, !isM190));
|
||||
|
||||
if (isM190)
|
||||
if (isM190) {
|
||||
#if ENABLED(BED_ANNEALING_GCODE)
|
||||
if (anneal) {
|
||||
LCD_MESSAGE(MSG_BED_ANNEALING);
|
||||
// Loop from current temp down to the target
|
||||
for (celsius_t cool_temp = thermalManager.degBed(); --cool_temp >= temp; ) {
|
||||
thermalManager.setTargetBed(cool_temp); // Cool by one degree
|
||||
thermalManager.wait_for_bed(false); // Could this wait forever?
|
||||
const millis_t ms = millis();
|
||||
if (PENDING(ms, anneal_ms) && cool_temp > temp) { // Still warmer and waiting?
|
||||
const millis_t remain = anneal_ms - ms;
|
||||
dwell(remain / (cool_temp - temp)); // Wait for a fraction of remaining time
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
thermalManager.wait_for_bed(no_wait_for_cooling);
|
||||
else
|
||||
}
|
||||
else {
|
||||
ui.set_status_reset_fn([]{
|
||||
const celsius_t c = thermalManager.degTargetBed();
|
||||
return c < 30 || thermalManager.degBedNear(c);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#endif // HAS_HEATED_BED
|
||||
|
|
|
@ -626,6 +626,7 @@ namespace LanguageNarrow_en {
|
|||
LSTR MSG_COOLING = _UxGT("Cooling...");
|
||||
LSTR MSG_BED_HEATING = _UxGT("Bed Heating...");
|
||||
LSTR MSG_BED_COOLING = _UxGT("Bed Cooling...");
|
||||
LSTR MSG_BED_ANNEALING = _UxGT("Annealing...");
|
||||
LSTR MSG_PROBE_HEATING = _UxGT("Probe Heating...");
|
||||
LSTR MSG_PROBE_COOLING = _UxGT("Probe Cooling...");
|
||||
LSTR MSG_CHAMBER_HEATING = _UxGT("Chamber Heating...");
|
||||
|
|
Loading…
Reference in a new issue