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

Make M109 S not wait for cooldown #2060

Open
wants to merge 2 commits into
base: MK3
Choose a base branch
from
Open
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
18 changes: 11 additions & 7 deletions Firmware/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ uint8_t newFanSpeed = 0;
#endif

static bool cancel_heatup = false;
bool CooldownNoWait;
Copy link
Collaborator

Choose a reason for hiding this comment

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

After re-reading this, it seems that wait_for_heater is also called from restore_extruder_temperature_from_ram, so the last value of M109 and M190 will affect the behavior of wait_for_heater, which is incorrect.

I don't see a reason why we need a global for this. I would add a parameter to wait_for_heater, with the default being false to match the previous behavior.


int8_t busy_state = NOT_BUSY;
static long prev_busy_signal_ms = -1;
Expand Down Expand Up @@ -6046,17 +6047,19 @@ SERIAL_PROTOCOLPGM("\n\n");
*/
case 109:
{
CooldownNoWait = false;
LCD_MESSAGERPGM(_T(MSG_HEATING));
heating_status = HeatingStatus::EXTRUDER_HEATING;
heating_status = HeatingStatus::EXTRUDER_HEATING;
prusa_statistics(1);

#ifdef AUTOTEMP
autotemp_enabled=false;
#endif
#endif
if (code_seen('S')) {
setTargetHotend(code_value());
} else if (code_seen('R')) {
setTargetHotend(code_value());
setTargetHotend(code_value());
CooldownNoWait = true;
} else if (code_seen('R')) {
setTargetHotend(code_value());
}
#ifdef AUTOTEMP
if (code_seen('S')) autotemp_min=code_value();
Expand All @@ -6078,7 +6081,7 @@ SERIAL_PROTOCOLPGM("\n\n");
wait_for_heater(codenum, active_extruder); //loops until target temperature is reached

LCD_MESSAGERPGM(_T(MSG_HEATING_COMPLETE));
heating_status = HeatingStatus::EXTRUDER_HEATING_COMPLETE;
heating_status = HeatingStatus::EXTRUDER_HEATING_COMPLETE;
prusa_statistics(2);

//starttime=_millis();
Expand All @@ -6102,7 +6105,7 @@ SERIAL_PROTOCOLPGM("\n\n");
case 190:
#if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1
{
bool CooldownNoWait = false;
CooldownNoWait = false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

As written before, this would cause M190 to affect the wait for extruder temperature during recovery.. which is not good. I would keep this one as-is.

LCD_MESSAGERPGM(_T(MSG_BED_HEATING));
heating_status = HeatingStatus::BED_HEATING;
prusa_statistics(1);
Expand Down Expand Up @@ -9722,6 +9725,7 @@ static void wait_for_heater(long codenum, uint8_t extruder) {
cancel_heatup = false;
while ((!cancel_heatup) && ((residencyStart == -1) ||
(residencyStart >= 0 && (((unsigned int)(_millis() - residencyStart)) < (TEMP_RESIDENCY_TIME * 1000UL))))) {
if ((CooldownNoWait == true) && !target_direction) break;
#else
while (target_direction ? (isHeatingHotend(tmp_extruder)) : (isCoolingHotend(tmp_extruder) && (CooldownNoWait == false))) {
#endif //TEMP_RESIDENCY_TIME
Expand Down