Browse Source

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."
gralco 9 years ago
parent
commit
907aed57db
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      Marlin/Marlin_main.cpp

+ 2
- 1
Marlin/Marlin_main.cpp View File

4325
     #ifdef TEMP_RESIDENCY_TIME
4325
     #ifdef TEMP_RESIDENCY_TIME
4326
       // Start the TEMP_RESIDENCY_TIME timer when we reach target temp for the first time.
4326
       // Start the TEMP_RESIDENCY_TIME timer when we reach target temp for the first time.
4327
       // Restart the timer whenever the temperature falls outside the hysteresis.
4327
       // Restart the timer whenever the temperature falls outside the hysteresis.
4328
-      if (labs(degHotend(target_extruder) - degTargetHotend(target_extruder)) > ((residency_start_ms < 0) ? TEMP_WINDOW : TEMP_HYSTERESIS))
4328
+      if ((residency_start_ms <= 0 && labs(degHotend(target_extruder) - degTargetHotend(target_extruder)) < TEMP_WINDOW) ||
4329
+          (labs(degHotend(target_extruder) - degTargetHotend(target_extruder)) > ((residency_start_ms < 0) ? TEMP_WINDOW : TEMP_HYSTERESIS)))
4329
         residency_start_ms = millis();
4330
         residency_start_ms = millis();
4330
     #endif //TEMP_RESIDENCY_TIME
4331
     #endif //TEMP_RESIDENCY_TIME
4331
 
4332
 

Loading…
Cancel
Save