Procházet zdrojové kódy

Skip hysteresis check when temp is already close to target

To eliminate a long delay during pause, park, and filament change
Scott Lahteine před 6 roky
rodič
revize
7fde3ed915
1 změnil soubory, kde provedl 11 přidání a 3 odebrání
  1. 11
    3
      Marlin/src/module/temperature.cpp

+ 11
- 3
Marlin/src/module/temperature.cpp Zobrazit soubor

2716
       #endif
2716
       #endif
2717
 
2717
 
2718
       float target_temp = -1.0, old_temp = 9999.0;
2718
       float target_temp = -1.0, old_temp = 9999.0;
2719
-      bool wants_to_cool = false;
2719
+      bool wants_to_cool = false, first_loop = true;
2720
       wait_for_heatup = true;
2720
       wait_for_heatup = true;
2721
       millis_t now, next_temp_ms = 0, next_cool_check_ms = 0;
2721
       millis_t now, next_temp_ms = 0, next_cool_check_ms = 0;
2722
       do {
2722
       do {
2759
 
2759
 
2760
           if (!residency_start_ms) {
2760
           if (!residency_start_ms) {
2761
             // Start the TEMP_RESIDENCY_TIME timer when we reach target temp for the first time.
2761
             // Start the TEMP_RESIDENCY_TIME timer when we reach target temp for the first time.
2762
-            if (temp_diff < TEMP_WINDOW) residency_start_ms = now;
2762
+            if (temp_diff < TEMP_WINDOW) {
2763
+              residency_start_ms = now;
2764
+              if (first_loop) residency_start_ms += (TEMP_RESIDENCY_TIME) * 1000UL;
2765
+            }
2763
           }
2766
           }
2764
           else if (temp_diff > TEMP_HYSTERESIS) {
2767
           else if (temp_diff > TEMP_HYSTERESIS) {
2765
             // Restart the timer whenever the temperature falls outside the hysteresis.
2768
             // Restart the timer whenever the temperature falls outside the hysteresis.
2786
           }
2789
           }
2787
         #endif
2790
         #endif
2788
 
2791
 
2792
+        first_loop = false;
2793
+
2789
       } while (wait_for_heatup && TEMP_CONDITIONS);
2794
       } while (wait_for_heatup && TEMP_CONDITIONS);
2790
 
2795
 
2791
       if (wait_for_heatup) {
2796
       if (wait_for_heatup) {
2828
       #endif
2833
       #endif
2829
 
2834
 
2830
       float target_temp = -1, old_temp = 9999;
2835
       float target_temp = -1, old_temp = 9999;
2831
-      bool wants_to_cool = false;
2836
+      bool wants_to_cool = false, first_loop = true;
2832
       wait_for_heatup = true;
2837
       wait_for_heatup = true;
2833
       millis_t now, next_temp_ms = 0, next_cool_check_ms = 0;
2838
       millis_t now, next_temp_ms = 0, next_cool_check_ms = 0;
2834
 
2839
 
2883
           if (!residency_start_ms) {
2888
           if (!residency_start_ms) {
2884
             // Start the TEMP_BED_RESIDENCY_TIME timer when we reach target temp for the first time.
2889
             // Start the TEMP_BED_RESIDENCY_TIME timer when we reach target temp for the first time.
2885
             if (temp_diff < TEMP_BED_WINDOW) residency_start_ms = now;
2890
             if (temp_diff < TEMP_BED_WINDOW) residency_start_ms = now;
2891
+            if (first_loop) residency_start_ms += (TEMP_BED_RESIDENCY_TIME) * 1000UL;
2886
           }
2892
           }
2887
           else if (temp_diff > TEMP_BED_HYSTERESIS) {
2893
           else if (temp_diff > TEMP_BED_HYSTERESIS) {
2888
             // Restart the timer whenever the temperature falls outside the hysteresis.
2894
             // Restart the timer whenever the temperature falls outside the hysteresis.
2909
           }
2915
           }
2910
         #endif
2916
         #endif
2911
 
2917
 
2918
+        first_loop = false;
2919
+
2912
       } while (wait_for_heatup && TEMP_BED_CONDITIONS);
2920
       } while (wait_for_heatup && TEMP_BED_CONDITIONS);
2913
 
2921
 
2914
       if (wait_for_heatup) ui.reset_status();
2922
       if (wait_for_heatup) ui.reset_status();

Loading…
Zrušit
Uložit