Parcourir la source

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 il y a 8 ans
Parent
révision
d814e468d2
1 fichiers modifiés avec 7 ajouts et 6 suppressions
  1. 7
    6
      Marlin/Marlin_main.cpp

+ 7
- 6
Marlin/Marlin_main.cpp Voir le fichier

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

Chargement…
Annuler
Enregistrer