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
2.0.x
Scott Lahteine 8 years ago
parent 4e1448e75a
commit d814e468d2

@ -2080,7 +2080,7 @@ static void clean_up_after_endstop_or_probe_move() {
#if ENABLED(BLTOUCH_HEATERS_OFF) #if ENABLED(BLTOUCH_HEATERS_OFF)
void set_heaters_for_bltouch(const bool deploy) { void set_heaters_for_bltouch(const bool deploy) {
static bool heaters_were_disabled = false; static int8_t heaters_were_disabled = 0;
static millis_t next_emi_protection; static millis_t next_emi_protection;
static float temps_at_entry[HOTENDS]; static float temps_at_entry[HOTENDS];
@ -2105,6 +2105,7 @@ static void clean_up_after_endstop_or_probe_move() {
#endif #endif
} }
else { else {
next_emi_protection = 0;
HOTEND_LOOP() thermalManager.setTargetHotend(temps_at_entry[e], e); HOTEND_LOOP() thermalManager.setTargetHotend(temps_at_entry[e], e);
#if HAS_TEMP_BED #if HAS_TEMP_BED
thermalManager.setTargetBed(bed_temp_at_entry); thermalManager.setTargetBed(bed_temp_at_entry);
@ -2115,9 +2116,6 @@ static void clean_up_after_endstop_or_probe_move() {
#endif // BLTOUCH_HEATERS_OFF #endif // BLTOUCH_HEATERS_OFF
void set_bltouch_deployed(const bool deploy) { void set_bltouch_deployed(const bool deploy) {
#if ENABLED(BLTOUCH_HEATERS_OFF)
set_heaters_for_bltouch(deploy);
#endif
if (deploy && TEST_BLTOUCH()) { // If BL-Touch says it's triggered if (deploy && TEST_BLTOUCH()) { // If BL-Touch says it's triggered
bltouch_command(BLTOUCH_RESET); // try to reset it. bltouch_command(BLTOUCH_RESET); // try to reset it.
bltouch_command(BLTOUCH_DEPLOY); // Also needs to deploy and stow to bltouch_command(BLTOUCH_DEPLOY); // Also needs to deploy and stow to
@ -2131,6 +2129,9 @@ static void clean_up_after_endstop_or_probe_move() {
stop(); // punt! stop(); // punt!
} }
} }
#if ENABLED(BLTOUCH_HEATERS_OFF)
set_heaters_for_bltouch(deploy);
#endif
bltouch_command(deploy ? BLTOUCH_DEPLOY : BLTOUCH_STOW); bltouch_command(deploy ? BLTOUCH_DEPLOY : BLTOUCH_STOW);
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {
@ -2153,12 +2154,12 @@ static void clean_up_after_endstop_or_probe_move() {
} }
#endif #endif
if (endstops.z_probe_enabled == deploy) return false;
#if ENABLED(BLTOUCH) && ENABLED(BLTOUCH_HEATERS_OFF) #if ENABLED(BLTOUCH) && ENABLED(BLTOUCH_HEATERS_OFF)
set_heaters_for_bltouch(deploy); set_heaters_for_bltouch(deploy);
#endif #endif
if (endstops.z_probe_enabled == deploy) return false;
// Make room for probe // Make room for probe
do_probe_raise(_Z_CLEARANCE_DEPLOY_PROBE); do_probe_raise(_Z_CLEARANCE_DEPLOY_PROBE);

Loading…
Cancel
Save