Skip to content

Commit

Permalink
bltouch: handle antclabs v3 possible EMI with X in G28 & G29
Browse files Browse the repository at this point in the history
Optional, but may reduce issues on the U30... double check the wiring...

Note: Could make issues during G29 if your "tubing" is a bit "short"
      Be sure there is enough length to reach end of X, if attached..

define BLTOUCH_EMI_X to try, if needed...
  • Loading branch information
tpruvot committed Jun 17, 2021
1 parent 2ac330b commit 3a5e9ef
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
11 changes: 11 additions & 0 deletions Marlin/src/gcode/bedlevel/abl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,10 @@ G29_TYPE GcodeSuite::G29() {

// Deploy certain probes before starting probing
#if HAS_BED_PROBE
#ifdef BLTOUCH_EMI_X
X_disable(); // optional, but the antclabs can have EMI noise issues,
// if X (or E) motor wires are in same pipe as PWM (on the U30)
#endif
if (ENABLED(BLTOUCH))
do_z_clearance(Z_CLEARANCE_DEPLOY_PROBE);
else if (probe.deploy()) {
Expand Down Expand Up @@ -712,6 +716,9 @@ G29_TYPE GcodeSuite::G29() {
TERN_(HAS_STATUS_MESSAGE, ui.reset_status());

// Stow the probe. No raise for FIX_MOUNTED_PROBE.
#ifdef BLTOUCH_EMI_X
X_disable(); // EMI noise
#endif
if (probe.stow()) {
set_bed_leveling_enabled(abl.reenable);
abl.measured_z = NAN;
Expand Down Expand Up @@ -896,6 +903,10 @@ G29_TYPE GcodeSuite::G29() {
DWIN_CompletedLeveling();
#endif

#ifdef BLTOUCH_EMI_X
X_enable(); // restore disabled X driver
#endif

report_current_position();

TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
Expand Down
3 changes: 3 additions & 0 deletions Marlin/src/module/motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1758,6 +1758,9 @@ void prepare_line_to_destination() {
//
#if HOMING_Z_WITH_PROBE
if (axis == Z_AXIS) {
#ifdef BLTOUCH_EMI_X
X_disable(); // workaround for the antclabs EMI noise
#endif
if (TERN0(BLTOUCH, bltouch.deploy())) return; // BLTouch was deployed above, but get the alarm state.
if (TERN0(PROBE_TARE, probe.tare())) return;
}
Expand Down
5 changes: 4 additions & 1 deletion Marlin/src/module/probe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
#include "../feature/tmc_util.h"
#endif

#if HAS_QUIET_PROBING
#if HAS_QUIET_PROBING || HOMING_Z_WITH_PROBE
#include "stepper/indirection.h"
#endif

Expand Down Expand Up @@ -775,6 +775,9 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai
do_blocking_move_to(npos, feedRate_t(XY_PROBE_FEEDRATE_MM_S));

float measured_z = NAN;
#ifdef BLTOUCH_EMI_X
X_disable(); // Antclabs EMI noise (not seen on the 3DTouch)
#endif
if (!deploy()) measured_z = run_z_probe(sanity_check) + offset.z;
if (!isnan(measured_z)) {
const bool big_raise = raise_after == PROBE_PT_BIG_RAISE;
Expand Down

0 comments on commit 3a5e9ef

Please sign in to comment.