1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-30 23:30:16 +00:00

Fix bug which can cause an infinite M109 loop

Since residency_start_ms is -1 when entering the heatup while loop whilst the hotend temp is close to the target them already then it may not escape.

Hence "Start the TEMP_RESIDENCY_TIME timer when we reach target temp for the first time."
This commit is contained in:
gralco 2016-04-08 14:27:08 -06:00 committed by Scott Lahteine
parent 3ecf38d32e
commit 907aed57db

View File

@ -4325,7 +4325,8 @@ inline void gcode_M109() {
#ifdef TEMP_RESIDENCY_TIME #ifdef TEMP_RESIDENCY_TIME
// Start the TEMP_RESIDENCY_TIME timer when we reach target temp for the first time. // Start the TEMP_RESIDENCY_TIME timer when we reach target temp for the first time.
// Restart the timer whenever the temperature falls outside the hysteresis. // Restart the timer whenever the temperature falls outside the hysteresis.
if (labs(degHotend(target_extruder) - degTargetHotend(target_extruder)) > ((residency_start_ms < 0) ? TEMP_WINDOW : TEMP_HYSTERESIS)) if ((residency_start_ms <= 0 && labs(degHotend(target_extruder) - degTargetHotend(target_extruder)) < TEMP_WINDOW) ||
(labs(degHotend(target_extruder) - degTargetHotend(target_extruder)) > ((residency_start_ms < 0) ? TEMP_WINDOW : TEMP_HYSTERESIS)))
residency_start_ms = millis(); residency_start_ms = millis();
#endif //TEMP_RESIDENCY_TIME #endif //TEMP_RESIDENCY_TIME