Sfoglia il codice sorgente

Fix set_heaters_for_bltouch and usage

- Only call `set_heaters_for_bltouch` when actually deploying/stowing
- Clear `next_emi_protection` when re-enabling heaters
Scott Lahteine 7 anni fa
parent
commit
d814e468d2
1 ha cambiato i file con 7 aggiunte e 6 eliminazioni
  1. 7
    6
      Marlin/Marlin_main.cpp

+ 7
- 6
Marlin/Marlin_main.cpp Vedi File

@@ -2080,7 +2080,7 @@ static void clean_up_after_endstop_or_probe_move() {
2080 2080
     #if ENABLED(BLTOUCH_HEATERS_OFF)
2081 2081
 
2082 2082
       void set_heaters_for_bltouch(const bool deploy) {
2083
-        static bool heaters_were_disabled = false;
2083
+        static int8_t heaters_were_disabled = 0;
2084 2084
         static millis_t next_emi_protection;
2085 2085
         static float temps_at_entry[HOTENDS];
2086 2086
 
@@ -2105,6 +2105,7 @@ static void clean_up_after_endstop_or_probe_move() {
2105 2105
           #endif
2106 2106
         }
2107 2107
         else {
2108
+          next_emi_protection = 0;
2108 2109
           HOTEND_LOOP() thermalManager.setTargetHotend(temps_at_entry[e], e);
2109 2110
           #if HAS_TEMP_BED
2110 2111
             thermalManager.setTargetBed(bed_temp_at_entry);
@@ -2115,9 +2116,6 @@ static void clean_up_after_endstop_or_probe_move() {
2115 2116
     #endif // BLTOUCH_HEATERS_OFF
2116 2117
 
2117 2118
     void set_bltouch_deployed(const bool deploy) {
2118
-      #if ENABLED(BLTOUCH_HEATERS_OFF)
2119
-        set_heaters_for_bltouch(deploy);
2120
-      #endif
2121 2119
       if (deploy && TEST_BLTOUCH()) {      // If BL-Touch says it's triggered
2122 2120
         bltouch_command(BLTOUCH_RESET);    //  try to reset it.
2123 2121
         bltouch_command(BLTOUCH_DEPLOY);   // Also needs to deploy and stow to
@@ -2131,6 +2129,9 @@ static void clean_up_after_endstop_or_probe_move() {
2131 2129
           stop();                          // punt!
2132 2130
         }
2133 2131
       }
2132
+      #if ENABLED(BLTOUCH_HEATERS_OFF)
2133
+        set_heaters_for_bltouch(deploy);
2134
+      #endif
2134 2135
       bltouch_command(deploy ? BLTOUCH_DEPLOY : BLTOUCH_STOW);
2135 2136
       #if ENABLED(DEBUG_LEVELING_FEATURE)
2136 2137
         if (DEBUGGING(LEVELING)) {
@@ -2153,12 +2154,12 @@ static void clean_up_after_endstop_or_probe_move() {
2153 2154
       }
2154 2155
     #endif
2155 2156
 
2157
+    if (endstops.z_probe_enabled == deploy) return false;
2158
+
2156 2159
     #if ENABLED(BLTOUCH) && ENABLED(BLTOUCH_HEATERS_OFF)
2157 2160
       set_heaters_for_bltouch(deploy);
2158 2161
     #endif
2159 2162
 
2160
-    if (endstops.z_probe_enabled == deploy) return false;
2161
-
2162 2163
     // Make room for probe
2163 2164
     do_probe_raise(_Z_CLEARANCE_DEPLOY_PROBE);
2164 2165
 

Loading…
Annulla
Salva